ref: 2b838d9081b597825f37f1816514cc9820f47097
parent: 22d67c346fde9630b9accfdd3b3abe9840a061fe
parent: 4f3398a26a18719c5a8866aae36a437d22737174
author: Yunqing Wang <[email protected]>
date: Wed Oct 17 19:11:46 EDT 2018
Merge "Optimize vp9_highbd_temporal_filter_apply_c"
--- a/vp9/encoder/vp9_temporal_filter.c
+++ b/vp9/encoder/vp9_temporal_filter.c
@@ -327,13 +327,23 @@
const uint16_t *frame2 = CONVERT_TO_SHORTPTR(frame2_8);
unsigned int i, j, k;
int modifier;
- int byte = 0;
const int rounding = strength > 0 ? 1 << (strength - 1) : 0;
+ int diff_sse[256] = { 0 };
+ int this_idx = 0;
+
+ for (i = 0; i < block_height; i++) {
+ for (j = 0; j < block_width; j++) {
+ const int diff =
+ frame1[i * (int)stride + j] - frame2[i * (int)block_width + j];
+ diff_sse[this_idx++] = diff * diff;
+ }
+ }
+
+ modifier = 0;
for (i = 0, k = 0; i < block_height; i++) {
for (j = 0; j < block_width; j++, k++) {
- int pixel_value = *frame2;
- int diff_sse[9] = { 0 };
+ int pixel_value = frame2[i * (int)block_width + j];
int idx, idy, index = 0;
for (idy = -1; idy <= 1; ++idy) {
@@ -343,9 +353,7 @@
if (row >= 0 && row < (int)block_height && col >= 0 &&
col < (int)block_width) {
- int diff = frame1[byte + idy * (int)stride + idx] -
- frame2[idy * (int)block_width + idx];
- diff_sse[index] = diff * diff;
+ modifier += diff_sse[row * (int)block_width + col];
++index;
}
}
@@ -352,13 +360,9 @@
}
assert(index > 0);
- modifier = 0;
- for (idx = 0; idx < 9; ++idx) modifier += diff_sse[idx];
-
modifier *= 3;
modifier /= index;
- ++frame2;
modifier += rounding;
modifier >>= strength;
@@ -369,11 +373,7 @@
count[k] += modifier;
accumulator[k] += modifier * pixel_value;
-
- byte++;
}
-
- byte += stride - block_width;
}
}
#endif // CONFIG_VP9_HIGHBITDEPTH