diff options
author | Michael Niedermayer <michaelni@gmx.at> | 2005-05-17 11:31:57 +0000 |
---|---|---|
committer | Michael Niedermayer <michaelni@gmx.at> | 2005-05-17 11:31:57 +0000 |
commit | 36af0c959e42a9427b2537682746d7f45802f579 (patch) | |
tree | 7531c89d513cb21eba22616d82ddcc4ebf70b685 | |
parent | 8b6103da0f0f2ac73cf2698e8f26d7b989a564ac (diff) | |
download | ffmpeg-36af0c959e42a9427b2537682746d7f45802f579.tar.gz |
fix idct permutation
Originally committed as revision 4258 to svn://svn.ffmpeg.org/ffmpeg/trunk
-rw-r--r-- | libavcodec/vp3.c | 18 |
1 files changed, 12 insertions, 6 deletions
diff --git a/libavcodec/vp3.c b/libavcodec/vp3.c index da4f531d29..5423da1eed 100644 --- a/libavcodec/vp3.c +++ b/libavcodec/vp3.c @@ -250,6 +250,8 @@ typedef struct Vp3DecodeContext { int u_fragment_start; int v_fragment_start; + ScanTable scantable; + /* tables */ uint16_t coded_dc_scale_factor[64]; uint32_t coded_ac_scale_factor[64]; @@ -885,20 +887,21 @@ static void init_dequantizer(Vp3DecodeContext *s) /* scale AC quantizers, zigzag at the same time in preparation for * the dequantization phase */ 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) s->intra_y_dequant[j] = MIN_DEQUANT_VAL; 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) s->intra_c_dequant[j] = MIN_DEQUANT_VAL; 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) s->inter_dequant[j] = MIN_DEQUANT_VAL * 2; s->inter_dequant[j] *= SCALER; @@ -1633,6 +1636,7 @@ static int unpack_vlcs(Vp3DecodeContext *s, GetBitContext *gb, int zero_run; DCTELEM coeff; Vp3Fragment *fragment; + uint8_t *perm= s->scantable.permutated; if ((first_fragment >= s->fragment_count) || (last_fragment >= s->fragment_count)) { @@ -1659,7 +1663,7 @@ static int unpack_vlcs(Vp3DecodeContext *s, GetBitContext *gb, if (!eob_run) { fragment->coeff_count += zero_run; 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", s->coded_fragment_list[i], fragment->coeffs[coeff_index]); } else { @@ -2510,6 +2514,8 @@ static int vp3_decode_init(AVCodecContext *avctx) if(avctx->idct_algo==FF_IDCT_AUTO) avctx->idct_algo=FF_IDCT_VP3; 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 * in the first frame decode */ |