]> granicus.if.org Git - libvpx/commitdiff
Add ref frame rate cost to non-RD mode decision
authorJingning Han <jingning@google.com>
Wed, 11 Feb 2015 18:51:50 +0000 (10:51 -0800)
committerJingning Han <jingning@google.com>
Wed, 11 Feb 2015 19:08:10 +0000 (11:08 -0800)
This commit adds a heuristic rate cost of reference frame to the
non-RD mode decision. It improves the compression performance of
speed -6 by 0.31% and speed -5 by 0.69%.

Change-Id: If7f3b45519d49b2cb640bcb7316a254efc8be446

vp9/encoder/vp9_pickmode.c

index 70e90b6e7bcbaee2561791476dcc936123456351..d24e4c7e6bf7daaffecfb19ccde261eea020d129 100644 (file)
@@ -577,6 +577,9 @@ static const PREDICTION_MODE inter_mode_set[INTER_MODES] = {
     ZEROMV, NEARESTMV, NEARMV, NEWMV,
 };
 
+static const int ref_frame_cost[MAX_REF_FRAMES] = {
+    1235, 229, 530, 615,
+};
 // TODO(jingning) placeholder for inter-frame non-RD mode decision.
 // this needs various further optimizations. to be continued..
 void vp9_pick_inter_mode(VP9_COMP *cpi, MACROBLOCK *x,
@@ -865,6 +868,7 @@ void vp9_pick_inter_mode(VP9_COMP *cpi, MACROBLOCK *x,
       this_rdc.rate += rate_mv;
       this_rdc.rate += cpi->inter_mode_cost[mbmi->mode_context[ref_frame]]
                                   [INTER_OFFSET(this_mode)];
+      this_rdc.rate += ref_frame_cost[ref_frame];
       this_rdc.rdcost = RDCOST(x->rdmult, x->rddiv,
                                this_rdc.rate, this_rdc.dist);
 
@@ -971,6 +975,7 @@ void vp9_pick_inter_mode(VP9_COMP *cpi, MACROBLOCK *x,
       this_rdc.rate = args.rate;
       this_rdc.dist = args.dist;
       this_rdc.rate += cpi->mbmode_cost[this_mode];
+      this_rdc.rate += ref_frame_cost[INTRA_FRAME];
       this_rdc.rate += intra_cost_penalty;
       this_rdc.rdcost = RDCOST(x->rdmult, x->rddiv,
                                this_rdc.rate, this_rdc.dist);