diff options
author | James Zern <jzern@google.com> | 2015-06-30 15:09:48 -0700 |
---|---|---|
committer | James Zern <jzern@google.com> | 2015-06-30 15:49:29 -0700 |
commit | 8aaf5ec4c7f3e4a5d6806550d1415c20b337230a (patch) | |
tree | bc500d95748d069c9b4a67d666a0e2e693ee80df /vp9 | |
parent | fc5f3b8f4f170a32207ca2eca60f87bb0a01d03c (diff) | |
download | libvpx-8aaf5ec4c7f3e4a5d6806550d1415c20b337230a.tar libvpx-8aaf5ec4c7f3e4a5d6806550d1415c20b337230a.tar.gz libvpx-8aaf5ec4c7f3e4a5d6806550d1415c20b337230a.tar.bz2 libvpx-8aaf5ec4c7f3e4a5d6806550d1415c20b337230a.zip |
vp9_dsubexp: remove clamp in inv_remap_prob()
the max value of the lookup in expanded form is:
(((1 << 7) - 1) << 1) - 65 + 1 + 64 = 254
remove the clamp [0, 253] and add one table entry
Change-Id: I0b5d0c66702fdb0b8f1cc9ab9b0dac66326e85a6
Diffstat (limited to 'vp9')
-rw-r--r-- | vp9/decoder/vp9_dsubexp.c | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/vp9/decoder/vp9_dsubexp.c b/vp9/decoder/vp9_dsubexp.c index c22617edb..3df548120 100644 --- a/vp9/decoder/vp9_dsubexp.c +++ b/vp9/decoder/vp9_dsubexp.c @@ -8,6 +8,8 @@ * be found in the AUTHORS file in the root of the source tree. */ +#include <assert.h> + #include "vp9/common/vp9_entropy.h" #include "vp9/decoder/vp9_dsubexp.h" @@ -27,7 +29,7 @@ static int decode_uniform(vp9_reader *r) { } static int inv_remap_prob(int v, int m) { - static int inv_map_table[MAX_PROB - 1] = { + static int inv_map_table[MAX_PROB] = { 6, 19, 32, 45, 58, 71, 84, 97, 110, 123, 136, 149, 162, 175, 188, 201, 214, 227, 240, 253, 0, 1, 2, 3, 4, 5, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 20, 21, 22, 23, 24, 25, 26, @@ -44,11 +46,9 @@ static int inv_remap_prob(int v, int m) { 190, 191, 192, 193, 194, 195, 196, 197, 198, 199, 200, 202, 203, 204, 205, 206, 207, 208, 209, 210, 211, 212, 213, 215, 216, 217, 218, 219, 220, 221, 222, 223, 224, 225, 226, 228, 229, 230, 231, 232, 233, 234, 235, 236, 237, - 238, 239, 241, 242, 243, 244, 245, 246, 247, 248, 249, 250, 251, 252 + 238, 239, 241, 242, 243, 244, 245, 246, 247, 248, 249, 250, 251, 252, 252 }; - // The clamp is not necessary for conforming VP9 stream, it is added to - // prevent out of bound access for bad input data - v = clamp(v, 0, 253); + assert(v < (int)(sizeof(inv_map_table) / sizeof(inv_map_table[0]))); v = inv_map_table[v]; m--; if ((m << 1) <= MAX_PROB) { |