--- trunk/xvidcore/src/bitstream/mbcoding.c 2002/06/30 10:46:29 252 +++ branches/dev-api-3/xvidcore/src/bitstream/mbcoding.c 2002/09/04 18:44:41 392 @@ -370,8 +370,10 @@ // interlacing if (frame->global_flags & XVID_INTERLACING) { - BitstreamPutBit(bs, pMB->field_dct); - DEBUG1("codep: field_dct: ", pMB->field_dct); + if (pMB->cbp) { + BitstreamPutBit(bs, pMB->field_dct); + DEBUG1("codep: field_dct: ", pMB->field_dct); + } // if inter block, write field ME flag if (pMB->mode == MODE_INTER || pMB->mode == MODE_INTER_Q) { @@ -412,24 +414,26 @@ Statistics * pStat) { - int intra = (pMB->mode == MODE_INTRA || pMB->mode == MODE_INTRA_Q); - if (frame->coding_type == P_VOP) { - if (pMB->cbp == 0 && pMB->mode == MODE_INTER && pMB->mvs[0].x == 0 && - pMB->mvs[0].y == 0) { - BitstreamPutBit(bs, 1); // not_coded - return; - } else BitstreamPutBit(bs, 0); // coded } - if (intra) + if (pMB->mode == MODE_INTRA || pMB->mode == MODE_INTRA_Q) CodeBlockIntra(frame, pMB, qcoeff, bs, pStat); else CodeBlockInter(frame, pMB, qcoeff, bs, pStat); } + +void +MBSkip(Bitstream * bs) +{ + BitstreamPutBit(bs, 1); // not coded + return; +} + + /*************************************************************** * bframe encoding start ***************************************************************/ @@ -518,11 +522,11 @@ int i; /* ------------------------------------------------------------------ - when a block is skipped it is decoded DIRECT(0,) - hence are interpolated from forward & backward frames + when a block is skipped it is decoded DIRECT(0,0) + hence is interpolated from forward & backward frames ------------------------------------------------------------------ */ - if (mb->mode == 5) { + if (mb->mode == MODE_DIRECT_NONE_MV) { BitstreamPutBit(bs, 1); // skipped return; } @@ -556,7 +560,8 @@ } if (mb->mode == MODE_DIRECT) { - // TODO: direct + CodeVector(bs, mb->deltamv.x, 1, pStat); /* fcode is always 1 for delta vector */ + CodeVector(bs, mb->deltamv.y, 1, pStat); /* prediction is always (0,0) */ } for (i = 0; i < 6; i++) {