shithub: libvpx

Download patch

ref: c77822615ee77ba8ec50585b299249c858cfba93
parent: acb9460929ac31ec221102c5d2cdb400a92f4e6f
parent: cc47231187c2b259ccbc4f0095f9940bc92d638c
author: Jerome Jiang <jianj@google.com>
date: Mon Oct 30 19:39:41 EDT 2017

Merge "vp9: Reduce stack usage of choose_partioning."

--- a/vp9/encoder/vp9_encodeframe.c
+++ b/vp9/encoder/vp9_encodeframe.c
@@ -287,8 +287,12 @@
 }
 
 typedef struct {
-  int64_t sum_square_error;
-  int64_t sum_error;
+  // This struct is used for computing variance in choose_partitioning(), where
+  // the max number of samples within a superblock is 16x16 (with 4x4 avg). Even
+  // in high bitdepth, uint32_t is enough for sum_square_error (2^12 * 2^12 * 16
+  // * 16 = 2^32).
+  uint32_t sum_square_error;
+  int32_t sum_error;
   int log2_count;
   int variance;
 } var;
@@ -381,7 +385,7 @@
 }
 
 // Set variance values given sum square error, sum error, count.
-static void fill_variance(int64_t s2, int64_t s, int c, var *v) {
+static void fill_variance(uint32_t s2, int32_t s, int c, var *v) {
   v->sum_square_error = s2;
   v->sum_error = s;
   v->log2_count = c;