aboutsummaryrefslogtreecommitdiffstats
path: root/libavcodec
diff options
context:
space:
mode:
authorPeter Ross <pross@xvid.org>2011-02-13 09:36:29 +0000
committerMichael Niedermayer <michaelni@gmx.at>2011-02-14 23:58:19 +0100
commitf20886e464874b246ae6acfea41f35c277b51752 (patch)
tree1547a160f151435fc6941a14402b5b733786fab4 /libavcodec
parenta093650b6c82ad84b257dd21e7d0028712f4bc34 (diff)
downloadffmpeg-f20886e464874b246ae6acfea41f35c277b51752.tar.gz
bink: permute Bink version 'b' quant matrices by inverse scan order
This fixes visual glitches in Bink version 'b' files, as the quantization tables were not being permuted. Signed-off-by: Mans Rullgard <mans@mansr.com> (cherry picked from commit 231539217431c32d4f22a16ee2834e24f54611f4)
Diffstat (limited to 'libavcodec')
-rw-r--r--libavcodec/bink.c13
1 files changed, 9 insertions, 4 deletions
diff --git a/libavcodec/bink.c b/libavcodec/bink.c
index f13e1c7a1b..95cfc92721 100644
--- a/libavcodec/bink.c
+++ b/libavcodec/bink.c
@@ -1210,6 +1210,7 @@ static int decode_frame(AVCodecContext *avctx, void *data, int *data_size, AVPac
*/
static av_cold void binkb_calc_quant()
{
+ uint8_t inv_bink_scan[64];
double s[64];
int i, j;
@@ -1228,17 +1229,21 @@ static av_cold void binkb_calc_quant()
}
}
+ for (i = 0; i < 64; i++)
+ inv_bink_scan[bink_scan[i]] = i;
+
for (j = 0; j < 16; j++) {
for (i = 0; i < 64; i++) {
+ int k = inv_bink_scan[i];
if (s[i] == 1.0) {
- binkb_intra_quant[j][i] = (1L << 12) * binkb_intra_seed[i] *
+ binkb_intra_quant[j][k] = (1L << 12) * binkb_intra_seed[i] *
binkb_num[j]/binkb_den[j];
- binkb_inter_quant[j][i] = (1L << 12) * binkb_inter_seed[i] *
+ binkb_inter_quant[j][k] = (1L << 12) * binkb_inter_seed[i] *
binkb_num[j]/binkb_den[j];
} else {
- binkb_intra_quant[j][i] = (1L << 12) * binkb_intra_seed[i] * s[i] *
+ binkb_intra_quant[j][k] = (1L << 12) * binkb_intra_seed[i] * s[i] *
binkb_num[j]/(double)binkb_den[j];
- binkb_inter_quant[j][i] = (1L << 12) * binkb_inter_seed[i] * s[i] *
+ binkb_inter_quant[j][k] = (1L << 12) * binkb_inter_seed[i] * s[i] *
binkb_num[j]/(double)binkb_den[j];
}
}