1 /*
2 * Copyright (c) 2023, Alliance for Open Media. All rights reserved
3 *
4 * This source code is subject to the terms of the BSD 2 Clause License and
5 * the Alliance for Open Media Patent License 1.0. If the BSD 2 Clause License
6 * was not distributed with this source code in the LICENSE file, you can
7 * obtain it at www.aomedia.org/license/software. If the Alliance for Open
8 * Media Patent License 1.0 was not distributed with this source code in the
9 * PATENTS file, you can obtain it at www.aomedia.org/license/patent.
10 */
11 #ifndef AOM_AV1_COMMON_ARM_HIGHBD_WARP_PLANE_NEON_H_
12 #define AOM_AV1_COMMON_ARM_HIGHBD_WARP_PLANE_NEON_H_
13
14 #include <arm_neon.h>
15 #include <assert.h>
16 #include <stdbool.h>
17
18 #include "aom_dsp/aom_dsp_common.h"
19 #include "aom_dsp/arm/mem_neon.h"
20 #include "aom_dsp/arm/sum_neon.h"
21 #include "aom_ports/mem.h"
22 #include "av1/common/scale.h"
23 #include "av1/common/warped_motion.h"
24 #include "config/av1_rtcd.h"
25
26 static AOM_FORCE_INLINE int16x8_t
27 highbd_horizontal_filter_4x1_f4(uint16x8x2_t in, int bd, int sx, int alpha);
28
29 static AOM_FORCE_INLINE int16x8_t
30 highbd_horizontal_filter_8x1_f8(uint16x8x2_t in, int bd, int sx, int alpha);
31
32 static AOM_FORCE_INLINE int16x8_t
33 highbd_horizontal_filter_4x1_f1(uint16x8x2_t in, int bd, int sx);
34
35 static AOM_FORCE_INLINE int16x8_t
36 highbd_horizontal_filter_8x1_f1(uint16x8x2_t in, int bd, int sx);
37
38 static AOM_FORCE_INLINE int32x4_t vertical_filter_4x1_f1(const int16x8_t *tmp,
39 int sy);
40
41 static AOM_FORCE_INLINE int32x4x2_t vertical_filter_8x1_f1(const int16x8_t *tmp,
42 int sy);
43
44 static AOM_FORCE_INLINE int32x4_t vertical_filter_4x1_f4(const int16x8_t *tmp,
45 int sy, int gamma);
46
47 static AOM_FORCE_INLINE int32x4x2_t vertical_filter_8x1_f8(const int16x8_t *tmp,
48 int sy, int gamma);
49
load_filters_1(int ofs)50 static AOM_FORCE_INLINE int16x8_t load_filters_1(int ofs) {
51 const int ofs0 = ROUND_POWER_OF_TWO(ofs, WARPEDDIFF_PREC_BITS);
52
53 const int16_t *base =
54 (int16_t *)av1_warped_filter + WARPEDPIXEL_PREC_SHIFTS * 8;
55 return vld1q_s16(base + ofs0 * 8);
56 }
57
load_filters_4(int16x8_t out[],int ofs,int stride)58 static AOM_FORCE_INLINE void load_filters_4(int16x8_t out[], int ofs,
59 int stride) {
60 const int ofs0 = ROUND_POWER_OF_TWO(ofs + stride * 0, WARPEDDIFF_PREC_BITS);
61 const int ofs1 = ROUND_POWER_OF_TWO(ofs + stride * 1, WARPEDDIFF_PREC_BITS);
62 const int ofs2 = ROUND_POWER_OF_TWO(ofs + stride * 2, WARPEDDIFF_PREC_BITS);
63 const int ofs3 = ROUND_POWER_OF_TWO(ofs + stride * 3, WARPEDDIFF_PREC_BITS);
64
65 const int16_t *base =
66 (int16_t *)av1_warped_filter + WARPEDPIXEL_PREC_SHIFTS * 8;
67 out[0] = vld1q_s16(base + ofs0 * 8);
68 out[1] = vld1q_s16(base + ofs1 * 8);
69 out[2] = vld1q_s16(base + ofs2 * 8);
70 out[3] = vld1q_s16(base + ofs3 * 8);
71 }
72
load_filters_8(int16x8_t out[],int ofs,int stride)73 static AOM_FORCE_INLINE void load_filters_8(int16x8_t out[], int ofs,
74 int stride) {
75 const int ofs0 = ROUND_POWER_OF_TWO(ofs + stride * 0, WARPEDDIFF_PREC_BITS);
76 const int ofs1 = ROUND_POWER_OF_TWO(ofs + stride * 1, WARPEDDIFF_PREC_BITS);
77 const int ofs2 = ROUND_POWER_OF_TWO(ofs + stride * 2, WARPEDDIFF_PREC_BITS);
78 const int ofs3 = ROUND_POWER_OF_TWO(ofs + stride * 3, WARPEDDIFF_PREC_BITS);
79 const int ofs4 = ROUND_POWER_OF_TWO(ofs + stride * 4, WARPEDDIFF_PREC_BITS);
80 const int ofs5 = ROUND_POWER_OF_TWO(ofs + stride * 5, WARPEDDIFF_PREC_BITS);
81 const int ofs6 = ROUND_POWER_OF_TWO(ofs + stride * 6, WARPEDDIFF_PREC_BITS);
82 const int ofs7 = ROUND_POWER_OF_TWO(ofs + stride * 7, WARPEDDIFF_PREC_BITS);
83
84 const int16_t *base =
85 (int16_t *)av1_warped_filter + WARPEDPIXEL_PREC_SHIFTS * 8;
86 out[0] = vld1q_s16(base + ofs0 * 8);
87 out[1] = vld1q_s16(base + ofs1 * 8);
88 out[2] = vld1q_s16(base + ofs2 * 8);
89 out[3] = vld1q_s16(base + ofs3 * 8);
90 out[4] = vld1q_s16(base + ofs4 * 8);
91 out[5] = vld1q_s16(base + ofs5 * 8);
92 out[6] = vld1q_s16(base + ofs6 * 8);
93 out[7] = vld1q_s16(base + ofs7 * 8);
94 }
95
clip_pixel_highbd_vec(int32x4_t val,int bd)96 static AOM_FORCE_INLINE uint16x4_t clip_pixel_highbd_vec(int32x4_t val,
97 int bd) {
98 const int limit = (1 << bd) - 1;
99 return vqmovun_s32(vminq_s32(val, vdupq_n_s32(limit)));
100 }
101
warp_affine_horizontal(const uint16_t * ref,int width,int height,int stride,int p_width,int16_t alpha,int16_t beta,int iy4,int sx4,int ix4,int16x8_t tmp[],int bd)102 static AOM_FORCE_INLINE void warp_affine_horizontal(const uint16_t *ref,
103 int width, int height,
104 int stride, int p_width,
105 int16_t alpha, int16_t beta,
106 int iy4, int sx4, int ix4,
107 int16x8_t tmp[], int bd) {
108 const int round0 = (bd == 12) ? ROUND0_BITS + 2 : ROUND0_BITS;
109
110 if (ix4 <= -7) {
111 for (int k = 0; k < 15; ++k) {
112 int iy = clamp(iy4 + k - 7, 0, height - 1);
113 int32_t dup_val = (1 << (bd + FILTER_BITS - round0 - 1)) +
114 ref[iy * stride] * (1 << (FILTER_BITS - round0));
115 tmp[k] = vdupq_n_s16(dup_val);
116 }
117 return;
118 } else if (ix4 >= width + 6) {
119 for (int k = 0; k < 15; ++k) {
120 int iy = clamp(iy4 + k - 7, 0, height - 1);
121 int32_t dup_val =
122 (1 << (bd + FILTER_BITS - round0 - 1)) +
123 ref[iy * stride + (width - 1)] * (1 << (FILTER_BITS - round0));
124 tmp[k] = vdupq_n_s16(dup_val);
125 }
126 return;
127 }
128
129 static const uint16_t kIotaArr[] = { 0, 1, 2, 3, 4, 5, 6, 7,
130 8, 9, 10, 11, 12, 13, 14, 15 };
131 const uint16x8_t indx0 = vld1q_u16(kIotaArr);
132 const uint16x8_t indx1 = vld1q_u16(kIotaArr + 8);
133
134 const int out_of_boundary_left = -(ix4 - 6);
135 const int out_of_boundary_right = (ix4 + 8) - width;
136
137 #define APPLY_HORIZONTAL_SHIFT(fn, ...) \
138 do { \
139 if (out_of_boundary_left >= 0 || out_of_boundary_right >= 0) { \
140 for (int k = 0; k < 15; ++k) { \
141 const int iy = clamp(iy4 + k - 7, 0, height - 1); \
142 uint16x8x2_t src_1 = vld1q_u16_x2(ref + iy * stride + ix4 - 7); \
143 \
144 if (out_of_boundary_left >= 0) { \
145 uint16x8_t cmp_vec = vdupq_n_u16(out_of_boundary_left); \
146 uint16x8_t vec_dup = vdupq_n_u16(ref[iy * stride]); \
147 uint16x8_t mask0 = vcleq_u16(indx0, cmp_vec); \
148 uint16x8_t mask1 = vcleq_u16(indx1, cmp_vec); \
149 src_1.val[0] = vbslq_u16(mask0, vec_dup, src_1.val[0]); \
150 src_1.val[1] = vbslq_u16(mask1, vec_dup, src_1.val[1]); \
151 } \
152 if (out_of_boundary_right >= 0) { \
153 uint16x8_t cmp_vec = vdupq_n_u16(15 - out_of_boundary_right); \
154 uint16x8_t vec_dup = vdupq_n_u16(ref[iy * stride + width - 1]); \
155 uint16x8_t mask0 = vcgeq_u16(indx0, cmp_vec); \
156 uint16x8_t mask1 = vcgeq_u16(indx1, cmp_vec); \
157 src_1.val[0] = vbslq_u16(mask0, vec_dup, src_1.val[0]); \
158 src_1.val[1] = vbslq_u16(mask1, vec_dup, src_1.val[1]); \
159 } \
160 tmp[k] = (fn)(src_1, __VA_ARGS__); \
161 } \
162 } else { \
163 for (int k = 0; k < 15; ++k) { \
164 const int iy = clamp(iy4 + k - 7, 0, height - 1); \
165 uint16x8x2_t src_1 = vld1q_u16_x2(ref + iy * stride + ix4 - 7); \
166 tmp[k] = (fn)(src_1, __VA_ARGS__); \
167 } \
168 } \
169 } while (0)
170
171 if (p_width == 4) {
172 if (beta == 0) {
173 if (alpha == 0) {
174 APPLY_HORIZONTAL_SHIFT(highbd_horizontal_filter_4x1_f1, bd, sx4);
175 } else {
176 APPLY_HORIZONTAL_SHIFT(highbd_horizontal_filter_4x1_f4, bd, sx4, alpha);
177 }
178 } else {
179 if (alpha == 0) {
180 APPLY_HORIZONTAL_SHIFT(highbd_horizontal_filter_4x1_f1, bd,
181 (sx4 + beta * (k - 3)));
182 } else {
183 APPLY_HORIZONTAL_SHIFT(highbd_horizontal_filter_4x1_f4, bd,
184 (sx4 + beta * (k - 3)), alpha);
185 }
186 }
187 } else {
188 if (beta == 0) {
189 if (alpha == 0) {
190 APPLY_HORIZONTAL_SHIFT(highbd_horizontal_filter_8x1_f1, bd, sx4);
191 } else {
192 APPLY_HORIZONTAL_SHIFT(highbd_horizontal_filter_8x1_f8, bd, sx4, alpha);
193 }
194 } else {
195 if (alpha == 0) {
196 APPLY_HORIZONTAL_SHIFT(highbd_horizontal_filter_8x1_f1, bd,
197 (sx4 + beta * (k - 3)));
198 } else {
199 APPLY_HORIZONTAL_SHIFT(highbd_horizontal_filter_8x1_f8, bd,
200 (sx4 + beta * (k - 3)), alpha);
201 }
202 }
203 }
204 }
205
highbd_vertical_filter_4x1_f4(uint16_t * pred,int p_stride,int bd,uint16_t * dst,int dst_stride,bool is_compound,bool do_average,bool use_dist_wtd_comp_avg,int fwd,int bwd,int16_t gamma,const int16x8_t * tmp,int i,int sy,int j)206 static AOM_FORCE_INLINE void highbd_vertical_filter_4x1_f4(
207 uint16_t *pred, int p_stride, int bd, uint16_t *dst, int dst_stride,
208 bool is_compound, bool do_average, bool use_dist_wtd_comp_avg, int fwd,
209 int bwd, int16_t gamma, const int16x8_t *tmp, int i, int sy, int j) {
210 int32x4_t sum0 = gamma == 0 ? vertical_filter_4x1_f1(tmp, sy)
211 : vertical_filter_4x1_f4(tmp, sy, gamma);
212
213 const int round0 = (bd == 12) ? ROUND0_BITS + 2 : ROUND0_BITS;
214 const int offset_bits_vert = bd + 2 * FILTER_BITS - round0;
215
216 sum0 = vaddq_s32(sum0, vdupq_n_s32(1 << offset_bits_vert));
217
218 uint16_t *dst16 = &pred[i * p_stride + j];
219
220 if (!is_compound) {
221 const int reduce_bits_vert = 2 * FILTER_BITS - round0;
222 sum0 = vrshlq_s32(sum0, vdupq_n_s32(-reduce_bits_vert));
223
224 const int res_sub_const = (1 << (bd - 1)) + (1 << bd);
225 sum0 = vsubq_s32(sum0, vdupq_n_s32(res_sub_const));
226 uint16x4_t res0 = clip_pixel_highbd_vec(sum0, bd);
227 vst1_u16(dst16, res0);
228 return;
229 }
230
231 sum0 = vrshrq_n_s32(sum0, COMPOUND_ROUND1_BITS);
232
233 uint16_t *p = &dst[i * dst_stride + j];
234
235 if (!do_average) {
236 vst1_u16(p, vqmovun_s32(sum0));
237 return;
238 }
239
240 uint16x4_t p0 = vld1_u16(p);
241 int32x4_t p_vec0 = vreinterpretq_s32_u32(vmovl_u16(p0));
242 if (use_dist_wtd_comp_avg) {
243 p_vec0 = vmulq_n_s32(p_vec0, fwd);
244 p_vec0 = vmlaq_n_s32(p_vec0, sum0, bwd);
245 p_vec0 = vshrq_n_s32(p_vec0, DIST_PRECISION_BITS);
246 } else {
247 p_vec0 = vhaddq_s32(p_vec0, sum0);
248 }
249
250 const int offset_bits = bd + 2 * FILTER_BITS - round0;
251 const int round1 = COMPOUND_ROUND1_BITS;
252 const int res_sub_const =
253 (1 << (offset_bits - round1)) + (1 << (offset_bits - round1 - 1));
254 const int round_bits = 2 * FILTER_BITS - round0 - round1;
255
256 p_vec0 = vsubq_s32(p_vec0, vdupq_n_s32(res_sub_const));
257 p_vec0 = vrshlq_s32(p_vec0, vdupq_n_s32(-round_bits));
258 uint16x4_t res0 = clip_pixel_highbd_vec(p_vec0, bd);
259 vst1_u16(dst16, res0);
260 }
261
highbd_vertical_filter_8x1_f8(uint16_t * pred,int p_stride,int bd,uint16_t * dst,int dst_stride,bool is_compound,bool do_average,bool use_dist_wtd_comp_avg,int fwd,int bwd,int16_t gamma,const int16x8_t * tmp,int i,int sy,int j)262 static AOM_FORCE_INLINE void highbd_vertical_filter_8x1_f8(
263 uint16_t *pred, int p_stride, int bd, uint16_t *dst, int dst_stride,
264 bool is_compound, bool do_average, bool use_dist_wtd_comp_avg, int fwd,
265 int bwd, int16_t gamma, const int16x8_t *tmp, int i, int sy, int j) {
266 int32x4x2_t sums = gamma == 0 ? vertical_filter_8x1_f1(tmp, sy)
267 : vertical_filter_8x1_f8(tmp, sy, gamma);
268 int32x4_t sum0 = sums.val[0];
269 int32x4_t sum1 = sums.val[1];
270
271 const int round0 = (bd == 12) ? ROUND0_BITS + 2 : ROUND0_BITS;
272 const int offset_bits_vert = bd + 2 * FILTER_BITS - round0;
273
274 sum0 = vaddq_s32(sum0, vdupq_n_s32(1 << offset_bits_vert));
275 sum1 = vaddq_s32(sum1, vdupq_n_s32(1 << offset_bits_vert));
276
277 uint16_t *dst16 = &pred[i * p_stride + j];
278
279 if (!is_compound) {
280 const int reduce_bits_vert = 2 * FILTER_BITS - round0;
281 sum0 = vrshlq_s32(sum0, vdupq_n_s32(-reduce_bits_vert));
282 sum1 = vrshlq_s32(sum1, vdupq_n_s32(-reduce_bits_vert));
283
284 const int res_sub_const = (1 << (bd - 1)) + (1 << bd);
285 sum0 = vsubq_s32(sum0, vdupq_n_s32(res_sub_const));
286 sum1 = vsubq_s32(sum1, vdupq_n_s32(res_sub_const));
287 uint16x4_t res0 = clip_pixel_highbd_vec(sum0, bd);
288 uint16x4_t res1 = clip_pixel_highbd_vec(sum1, bd);
289 vst1_u16(dst16, res0);
290 vst1_u16(dst16 + 4, res1);
291 return;
292 }
293
294 sum0 = vrshrq_n_s32(sum0, COMPOUND_ROUND1_BITS);
295 sum1 = vrshrq_n_s32(sum1, COMPOUND_ROUND1_BITS);
296
297 uint16_t *p = &dst[i * dst_stride + j];
298
299 if (!do_average) {
300 vst1_u16(p, vqmovun_s32(sum0));
301 vst1_u16(p + 4, vqmovun_s32(sum1));
302 return;
303 }
304
305 uint16x8_t p0 = vld1q_u16(p);
306 int32x4_t p_vec0 = vreinterpretq_s32_u32(vmovl_u16(vget_low_u16(p0)));
307 int32x4_t p_vec1 = vreinterpretq_s32_u32(vmovl_u16(vget_high_u16(p0)));
308 if (use_dist_wtd_comp_avg) {
309 p_vec0 = vmulq_n_s32(p_vec0, fwd);
310 p_vec1 = vmulq_n_s32(p_vec1, fwd);
311 p_vec0 = vmlaq_n_s32(p_vec0, sum0, bwd);
312 p_vec1 = vmlaq_n_s32(p_vec1, sum1, bwd);
313 p_vec0 = vshrq_n_s32(p_vec0, DIST_PRECISION_BITS);
314 p_vec1 = vshrq_n_s32(p_vec1, DIST_PRECISION_BITS);
315 } else {
316 p_vec0 = vhaddq_s32(p_vec0, sum0);
317 p_vec1 = vhaddq_s32(p_vec1, sum1);
318 }
319
320 const int offset_bits = bd + 2 * FILTER_BITS - round0;
321 const int round1 = COMPOUND_ROUND1_BITS;
322 const int res_sub_const =
323 (1 << (offset_bits - round1)) + (1 << (offset_bits - round1 - 1));
324 const int round_bits = 2 * FILTER_BITS - round0 - round1;
325
326 p_vec0 = vsubq_s32(p_vec0, vdupq_n_s32(res_sub_const));
327 p_vec1 = vsubq_s32(p_vec1, vdupq_n_s32(res_sub_const));
328
329 p_vec0 = vrshlq_s32(p_vec0, vdupq_n_s32(-round_bits));
330 p_vec1 = vrshlq_s32(p_vec1, vdupq_n_s32(-round_bits));
331 uint16x4_t res0 = clip_pixel_highbd_vec(p_vec0, bd);
332 uint16x4_t res1 = clip_pixel_highbd_vec(p_vec1, bd);
333 vst1_u16(dst16, res0);
334 vst1_u16(dst16 + 4, res1);
335 }
336
warp_affine_vertical(uint16_t * pred,int p_width,int p_height,int p_stride,int bd,uint16_t * dst,int dst_stride,bool is_compound,bool do_average,bool use_dist_wtd_comp_avg,int fwd,int bwd,int16_t gamma,int16_t delta,const int16x8_t * tmp,int i,int sy4,int j)337 static AOM_FORCE_INLINE void warp_affine_vertical(
338 uint16_t *pred, int p_width, int p_height, int p_stride, int bd,
339 uint16_t *dst, int dst_stride, bool is_compound, bool do_average,
340 bool use_dist_wtd_comp_avg, int fwd, int bwd, int16_t gamma, int16_t delta,
341 const int16x8_t *tmp, int i, int sy4, int j) {
342 int limit_height = p_height > 4 ? 8 : 4;
343
344 if (p_width > 4) {
345 // p_width == 8
346 for (int k = 0; k < limit_height; ++k) {
347 int sy = sy4 + delta * k;
348 highbd_vertical_filter_8x1_f8(
349 pred, p_stride, bd, dst, dst_stride, is_compound, do_average,
350 use_dist_wtd_comp_avg, fwd, bwd, gamma, tmp + k, i + k, sy, j);
351 }
352 } else {
353 // p_width == 4
354 for (int k = 0; k < limit_height; ++k) {
355 int sy = sy4 + delta * k;
356 highbd_vertical_filter_4x1_f4(
357 pred, p_stride, bd, dst, dst_stride, is_compound, do_average,
358 use_dist_wtd_comp_avg, fwd, bwd, gamma, tmp + k, i + k, sy, j);
359 }
360 }
361 }
362
highbd_warp_affine_common(const int32_t * mat,const uint16_t * ref,int width,int height,int stride,uint16_t * pred,int p_col,int p_row,int p_width,int p_height,int p_stride,int subsampling_x,int subsampling_y,int bd,ConvolveParams * conv_params,int16_t alpha,int16_t beta,int16_t gamma,int16_t delta)363 static AOM_FORCE_INLINE void highbd_warp_affine_common(
364 const int32_t *mat, const uint16_t *ref, int width, int height, int stride,
365 uint16_t *pred, int p_col, int p_row, int p_width, int p_height,
366 int p_stride, int subsampling_x, int subsampling_y, int bd,
367 ConvolveParams *conv_params, int16_t alpha, int16_t beta, int16_t gamma,
368 int16_t delta) {
369 uint16_t *const dst = conv_params->dst;
370 const int dst_stride = conv_params->dst_stride;
371 const bool is_compound = conv_params->is_compound;
372 const bool do_average = conv_params->do_average;
373 const bool use_dist_wtd_comp_avg = conv_params->use_dist_wtd_comp_avg;
374 const int fwd = conv_params->fwd_offset;
375 const int bwd = conv_params->bck_offset;
376
377 assert(IMPLIES(is_compound, dst != NULL));
378
379 for (int i = 0; i < p_height; i += 8) {
380 for (int j = 0; j < p_width; j += 8) {
381 // Calculate the center of this 8x8 block,
382 // project to luma coordinates (if in a subsampled chroma plane),
383 // apply the affine transformation,
384 // then convert back to the original coordinates (if necessary)
385 const int32_t src_x = (j + 4 + p_col) << subsampling_x;
386 const int32_t src_y = (i + 4 + p_row) << subsampling_y;
387 const int64_t dst_x =
388 (int64_t)mat[2] * src_x + (int64_t)mat[3] * src_y + (int64_t)mat[0];
389 const int64_t dst_y =
390 (int64_t)mat[4] * src_x + (int64_t)mat[5] * src_y + (int64_t)mat[1];
391 const int64_t x4 = dst_x >> subsampling_x;
392 const int64_t y4 = dst_y >> subsampling_y;
393
394 const int32_t ix4 = (int32_t)(x4 >> WARPEDMODEL_PREC_BITS);
395 int32_t sx4 = x4 & ((1 << WARPEDMODEL_PREC_BITS) - 1);
396 const int32_t iy4 = (int32_t)(y4 >> WARPEDMODEL_PREC_BITS);
397 int32_t sy4 = y4 & ((1 << WARPEDMODEL_PREC_BITS) - 1);
398
399 sx4 += alpha * (-4) + beta * (-4);
400 sy4 += gamma * (-4) + delta * (-4);
401
402 sx4 &= ~((1 << WARP_PARAM_REDUCE_BITS) - 1);
403 sy4 &= ~((1 << WARP_PARAM_REDUCE_BITS) - 1);
404
405 // Each horizontal filter result is formed by the sum of up to eight
406 // multiplications by filter values and then a shift. Although both the
407 // inputs and filters are loaded as int16, the input data is at most bd
408 // bits and the filters are at most 8 bits each. Additionally since we
409 // know all possible filter values we know that the sum of absolute
410 // filter values will fit in at most 9 bits. With this in mind we can
411 // conclude that the sum of each filter application will fit in bd + 9
412 // bits. The shift following the summation is ROUND0_BITS (which is 3),
413 // +2 for 12-bit, which gives us a final storage of:
414 // bd == 8: ( 8 + 9) - 3 => 14 bits
415 // bd == 10: (10 + 9) - 3 => 16 bits
416 // bd == 12: (12 + 9) - 5 => 16 bits
417 // So it is safe to use int16x8_t as the intermediate storage type here.
418 int16x8_t tmp[15];
419
420 warp_affine_horizontal(ref, width, height, stride, p_width, alpha, beta,
421 iy4, sx4, ix4, tmp, bd);
422 warp_affine_vertical(pred, p_width, p_height, p_stride, bd, dst,
423 dst_stride, is_compound, do_average,
424 use_dist_wtd_comp_avg, fwd, bwd, gamma, delta, tmp,
425 i, sy4, j);
426 }
427 }
428 }
429
430 #endif // AOM_AV1_COMMON_ARM_HIGHBD_WARP_PLANE_NEON_H_
431