From: Zoe Liu Date: Thu, 12 Mar 2015 16:43:23 +0000 (-0700) Subject: Fixed a bug & a build warning for newmvref-sub8x8 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=0337ae52180be6f826f666d1fd498275b800ca7c;p=libvpx Fixed a bug & a build warning for newmvref-sub8x8 Change-Id: I799fc3fb4c1201da14c97bf66e06dec655f6a620 --- diff --git a/vp9/encoder/vp9_rdopt.c b/vp9/encoder/vp9_rdopt.c index d46e5850b..9dbfad5d6 100644 --- a/vp9/encoder/vp9_rdopt.c +++ b/vp9/encoder/vp9_rdopt.c @@ -2276,9 +2276,6 @@ static int set_and_cost_bmi_mvs(VP9_COMP *cpi, MACROBLOCKD *xd, int i, int *mvcost[2]) { MODE_INFO *const mic = xd->mi[0].src_mi; const MB_MODE_INFO *const mbmi = &mic->mbmi; -#if CONFIG_NEWMVREF_SUB8X8 - int usehp = cpi->common.allow_high_precision_mv; -#endif // CONFIG_NEWMVREF_SUB8X8 int thismvcost = 0; int idx, idy; const int num_4x4_blocks_wide = num_4x4_blocks_wide_lookup[mbmi->sb_type]; @@ -2332,9 +2329,11 @@ static int set_and_cost_bmi_mvs(VP9_COMP *cpi, MACROBLOCKD *xd, int i, case NEW_NEARESTMV: this_mv[0].as_int = seg_mvs[mbmi->ref_frame[0]].as_int; #if CONFIG_NEWMVREF_SUB8X8 - usehp = usehp && vp9_use_mv_hp(&best_ref_mv[0]->as_mv); - if (!usehp) - vp9_lower_mv_precision(&this_mv[0].as_mv, usehp); + // Check the ref mv precision to have the final mv precision aligned + // with that of its reference. + if (!cpi->common.allow_high_precision_mv || + !vp9_use_mv_hp(&best_ref_mv[0]->as_mv)) + vp9_lower_mv_precision(&this_mv[0].as_mv, 0); #endif // CONFIG_NEWMVREF_SUB8X8 thismvcost += vp9_mv_bit_cost(&this_mv[0].as_mv, &best_ref_mv[0]->as_mv, mvjcost, mvcost, MV_COST_WEIGHT_SUB); @@ -2345,9 +2344,11 @@ static int set_and_cost_bmi_mvs(VP9_COMP *cpi, MACROBLOCKD *xd, int i, this_mv[0].as_int = frame_mv[mbmi->ref_frame[0]].as_int; this_mv[1].as_int = seg_mvs[mbmi->ref_frame[1]].as_int; #if CONFIG_NEWMVREF_SUB8X8 - usehp = usehp && vp9_use_mv_hp(&best_ref_mv[1]->as_mv); - if (!usehp) - vp9_lower_mv_precision(&this_mv[1].as_mv, usehp); + // Check the ref mv precision to have the final mv precision aligned + // with that of its reference. + if (!cpi->common.allow_high_precision_mv || + !vp9_use_mv_hp(&best_ref_mv[1]->as_mv)) + vp9_lower_mv_precision(&this_mv[1].as_mv, 0); #endif // CONFIG_NEWMVREF_SUB8X8 thismvcost += vp9_mv_bit_cost(&this_mv[1].as_mv, &best_ref_mv[1]->as_mv, mvjcost, mvcost, MV_COST_WEIGHT_SUB); @@ -3064,7 +3065,7 @@ static int64_t rd_pick_best_sub8x8_mode(VP9_COMP *cpi, MACROBLOCK *x, have_ref = 1; for (ref = 0; ref < 1 + has_second_rf; ++ref) #if CONFIG_NEWMVREF_SUB8X8 - if (have_newmv_in_inter_mode) + if (have_newmv_in_inter_mode(this_mode)) have_ref &= ( (mode_mv[this_mode][ref].as_int == ref_bsi->rdstat[i][mode_idx].mvs[ref].as_int) &&