shithub: libvpx

Download patch

ref: 4dc390b15d45bda474b1be23a01e36f20bd41d32
parent: fd22c492f7b53653d5aba22761015297f73031d3
parent: 36a9a33b900c802aff4a3ca4bf6943c5608ef8dd
author: Jingning Han <[email protected]>
date: Fri Jul 31 21:01:37 EDT 2015

Merge "Add dynamic range notes to vp9_vector_var_c"

--- a/vp9/encoder/vp9_avg.c
+++ b/vp9/encoder/vp9_avg.c
@@ -155,6 +155,9 @@
   return sum;
 }
 
+// ref: [0 - 510]
+// src: [0 - 510]
+// bwl: {2, 3, 4}
 int vp9_vector_var_c(int16_t const *ref, int16_t const *src,
                      const int bwl) {
   int i;
@@ -162,11 +165,12 @@
   int sse = 0, mean = 0, var;
 
   for (i = 0; i < width; ++i) {
-    int diff = ref[i] - src[i];
-    mean += diff;
-    sse += diff * diff;
+    int diff = ref[i] - src[i];  // diff: dynamic range [-510, 510], 10 bits.
+    mean += diff;                // mean: dynamic range 16 bits.
+    sse += diff * diff;          // sse:  dynamic range 26 bits.
   }
 
+  // (mean * mean): dynamic range 31 bits.
   var = sse - ((mean * mean) >> (bwl + 2));
   return var;
 }