Commit 75fbd558 authored by michael's avatar michael

fix idct permutation


git-svn-id: file:///var/local/repositories/ffmpeg/trunk@4258 9553f0bf-9b14-0410-a0b8-cfaf0461ba5b
parent 1b28aef3
...@@ -250,6 +250,8 @@ typedef struct Vp3DecodeContext { ...@@ -250,6 +250,8 @@ typedef struct Vp3DecodeContext {
int u_fragment_start; int u_fragment_start;
int v_fragment_start; int v_fragment_start;
ScanTable scantable;
/* tables */ /* tables */
uint16_t coded_dc_scale_factor[64]; uint16_t coded_dc_scale_factor[64];
uint32_t coded_ac_scale_factor[64]; uint32_t coded_ac_scale_factor[64];
...@@ -885,20 +887,21 @@ static void init_dequantizer(Vp3DecodeContext *s) ...@@ -885,20 +887,21 @@ static void init_dequantizer(Vp3DecodeContext *s)
/* scale AC quantizers, zigzag at the same time in preparation for /* scale AC quantizers, zigzag at the same time in preparation for
* the dequantization phase */ * the dequantization phase */
for (i = 1; i < 64; i++) { for (i = 1; i < 64; i++) {
int k= s->scantable.scantable[i];
j = s->scantable.permutated[i];
j = i;
s->intra_y_dequant[j] = s->coded_intra_y_dequant[i] * ac_scale_factor / 100; s->intra_y_dequant[j] = s->coded_intra_y_dequant[k] * ac_scale_factor / 100;
if (s->intra_y_dequant[j] < MIN_DEQUANT_VAL) if (s->intra_y_dequant[j] < MIN_DEQUANT_VAL)
s->intra_y_dequant[j] = MIN_DEQUANT_VAL; s->intra_y_dequant[j] = MIN_DEQUANT_VAL;
s->intra_y_dequant[j] *= SCALER; s->intra_y_dequant[j] *= SCALER;
s->intra_c_dequant[j] = s->coded_intra_c_dequant[i] * ac_scale_factor / 100; s->intra_c_dequant[j] = s->coded_intra_c_dequant[k] * ac_scale_factor / 100;
if (s->intra_c_dequant[j] < MIN_DEQUANT_VAL) if (s->intra_c_dequant[j] < MIN_DEQUANT_VAL)
s->intra_c_dequant[j] = MIN_DEQUANT_VAL; s->intra_c_dequant[j] = MIN_DEQUANT_VAL;
s->intra_c_dequant[j] *= SCALER; s->intra_c_dequant[j] *= SCALER;
s->inter_dequant[j] = s->coded_inter_dequant[i] * ac_scale_factor / 100; s->inter_dequant[j] = s->coded_inter_dequant[k] * ac_scale_factor / 100;
if (s->inter_dequant[j] < MIN_DEQUANT_VAL * 2) if (s->inter_dequant[j] < MIN_DEQUANT_VAL * 2)
s->inter_dequant[j] = MIN_DEQUANT_VAL * 2; s->inter_dequant[j] = MIN_DEQUANT_VAL * 2;
s->inter_dequant[j] *= SCALER; s->inter_dequant[j] *= SCALER;
...@@ -1633,6 +1636,7 @@ static int unpack_vlcs(Vp3DecodeContext *s, GetBitContext *gb, ...@@ -1633,6 +1636,7 @@ static int unpack_vlcs(Vp3DecodeContext *s, GetBitContext *gb,
int zero_run; int zero_run;
DCTELEM coeff; DCTELEM coeff;
Vp3Fragment *fragment; Vp3Fragment *fragment;
uint8_t *perm= s->scantable.permutated;
if ((first_fragment >= s->fragment_count) || if ((first_fragment >= s->fragment_count) ||
(last_fragment >= s->fragment_count)) { (last_fragment >= s->fragment_count)) {
...@@ -1659,7 +1663,7 @@ static int unpack_vlcs(Vp3DecodeContext *s, GetBitContext *gb, ...@@ -1659,7 +1663,7 @@ static int unpack_vlcs(Vp3DecodeContext *s, GetBitContext *gb,
if (!eob_run) { if (!eob_run) {
fragment->coeff_count += zero_run; fragment->coeff_count += zero_run;
if (fragment->coeff_count < 64) if (fragment->coeff_count < 64)
fragment->coeffs[dezigzag_index[fragment->coeff_count++]] = coeff; fragment->coeffs[perm[fragment->coeff_count++]] = coeff;
debug_vlc(" fragment %d coeff = %d\n", debug_vlc(" fragment %d coeff = %d\n",
s->coded_fragment_list[i], fragment->coeffs[coeff_index]); s->coded_fragment_list[i], fragment->coeffs[coeff_index]);
} else { } else {
...@@ -2511,6 +2515,8 @@ static int vp3_decode_init(AVCodecContext *avctx) ...@@ -2511,6 +2515,8 @@ static int vp3_decode_init(AVCodecContext *avctx)
avctx->idct_algo=FF_IDCT_VP3; avctx->idct_algo=FF_IDCT_VP3;
dsputil_init(&s->dsp, avctx); dsputil_init(&s->dsp, avctx);
ff_init_scantable(s->dsp.idct_permutation, &s->scantable, ff_zigzag_direct);
/* initialize to an impossible value which will force a recalculation /* initialize to an impossible value which will force a recalculation
* in the first frame decode */ * in the first frame decode */
s->quality_index = -1; s->quality_index = -1;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment