From 15d041e1e2b074e584773a3e0545b58cbf969e46 Mon Sep 17 00:00:00 2001 From: Jingning Han Date: Wed, 1 Aug 2018 14:34:14 -0700 Subject: [PATCH] Simplify temporal filter strength calculation Change-Id: I5f878e9b6581bcb427ecc29ce490feb68378f8af --- vp9/encoder/vp9_temporal_filter.c | 2 +- vp9/encoder/x86/temporal_filter_sse4.c | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/vp9/encoder/vp9_temporal_filter.c b/vp9/encoder/vp9_temporal_filter.c index 99a03edf3..18428c558 100644 --- a/vp9/encoder/vp9_temporal_filter.c +++ b/vp9/encoder/vp9_temporal_filter.c @@ -103,7 +103,7 @@ void vp9_temporal_filter_apply_c(const uint8_t *frame1, unsigned int stride, unsigned int i, j, k; int modifier; int byte = 0; - const int rounding = strength > 0 ? 1 << (strength - 1) : 0; + const int rounding = (1 << strength) >> 1; assert(strength >= 0); assert(strength <= 6); diff --git a/vp9/encoder/x86/temporal_filter_sse4.c b/vp9/encoder/x86/temporal_filter_sse4.c index 460dab659..e5860d39c 100644 --- a/vp9/encoder/x86/temporal_filter_sse4.c +++ b/vp9/encoder/x86/temporal_filter_sse4.c @@ -241,7 +241,7 @@ void vp9_temporal_filter_apply_sse4_1(const uint8_t *a, unsigned int stride, int weight, uint32_t *accumulator, uint16_t *count) { unsigned int h; - const int rounding = strength > 0 ? 1 << (strength - 1) : 0; + const int rounding = (1 << strength) >> 1; assert(strength >= 0); assert(strength <= 6); -- 2.40.0