Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1678)

Unified Diff: source/libvpx/vp9/encoder/vp9_avg.c

Issue 996503002: libvpx: Pull from upstream (Closed) Base URL: https://chromium.googlesource.com/chromium/deps/libvpx.git@master
Patch Set: Created 5 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « source/libvpx/vp9/encoder/vp9_aq_cyclicrefresh.c ('k') | source/libvpx/vp9/encoder/vp9_bitstream.c » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: source/libvpx/vp9/encoder/vp9_avg.c
diff --git a/source/libvpx/vp9/encoder/vp9_avg.c b/source/libvpx/vp9/encoder/vp9_avg.c
index 8d6cf0667c15b1ae80156c01b48d048bdbc64589..90d113c325143b3d2ddef08649d43cc85ce6e108 100644
--- a/source/libvpx/vp9/encoder/vp9_avg.c
+++ b/source/libvpx/vp9/encoder/vp9_avg.c
@@ -32,11 +32,13 @@ unsigned int vp9_avg_4x4_c(const uint8_t *s, int p) {
void vp9_int_pro_row_c(int16_t *hbuf, uint8_t const *ref,
const int ref_stride, const int height) {
int idx;
+ const int norm_factor = MAX(8, height >> 1);
for (idx = 0; idx < 16; ++idx) {
int i;
hbuf[idx] = 0;
for (i = 0; i < height; ++i)
hbuf[idx] += ref[i * ref_stride];
+ hbuf[idx] /= norm_factor;
++ref;
}
}
@@ -44,18 +46,26 @@ void vp9_int_pro_row_c(int16_t *hbuf, uint8_t const *ref,
int16_t vp9_int_pro_col_c(uint8_t const *ref, const int width) {
int idx;
int16_t sum = 0;
+ const int norm_factor = MAX(8, width >> 1);
for (idx = 0; idx < width; ++idx)
sum += ref[idx];
- return sum;
+ return sum / norm_factor;
}
-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
« no previous file with comments | « source/libvpx/vp9/encoder/vp9_aq_cyclicrefresh.c ('k') | source/libvpx/vp9/encoder/vp9_bitstream.c » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698