Thu, 22 Jan 2015 13:21:57 +0100
Incorporate requested changes from Mozilla in review:
https://bugzilla.mozilla.org/show_bug.cgi?id=1123480#c6
michael@0 | 1 | /* |
michael@0 | 2 | * Copyright (c) 2013 The WebM project authors. All Rights Reserved. |
michael@0 | 3 | * |
michael@0 | 4 | * Use of this source code is governed by a BSD-style license |
michael@0 | 5 | * that can be found in the LICENSE file in the root of the source |
michael@0 | 6 | * tree. An additional intellectual property rights grant can be found |
michael@0 | 7 | * in the file PATENTS. All contributing project authors may |
michael@0 | 8 | * be found in the AUTHORS file in the root of the source tree. |
michael@0 | 9 | */ |
michael@0 | 10 | |
michael@0 | 11 | #include "./vp9_rtcd.h" |
michael@0 | 12 | #include "vp9/common/vp9_common.h" |
michael@0 | 13 | #include "vpx_ports/mem.h" |
michael@0 | 14 | |
michael@0 | 15 | void vp9_convolve8_neon(const uint8_t *src, ptrdiff_t src_stride, |
michael@0 | 16 | uint8_t *dst, ptrdiff_t dst_stride, |
michael@0 | 17 | const int16_t *filter_x, int x_step_q4, |
michael@0 | 18 | const int16_t *filter_y, int y_step_q4, |
michael@0 | 19 | int w, int h) { |
michael@0 | 20 | /* Given our constraints: w <= 64, h <= 64, taps == 8 we can reduce the |
michael@0 | 21 | * maximum buffer size to 64 * 64 + 7 (+ 1 to make it divisible by 4). |
michael@0 | 22 | */ |
michael@0 | 23 | DECLARE_ALIGNED_ARRAY(8, uint8_t, temp, 64 * 72); |
michael@0 | 24 | |
michael@0 | 25 | // Account for the vertical phase needing 3 lines prior and 4 lines post |
michael@0 | 26 | int intermediate_height = h + 7; |
michael@0 | 27 | |
michael@0 | 28 | if (x_step_q4 != 16 || y_step_q4 != 16) |
michael@0 | 29 | return vp9_convolve8_c(src, src_stride, |
michael@0 | 30 | dst, dst_stride, |
michael@0 | 31 | filter_x, x_step_q4, |
michael@0 | 32 | filter_y, y_step_q4, |
michael@0 | 33 | w, h); |
michael@0 | 34 | |
michael@0 | 35 | /* Filter starting 3 lines back. The neon implementation will ignore the |
michael@0 | 36 | * given height and filter a multiple of 4 lines. Since this goes in to |
michael@0 | 37 | * the temp buffer which has lots of extra room and is subsequently discarded |
michael@0 | 38 | * this is safe if somewhat less than ideal. |
michael@0 | 39 | */ |
michael@0 | 40 | vp9_convolve8_horiz_neon(src - src_stride * 3, src_stride, |
michael@0 | 41 | temp, 64, |
michael@0 | 42 | filter_x, x_step_q4, filter_y, y_step_q4, |
michael@0 | 43 | w, intermediate_height); |
michael@0 | 44 | |
michael@0 | 45 | /* Step into the temp buffer 3 lines to get the actual frame data */ |
michael@0 | 46 | vp9_convolve8_vert_neon(temp + 64 * 3, 64, |
michael@0 | 47 | dst, dst_stride, |
michael@0 | 48 | filter_x, x_step_q4, filter_y, y_step_q4, |
michael@0 | 49 | w, h); |
michael@0 | 50 | } |
michael@0 | 51 | |
michael@0 | 52 | void vp9_convolve8_avg_neon(const uint8_t *src, ptrdiff_t src_stride, |
michael@0 | 53 | uint8_t *dst, ptrdiff_t dst_stride, |
michael@0 | 54 | const int16_t *filter_x, int x_step_q4, |
michael@0 | 55 | const int16_t *filter_y, int y_step_q4, |
michael@0 | 56 | int w, int h) { |
michael@0 | 57 | DECLARE_ALIGNED_ARRAY(8, uint8_t, temp, 64 * 72); |
michael@0 | 58 | int intermediate_height = h + 7; |
michael@0 | 59 | |
michael@0 | 60 | if (x_step_q4 != 16 || y_step_q4 != 16) |
michael@0 | 61 | return vp9_convolve8_avg_c(src, src_stride, |
michael@0 | 62 | dst, dst_stride, |
michael@0 | 63 | filter_x, x_step_q4, |
michael@0 | 64 | filter_y, y_step_q4, |
michael@0 | 65 | w, h); |
michael@0 | 66 | |
michael@0 | 67 | /* This implementation has the same issues as above. In addition, we only want |
michael@0 | 68 | * to average the values after both passes. |
michael@0 | 69 | */ |
michael@0 | 70 | vp9_convolve8_horiz_neon(src - src_stride * 3, src_stride, |
michael@0 | 71 | temp, 64, |
michael@0 | 72 | filter_x, x_step_q4, filter_y, y_step_q4, |
michael@0 | 73 | w, intermediate_height); |
michael@0 | 74 | vp9_convolve8_avg_vert_neon(temp + 64 * 3, |
michael@0 | 75 | 64, dst, dst_stride, |
michael@0 | 76 | filter_x, x_step_q4, filter_y, y_step_q4, |
michael@0 | 77 | w, h); |
michael@0 | 78 | } |