]> granicus.if.org Git - libvpx/commitdiff
Fix compound mv costing for ref-mv.
authorGeza Lore <gezalore@gmail.com>
Wed, 27 Apr 2016 12:37:29 +0000 (13:37 +0100)
committerGeza Lore <gezalore@gmail.com>
Wed, 27 Apr 2016 12:37:29 +0000 (13:37 +0100)
I believe this is necessary for computing the correct rate,
when not doing joint_motion_search.

Change-Id: I7634d6d7a5e6f0a6998edb4d577dd047d80df3c8

vp10/encoder/rdopt.c

index a50ee5ad7859f1938da1abe821f0d1d788762201..f2f829113b74fe0f4702fc02f4171395335e17f1 100644 (file)
@@ -6387,10 +6387,16 @@ static int64_t handle_inter_mode(VP10_COMP *cpi, MACROBLOCK *x,
           joint_motion_search(cpi, x, bsize, frame_mv,
                               mi_row, mi_col, NULL, single_newmv, &rate_mv, 0);
         } else {
+#if CONFIG_REF_MV
+          vp10_set_mvcost(x, mbmi->ref_frame[0]);
+#endif  // CONFIG_REF_MV
           rate_mv  = vp10_mv_bit_cost(&frame_mv[refs[0]].as_mv,
                                       &x->mbmi_ext->ref_mvs[refs[0]][0].as_mv,
                                       x->nmvjointcost, x->mvcost,
                                       MV_COST_WEIGHT);
+#if CONFIG_REF_MV
+          vp10_set_mvcost(x, mbmi->ref_frame[1]);
+#endif  // CONFIG_REF_MV
           rate_mv += vp10_mv_bit_cost(&frame_mv[refs[1]].as_mv,
                                       &x->mbmi_ext->ref_mvs[refs[1]][0].as_mv,
                                       x->nmvjointcost, x->mvcost,
@@ -6417,9 +6423,15 @@ static int64_t handle_inter_mode(VP10_COMP *cpi, MACROBLOCK *x,
                             mi_row, mi_col,
                             single_newmv, &rate_mv, 0);
       } else {
+#if CONFIG_REF_MV
+        vp10_set_mvcost(x, mbmi->ref_frame[0]);
+#endif  // CONFIG_REF_MV
         rate_mv  = vp10_mv_bit_cost(&frame_mv[refs[0]].as_mv,
                                    &x->mbmi_ext->ref_mvs[refs[0]][0].as_mv,
                                    x->nmvjointcost, x->mvcost, MV_COST_WEIGHT);
+#if CONFIG_REF_MV
+        vp10_set_mvcost(x, mbmi->ref_frame[1]);
+#endif  // CONFIG_REF_MV
         rate_mv += vp10_mv_bit_cost(&frame_mv[refs[1]].as_mv,
                                    &x->mbmi_ext->ref_mvs[refs[1]][0].as_mv,
                                    x->nmvjointcost, x->mvcost, MV_COST_WEIGHT);