370 |
|
|
371 |
// interlacing |
// interlacing |
372 |
if (frame->global_flags & XVID_INTERLACING) { |
if (frame->global_flags & XVID_INTERLACING) { |
373 |
|
if (pMB->cbp) { |
374 |
BitstreamPutBit(bs, pMB->field_dct); |
BitstreamPutBit(bs, pMB->field_dct); |
375 |
DEBUG1("codep: field_dct: ", pMB->field_dct); |
DEBUG1("codep: field_dct: ", pMB->field_dct); |
376 |
|
} |
377 |
|
|
378 |
// if inter block, write field ME flag |
// if inter block, write field ME flag |
379 |
if (pMB->mode == MODE_INTER || pMB->mode == MODE_INTER_Q) { |
if (pMB->mode == MODE_INTER || pMB->mode == MODE_INTER_Q) { |
414 |
Statistics * pStat) |
Statistics * pStat) |
415 |
{ |
{ |
416 |
|
|
|
int intra = (pMB->mode == MODE_INTRA || pMB->mode == MODE_INTRA_Q); |
|
|
|
|
417 |
if (frame->coding_type == P_VOP) { |
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 |
|
418 |
BitstreamPutBit(bs, 0); // coded |
BitstreamPutBit(bs, 0); // coded |
419 |
} |
} |
420 |
|
|
421 |
if (intra) |
if (pMB->mode == MODE_INTRA || pMB->mode == MODE_INTRA_Q) |
422 |
CodeBlockIntra(frame, pMB, qcoeff, bs, pStat); |
CodeBlockIntra(frame, pMB, qcoeff, bs, pStat); |
423 |
else |
else |
424 |
CodeBlockInter(frame, pMB, qcoeff, bs, pStat); |
CodeBlockInter(frame, pMB, qcoeff, bs, pStat); |
425 |
|
|
426 |
} |
} |
427 |
|
|
428 |
|
|
429 |
|
void |
430 |
|
MBSkip(Bitstream * bs) |
431 |
|
{ |
432 |
|
BitstreamPutBit(bs, 1); // not coded |
433 |
|
return; |
434 |
|
} |
435 |
|
|
436 |
|
|
437 |
/*************************************************************** |
/*************************************************************** |
438 |
* bframe encoding start |
* bframe encoding start |
439 |
***************************************************************/ |
***************************************************************/ |
522 |
int i; |
int i; |
523 |
|
|
524 |
/* ------------------------------------------------------------------ |
/* ------------------------------------------------------------------ |
525 |
when a block is skipped it is decoded DIRECT(0,) |
when a block is skipped it is decoded DIRECT(0,0) |
526 |
hence are interpolated from forward & backward frames |
hence is interpolated from forward & backward frames |
527 |
------------------------------------------------------------------ */ |
------------------------------------------------------------------ */ |
528 |
|
|
529 |
if (mb->mode == 5) { |
if (mb->mode == MODE_DIRECT_NONE_MV) { |
530 |
BitstreamPutBit(bs, 1); // skipped |
BitstreamPutBit(bs, 1); // skipped |
531 |
return; |
return; |
532 |
} |
} |
560 |
} |
} |
561 |
|
|
562 |
if (mb->mode == MODE_DIRECT) { |
if (mb->mode == MODE_DIRECT) { |
563 |
// TODO: direct |
CodeVector(bs, mb->deltamv.x, 1, pStat); /* fcode is always 1 for delta vector */ |
564 |
|
CodeVector(bs, mb->deltamv.y, 1, pStat); /* prediction is always (0,0) */ |
565 |
} |
} |
566 |
|
|
567 |
for (i = 0; i < 6; i++) { |
for (i = 0; i < 6; i++) { |