summaryrefslogtreecommitdiff
path: root/vp9/encoder/vp9_avg.c
diff options
context:
space:
mode:
authorJingning Han <jingning@google.com>2015-02-27 13:35:22 -0800
committerJingning Han <jingning@google.com>2015-03-01 10:42:56 -0800
commit1790d45252efb29903baae3d1776bb24cee76558 (patch)
treec78441dc2aef61b80f9b027634c927540e1a4912 /vp9/encoder/vp9_avg.c
parentf4e0eb17e85eb84c162ac0218cf32a9eccece353 (diff)
downloadlibvpx-1790d45252efb29903baae3d1776bb24cee76558.tar
libvpx-1790d45252efb29903baae3d1776bb24cee76558.tar.gz
libvpx-1790d45252efb29903baae3d1776bb24cee76558.tar.bz2
libvpx-1790d45252efb29903baae3d1776bb24cee76558.zip
Use variance metric for integral projection vector match
This commit replaces the SAD with variance as metric for the integral projection vector match. It improves the search accuracy in the presence of slight light change. The average speed -6 compression performance for rtc set is improved by 1.7%. No speed changes are observed for the test clips. Change-Id: I71c1d27e42de2aa429fb3564e6549bba1c7d6d4d
Diffstat (limited to 'vp9/encoder/vp9_avg.c')
-rw-r--r--vp9/encoder/vp9_avg.c22
1 files changed, 15 insertions, 7 deletions
diff --git a/vp9/encoder/vp9_avg.c b/vp9/encoder/vp9_avg.c
index 8d6cf0667..50c8bca0b 100644
--- a/vp9/encoder/vp9_avg.c
+++ b/vp9/encoder/vp9_avg.c
@@ -37,6 +37,7 @@ void vp9_int_pro_row_c(int16_t *hbuf, uint8_t const *ref,
hbuf[idx] = 0;
for (i = 0; i < height; ++i)
hbuf[idx] += ref[i * ref_stride];
+ hbuf[idx] /= 32;
++ref;
}
}
@@ -46,16 +47,23 @@ int16_t vp9_int_pro_col_c(uint8_t const *ref, const int width) {
int16_t sum = 0;
for (idx = 0; idx < width; ++idx)
sum += ref[idx];
- return sum;
+ return sum / 32;
}
-int vp9_vector_sad_c(int16_t const *ref, int16_t const *src,
- const int width) {
+int vp9_vector_var_c(int16_t const *ref, int16_t const *src,
+ const int bwl) {
int i;
- int this_sad = 0;
- for (i = 0; i < width; ++i)
- this_sad += abs(ref[i] - src[i]);
- return this_sad;
+ int width = 4 << bwl;
+ int sse = 0, mean = 0, var;
+
+ for (i = 0; i < width; ++i) {
+ int diff = ref[i] - src[i];
+ mean += diff;
+ sse += diff * diff;
+ }
+
+ var = sse - ((mean * mean) >> (bwl + 2));
+ return var;
}
#if CONFIG_VP9_HIGHBITDEPTH