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) { |
|
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 |
|
416 |
BitstreamPutBit(bs, 0); // coded |
BitstreamPutBit(bs, 0); // coded |
417 |
} |
} |
418 |
|
|
419 |
if (intra) |
if (pMB->mode == MODE_INTRA || pMB->mode == MODE_INTRA_Q) |
420 |
CodeBlockIntra(frame, pMB, qcoeff, bs, pStat); |
CodeBlockIntra(frame, pMB, qcoeff, bs, pStat); |
421 |
else |
else |
422 |
CodeBlockInter(frame, pMB, qcoeff, bs, pStat); |
CodeBlockInter(frame, pMB, qcoeff, bs, pStat); |
423 |
|
|
424 |
} |
} |
425 |
|
|
426 |
|
|
427 |
|
void |
428 |
|
MBSkip(Bitstream * bs) |
429 |
|
{ |
430 |
|
BitstreamPutBit(bs, 1); // not coded |
431 |
|
return; |
432 |
|
} |
433 |
|
|
434 |
|
|
435 |
/*************************************************************** |
/*************************************************************** |
436 |
* bframe encoding start |
* bframe encoding start |
437 |
***************************************************************/ |
***************************************************************/ |
520 |
int i; |
int i; |
521 |
|
|
522 |
/* ------------------------------------------------------------------ |
/* ------------------------------------------------------------------ |
523 |
when a block is skipped it is decoded DIRECT(0,) |
when a block is skipped it is decoded DIRECT(0,0) |
524 |
hence are interpolated from forward & backward frames |
hence is interpolated from forward & backward frames |
525 |
------------------------------------------------------------------ */ |
------------------------------------------------------------------ */ |
526 |
|
|
527 |
if (mb->mode == 5) { |
if (mb->mode == MODE_DIRECT_NONE_MV) { |
528 |
BitstreamPutBit(bs, 1); // skipped |
BitstreamPutBit(bs, 1); // skipped |
529 |
return; |
return; |
530 |
} |
} |
558 |
} |
} |
559 |
|
|
560 |
if (mb->mode == MODE_DIRECT) { |
if (mb->mode == MODE_DIRECT) { |
561 |
// TODO: direct |
CodeVector(bs, mb->deltamv.x, 1, pStat); /* fcode is always 1 for delta vector */ |
562 |
|
CodeVector(bs, mb->deltamv.y, 1, pStat); /* prediction is always (0,0) */ |
563 |
} |
} |
564 |
|
|
565 |
for (i = 0; i < 6; i++) { |
for (i = 0; i < 6; i++) { |