summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--vp9/encoder/vp9_temporal_filter.c28
1 files changed, 14 insertions, 14 deletions
diff --git a/vp9/encoder/vp9_temporal_filter.c b/vp9/encoder/vp9_temporal_filter.c
index b94f30189..f9a1af5f4 100644
--- a/vp9/encoder/vp9_temporal_filter.c
+++ b/vp9/encoder/vp9_temporal_filter.c
@@ -327,13 +327,23 @@ void vp9_highbd_temporal_filter_apply_c(
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,22 +353,16 @@ void vp9_highbd_temporal_filter_apply_c(
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;
}
}
}
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 @@ void vp9_highbd_temporal_filter_apply_c(
count[k] += modifier;
accumulator[k] += modifier * pixel_value;
-
- byte++;
}
-
- byte += stride - block_width;
}
}
#endif // CONFIG_VP9_HIGHBITDEPTH