Home | History | Annotate | Download | only in arm
      1 /*
      2  *  Copyright (c) 2013 The WebM project authors. All Rights Reserved.
      3  *
      4  *  Use of this source code is governed by a BSD-style license
      5  *  that can be found in the LICENSE file in the root of the source
      6  *  tree. An additional intellectual property rights grant can be found
      7  *  in the file PATENTS.  All contributing project authors may
      8  *  be found in the AUTHORS file in the root of the source tree.
      9  */
     10 
     11 #include <assert.h>
     12 
     13 #include "./vpx_dsp_rtcd.h"
     14 #include "vpx_dsp/vpx_dsp_common.h"
     15 #include "vpx_ports/mem.h"
     16 
     17 void vpx_convolve8_neon(const uint8_t *src, ptrdiff_t src_stride, uint8_t *dst,
     18                         ptrdiff_t dst_stride, const int16_t *filter_x,
     19                         int x_step_q4, const int16_t *filter_y, int y_step_q4,
     20                         int w, int h) {
     21   /* Given our constraints: w <= 64, h <= 64, taps == 8 we can reduce the
     22    * maximum buffer size to 64 * 64 + 7 (+ 1 to make it divisible by 4).
     23    */
     24   DECLARE_ALIGNED(8, uint8_t, temp[64 * 72]);
     25 
     26   // Account for the vertical phase needing 3 lines prior and 4 lines post
     27   const int intermediate_height = h + 7;
     28 
     29   assert(y_step_q4 == 16);
     30   assert(x_step_q4 == 16);
     31 
     32   /* Filter starting 3 lines back. The neon implementation will ignore the given
     33    * height and filter a multiple of 4 lines. Since this goes in to the temp
     34    * buffer which has lots of extra room and is subsequently discarded this is
     35    * safe if somewhat less than ideal.   */
     36   vpx_convolve8_horiz_neon(src - src_stride * 3, src_stride, temp, w, filter_x,
     37                            x_step_q4, filter_y, y_step_q4, w,
     38                            intermediate_height);
     39 
     40   /* Step into the temp buffer 3 lines to get the actual frame data */
     41   vpx_convolve8_vert_neon(temp + w * 3, w, dst, dst_stride, filter_x, x_step_q4,
     42                           filter_y, y_step_q4, w, h);
     43 }
     44 
     45 void vpx_convolve8_avg_neon(const uint8_t *src, ptrdiff_t src_stride,
     46                             uint8_t *dst, ptrdiff_t dst_stride,
     47                             const int16_t *filter_x, int x_step_q4,
     48                             const int16_t *filter_y, int y_step_q4, int w,
     49                             int h) {
     50   DECLARE_ALIGNED(8, uint8_t, temp[64 * 72]);
     51   const int intermediate_height = h + 7;
     52 
     53   assert(y_step_q4 == 16);
     54   assert(x_step_q4 == 16);
     55 
     56   /* This implementation has the same issues as above. In addition, we only want
     57    * to average the values after both passes.
     58    */
     59   vpx_convolve8_horiz_neon(src - src_stride * 3, src_stride, temp, w, filter_x,
     60                            x_step_q4, filter_y, y_step_q4, w,
     61                            intermediate_height);
     62   vpx_convolve8_avg_vert_neon(temp + w * 3, w, dst, dst_stride, filter_x,
     63                               x_step_q4, filter_y, y_step_q4, w, h);
     64 }
     65