shithub: libvpx

Download patch

ref: 73b65e763c88a24914566118f078c2a6fb0a553a
parent: 6dba2fb7774e9f02ff7bb4e2778a614a70720f44
author: Jingning Han <jingning@google.com>
date: Sat Jul 21 17:49:42 EDT 2018

Refactor tpl model update function

Fill up all the blocks inside an operating unit with the provided
statistics.

Change-Id: I93556e0daf9f08cbe62d3c12cf38b5e26ad7c799

--- a/vp9/encoder/vp9_encoder.c
+++ b/vp9/encoder/vp9_encoder.c
@@ -5700,13 +5700,21 @@
                         (tpl_stats->mc_dep_cost * tpl_stats->inter_cost) /
                             tpl_stats->intra_cost;
 
-      ref_stats[ref_mi_row * ref_tpl_frame->stride + ref_mi_col].mc_flow +=
-          (mc_flow * overlap_area) / pix_num;
+      int idx, idy;
 
-      ref_stats[ref_mi_row * ref_tpl_frame->stride + ref_mi_col].mc_ref_cost +=
-          ((tpl_stats->intra_cost - tpl_stats->inter_cost) * overlap_area) /
-          pix_num;
-      assert(overlap_area >= 0);
+      for (idy = 0; idy < mi_height; ++idy) {
+        for (idx = 0; idx < mi_width; ++idx) {
+          TplDepStats *des_stats =
+              &ref_stats[(ref_mi_row + idy) * ref_tpl_frame->stride +
+                         (ref_mi_col + idx)];
+
+          des_stats->mc_flow += (mc_flow * overlap_area) / pix_num;
+          des_stats->mc_ref_cost +=
+              ((tpl_stats->intra_cost - tpl_stats->inter_cost) * overlap_area) /
+              pix_num;
+          assert(overlap_area >= 0);
+        }
+      }
     }
   }
 }