# HG changeset patch # User tmmm # Date 1052621467 0 # Node ID fe46bd7c64d499a022dba9b82d602751a657a9a5 # Parent 6eab0df78d47cc63c047d91796a305bbf1e94d04 get those permutations straight diff -r 6eab0df78d47 -r fe46bd7c64d4 vp3.c --- a/vp3.c Sat May 10 21:46:17 2003 +0000 +++ b/vp3.c Sun May 11 02:51:07 2003 +0000 @@ -862,7 +862,7 @@ * the dequantization phase */ for (i = 1; i < 64; i++) { - j = quant_index[i]; + j = zigzag_index[i]; s->intra_y_dequant[j] = vp31_intra_y_dequant[i] * quality_scale / 100; if (s->intra_y_dequant[j] < MIN_DEQUANT_VAL) @@ -2065,6 +2065,7 @@ int j; int16_t *dequantizer; DCTELEM dequant_block[64]; + DCTELEM dequant_block_permuted[64]; unsigned char *output_plane; unsigned char *last_plane; unsigned char *golden_plane; @@ -2155,9 +2156,12 @@ i, s->all_fragments[i].coding_method, s->all_fragments[i].coeffs[0], dequantizer[0]); for (j = 0; j < 64; j++) - dequant_block[dequant_index[j]] = + dequant_block[dezigzag_index[j]] = s->all_fragments[i].coeffs[j] * dequantizer[j]; + for (j = 0; j < 64; j++) + dequant_block_permuted[s->dsp.idct_permutation[j]] = + dequant_block[j]; debug_idct("dequantized block:\n"); for (m = 0; m < 8; m++) { @@ -2171,14 +2175,14 @@ /* invert DCT and place (or add) in final output */ if (s->all_fragments[i].coding_method == MODE_INTRA) { - dequant_block[0] += 1024; + dequant_block_permuted[0] += 1024; s->dsp.idct_put( output_plane + s->all_fragments[i].first_pixel, - stride, dequant_block); + stride, dequant_block_permuted); } else { s->dsp.idct_add( output_plane + s->all_fragments[i].first_pixel, - stride, dequant_block); + stride, dequant_block_permuted); } debug_idct("block after idct_%s():\n", @@ -2363,7 +2367,7 @@ /* build quantization table */ for (i = 0; i < 64; i++) - quant_index[dequant_index[i]] = i; + zigzag_index[dezigzag_index[i]] = i; /* work out the block mapping tables */ s->superblock_fragments = av_malloc(s->superblock_count * 16 * sizeof(int)); diff -r 6eab0df78d47 -r fe46bd7c64d4 vp3data.h --- a/vp3data.h Sat May 10 21:46:17 2003 +0000 +++ b/vp3data.h Sun May 11 02:51:07 2003 +0000 @@ -60,7 +60,7 @@ }; /* table used to convert natural order <-> zigzag order */ -static const int dequant_index[64] = +static const int dezigzag_index[64] = { 0, 1, 8, 16, 9, 2, 3, 10, 17, 24, 32, 25, 18, 11, 4, 5, 12, 19, 26, 33, 40, 48, 41, 34, @@ -71,8 +71,8 @@ 53, 60, 61, 54, 47, 55, 62, 63 }; -/* inverse of dequant index */ -static int quant_index[64]; +/* inverse of dezigzag index */ +static int zigzag_index[64]; static const uint16_t dc_bias[16][32][2] = { { /* DC bias table 0 */