62 |
#define ABS(X) (((X)>0)?(X):-(X)) |
#define ABS(X) (((X)>0)?(X):-(X)) |
63 |
#define CLIP(X,A) (X > A) ? (A) : (X) |
#define CLIP(X,A) (X > A) ? (A) : (X) |
64 |
|
|
65 |
VLC intra_table[524032]; |
VLC intra_table[4*2048*64]; |
66 |
VLC inter_table[524032]; |
VLC inter_table[4*2048*64]; |
67 |
|
|
68 |
VLC DCT3Dintra[4096]; |
VLC DCT3Dintra[4096]; |
69 |
VLC DCT3Dinter[4096]; |
VLC DCT3Dinter[4096]; |
440 |
if (frame->global_flags & XVID_INTERLACING) { |
if (frame->global_flags & XVID_INTERLACING) { |
441 |
if (pMB->cbp) { |
if (pMB->cbp) { |
442 |
BitstreamPutBit(bs, pMB->field_dct); |
BitstreamPutBit(bs, pMB->field_dct); |
443 |
DEBUG1("codep: field_dct: ", pMB->field_dct); |
DPRINTF(DPRINTF_MB,"codep: field_dct: %i", pMB->field_dct); |
444 |
} |
} |
445 |
|
|
446 |
// if inter block, write field ME flag |
// if inter block, write field ME flag |
447 |
if (pMB->mode == MODE_INTER || pMB->mode == MODE_INTER_Q) { |
if (pMB->mode == MODE_INTER || pMB->mode == MODE_INTER_Q) { |
448 |
BitstreamPutBit(bs, pMB->field_pred); |
BitstreamPutBit(bs, pMB->field_pred); |
449 |
DEBUG1("codep: field_pred: ", pMB->field_pred); |
DPRINTF(DPRINTF_MB,"codep: field_pred: %i", pMB->field_pred); |
450 |
|
|
451 |
// write field prediction references |
// write field prediction references |
452 |
if (pMB->field_pred) { |
if (pMB->field_pred) { |
831 |
do { |
do { |
832 |
level = get_coeff(bs, &run, &last, 1, 0); |
level = get_coeff(bs, &run, &last, 1, 0); |
833 |
if (run == -1) { |
if (run == -1) { |
834 |
DEBUG("fatal: invalid run"); |
DPRINTF(DPRINTF_ERROR,"fatal: invalid run"); |
835 |
break; |
break; |
836 |
} |
} |
837 |
coeff += run; |
coeff += run; |
840 |
DPRINTF(DPRINTF_COEFF,"block[%i] %i", scan[coeff], level); |
DPRINTF(DPRINTF_COEFF,"block[%i] %i", scan[coeff], level); |
841 |
//DPRINTF(DPRINTF_COEFF,"block[%i] %i %08x", scan[coeff], level, BitstreamShowBits(bs, 32)); |
//DPRINTF(DPRINTF_COEFF,"block[%i] %i %08x", scan[coeff], level, BitstreamShowBits(bs, 32)); |
842 |
|
|
843 |
if (level < -127 || level > 127) { |
if (level < -2047 || level > 2047) { |
844 |
DEBUG1("warning: intra_overflow", level); |
DPRINTF(DPRINTF_ERROR,"warning: intra_overflow %i", level); |
845 |
} |
} |
846 |
coeff++; |
coeff++; |
847 |
} while (!last); |
} while (!last); |
864 |
do { |
do { |
865 |
level = get_coeff(bs, &run, &last, 0, 0); |
level = get_coeff(bs, &run, &last, 0, 0); |
866 |
if (run == -1) { |
if (run == -1) { |
867 |
DEBUG("fatal: invalid run"); |
DPRINTF(DPRINTF_ERROR,"fatal: invalid run"); |
868 |
break; |
break; |
869 |
} |
} |
870 |
p += run; |
p += run; |
874 |
DPRINTF(DPRINTF_COEFF,"block[%i] %i", scan[p], level); |
DPRINTF(DPRINTF_COEFF,"block[%i] %i", scan[p], level); |
875 |
// DPRINTF(DPRINTF_COEFF,"block[%i] %i %08x", scan[p], level, BitstreamShowBits(bs, 32)); |
// DPRINTF(DPRINTF_COEFF,"block[%i] %i %08x", scan[p], level, BitstreamShowBits(bs, 32)); |
876 |
|
|
877 |
if (level < -127 || level > 127) { |
if (level < -2047 || level > 2047) { |
878 |
DEBUG1("warning: inter_overflow", level); |
DPRINTF(DPRINTF_ERROR,"warning: inter overflow %i", level); |
879 |
} |
} |
880 |
p++; |
p++; |
881 |
} while (!last); |
} while (!last); |