ref: 36a9a33b900c802aff4a3ca4bf6943c5608ef8dd
parent: 7f8dd35329fcec4f32eba6f56ada69224e30f238
author: Jingning Han <[email protected]>
date: Fri Jul 31 12:41:51 EDT 2015
Add dynamic range notes to vp9_vector_var_c Change-Id: If536ad31046ecd9e2ecd9c21f52f8192c8153ad7
--- 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;
}