Simplify temporal filter strength calculation
authorJingning Han <jingning@google.com>
Wed, 1 Aug 2018 21:34:14 +0000 (14:34 -0700)
committerJingning Han <jingning@google.com>
Wed, 8 Aug 2018 16:24:16 +0000 (09:24 -0700)
Change-Id: I5f878e9b6581bcb427ecc29ce490feb68378f8af

vp9/encoder/vp9_temporal_filter.c
vp9/encoder/x86/temporal_filter_sse4.c

index 99a03edf37dd091fe7c25a1a4ccf412dbdbe251a..18428c55870b2c2190ca604f048fba4e75ac1270 100644 (file)
@@ -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);
index 460dab659380a8c24bf7f74ad6b133a20bc07e7c..e5860d39cedc29ceeb087ea7bf6b2d8d8d7545d1 100644 (file)
@@ -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);