59 |
* |
* |
60 |
*************************************************************************/ |
*************************************************************************/ |
61 |
|
|
62 |
|
#include <stdio.h> |
63 |
#include <stdlib.h> |
#include <stdlib.h> |
64 |
#include <string.h> |
#include <string.h> |
65 |
|
|
105 |
image_destroy(&dec->tmp, dec->edged_width, dec->edged_height); |
image_destroy(&dec->tmp, dec->edged_width, dec->edged_height); |
106 |
image_destroy(&dec->qtmp, dec->edged_width, dec->edged_height); |
image_destroy(&dec->qtmp, dec->edged_width, dec->edged_height); |
107 |
|
|
108 |
|
image_destroy(&dec->gmc, dec->edged_width, dec->edged_height); |
109 |
|
|
110 |
if (dec->last_mbs) |
if (dec->last_mbs) |
111 |
xvid_free(dec->last_mbs); |
xvid_free(dec->last_mbs); |
112 |
if (dec->mbs) |
if (dec->mbs) |
156 |
return XVID_ERR_MEMORY; |
return XVID_ERR_MEMORY; |
157 |
} |
} |
158 |
|
|
159 |
|
if (image_create(&dec->gmc, dec->edged_width, dec->edged_height)) { |
160 |
|
image_destroy(&dec->qtmp, dec->edged_width, dec->edged_height); |
161 |
|
image_destroy(&dec->cur, dec->edged_width, dec->edged_height); |
162 |
|
image_destroy(&dec->refn[0], dec->edged_width, dec->edged_height); |
163 |
|
image_destroy(&dec->refn[1], dec->edged_width, dec->edged_height); |
164 |
|
image_destroy(&dec->tmp, dec->edged_width, dec->edged_height); |
165 |
|
xvid_free(dec); |
166 |
|
return XVID_ERR_MEMORY; |
167 |
|
} |
168 |
|
|
169 |
dec->mbs = |
dec->mbs = |
170 |
xvid_malloc(sizeof(MACROBLOCK) * dec->mb_width * dec->mb_height, |
xvid_malloc(sizeof(MACROBLOCK) * dec->mb_width * dec->mb_height, |
171 |
CACHE_LINE); |
CACHE_LINE); |
224 |
image_null(&dec->tmp); |
image_null(&dec->tmp); |
225 |
image_null(&dec->qtmp); |
image_null(&dec->qtmp); |
226 |
|
|
227 |
|
/* image based GMC */ |
228 |
|
image_null(&dec->gmc); |
229 |
|
|
230 |
|
|
231 |
dec->mbs = NULL; |
dec->mbs = NULL; |
232 |
dec->last_mbs = NULL; |
dec->last_mbs = NULL; |
233 |
|
|
254 |
{ |
{ |
255 |
xvid_free(dec->last_mbs); |
xvid_free(dec->last_mbs); |
256 |
xvid_free(dec->mbs); |
xvid_free(dec->mbs); |
257 |
|
|
258 |
|
image_destroy(&dec->gmc, dec->edged_width, dec->edged_height); /* image based GMC */ |
259 |
|
|
260 |
image_destroy(&dec->refn[0], dec->edged_width, dec->edged_height); |
image_destroy(&dec->refn[0], dec->edged_width, dec->edged_height); |
261 |
image_destroy(&dec->refn[1], dec->edged_width, dec->edged_height); |
image_destroy(&dec->refn[1], dec->edged_width, dec->edged_height); |
262 |
image_destroy(&dec->tmp, dec->edged_width, dec->edged_height); |
image_destroy(&dec->tmp, dec->edged_width, dec->edged_height); |
417 |
Bitstream * bs, |
Bitstream * bs, |
418 |
const uint32_t quant, |
const uint32_t quant, |
419 |
const uint32_t rounding, |
const uint32_t rounding, |
420 |
const int reduced_resolution) |
const int reduced_resolution, |
421 |
|
const int mcsel) |
422 |
{ |
{ |
423 |
|
|
424 |
DECLARE_ALIGNED_MATRIX(block, 6, 64, int16_t, CACHE_LINE); |
DECLARE_ALIGNED_MATRIX(block, 6, 64, int16_t, CACHE_LINE); |
430 |
uint32_t i; |
uint32_t i; |
431 |
uint32_t iQuant = pMB->quant; |
uint32_t iQuant = pMB->quant; |
432 |
uint8_t *pY_Cur, *pU_Cur, *pV_Cur; |
uint8_t *pY_Cur, *pU_Cur, *pV_Cur; |
433 |
|
uint8_t *pY_Ref, *pU_Ref, *pV_Ref; /* ref for GMC is _not_ pRef itself */ |
434 |
|
|
435 |
int uv_dx, uv_dy; |
int uv_dx, uv_dy; |
436 |
VECTOR mv[4]; /* local copy of mvs */ |
VECTOR mv[4]; /* local copy of mvs */ |
451 |
mv[i] = pMB->mvs[i]; |
mv[i] = pMB->mvs[i]; |
452 |
} |
} |
453 |
|
|
454 |
|
if (mcsel) { |
455 |
|
mv[0].x = mv[0].y = mv[1].x = mv[1].y = mv[2].x = mv[2].y = mv[3].x = mv[3].y = 0; |
456 |
|
/* position in ref is same as the block, set vector to (0,0) */ |
457 |
|
pY_Ref = dec->gmc.y; |
458 |
|
pU_Ref = dec->gmc.u; |
459 |
|
pV_Ref = dec->gmc.v; |
460 |
|
/* but reference itself isn't. It's warped... */ |
461 |
|
/* Btw., this is too slow! For GMC it should simply be transfer_16to8add() */ |
462 |
|
} else { |
463 |
|
pY_Ref = dec->refn[0].y; |
464 |
|
pU_Ref = dec->refn[0].u; |
465 |
|
pV_Ref = dec->refn[0].v; |
466 |
|
} |
467 |
|
|
468 |
if (pMB->mode == MODE_INTER || pMB->mode == MODE_INTER_Q) { |
if (pMB->mode == MODE_INTER || pMB->mode == MODE_INTER_Q) { |
|
uv_dx = mv[0].x; |
|
|
uv_dy = mv[0].y; |
|
469 |
|
|
470 |
if (dec->quarterpel) |
uv_dx = mv[0].x / (1 + dec->quarterpel); |
471 |
{ |
uv_dy = mv[0].y / (1 + dec->quarterpel); |
|
uv_dx /= 2; |
|
|
uv_dy /= 2; |
|
|
} |
|
472 |
|
|
473 |
uv_dx = (uv_dx >> 1) + roundtab_79[uv_dx & 0x3]; |
uv_dx = (uv_dx >> 1) + roundtab_79[uv_dx & 0x3]; |
474 |
uv_dy = (uv_dy >> 1) + roundtab_79[uv_dy & 0x3]; |
uv_dy = (uv_dy >> 1) + roundtab_79[uv_dy & 0x3]; |
476 |
start_timer(); |
start_timer(); |
477 |
if (reduced_resolution) |
if (reduced_resolution) |
478 |
{ |
{ |
479 |
interpolate32x32_switch(dec->cur.y, dec->refn[0].y, 32*x_pos, 32*y_pos, |
interpolate32x32_switch(dec->cur.y, pY_Ref , 32*x_pos, 32*y_pos, |
480 |
mv[0].x, mv[0].y, stride, rounding); |
mv[0].x, mv[0].y, stride, rounding); |
481 |
interpolate16x16_switch(dec->cur.u, dec->refn[0].u, 16 * x_pos, 16 * y_pos, |
interpolate16x16_switch(dec->cur.u, pU_Ref , 16 * x_pos, 16 * y_pos, |
482 |
uv_dx, uv_dy, stride2, rounding); |
uv_dx, uv_dy, stride2, rounding); |
483 |
interpolate16x16_switch(dec->cur.v, dec->refn[0].v, 16 * x_pos, 16 * y_pos, |
interpolate16x16_switch(dec->cur.v, pV_Ref , 16 * x_pos, 16 * y_pos, |
484 |
uv_dx, uv_dy, stride2, rounding); |
uv_dx, uv_dy, stride2, rounding); |
485 |
|
|
486 |
} |
} |
487 |
else |
else |
488 |
{ |
{ |
489 |
if(dec->quarterpel) { |
if(dec->quarterpel) { |
490 |
interpolate16x16_quarterpel(dec->cur.y, dec->refn[0].y, dec->qtmp.y, dec->qtmp.y + 64, |
interpolate16x16_quarterpel(dec->cur.y, pY_Ref , dec->qtmp.y, dec->qtmp.y + 64, |
491 |
dec->qtmp.y + 128, 16*x_pos, 16*y_pos, |
dec->qtmp.y + 128, 16*x_pos, 16*y_pos, |
492 |
mv[0].x, mv[0].y, stride, rounding); |
mv[0].x, mv[0].y, stride, rounding); |
493 |
} |
} |
494 |
else { |
else { |
495 |
interpolate16x16_switch(dec->cur.y, dec->refn[0].y, 16*x_pos, 16*y_pos, |
interpolate16x16_switch(dec->cur.y, pY_Ref , 16*x_pos, 16*y_pos, |
496 |
mv[0].x, mv[0].y, stride, rounding); |
mv[0].x, mv[0].y, stride, rounding); |
497 |
} |
} |
498 |
|
|
499 |
interpolate8x8_switch(dec->cur.u, dec->refn[0].u, 8 * x_pos, 8 * y_pos, |
interpolate8x8_switch(dec->cur.u, pU_Ref , 8 * x_pos, 8 * y_pos, |
500 |
uv_dx, uv_dy, stride2, rounding); |
uv_dx, uv_dy, stride2, rounding); |
501 |
interpolate8x8_switch(dec->cur.v, dec->refn[0].v, 8 * x_pos, 8 * y_pos, |
interpolate8x8_switch(dec->cur.v, pV_Ref , 8 * x_pos, 8 * y_pos, |
502 |
uv_dx, uv_dy, stride2, rounding); |
uv_dx, uv_dy, stride2, rounding); |
503 |
} |
} |
504 |
stop_comp_timer(); |
stop_comp_timer(); |
523 |
start_timer(); |
start_timer(); |
524 |
if (reduced_resolution) |
if (reduced_resolution) |
525 |
{ |
{ |
526 |
interpolate16x16_switch(dec->cur.y, dec->refn[0].y, 32*x_pos, 32*y_pos, |
interpolate16x16_switch(dec->cur.y, pY_Ref , 32*x_pos, 32*y_pos, |
527 |
mv[0].x, mv[0].y, stride, rounding); |
mv[0].x, mv[0].y, stride, rounding); |
528 |
interpolate16x16_switch(dec->cur.y, dec->refn[0].y, 32*x_pos + 16, 32*y_pos, |
interpolate16x16_switch(dec->cur.y, pY_Ref , 32*x_pos + 16, 32*y_pos, |
529 |
mv[1].x, mv[1].y, stride, rounding); |
mv[1].x, mv[1].y, stride, rounding); |
530 |
interpolate16x16_switch(dec->cur.y, dec->refn[0].y, 32*x_pos, 32*y_pos + 16, |
interpolate16x16_switch(dec->cur.y, pY_Ref , 32*x_pos, 32*y_pos + 16, |
531 |
mv[2].x, mv[2].y, stride, rounding); |
mv[2].x, mv[2].y, stride, rounding); |
532 |
interpolate16x16_switch(dec->cur.y, dec->refn[0].y, 32*x_pos + 16, 32*y_pos + 16, |
interpolate16x16_switch(dec->cur.y, pY_Ref , 32*x_pos + 16, 32*y_pos + 16, |
533 |
mv[3].x, mv[3].y, stride, rounding); |
mv[3].x, mv[3].y, stride, rounding); |
534 |
interpolate16x16_switch(dec->cur.u, dec->refn[0].u, 16 * x_pos, 16 * y_pos, |
interpolate16x16_switch(dec->cur.u, pU_Ref , 16 * x_pos, 16 * y_pos, |
535 |
uv_dx, uv_dy, stride2, rounding); |
uv_dx, uv_dy, stride2, rounding); |
536 |
interpolate16x16_switch(dec->cur.v, dec->refn[0].v, 16 * x_pos, 16 * y_pos, |
interpolate16x16_switch(dec->cur.v, pV_Ref , 16 * x_pos, 16 * y_pos, |
537 |
uv_dx, uv_dy, stride2, rounding); |
uv_dx, uv_dy, stride2, rounding); |
538 |
|
|
539 |
// set_block(pY_Cur, stride, 32, 32, 127); |
// set_block(pY_Cur, stride, 32, 32, 127); |
541 |
else |
else |
542 |
{ |
{ |
543 |
if(dec->quarterpel) { |
if(dec->quarterpel) { |
544 |
interpolate8x8_quarterpel(dec->cur.y, dec->refn[0].y, dec->qtmp.y, dec->qtmp.y + 64, |
interpolate8x8_quarterpel(dec->cur.y, pY_Ref , dec->qtmp.y, dec->qtmp.y + 64, |
545 |
dec->qtmp.y + 128, 16*x_pos, 16*y_pos, |
dec->qtmp.y + 128, 16*x_pos, 16*y_pos, |
546 |
mv[0].x, mv[0].y, stride, rounding); |
mv[0].x, mv[0].y, stride, rounding); |
547 |
interpolate8x8_quarterpel(dec->cur.y, dec->refn[0].y, dec->qtmp.y, dec->qtmp.y + 64, |
interpolate8x8_quarterpel(dec->cur.y, pY_Ref , dec->qtmp.y, dec->qtmp.y + 64, |
548 |
dec->qtmp.y + 128, 16*x_pos + 8, 16*y_pos, |
dec->qtmp.y + 128, 16*x_pos + 8, 16*y_pos, |
549 |
mv[1].x, mv[1].y, stride, rounding); |
mv[1].x, mv[1].y, stride, rounding); |
550 |
interpolate8x8_quarterpel(dec->cur.y, dec->refn[0].y, dec->qtmp.y, dec->qtmp.y + 64, |
interpolate8x8_quarterpel(dec->cur.y, pY_Ref , dec->qtmp.y, dec->qtmp.y + 64, |
551 |
dec->qtmp.y + 128, 16*x_pos, 16*y_pos + 8, |
dec->qtmp.y + 128, 16*x_pos, 16*y_pos + 8, |
552 |
mv[2].x, mv[2].y, stride, rounding); |
mv[2].x, mv[2].y, stride, rounding); |
553 |
interpolate8x8_quarterpel(dec->cur.y, dec->refn[0].y, dec->qtmp.y, dec->qtmp.y + 64, |
interpolate8x8_quarterpel(dec->cur.y, pY_Ref , dec->qtmp.y, dec->qtmp.y + 64, |
554 |
dec->qtmp.y + 128, 16*x_pos + 8, 16*y_pos + 8, |
dec->qtmp.y + 128, 16*x_pos + 8, 16*y_pos + 8, |
555 |
mv[3].x, mv[3].y, stride, rounding); |
mv[3].x, mv[3].y, stride, rounding); |
556 |
} |
} |
557 |
else { |
else { |
558 |
interpolate8x8_switch(dec->cur.y, dec->refn[0].y, 16*x_pos, 16*y_pos, |
interpolate8x8_switch(dec->cur.y, pY_Ref , 16*x_pos, 16*y_pos, |
559 |
mv[0].x, mv[0].y, stride, rounding); |
mv[0].x, mv[0].y, stride, rounding); |
560 |
interpolate8x8_switch(dec->cur.y, dec->refn[0].y, 16*x_pos + 8, 16*y_pos, |
interpolate8x8_switch(dec->cur.y, pY_Ref , 16*x_pos + 8, 16*y_pos, |
561 |
mv[1].x, mv[1].y, stride, rounding); |
mv[1].x, mv[1].y, stride, rounding); |
562 |
interpolate8x8_switch(dec->cur.y, dec->refn[0].y, 16*x_pos, 16*y_pos + 8, |
interpolate8x8_switch(dec->cur.y, pY_Ref , 16*x_pos, 16*y_pos + 8, |
563 |
mv[2].x, mv[2].y, stride, rounding); |
mv[2].x, mv[2].y, stride, rounding); |
564 |
interpolate8x8_switch(dec->cur.y, dec->refn[0].y, 16*x_pos + 8, 16*y_pos + 8, |
interpolate8x8_switch(dec->cur.y, pY_Ref , 16*x_pos + 8, 16*y_pos + 8, |
565 |
mv[3].x, mv[3].y, stride, rounding); |
mv[3].x, mv[3].y, stride, rounding); |
566 |
} |
} |
567 |
|
|
568 |
interpolate8x8_switch(dec->cur.u, dec->refn[0].u, 8 * x_pos, 8 * y_pos, |
interpolate8x8_switch(dec->cur.u, pU_Ref , 8 * x_pos, 8 * y_pos, |
569 |
uv_dx, uv_dy, stride2, rounding); |
uv_dx, uv_dy, stride2, rounding); |
570 |
interpolate8x8_switch(dec->cur.v, dec->refn[0].v, 8 * x_pos, 8 * y_pos, |
interpolate8x8_switch(dec->cur.v, pV_Ref , 8 * x_pos, 8 * y_pos, |
571 |
uv_dx, uv_dy, stride2, rounding); |
uv_dx, uv_dy, stride2, rounding); |
572 |
} |
} |
573 |
stop_comp_timer(); |
stop_comp_timer(); |
744 |
mv.x = get_mv(bs, fcode); |
mv.x = get_mv(bs, fcode); |
745 |
mv.y = get_mv(bs, fcode); |
mv.y = get_mv(bs, fcode); |
746 |
|
|
747 |
DPRINTF(DPRINTF_MV,"mv_diff (%i,%i) pred (%i,%i)", mv.x, mv.y, pmv.x, pmv.y); |
DPRINTF(DPRINTF_MV,"mv_diff (%i,%i) pred (%i,%i) result (%i,%i)", mv.x, mv.y, pmv.x, pmv.y, mv.x+pmv.x, mv.y+pmv.y); |
748 |
|
|
749 |
mv.x += pmv.x; |
mv.x += pmv.x; |
750 |
mv.y += pmv.y; |
mv.y += pmv.y; |
781 |
} |
} |
782 |
|
|
783 |
|
|
784 |
/* for P_VOP set gmc_mv to NULL */ |
/* for P_VOP set gmc_warp to NULL */ |
785 |
void |
void |
786 |
decoder_pframe(DECODER * dec, |
decoder_pframe(DECODER * dec, |
787 |
Bitstream * bs, |
Bitstream * bs, |
790 |
int quant, |
int quant, |
791 |
int fcode, |
int fcode, |
792 |
int intra_dc_threshold, |
int intra_dc_threshold, |
793 |
VECTOR * gmc_mv) |
const WARPPOINTS *const gmc_warp) |
794 |
{ |
{ |
795 |
|
|
796 |
uint32_t x, y; |
uint32_t x, y; |
799 |
uint32_t mb_width = dec->mb_width; |
uint32_t mb_width = dec->mb_width; |
800 |
uint32_t mb_height = dec->mb_height; |
uint32_t mb_height = dec->mb_height; |
801 |
|
|
802 |
|
static int framecount=0; |
803 |
if (reduced_resolution) |
if (reduced_resolution) |
804 |
{ |
{ |
805 |
mb_width = (dec->width + 31) / 32; |
mb_width = (dec->width + 31) / 32; |
811 |
dec->width, dec->height); |
dec->width, dec->height); |
812 |
stop_edges_timer(); |
stop_edges_timer(); |
813 |
|
|
814 |
|
if (gmc_warp) |
815 |
|
{ |
816 |
|
char filename[80]; |
817 |
|
sprintf(filename,"dGMC%05d.pgm",framecount); |
818 |
|
// accuracy: 0==1/2, 1=1/4, 2=1/8, 3=1/16 |
819 |
|
if ( (dec->sprite_warping_accuracy != 3) || (dec->sprite_warping_points != 2) ) |
820 |
|
{ |
821 |
|
fprintf(stderr,"Wrong GMC parameters acc=%d(-> 1/%d), %d!!!\n", |
822 |
|
dec->sprite_warping_accuracy,(2<<dec->sprite_warping_accuracy), |
823 |
|
dec->sprite_warping_points); |
824 |
|
} |
825 |
|
|
826 |
|
generate_GMCparameters( dec->sprite_warping_points, |
827 |
|
(2 << dec->sprite_warping_accuracy), gmc_warp, |
828 |
|
dec->width, dec->height, &dec->gmc_data); |
829 |
|
|
830 |
|
generate_GMCimage(&dec->gmc_data, &dec->refn[0], |
831 |
|
mb_width, mb_height, |
832 |
|
dec->edged_width, dec->edged_width/2, |
833 |
|
fcode, 0, 0, |
834 |
|
rounding, dec->mbs, &dec->gmc); |
835 |
|
|
836 |
|
/* |
837 |
|
sprintf(filename,"dGMC%05d.pgm",framecount); |
838 |
|
image_dump_yuvpgm(&dec->gmc, |
839 |
|
dec->edged_width, dec->width, dec->height, filename); |
840 |
|
|
841 |
|
sprintf(filename,"dREF%05d.pgm",framecount); |
842 |
|
image_dump_yuvpgm(&dec->refn[0], |
843 |
|
dec->edged_width, dec->width, dec->height, filename); |
844 |
|
sprintf(filename,"dCUR%05d.pgm",framecount); |
845 |
|
image_dump_yuvpgm(&dec->cur, |
846 |
|
dec->edged_width, dec->width, dec->height, filename); |
847 |
|
framecount++; |
848 |
|
*/ |
849 |
|
} |
850 |
|
|
851 |
bound = 0; |
bound = 0; |
852 |
|
|
853 |
for (y = 0; y < mb_height; y++) { |
for (y = 0; y < mb_height; y++) { |
871 |
DPRINTF(DPRINTF_MB, "macroblock (%i,%i) %08x", x, y, BitstreamShowBits(bs, 32)); |
DPRINTF(DPRINTF_MB, "macroblock (%i,%i) %08x", x, y, BitstreamShowBits(bs, 32)); |
872 |
|
|
873 |
//if (!(dec->mb_skip[y*dec->mb_width + x]=BitstreamGetBit(bs))) // not_coded |
//if (!(dec->mb_skip[y*dec->mb_width + x]=BitstreamGetBit(bs))) // not_coded |
874 |
if (!(BitstreamGetBit(bs))) // not_coded |
if (!(BitstreamGetBit(bs))) // block _is_ coded |
875 |
{ |
{ |
876 |
uint32_t mcbpc; |
uint32_t mcbpc; |
877 |
uint32_t cbpc; |
uint32_t cbpc; |
896 |
acpred_flag = BitstreamGetBit(bs); |
acpred_flag = BitstreamGetBit(bs); |
897 |
} |
} |
898 |
|
|
899 |
if (gmc_mv && (mb->mode == MODE_INTER || mb->mode == MODE_INTER_Q)) |
if (gmc_warp && (mb->mode == MODE_INTER || mb->mode == MODE_INTER_Q)) |
900 |
{ |
{ |
901 |
mcsel = BitstreamGetBit(bs); |
mcsel = BitstreamGetBit(bs); |
902 |
} |
} |
903 |
|
|
904 |
cbpy = get_cbpy(bs, intra); |
cbpy = get_cbpy(bs, intra); |
905 |
DPRINTF(DPRINTF_MB, "cbpy %i", cbpy); |
DPRINTF(DPRINTF_MB, "cbpy %i mcsel %i ", cbpy,mcsel); |
906 |
|
|
907 |
cbp = (cbpy << 2) | cbpc; |
cbp = (cbpy << 2) | cbpc; |
908 |
|
|
942 |
|
|
943 |
if (mcsel) |
if (mcsel) |
944 |
{ |
{ |
945 |
mb->mvs[0].x = mb->mvs[1].x = mb->mvs[2].x = mb->mvs[3].x = gmc_sanitize(gmc_mv[0].x, dec->quarterpel, fcode); |
mb->mvs[0] = mb->mvs[1] = mb->mvs[2] = mb->mvs[3] = mb->amv; |
946 |
mb->mvs[0].y = mb->mvs[1].y = mb->mvs[2].y = mb->mvs[3].y = gmc_sanitize(gmc_mv[0].y, dec->quarterpel, fcode); |
/* already clipped to fcode */ |
947 |
|
|
948 |
} else if (dec->interlacing && mb->field_pred) { |
} else if (dec->interlacing && mb->field_pred) { |
949 |
get_motion_vector(dec, bs, x, y, 0, &mb->mvs[0], |
get_motion_vector(dec, bs, x, y, 0, &mb->mvs[0], |
953 |
} else { |
} else { |
954 |
get_motion_vector(dec, bs, x, y, 0, &mb->mvs[0], |
get_motion_vector(dec, bs, x, y, 0, &mb->mvs[0], |
955 |
fcode, bound); |
fcode, bound); |
956 |
mb->mvs[1].x = mb->mvs[2].x = mb->mvs[3].x = |
mb->mvs[1] = mb->mvs[2] = mb->mvs[3] = mb->mvs[0]; |
|
mb->mvs[0].x; |
|
|
mb->mvs[1].y = mb->mvs[2].y = mb->mvs[3].y = |
|
|
mb->mvs[0].y; |
|
957 |
} |
} |
958 |
} else if (mb->mode == MODE_INTER4V ) { |
} else if (mb->mode == MODE_INTER4V ) { |
959 |
|
|
973 |
} |
} |
974 |
|
|
975 |
decoder_mbinter(dec, mb, x, y, acpred_flag, cbp, bs, quant, |
decoder_mbinter(dec, mb, x, y, acpred_flag, cbp, bs, quant, |
976 |
rounding, reduced_resolution); |
rounding, reduced_resolution, mcsel); |
977 |
|
|
978 |
} |
} |
979 |
else if (gmc_mv) /* not coded S_VOP macroblock */ |
else if (gmc_warp) /* a not coded S(GMC)-VOP macroblock */ |
980 |
{ |
{ |
981 |
mb->mode = MODE_NOT_CODED_GMC; |
mb->mode = MODE_NOT_CODED_GMC; |
982 |
mb->mvs[0].x = mb->mvs[1].x = mb->mvs[2].x = mb->mvs[3].x = gmc_sanitize(gmc_mv[0].x, dec->quarterpel, fcode); |
mb->mvs[0] = mb->mvs[1] = mb->mvs[2] = mb->mvs[3] = mb->amv; |
983 |
mb->mvs[0].y = mb->mvs[1].y = mb->mvs[2].y = mb->mvs[3].y = gmc_sanitize(gmc_mv[0].y, dec->quarterpel, fcode); |
|
984 |
decoder_mbinter(dec, mb, x, y, 0, 0, bs, quant, rounding, reduced_resolution); |
start_timer(); |
985 |
|
|
986 |
|
transfer16x16_copy(dec->cur.y + (16*y)*dec->edged_width + (16*x), |
987 |
|
dec->gmc.y + (16*y)*dec->edged_width + (16*x), |
988 |
|
dec->edged_width); |
989 |
|
|
990 |
|
transfer8x8_copy(dec->cur.u + (8*y)*dec->edged_width/2 + (8*x), |
991 |
|
dec->gmc.u + (8*y)*dec->edged_width/2 + (8*x), |
992 |
|
dec->edged_width/2); |
993 |
|
|
994 |
|
transfer8x8_copy(dec->cur.v + (8*y)*dec->edged_width/2 + (8*x), |
995 |
|
dec->gmc.v + (8*y)*dec->edged_width/2 + (8*x), |
996 |
|
dec->edged_width/2); |
997 |
|
|
998 |
|
stop_transfer_timer(); |
999 |
|
|
1000 |
|
if(dec->out_frm && cp_mb > 0) { |
1001 |
|
output_slice(&dec->cur, dec->edged_width,dec->width,dec->out_frm,st_mb,y,cp_mb); |
1002 |
|
cp_mb = 0; |
1003 |
|
} |
1004 |
|
st_mb = x+1; |
1005 |
} |
} |
1006 |
else /* not coded P_VOP macroblock */ |
else /* not coded P_VOP macroblock */ |
1007 |
{ |
{ |
1725 |
uint32_t fcode_forward; |
uint32_t fcode_forward; |
1726 |
uint32_t fcode_backward; |
uint32_t fcode_backward; |
1727 |
uint32_t intra_dc_threshold; |
uint32_t intra_dc_threshold; |
1728 |
VECTOR gmc_mv[5]; |
WARPPOINTS gmc_warp; |
1729 |
uint32_t vop_type; |
uint32_t vop_type; |
1730 |
int success = 0; |
int success = 0; |
1731 |
int output = 0; |
int output = 0; |
1780 |
repeat: |
repeat: |
1781 |
|
|
1782 |
vop_type = BitstreamReadHeaders(&bs, dec, &rounding, &reduced_resolution, |
vop_type = BitstreamReadHeaders(&bs, dec, &rounding, &reduced_resolution, |
1783 |
&quant, &fcode_forward, &fcode_backward, &intra_dc_threshold, gmc_mv); |
&quant, &fcode_forward, &fcode_backward, &intra_dc_threshold, &gmc_warp); |
1784 |
|
|
1785 |
DPRINTF(DPRINTF_HEADER, "vop_type=%i, packed=%i, time=%i, time_pp=%i, time_bp=%i", |
DPRINTF(DPRINTF_HEADER, "vop_type=%i, packed=%i, time=%lli, time_pp=%i, time_bp=%i", |
1786 |
vop_type, dec->packed_mode, dec->time, dec->time_pp, dec->time_bp); |
vop_type, dec->packed_mode, dec->time, dec->time_pp, dec->time_bp); |
1787 |
|
|
1788 |
if (vop_type == - 1) |
if (vop_type == - 1) |
1841 |
break; |
break; |
1842 |
case S_VOP : |
case S_VOP : |
1843 |
decoder_pframe(dec, &bs, rounding, reduced_resolution, quant, |
decoder_pframe(dec, &bs, rounding, reduced_resolution, quant, |
1844 |
fcode_forward, intra_dc_threshold, gmc_mv); |
fcode_forward, intra_dc_threshold, &gmc_warp); |
1845 |
break; |
break; |
1846 |
case N_VOP : |
case N_VOP : |
1847 |
image_copy(&dec->cur, &dec->refn[0], dec->edged_width, dec->height); |
image_copy(&dec->cur, &dec->refn[0], dec->edged_width, dec->height); |