19 |
* along with this program ; if not, write to the Free Software |
* along with this program ; if not, write to the Free Software |
20 |
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA |
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA |
21 |
* |
* |
22 |
* $Id: mbcoding.c,v 1.44.2.14 2003-10-01 23:23:01 edgomez Exp $ |
* $Id: mbcoding.c,v 1.44.2.15 2003-10-03 13:47:00 syskin Exp $ |
23 |
* |
* |
24 |
****************************************************************************/ |
****************************************************************************/ |
25 |
|
|
775 |
|
|
776 |
} |
} |
777 |
|
|
|
|
|
|
/* moved to mbcoding.h so that in can be 'static __inline' */ |
|
|
#if 0 |
|
|
void |
|
|
MBSkip(Bitstream * bs) |
|
|
{ |
|
|
BitstreamPutBit(bs, 1); /* not coded */ |
|
|
} |
|
|
#endif |
|
|
|
|
778 |
/*************************************************************** |
/*************************************************************** |
779 |
* bframe encoding start |
* bframe encoding start |
780 |
***************************************************************/ |
***************************************************************/ |
838 |
|
|
839 |
|
|
840 |
void |
void |
841 |
MBCodingBVOP(const MACROBLOCK * mb, |
MBCodingBVOP(const FRAMEINFO * const frame, |
842 |
|
const MACROBLOCK * mb, |
843 |
const int16_t qcoeff[6 * 64], |
const int16_t qcoeff[6 * 64], |
844 |
const int32_t fcode, |
const int32_t fcode, |
845 |
const int32_t bcode, |
const int32_t bcode, |
846 |
Bitstream * bs, |
Bitstream * bs, |
847 |
Statistics * pStat, |
Statistics * pStat) |
|
int direction) |
|
848 |
{ |
{ |
849 |
int vcode = fcode; |
int vcode = fcode; |
850 |
unsigned int i; |
unsigned int i; |
851 |
|
|
852 |
|
const uint16_t *scan_table = |
853 |
|
frame->vop_flags & XVID_VOP_ALTERNATESCAN ? |
854 |
|
scan_tables[2] : scan_tables[0]; |
855 |
|
|
856 |
|
|
857 |
/* ------------------------------------------------------------------ |
/* ------------------------------------------------------------------ |
858 |
when a block is skipped it is decoded DIRECT(0,0) |
when a block is skipped it is decoded DIRECT(0,0) |
859 |
hence is interpolated from forward & backward frames |
hence is interpolated from forward & backward frames |
882 |
put_bvop_dbquant(bs, 0); /* todo: mb->dquant = 0 */ |
put_bvop_dbquant(bs, 0); /* todo: mb->dquant = 0 */ |
883 |
} |
} |
884 |
|
|
885 |
|
if (frame->vol_flags & XVID_VOL_INTERLACING) { |
886 |
|
if (mb->cbp) { |
887 |
|
BitstreamPutBit(bs, mb->field_dct); |
888 |
|
DPRINTF(XVID_DEBUG_MB,"codep: field_dct: %i\n", mb->field_dct); |
889 |
|
} |
890 |
|
|
891 |
|
/* if not direct block, write field ME flag */ |
892 |
|
if (mb->mode != MODE_DIRECT) { |
893 |
|
BitstreamPutBit(bs, 0 /*mb->field_pred*/); /* field ME not implemented */ |
894 |
|
|
895 |
|
/* write field prediction references */ |
896 |
|
/* if (mb->field_pred) { |
897 |
|
BitstreamPutBit(bs, mb->field_for_top); |
898 |
|
BitstreamPutBit(bs, mb->field_for_bot); |
899 |
|
}*/ |
900 |
|
} |
901 |
|
} |
902 |
|
|
903 |
|
|
904 |
switch (mb->mode) { |
switch (mb->mode) { |
905 |
case MODE_INTERPOLATE: |
case MODE_INTERPOLATE: |
906 |
CodeVector(bs, mb->pmvs[1].x, vcode, pStat); /* forward vector of interpolate mode */ |
CodeVector(bs, mb->pmvs[1].x, vcode, pStat); /* forward vector of interpolate mode */ |