627 |
|
|
628 |
#endif |
#endif |
629 |
|
|
|
|
|
|
static int iDQtab[5] = { |
|
|
1, 0, -1 /* no change */, 2, 3 |
|
|
}; |
|
|
#define DQ_VALUE2INDEX(value) iDQtab[(value)+2] |
|
|
|
|
|
|
|
630 |
static __inline void |
static __inline void |
631 |
CodeBlockIntra(const FRAMEINFO * const frame, |
CodeBlockIntra(const FRAMEINFO * const frame, |
632 |
const MACROBLOCK * pMB, |
const MACROBLOCK * pMB, |
657 |
BitstreamPutBits(bs, 0, 1); |
BitstreamPutBits(bs, 0, 1); |
658 |
|
|
659 |
// write cbpy |
// write cbpy |
660 |
BitstreamPutBits(bs, cbpy_tab[cbpy].code, cbpy_tab[cbpy].len); |
BitstreamPutBits(bs, xvid_cbpy_tab[cbpy].code, xvid_cbpy_tab[cbpy].len); |
661 |
|
|
662 |
// write dquant |
// write dquant |
663 |
if (pMB->mode == MODE_INTRA_Q) |
if (pMB->mode == MODE_INTRA_Q) |
664 |
BitstreamPutBits(bs, DQ_VALUE2INDEX(pMB->dquant), 2); |
BitstreamPutBits(bs, pMB->dquant, 2); |
665 |
|
|
666 |
// write interlacing |
// write interlacing |
667 |
if (frame->vol_flags & XVID_VOL_INTERLACING) { |
if (frame->global_flags & XVID_INTERLACING) { |
668 |
BitstreamPutBit(bs, pMB->field_dct); |
BitstreamPutBit(bs, pMB->field_dct); |
669 |
} |
} |
670 |
// code block coeffs |
// code block coeffs |
678 |
|
|
679 |
if (pMB->cbp & (1 << (5 - i))) { |
if (pMB->cbp & (1 << (5 - i))) { |
680 |
const uint16_t *scan_table = |
const uint16_t *scan_table = |
681 |
frame->vop_flags & XVID_VOP_ALTERNATESCAN ? |
frame->global_flags & XVID_ALTERNATESCAN ? |
682 |
scan_tables[2] : scan_tables[pMB->acpred_directions[i]]; |
scan_tables[2] : scan_tables[pMB->acpred_directions[i]]; |
683 |
|
|
684 |
bits = BitstreamPos(bs); |
bits = BitstreamPos(bs); |
719 |
BitstreamPutBit(bs, pMB->mcsel); // mcsel: '0'=local motion, '1'=GMC |
BitstreamPutBit(bs, pMB->mcsel); // mcsel: '0'=local motion, '1'=GMC |
720 |
|
|
721 |
// write cbpy |
// write cbpy |
722 |
BitstreamPutBits(bs, cbpy_tab[cbpy].code, cbpy_tab[cbpy].len); |
BitstreamPutBits(bs, xvid_cbpy_tab[cbpy].code, xvid_cbpy_tab[cbpy].len); |
723 |
|
|
724 |
// write dquant |
// write dquant |
725 |
if (pMB->mode == MODE_INTER_Q) |
if (pMB->mode == MODE_INTER_Q) |
726 |
BitstreamPutBits(bs, DQ_VALUE2INDEX(pMB->dquant), 2); |
BitstreamPutBits(bs, pMB->dquant, 2); |
727 |
|
|
728 |
// interlacing |
// interlacing |
729 |
if (frame->vol_flags & XVID_VOL_INTERLACING) { |
if (frame->global_flags & XVID_INTERLACING) { |
730 |
if (pMB->cbp) { |
if (pMB->cbp) { |
731 |
BitstreamPutBit(bs, pMB->field_dct); |
BitstreamPutBit(bs, pMB->field_dct); |
732 |
DPRINTF(DPRINTF_MB,"codep: field_dct: %i", pMB->field_dct); |
DPRINTF(DPRINTF_MB,"codep: field_dct: %i", pMB->field_dct); |
758 |
if (pMB->cbp & (1 << (5 - i))) |
if (pMB->cbp & (1 << (5 - i))) |
759 |
{ |
{ |
760 |
const uint16_t *scan_table = |
const uint16_t *scan_table = |
761 |
frame->vop_flags & XVID_VOP_ALTERNATESCAN ? |
frame->global_flags & XVID_ALTERNATESCAN ? |
762 |
scan_tables[2] : scan_tables[0]; |
scan_tables[2] : scan_tables[0]; |
763 |
|
|
764 |
#ifdef BIGLUT |
#ifdef BIGLUT |
1618 |
{5, 6}, {5, 9}, {5, 8}, {3, 7}, {2, 9} |
{5, 6}, {5, 9}, {5, 8}, {3, 7}, {2, 9} |
1619 |
}; |
}; |
1620 |
|
|
1621 |
const VLC cbpy_tab[16] = { |
const VLC xvid_cbpy_tab[16] = { |
1622 |
{3, 4}, {5, 5}, {4, 5}, {9, 4}, {3, 5}, {7, 4}, {2, 6}, {11, 4}, |
{3, 4}, {5, 5}, {4, 5}, {9, 4}, {3, 5}, {7, 4}, {2, 6}, {11, 4}, |
1623 |
{2, 5}, {3, 6}, {5, 4}, {10, 4}, {4, 4}, {8, 4}, {6, 4}, {3, 2} |
{2, 5}, {3, 6}, {5, 4}, {10, 4}, {4, 4}, {8, 4}, {6, 4}, {3, 2} |
1624 |
}; |
}; |