212 |
= (ESCAPE3 << 21) | (last << 20) | (run << 14) | (1 << 13) | ((level & 0xfff) << 1) | 1; |
= (ESCAPE3 << 21) | (last << 20) | (run << 14) | (1 << 13) | ((level & 0xfff) << 1) | 1; |
213 |
coeff_VLC[intra][last][level + offset][run].len = 30; |
coeff_VLC[intra][last][level + offset][run].len = 30; |
214 |
coeff_VLC[intra][last][offset - level][run].code |
coeff_VLC[intra][last][offset - level][run].code |
215 |
= (ESCAPE3 << 21) | (last << 20) | (run << 14) | (1 << 13) | ((-level & 0xfff) << 1) | 1; |
= (ESCAPE3 << 21) | (last << 20) | (run << 14) | (1 << 13) | ((-(int32_t)level & 0xfff) << 1) | 1; |
216 |
coeff_VLC[intra][last][offset - level][run].len = 30; |
coeff_VLC[intra][last][offset - level][run].len = 30; |
217 |
} |
} |
218 |
continue; |
continue; |
627 |
|
|
628 |
#endif |
#endif |
629 |
|
|
630 |
|
|
631 |
|
static int iDQtab[5] = { |
632 |
|
1, 0, -1 /* no change */, 2, 3 |
633 |
|
}; |
634 |
|
#define DQ_VALUE2INDEX(value) iDQtab[(value)+2] |
635 |
|
|
636 |
|
|
637 |
static __inline void |
static __inline void |
638 |
CodeBlockIntra(const FRAMEINFO * const frame, |
CodeBlockIntra(const FRAMEINFO * const frame, |
639 |
const MACROBLOCK * pMB, |
const MACROBLOCK * pMB, |
668 |
|
|
669 |
// write dquant |
// write dquant |
670 |
if (pMB->mode == MODE_INTRA_Q) |
if (pMB->mode == MODE_INTRA_Q) |
671 |
BitstreamPutBits(bs, pMB->dquant, 2); |
BitstreamPutBits(bs, DQ_VALUE2INDEX(pMB->dquant), 2); |
672 |
|
|
673 |
// write interlacing |
// write interlacing |
674 |
if (frame->global_flags & XVID_INTERLACING) { |
if (frame->vol_flags & XVID_VOL_INTERLACING) { |
675 |
BitstreamPutBit(bs, pMB->field_dct); |
BitstreamPutBit(bs, pMB->field_dct); |
676 |
} |
} |
677 |
// code block coeffs |
// code block coeffs |
685 |
|
|
686 |
if (pMB->cbp & (1 << (5 - i))) { |
if (pMB->cbp & (1 << (5 - i))) { |
687 |
const uint16_t *scan_table = |
const uint16_t *scan_table = |
688 |
frame->global_flags & XVID_ALTERNATESCAN ? |
frame->vop_flags & XVID_VOP_ALTERNATESCAN ? |
689 |
scan_tables[2] : scan_tables[pMB->acpred_directions[i]]; |
scan_tables[2] : scan_tables[pMB->acpred_directions[i]]; |
690 |
|
|
691 |
bits = BitstreamPos(bs); |
bits = BitstreamPos(bs); |
730 |
|
|
731 |
// write dquant |
// write dquant |
732 |
if (pMB->mode == MODE_INTER_Q) |
if (pMB->mode == MODE_INTER_Q) |
733 |
BitstreamPutBits(bs, pMB->dquant, 2); |
BitstreamPutBits(bs, DQ_VALUE2INDEX(pMB->dquant), 2); |
734 |
|
|
735 |
// interlacing |
// interlacing |
736 |
if (frame->global_flags & XVID_INTERLACING) { |
if (frame->vol_flags & XVID_VOL_INTERLACING) { |
737 |
if (pMB->cbp) { |
if (pMB->cbp) { |
738 |
BitstreamPutBit(bs, pMB->field_dct); |
BitstreamPutBit(bs, pMB->field_dct); |
739 |
DPRINTF(DPRINTF_MB,"codep: field_dct: %i", pMB->field_dct); |
DPRINTF(DPRINTF_MB,"codep: field_dct: %i", pMB->field_dct); |
765 |
if (pMB->cbp & (1 << (5 - i))) |
if (pMB->cbp & (1 << (5 - i))) |
766 |
{ |
{ |
767 |
const uint16_t *scan_table = |
const uint16_t *scan_table = |
768 |
frame->global_flags & XVID_ALTERNATESCAN ? |
frame->vop_flags & XVID_VOP_ALTERNATESCAN ? |
769 |
scan_tables[2] : scan_tables[0]; |
scan_tables[2] : scan_tables[0]; |
770 |
|
|
771 |
#ifdef BIGLUT |
#ifdef BIGLUT |