412 |
Statistics * pStat) |
Statistics * pStat) |
413 |
{ |
{ |
414 |
|
|
|
int intra = (pMB->mode == MODE_INTRA || pMB->mode == MODE_INTRA_Q); |
|
|
|
|
415 |
if (frame->coding_type == P_VOP) { |
if (frame->coding_type == P_VOP) { |
416 |
if (pMB->cbp == 0 && pMB->mode == MODE_INTER && pMB->mvs[0].x == 0 && |
if (pMB->cbp == 0 && pMB->mode == MODE_INTER && pMB->mvs[0].x == 0 && |
417 |
pMB->mvs[0].y == 0) { |
pMB->mvs[0].y == 0) { |
418 |
|
|
419 |
|
#ifdef _DISABLE_SKIP |
420 |
|
/* disable SKIP when Bframes active until some workaround for the B-SKIP problem is found */ |
421 |
|
BitstreamPutBit(bs, 0); // always coded! |
422 |
|
#else |
423 |
BitstreamPutBit(bs, 1); // not_coded |
BitstreamPutBit(bs, 1); // not_coded |
424 |
|
|
425 |
return; |
return; |
426 |
|
#endif |
427 |
} else |
} else |
428 |
BitstreamPutBit(bs, 0); // coded |
BitstreamPutBit(bs, 0); // coded |
429 |
} |
} |
430 |
|
|
431 |
if (intra) |
if (pMB->mode == MODE_INTRA || pMB->mode == MODE_INTRA_Q) |
432 |
CodeBlockIntra(frame, pMB, qcoeff, bs, pStat); |
CodeBlockIntra(frame, pMB, qcoeff, bs, pStat); |
433 |
else |
else |
434 |
CodeBlockInter(frame, pMB, qcoeff, bs, pStat); |
CodeBlockInter(frame, pMB, qcoeff, bs, pStat); |
523 |
int i; |
int i; |
524 |
|
|
525 |
/* ------------------------------------------------------------------ |
/* ------------------------------------------------------------------ |
526 |
when a block is skipped it is decoded DIRECT(0,) |
when a block is skipped it is decoded DIRECT(0,0) |
527 |
hence are interpolated from forward & backward frames |
hence is interpolated from forward & backward frames |
528 |
------------------------------------------------------------------ */ |
------------------------------------------------------------------ */ |
529 |
|
|
530 |
if (mb->mode == 5) { |
if (mb->mode == MODE_DIRECT_NONE_MV) { |
531 |
BitstreamPutBit(bs, 1); // skipped |
BitstreamPutBit(bs, 1); // skipped |
532 |
return; |
return; |
533 |
} |
} |
561 |
} |
} |
562 |
|
|
563 |
if (mb->mode == MODE_DIRECT) { |
if (mb->mode == MODE_DIRECT) { |
564 |
// TODO: direct |
CodeVector(bs, mb->mvs[0].x, 1, pStat); /* fcode is always 1 for delta vector */ |
565 |
|
CodeVector(bs, mb->mvs[0].y, 1, pStat); /* prediction is always (0,0) */ |
566 |
} |
} |
567 |
|
|
568 |
for (i = 0; i < 6; i++) { |
for (i = 0; i < 6; i++) { |
579 |
***************************************************************/ |
***************************************************************/ |
580 |
|
|
581 |
|
|
|
void |
|
|
skip_stuffing(Bitstream *bs) |
|
|
{ |
|
|
while (BitstreamShowBits(bs, 9) == 1) |
|
|
BitstreamSkip(bs, 9); |
|
|
} |
|
|
|
|
|
|
|
|
|
|
582 |
// for IVOP addbits == 0 |
// for IVOP addbits == 0 |
583 |
// for PVOP addbits == fcode - 1 |
// for PVOP addbits == fcode - 1 |
584 |
// for BVOP addbits == max(fcode,bcode) - 1 |
// for BVOP addbits == max(fcode,bcode) - 1 |
779 |
} |
} |
780 |
coeff += run; |
coeff += run; |
781 |
block[scan[coeff]] = level; |
block[scan[coeff]] = level; |
782 |
|
|
783 |
|
DPRINTF(DPRINTF_COEFF,"block[%i] %i", scan[coeff], level); |
784 |
|
//DPRINTF(DPRINTF_COEFF,"block[%i] %i %08x", scan[coeff], level, BitstreamShowBits(bs, 32)); |
785 |
|
|
786 |
if (level < -127 || level > 127) { |
if (level < -127 || level > 127) { |
787 |
DEBUG1("warning: intra_overflow", level); |
DEBUG1("warning: intra_overflow", level); |
788 |
} |
} |
812 |
p += run; |
p += run; |
813 |
|
|
814 |
block[scan[p]] = level; |
block[scan[p]] = level; |
815 |
|
|
816 |
|
DPRINTF(DPRINTF_COEFF,"block[%i] %i", scan[p], level); |
817 |
|
// DPRINTF(DPRINTF_COEFF,"block[%i] %i %08x", scan[p], level, BitstreamShowBits(bs, 32)); |
818 |
|
|
819 |
if (level < -127 || level > 127) { |
if (level < -127 || level > 127) { |
820 |
DEBUG1("warning: inter_overflow", level); |
DEBUG1("warning: inter_overflow", level); |
821 |
} |
} |