summaryrefslogtreecommitdiffstats
path: root/libvpx/vp9/decoder/vp9_dsubexp.c
diff options
context:
space:
mode:
authorhkuang <hkuang@google.com>2013-11-13 18:48:14 -0800
committerAndroid Git Automerger <android-git-automerger@android.com>2013-11-13 18:48:14 -0800
commita1b7a7bb1ccf3f479bbca69a52a76eb05789dbaf (patch)
tree098e8b4772cb24cf53e3430f5a28ea1b80e875bd /libvpx/vp9/decoder/vp9_dsubexp.c
parent60f286339b17c89a358efbc94fb18d322faf4552 (diff)
parent5ae7ac49f08a179e4f054d99fcfc9dce78d26e58 (diff)
downloadandroid_external_libvpx-a1b7a7bb1ccf3f479bbca69a52a76eb05789dbaf.tar.gz
android_external_libvpx-a1b7a7bb1ccf3f479bbca69a52a76eb05789dbaf.tar.bz2
android_external_libvpx-a1b7a7bb1ccf3f479bbca69a52a76eb05789dbaf.zip
am 5ae7ac49: Roll latest libvpx into Android.
* commit '5ae7ac49f08a179e4f054d99fcfc9dce78d26e58': Roll latest libvpx into Android.
Diffstat (limited to 'libvpx/vp9/decoder/vp9_dsubexp.c')
-rw-r--r--libvpx/vp9/decoder/vp9_dsubexp.c15
1 files changed, 8 insertions, 7 deletions
diff --git a/libvpx/vp9/decoder/vp9_dsubexp.c b/libvpx/vp9/decoder/vp9_dsubexp.c
index 8cc64f7..fcca017 100644
--- a/libvpx/vp9/decoder/vp9_dsubexp.c
+++ b/libvpx/vp9/decoder/vp9_dsubexp.c
@@ -48,8 +48,6 @@ static int merge_index(int v, int n, int modulus) {
static int inv_remap_prob(int v, int m) {
static int inv_map_table[MAX_PROB - 1] = {
- // generated by:
- // inv_map_table[j] = merge_index(j, MAX_PROB - 1, MODULUS_PARAM);
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,
@@ -66,10 +64,11 @@ 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
};
- // v = merge_index(v, MAX_PROBS - 1, MODULUS_PARAM);
+ // 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);
v = inv_map_table[v];
m--;
if ((m << 1) <= MAX_PROB) {
@@ -101,6 +100,8 @@ static int decode_term_subexp(vp9_reader *r, int k, int num_syms) {
}
void vp9_diff_update_prob(vp9_reader *r, vp9_prob* p) {
- int delp = decode_term_subexp(r, SUBEXP_PARAM, 255);
- *p = (vp9_prob)inv_remap_prob(delp, *p);
+ if (vp9_read(r, DIFF_UPDATE_PROB)) {
+ const int delp = decode_term_subexp(r, SUBEXP_PARAM, 255);
+ *p = (vp9_prob)inv_remap_prob(delp, *p);
+ }
}