Generalize the mv cost update to any newmv mode
Corrects an incomplete condition set in a previous patch
to cover compound modes with newmv.
STATS_CHANGED - a slight improvement
Change-Id: Ib9901038c7fe731baf8fb9e9d5e8e4ef46f4eecf
diff --git a/av1/encoder/encodeframe.c b/av1/encoder/encodeframe.c
index 61648a8..414da36 100644
--- a/av1/encoder/encodeframe.c
+++ b/av1/encoder/encodeframe.c
@@ -1422,11 +1422,23 @@
}
}
}
- if (new_mv) {
+ if (have_newmv_in_inter_mode(mbmi->mode)) {
const int allow_hp = cm->cur_frame_force_integer_mv
? MV_SUBPEL_NONE
: cm->allow_high_precision_mv;
- for (int ref = 0; ref < 1 + has_second_ref(mbmi); ++ref) {
+ if (new_mv) {
+ for (int ref = 0; ref < 1 + has_second_ref(mbmi); ++ref) {
+ const int_mv ref_mv = av1_get_ref_mv(x, ref);
+ av1_update_mv_stats(&mbmi->mv[ref].as_mv, &ref_mv.as_mv, &fc->nmvc,
+ allow_hp);
+ }
+ } else if (mbmi->mode == NEAREST_NEWMV || mbmi->mode == NEAR_NEWMV) {
+ const int ref = 1;
+ const int_mv ref_mv = av1_get_ref_mv(x, ref);
+ av1_update_mv_stats(&mbmi->mv[ref].as_mv, &ref_mv.as_mv, &fc->nmvc,
+ allow_hp);
+ } else if (mbmi->mode == NEW_NEARESTMV || mbmi->mode == NEW_NEARMV) {
+ const int ref = 0;
const int_mv ref_mv = av1_get_ref_mv(x, ref);
av1_update_mv_stats(&mbmi->mv[ref].as_mv, &ref_mv.as_mv, &fc->nmvc,
allow_hp);