shithub: libvpx

Download patch

ref: 729d7d6a2ff0f9a9d2f5534767ddb7edd6f598a7
parent: e7294a64047f0e0a24d81954d3fa38b1c7ac106c
parent: d99ba0399e0ef3f78a701e01df41707d66dafb4e
author: Jingning Han <jingning@google.com>
date: Wed Jun 20 00:10:38 EDT 2018

Merge "Refactor partition mode cost calculation"

--- a/vp9/encoder/vp9_encodeframe.c
+++ b/vp9/encoder/vp9_encodeframe.c
@@ -3559,9 +3559,11 @@
                      best_rdc.rdcost);
     if (this_rdc.rate != INT_MAX) {
       if (bsize >= BLOCK_8X8) {
-        this_rdc.rate += cpi->partition_cost[pl][PARTITION_NONE];
         this_rdc.rdcost =
             RDCOST(x->rdmult, x->rddiv, this_rdc.rate, this_rdc.dist);
+        this_rdc.rdcost += RDCOST(x->rdmult, x->rddiv,
+                                  cpi->partition_cost[pl][PARTITION_NONE], 0);
+        this_rdc.rate += cpi->partition_cost[pl][PARTITION_NONE];
       }
 
       if (this_rdc.rdcost < best_rdc.rdcost) {
@@ -3712,8 +3714,10 @@
     }
 
     if (sum_rdc.rdcost < best_rdc.rdcost && i == 4) {
-      sum_rdc.rate += cpi->partition_cost[pl][PARTITION_SPLIT];
       sum_rdc.rdcost = RDCOST(x->rdmult, x->rddiv, sum_rdc.rate, sum_rdc.dist);
+      sum_rdc.rdcost += RDCOST(x->rdmult, x->rddiv,
+                               cpi->partition_cost[pl][PARTITION_SPLIT], 0);
+      sum_rdc.rate += cpi->partition_cost[pl][PARTITION_SPLIT];
 
       if (sum_rdc.rdcost < best_rdc.rdcost) {
         best_rdc = sum_rdc;
@@ -3773,8 +3777,10 @@
     }
 
     if (sum_rdc.rdcost < best_rdc.rdcost) {
-      sum_rdc.rate += cpi->partition_cost[pl][PARTITION_HORZ];
       sum_rdc.rdcost = RDCOST(x->rdmult, x->rddiv, sum_rdc.rate, sum_rdc.dist);
+      sum_rdc.rdcost += RDCOST(x->rdmult, x->rddiv,
+                               cpi->partition_cost[pl][PARTITION_HORZ], 0);
+      sum_rdc.rate += cpi->partition_cost[pl][PARTITION_HORZ];
       if (sum_rdc.rdcost < best_rdc.rdcost) {
         best_rdc = sum_rdc;
         pc_tree->partitioning = PARTITION_HORZ;
@@ -3821,8 +3827,10 @@
     }
 
     if (sum_rdc.rdcost < best_rdc.rdcost) {
-      sum_rdc.rate += cpi->partition_cost[pl][PARTITION_VERT];
       sum_rdc.rdcost = RDCOST(x->rdmult, x->rddiv, sum_rdc.rate, sum_rdc.dist);
+      sum_rdc.rdcost += RDCOST(x->rdmult, x->rddiv,
+                               cpi->partition_cost[pl][PARTITION_VERT], 0);
+      sum_rdc.rate += cpi->partition_cost[pl][PARTITION_VERT];
       if (sum_rdc.rdcost < best_rdc.rdcost) {
         best_rdc = sum_rdc;
         pc_tree->partitioning = PARTITION_VERT;