1 /*
2 * Copyright (c) 2023 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 #include <assert.h>
13
14 #include "./vpx_dsp_rtcd.h"
15 #include "./vpx_config.h"
16
vpx_highbd_comp_avg_pred_neon(uint16_t * comp_pred,const uint16_t * pred,int width,int height,const uint16_t * ref,int ref_stride)17 void vpx_highbd_comp_avg_pred_neon(uint16_t *comp_pred, const uint16_t *pred,
18 int width, int height, const uint16_t *ref,
19 int ref_stride) {
20 int i = height;
21 if (width > 8) {
22 do {
23 int j = 0;
24 do {
25 const uint16x8_t p = vld1q_u16(pred + j);
26 const uint16x8_t r = vld1q_u16(ref + j);
27
28 uint16x8_t avg = vrhaddq_u16(p, r);
29 vst1q_u16(comp_pred + j, avg);
30
31 j += 8;
32 } while (j < width);
33
34 comp_pred += width;
35 pred += width;
36 ref += ref_stride;
37 } while (--i != 0);
38 } else if (width == 8) {
39 do {
40 const uint16x8_t p = vld1q_u16(pred);
41 const uint16x8_t r = vld1q_u16(ref);
42
43 uint16x8_t avg = vrhaddq_u16(p, r);
44 vst1q_u16(comp_pred, avg);
45
46 comp_pred += width;
47 pred += width;
48 ref += ref_stride;
49 } while (--i != 0);
50 } else {
51 assert(width == 4);
52 do {
53 const uint16x4_t p = vld1_u16(pred);
54 const uint16x4_t r = vld1_u16(ref);
55
56 uint16x4_t avg = vrhadd_u16(p, r);
57 vst1_u16(comp_pred, avg);
58
59 comp_pred += width;
60 pred += width;
61 ref += ref_stride;
62 } while (--i != 0);
63 }
64 }
65