From: Jingning Han Date: Tue, 26 Aug 2014 22:53:56 +0000 (-0700) Subject: Add an early termination check in handle_inter_mode X-Git-Tag: v1.4.0~906^2 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=cd228fcdb8deafe51ead715988d395e05f8eda17;p=libvpx Add an early termination check in handle_inter_mode Check the mode and motion vector cost. If it is already above the existing best rate-distortion cost, skip the rest check process on this mode. Change-Id: Ie065cebdfda2a3be3be18b8e8b43dc29aaa8c179 --- diff --git a/vp9/encoder/vp9_rdopt.c b/vp9/encoder/vp9_rdopt.c index f7b5925fa..053dbbbd0 100644 --- a/vp9/encoder/vp9_rdopt.c +++ b/vp9/encoder/vp9_rdopt.c @@ -2236,6 +2236,10 @@ static int64_t handle_inter_mode(VP9_COMP *cpi, MACROBLOCK *x, * if the first is known */ *rate2 += cost_mv_ref(cpi, this_mode, mbmi->mode_context[refs[0]]); + if (RDCOST(x->rdmult, x->rddiv, *rate2, 0) > ref_best_rd && + mbmi->mode != NEARESTMV) + return INT64_MAX; + pred_exists = 0; // Are all MVs integer pel for Y and UV intpel_mv = !mv_has_subpel(&mbmi->mv[0].as_mv);