shithub: libvpx

Download patch

ref: 9a31d05e24ebcf4c14edd586c10f5fe6385cc395
parent: 3984b41c87a4c9db65ee6fbde8224e9f827f50d2
author: Dmitry Kovalev <[email protected]>
date: Mon Aug 12 10:28:00 EDT 2013

Removing unused convolve_avg_c function + cleanup.

Change-Id: Id2b126c6456627c25e4041a82e304d0151d951ba

--- a/vp9/common/vp9_convolve.c
+++ b/vp9/common/vp9_convolve.c
@@ -237,36 +237,6 @@
                   w, h, taps);
 }
 
-static void convolve_avg_c(const uint8_t *src, ptrdiff_t src_stride,
-                           uint8_t *dst, ptrdiff_t dst_stride,
-                           const int16_t *filter_x, int x_step_q4,
-                           const int16_t *filter_y, int y_step_q4,
-                           int w, int h, int taps) {
-  /* Fixed size intermediate buffer places limits on parameters.
-   * Maximum intermediate_height is 135, for y_step_q4 == 32,
-   * h == 64, taps == 8.
-   */
-  uint8_t temp[64 * 135];
-  int intermediate_height = MAX(((h * y_step_q4) >> 4), 1) + taps - 1;
-
-  assert(w <= 64);
-  assert(h <= 64);
-  assert(taps <= 8);
-  assert(y_step_q4 <= 32);
-  assert(x_step_q4 <= 32);
-
-  if (intermediate_height < h)
-    intermediate_height = h;
-
-  convolve_horiz_c(src - src_stride * (taps / 2 - 1), src_stride,
-                   temp, 64,
-                   filter_x, x_step_q4, filter_y, y_step_q4,
-                   w, intermediate_height, taps);
-  convolve_avg_vert_c(temp + 64 * (taps / 2 - 1), 64, dst, dst_stride,
-                      filter_x, x_step_q4, filter_y, y_step_q4,
-                      w, h, taps);
-}
-
 void vp9_convolve8_horiz_c(const uint8_t *src, ptrdiff_t src_stride,
                            uint8_t *dst, ptrdiff_t dst_stride,
                            const int16_t *filter_x, int x_step_q4,
@@ -273,8 +243,7 @@
                            const int16_t *filter_y, int y_step_q4,
                            int w, int h) {
   convolve_horiz_c(src, src_stride, dst, dst_stride,
-                   filter_x, x_step_q4, filter_y, y_step_q4,
-                   w, h, 8);
+                   filter_x, x_step_q4, filter_y, y_step_q4, w, h, 8);
 }
 
 void vp9_convolve8_avg_horiz_c(const uint8_t *src, ptrdiff_t src_stride,
@@ -283,8 +252,7 @@
                                const int16_t *filter_y, int y_step_q4,
                                int w, int h) {
   convolve_avg_horiz_c(src, src_stride, dst, dst_stride,
-                       filter_x, x_step_q4, filter_y, y_step_q4,
-                       w, h, 8);
+                       filter_x, x_step_q4, filter_y, y_step_q4, w, h, 8);
 }
 
 void vp9_convolve8_vert_c(const uint8_t *src, ptrdiff_t src_stride,
@@ -293,8 +261,7 @@
                           const int16_t *filter_y, int y_step_q4,
                           int w, int h) {
   convolve_vert_c(src, src_stride, dst, dst_stride,
-                  filter_x, x_step_q4, filter_y, y_step_q4,
-                  w, h, 8);
+                  filter_x, x_step_q4, filter_y, y_step_q4, w, h, 8);
 }
 
 void vp9_convolve8_avg_vert_c(const uint8_t *src, ptrdiff_t src_stride,
@@ -303,8 +270,7 @@
                               const int16_t *filter_y, int y_step_q4,
                               int w, int h) {
   convolve_avg_vert_c(src, src_stride, dst, dst_stride,
-                      filter_x, x_step_q4, filter_y, y_step_q4,
-                      w, h, 8);
+                      filter_x, x_step_q4, filter_y, y_step_q4, w, h, 8);
 }
 
 void vp9_convolve8_c(const uint8_t *src, ptrdiff_t src_stride,
@@ -313,8 +279,7 @@
                      const int16_t *filter_y, int y_step_q4,
                      int w, int h) {
   convolve_c(src, src_stride, dst, dst_stride,
-             filter_x, x_step_q4, filter_y, y_step_q4,
-             w, h, 8);
+             filter_x, x_step_q4, filter_y, y_step_q4, w, h, 8);
 }
 
 void vp9_convolve8_avg_c(const uint8_t *src, ptrdiff_t src_stride,
@@ -327,16 +292,9 @@
   assert(w <= 64);
   assert(h <= 64);
 
-  vp9_convolve8(src, src_stride,
-                temp, 64,
-                filter_x, x_step_q4,
-                filter_y, y_step_q4,
-                w, h);
-  vp9_convolve_avg(temp, 64,
-                   dst, dst_stride,
-                   NULL, 0, /* These unused parameter should be removed! */
-                   NULL, 0, /* These unused parameter should be removed! */
-                   w, h);
+  vp9_convolve8(src, src_stride, temp, 64,
+               filter_x, x_step_q4, filter_y, y_step_q4, w, h);
+  vp9_convolve_avg(temp, 64, dst, dst_stride, NULL, 0, NULL, 0, w, h);
 }
 
 void vp9_convolve_copy_c(const uint8_t *src, ptrdiff_t src_stride,
@@ -361,9 +319,9 @@
   int x, y;
 
   for (y = 0; y < h; ++y) {
-    for (x = 0; x < w; ++x) {
-      dst[x] = (dst[x] + src[x] + 1) >> 1;
-    }
+    for (x = 0; x < w; ++x)
+      dst[x] = ROUND_POWER_OF_TWO(dst[x] + src[x], 1);
+
     src += src_stride;
     dst += dst_stride;
   }