shithub: libvpx

Download patch

ref: 4cab8adc9e6274a62c796f9434459f316f622652
parent: 3248ea0e455aa3a57e9b034d740181d216c99cfb
author: chiyotsai <chiyotsai@google.com>
date: Thu Jan 31 16:39:19 EST 2019

Some cosmetic fixes to temporal filter

BUG=webm:1591

Change-Id: I34fd7e6cbe6f3d5486a669d0895402fd21de7641

--- a/vp9/encoder/vp9_temporal_filter.c
+++ b/vp9/encoder/vp9_temporal_filter.c
@@ -225,24 +225,24 @@
                                     unsigned int block_height,
                                     unsigned int block_width,
                                     const int *const blk_fw, int use_32x32) {
-  int filter_weight = 0;
-
-  if (use_32x32)
-    // blk_fw[0] ~ blk_fw[3] are the same.
+  // blk_fw[0] ~ blk_fw[3] are the same.
+  if (use_32x32) {
     return blk_fw[0];
+  }
 
   if (i < block_height / 2) {
-    if (j < block_width / 2)
-      filter_weight = blk_fw[0];
-    else
-      filter_weight = blk_fw[1];
-  } else {
-    if (j < block_width / 2)
-      filter_weight = blk_fw[2];
-    else
-      filter_weight = blk_fw[3];
+    if (j < block_width / 2) {
+      return blk_fw[0];
+    }
+
+    return blk_fw[1];
   }
-  return filter_weight;
+
+  if (j < block_width / 2) {
+    return blk_fw[2];
+  }
+
+  return blk_fw[3];
 }
 
 void vp9_apply_temporal_filter_c(
@@ -296,7 +296,7 @@
   for (i = 0, k = 0, m = 0; i < block_height; i++) {
     for (j = 0; j < block_width; j++) {
       const int pixel_value = y_pred[i * y_buf_stride + j];
-      int filter_weight =
+      const int filter_weight =
           get_filter_weight(i, j, block_height, block_width, blk_fw, use_32x32);
 
       // non-local mean approach
--- a/vp9/encoder/x86/temporal_filter_sse4.c
+++ b/vp9/encoder/x86/temporal_filter_sse4.c
@@ -254,7 +254,7 @@
                                            __m128i *v_first,
                                            __m128i *v_second) {
   if (!ss_x) {
-    // If there is no chroma subsampling in the horizaontal direction, then we
+    // If there is no chroma subsampling in the horizontal direction, then we
     // need to load 16 entries from chroma.
     read_dist_16(u_dist, u_first, u_second);
     read_dist_16(v_dist, v_first, v_second);
@@ -274,8 +274,8 @@
   }
 }
 
-// Horizonta add unsigned 16-bit ints in src and store them as signed 32-bit int
-// in dst.
+// Horizontal add unsigned 16-bit ints in src and store them as signed 32-bit
+// int in dst.
 static INLINE void hadd_epu16(__m128i *src, __m128i *dst) {
   const __m128i zero = _mm_setzero_si128();
   const __m128i shift_right = _mm_srli_si128(*src, 2);
@@ -323,7 +323,7 @@
 
 // Apply temporal filter to the luma components. This performs temporal
 // filtering on a luma block of 16 X block_height. Use blk_fw as an array of
-// size 4for the weights for each of the 4 subblocks if blk_fw is not NULL,
+// size 4 for the weights for each of the 4 subblocks if blk_fw is not NULL,
 // else use top_weight for top half, and bottom weight for bottom half.
 static void vp9_apply_temporal_filter_luma_16(
     const uint8_t *y_src, int y_src_stride, const uint8_t *y_pre,