diff options
author | Dmitry Kovalev <dkovalev@google.com> | 2013-11-19 14:59:12 -0800 |
---|---|---|
committer | Dmitry Kovalev <dkovalev@google.com> | 2013-11-19 14:59:12 -0800 |
commit | e55d3e6d1bc346200bb9694de31518b3770a4c0d (patch) | |
tree | fb23707cd06f9cc7b44523a5f1e1b0284e791b94 /vp9/encoder/vp9_encodemv.c | |
parent | 953b1e968384bea066b4ec3878de8b504b815781 (diff) | |
download | libvpx-e55d3e6d1bc346200bb9694de31518b3770a4c0d.tar.gz |
Cleaning up probability/cost functions.
Change-Id: Ifad4b0e6355ce49fcc6f470becc080e8069452ee
Diffstat (limited to 'vp9/encoder/vp9_encodemv.c')
-rw-r--r-- | vp9/encoder/vp9_encodemv.c | 21 |
1 files changed, 8 insertions, 13 deletions
diff --git a/vp9/encoder/vp9_encodemv.c b/vp9/encoder/vp9_encodemv.c index 030ca6413..7e838c901 100644 --- a/vp9/encoder/vp9_encodemv.c +++ b/vp9/encoder/vp9_encodemv.c @@ -126,20 +126,15 @@ static void build_nmv_component_cost_table(int *mvcost, static int update_mv(vp9_writer *w, const unsigned int ct[2], vp9_prob *cur_p, vp9_prob upd_p) { - const vp9_prob new_p = get_binary_prob(ct[0], ct[1]); - vp9_prob mod_p = new_p | 1; - const int cur_b = cost_branch256(ct, *cur_p); - const int mod_b = cost_branch256(ct, mod_p); - const int cost = 7 * 256 + (vp9_cost_one(upd_p) - vp9_cost_zero(upd_p)); - if (cur_b - mod_b > cost) { - *cur_p = mod_p; - vp9_write(w, 1, upd_p); - vp9_write_literal(w, mod_p >> 1, 7); - return 1; - } else { - vp9_write(w, 0, upd_p); - return 0; + const vp9_prob new_p = get_binary_prob(ct[0], ct[1]) | 1; + const int update = cost_branch256(ct, *cur_p) + vp9_cost_zero(upd_p) > + cost_branch256(ct, new_p) + vp9_cost_one(upd_p) + 7 * 256; + vp9_write(w, update, upd_p); + if (update) { + *cur_p = new_p; + vp9_write_literal(w, new_p >> 1, 7); } + return update; } static void counts_to_nmv_context( |