From a4d906c13228ac79ed83c4c55b18df4698224db9 Mon Sep 17 00:00:00 2001 From: Deb Mukherjee <debargha@google.com> Date: Tue, 11 Jun 2013 09:31:33 -0700 Subject: [PATCH] Minor change in forward updates Removes the case of coding prob = 0 for forward updates, since that is not an allowed probability to code. Slightly improves efficiency but may not matter in practice. Change-Id: I3b4caf82e8f0891992f0706d4089cc5a27568dba --- vp9/decoder/vp9_decodframe.c | 7 ++++--- vp9/encoder/vp9_bitstream.c | 6 ++++-- 2 files changed, 8 insertions(+), 5 deletions(-) diff --git a/vp9/decoder/vp9_decodframe.c b/vp9/decoder/vp9_decodframe.c index 43015b987b..fa1f8a46d7 100644 --- a/vp9/decoder/vp9_decodframe.c +++ b/vp9/decoder/vp9_decodframe.c @@ -156,13 +156,14 @@ static int merge_index(int v, int n, int modulus) { } static int inv_remap_prob(int v, int m) { - const int n = 256; + const int n = 255; v = merge_index(v, n - 1, MODULUS_PARAM); + m--; if ((m << 1) <= n) { - return inv_recenter_nonneg(v + 1, m); + return 1 + inv_recenter_nonneg(v + 1, m); } else { - return n - 1 - inv_recenter_nonneg(v + 1, n - 1 - m); + return n - inv_recenter_nonneg(v + 1, n - 1 - m); } } diff --git a/vp9/encoder/vp9_bitstream.c b/vp9/encoder/vp9_bitstream.c index 2808571e8e..86cd810312 100644 --- a/vp9/encoder/vp9_bitstream.c +++ b/vp9/encoder/vp9_bitstream.c @@ -265,7 +265,7 @@ int count_term_subexp(int word, int k, int num_syms) { static void compute_update_table() { int i; - for (i = 0; i < 255; i++) + for (i = 0; i < 254; i++) update_bits[i] = count_term_subexp(i, SUBEXP_PARAM, 255); } @@ -277,9 +277,11 @@ static int split_index(int i, int n, int modulus) { } static int remap_prob(int v, int m) { - const int n = 256; + const int n = 255; const int modulus = MODULUS_PARAM; int i; + v--; + m--; if ((m << 1) <= n) i = recenter_nonneg(v, m) - 1; else -- GitLab