diff options
author | Dmitry Kovalev <dkovalev@google.com> | 2013-07-25 12:52:26 -0700 |
---|---|---|
committer | Gerrit Code Review <gerrit@gerrit.golo.chromium.org> | 2013-07-25 12:52:26 -0700 |
commit | be00d3970dbe4efc3d537e374774269ff2bb0621 (patch) | |
tree | 0568ef486113f6d6c0bb70cbf87b6585e1670529 /vp9/common/vp9_entropymv.c | |
parent | d604914f0976f50ecb0b267c4793bc6db8c083fb (diff) | |
parent | 40358dc406cf9ae46d063b170b6ddf84a754a87d (diff) | |
download | libvpx-be00d3970dbe4efc3d537e374774269ff2bb0621.tar libvpx-be00d3970dbe4efc3d537e374774269ff2bb0621.tar.gz libvpx-be00d3970dbe4efc3d537e374774269ff2bb0621.tar.bz2 libvpx-be00d3970dbe4efc3d537e374774269ff2bb0621.zip |
Merge "Removing duplicated code for merging two probabilities."
Diffstat (limited to 'vp9/common/vp9_entropymv.c')
-rw-r--r-- | vp9/common/vp9_entropymv.c | 29 |
1 files changed, 8 insertions, 21 deletions
diff --git a/vp9/common/vp9_entropymv.c b/vp9/common/vp9_entropymv.c index 5ceec0d6b..f819d6839 100644 --- a/vp9/common/vp9_entropymv.c +++ b/vp9/common/vp9_entropymv.c @@ -170,14 +170,7 @@ void vp9_inc_mv(const MV *mv, nmv_context_counts *counts) { } static void adapt_prob(vp9_prob *dest, vp9_prob prep, unsigned int ct[2]) { - const int count = MIN(ct[0] + ct[1], MV_COUNT_SAT); - if (count) { - const vp9_prob newp = get_binary_prob(ct[0], ct[1]); - const int factor = MV_MAX_UPDATE_FACTOR * count / MV_COUNT_SAT; - *dest = weighted_prob(prep, newp, factor); - } else { - *dest = prep; - } + *dest = merge_probs2(prep, ct, MV_COUNT_SAT, MV_MAX_UPDATE_FACTOR); } void vp9_counts_process(nmv_context_counts *nmv_count, int usehp) { @@ -190,26 +183,20 @@ static unsigned int adapt_probs(unsigned int i, vp9_prob this_probs[], const vp9_prob last_probs[], const unsigned int num_events[]) { - vp9_prob this_prob; - const uint32_t left = tree[i] <= 0 + + const unsigned int left = tree[i] <= 0 ? num_events[-tree[i]] : adapt_probs(tree[i], tree, this_probs, last_probs, num_events); - const uint32_t right = tree[i + 1] <= 0 + const unsigned int right = tree[i + 1] <= 0 ? num_events[-tree[i + 1]] : adapt_probs(tree[i + 1], tree, this_probs, last_probs, num_events); - uint32_t weight = left + right; - if (weight) { - this_prob = get_binary_prob(left, right); - weight = weight > MV_COUNT_SAT ? MV_COUNT_SAT : weight; - this_prob = weighted_prob(last_probs[i >> 1], this_prob, - MV_MAX_UPDATE_FACTOR * weight / MV_COUNT_SAT); - } else { - this_prob = last_probs[i >> 1]; - } - this_probs[i >> 1] = this_prob; + const unsigned int ct[2] = { left, right }; + + this_probs[i >> 1] = merge_probs2(last_probs[i >> 1], ct, + MV_COUNT_SAT, MV_MAX_UPDATE_FACTOR); return left + right; } |