1 /*
2 * Copyright (c) 2014 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 <arm_neon.h>
12
13 #include "./vpx_dsp_rtcd.h"
14 #include "vpx/vpx_integer.h"
15
vpx_convolve_copy_neon(const uint8_t * src,ptrdiff_t src_stride,uint8_t * dst,ptrdiff_t dst_stride,const int16_t * filter_x,int filter_x_stride,const int16_t * filter_y,int filter_y_stride,int w,int h)16 void vpx_convolve_copy_neon(
17 const uint8_t *src, // r0
18 ptrdiff_t src_stride, // r1
19 uint8_t *dst, // r2
20 ptrdiff_t dst_stride, // r3
21 const int16_t *filter_x,
22 int filter_x_stride,
23 const int16_t *filter_y,
24 int filter_y_stride,
25 int w,
26 int h) {
27 uint8x8_t d0u8, d2u8;
28 uint8x16_t q0u8, q1u8, q2u8, q3u8;
29 (void)filter_x; (void)filter_x_stride;
30 (void)filter_y; (void)filter_y_stride;
31
32 if (w > 32) { // copy64
33 for (; h > 0; h--) {
34 q0u8 = vld1q_u8(src);
35 q1u8 = vld1q_u8(src + 16);
36 q2u8 = vld1q_u8(src + 32);
37 q3u8 = vld1q_u8(src + 48);
38 src += src_stride;
39
40 vst1q_u8(dst, q0u8);
41 vst1q_u8(dst + 16, q1u8);
42 vst1q_u8(dst + 32, q2u8);
43 vst1q_u8(dst + 48, q3u8);
44 dst += dst_stride;
45 }
46 } else if (w == 32) { // copy32
47 for (; h > 0; h -= 2) {
48 q0u8 = vld1q_u8(src);
49 q1u8 = vld1q_u8(src + 16);
50 src += src_stride;
51 q2u8 = vld1q_u8(src);
52 q3u8 = vld1q_u8(src + 16);
53 src += src_stride;
54
55 vst1q_u8(dst, q0u8);
56 vst1q_u8(dst + 16, q1u8);
57 dst += dst_stride;
58 vst1q_u8(dst, q2u8);
59 vst1q_u8(dst + 16, q3u8);
60 dst += dst_stride;
61 }
62 } else if (w > 8) { // copy16
63 for (; h > 0; h -= 2) {
64 q0u8 = vld1q_u8(src);
65 src += src_stride;
66 q1u8 = vld1q_u8(src);
67 src += src_stride;
68
69 vst1q_u8(dst, q0u8);
70 dst += dst_stride;
71 vst1q_u8(dst, q1u8);
72 dst += dst_stride;
73 }
74 } else if (w == 8) { // copy8
75 for (; h > 0; h -= 2) {
76 d0u8 = vld1_u8(src);
77 src += src_stride;
78 d2u8 = vld1_u8(src);
79 src += src_stride;
80
81 vst1_u8(dst, d0u8);
82 dst += dst_stride;
83 vst1_u8(dst, d2u8);
84 dst += dst_stride;
85 }
86 } else { // copy4
87 for (; h > 0; h--) {
88 *(uint32_t *)dst = *(const uint32_t *)src;
89 src += src_stride;
90 dst += dst_stride;
91 }
92 }
93 return;
94 }
95