shithub: libvpx

Download patch

ref: a57301cfa409dcdffab8eb1fe12585be740dc221
parent: 98efa1c43f5fec025dc48b8bd63b6d15f2cd6498
author: Jingning Han <jingning@google.com>
date: Fri Aug 17 05:08:15 EDT 2018

Clean up var define in apply_temporal_filter()

Change-Id: Iffb90d1ce61a70de52196247e18a31485038e6dd

--- a/vp9/encoder/vp9_temporal_filter.c
+++ b/vp9/encoder/vp9_temporal_filter.c
@@ -134,7 +134,8 @@
 
       // non-local mean approach
       int diff_sse[9] = { 0 };
-      int idx, idy, index = 0;
+      int idx, idy;
+      int y_index = 0;
 
       const int uv_r = i >> ss_y;
       const int uv_c = j >> ss_x;
@@ -150,13 +151,13 @@
               col < (int)block_width) {
             const int diff = y_frame1[row * (int)y_stride + col] -
                              y_pred[row * (int)block_width + col];
-            diff_sse[index] = diff * diff;
-            ++index;
+            diff_sse[y_index] = diff * diff;
+            ++y_index;
           }
         }
       }
 
-      assert(index > 0);
+      assert(y_index > 0);
 
       modifier = 0;
       for (idx = 0; idx < 9; ++idx) modifier += diff_sse[idx];
@@ -169,9 +170,10 @@
              v_pred[uv_r * uv_buf_stride + uv_c];
       modifier += diff * diff;
 
-      index += 2;
+      y_index += 2;
 
-      modifier = mod_index(modifier, index, rounding, strength, filter_weight);
+      modifier =
+          mod_index(modifier, y_index, rounding, strength, filter_weight);
 
       y_count[k] += modifier;
       y_accumulator[k] += modifier * pixel_value;
@@ -186,7 +188,8 @@
         // non-local mean approach
         int u_diff_sse[9] = { 0 };
         int v_diff_sse[9] = { 0 };
-        int idx, idy, index = 0;
+        int idx, idy;
+        int cr_index = 0;
         int u_mod = 0, v_mod = 0;
         int y_diff = 0;
 
@@ -199,18 +202,18 @@
                 col < uv_block_width) {
               int diff = u_frame1[row * uv_stride + col] -
                          u_pred[row * uv_buf_stride + col];
-              u_diff_sse[index] = diff * diff;
+              u_diff_sse[cr_index] = diff * diff;
 
               diff = v_frame1[row * uv_stride + col] -
                      v_pred[row * uv_buf_stride + col];
-              v_diff_sse[index] = diff * diff;
+              v_diff_sse[cr_index] = diff * diff;
 
-              ++index;
+              ++cr_index;
             }
           }
         }
 
-        assert(index > 0);
+        assert(cr_index > 0);
 
         for (idx = 0; idx < 9; ++idx) {
           u_mod += u_diff_sse[idx];
@@ -224,7 +227,7 @@
             const int diff = y_frame1[row * (int)y_stride + col] -
                              y_pred[row * (int)block_width + col];
             y_diff += diff * diff;
-            ++index;
+            ++cr_index;
           }
         }
 
@@ -231,8 +234,8 @@
         u_mod += y_diff;
         v_mod += y_diff;
 
-        u_mod = mod_index(u_mod, index, rounding, strength, filter_weight);
-        v_mod = mod_index(v_mod, index, rounding, strength, filter_weight);
+        u_mod = mod_index(u_mod, cr_index, rounding, strength, filter_weight);
+        v_mod = mod_index(v_mod, cr_index, rounding, strength, filter_weight);
 
         u_count[m] += u_mod;
         u_accumulator[m] += u_mod * u_pixel_value;