summaryrefslogtreecommitdiff
path: root/vp10/decoder/detokenize.c
diff options
context:
space:
mode:
authorRonald S. Bultje <rsbultje@gmail.com>2015-09-30 21:37:20 -0400
committerRonald S. Bultje <rsbultje@gmail.com>2015-10-05 20:58:32 -0400
commit3461e8ce64739f8e70a9bcb8b062382e23a09cf9 (patch)
tree954d66920e00cddc66c5d91dd41780a60a0a6693 /vp10/decoder/detokenize.c
parentd77a84bf52ea678b8ad484d492e8ef51b32cdf48 (diff)
downloadlibvpx-3461e8ce64739f8e70a9bcb8b062382e23a09cf9.tar
libvpx-3461e8ce64739f8e70a9bcb8b062382e23a09cf9.tar.gz
libvpx-3461e8ce64739f8e70a9bcb8b062382e23a09cf9.tar.bz2
libvpx-3461e8ce64739f8e70a9bcb8b062382e23a09cf9.zip
vp10: skip unreachable cat6 token extrabits.
We have historically added new bits to cat6 whenever we added a new transform size (or bitdepth, for that matter). However, we have always coded these new bits regardless of the actual transform size, which means that for smaller transforms, we code bits that cannot possibly be set. The coding (quality) impact of this is negligible, but the bigger issue is that this allows creating bitstreams with coefficient values that are nonsensible and can cause int overflows, which then de facto become part of the bitstream spec. By not coding these bits, we remove this possibility. See issue 1065. Change-Id: Ib3186eca2df6a7a15ddc60c8b55af182aadd964d
Diffstat (limited to 'vp10/decoder/detokenize.c')
-rw-r--r--vp10/decoder/detokenize.c17
1 files changed, 12 insertions, 5 deletions
diff --git a/vp10/decoder/detokenize.c b/vp10/decoder/detokenize.c
index 2902ece7c..d39e3dc06 100644
--- a/vp10/decoder/detokenize.c
+++ b/vp10/decoder/detokenize.c
@@ -163,26 +163,33 @@ static int decode_coefs(const MACROBLOCKD *xd,
case CATEGORY5_TOKEN:
val = CAT5_MIN_VAL + read_coeff(cat5_prob, 5, r);
break;
- case CATEGORY6_TOKEN:
+ case CATEGORY6_TOKEN: {
+#if CONFIG_MISC_FIXES
+ const int skip_bits = TX_SIZES - 1 - tx_size;
+#else
+ const int skip_bits = 0;
+#endif
+ const uint8_t *cat6p = cat6_prob + skip_bits;
#if CONFIG_VP9_HIGHBITDEPTH
switch (xd->bd) {
case VPX_BITS_8:
- val = CAT6_MIN_VAL + read_coeff(cat6_prob, 14, r);
+ val = CAT6_MIN_VAL + read_coeff(cat6p, 14 - skip_bits, r);
break;
case VPX_BITS_10:
- val = CAT6_MIN_VAL + read_coeff(cat6_prob, 16, r);
+ val = CAT6_MIN_VAL + read_coeff(cat6p, 16 - skip_bits, r);
break;
case VPX_BITS_12:
- val = CAT6_MIN_VAL + read_coeff(cat6_prob, 18, r);
+ val = CAT6_MIN_VAL + read_coeff(cat6p, 18 - skip_bits, r);
break;
default:
assert(0);
return -1;
}
#else
- val = CAT6_MIN_VAL + read_coeff(cat6_prob, 14, r);
+ val = CAT6_MIN_VAL + read_coeff(cat6p, 14 - skip_bits, r);
#endif
break;
+ }
}
}
v = (val * dqv) >> dq_shift;