• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  *  Copyright (c) 2019, Alliance for Open Media. 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 "config/aom_dsp_rtcd.h"
12 #include "config/aom_config.h"
13 
14 #include "aom/aom_integer.h"
15 #include "aom_ports/mem.h"
16 
horizontal_add_s16x8(const int16x8_t v_16x8)17 static INLINE int horizontal_add_s16x8(const int16x8_t v_16x8) {
18   const int32x4_t a = vpaddlq_s16(v_16x8);
19   const int64x2_t b = vpaddlq_s32(a);
20   const int32x2_t c = vadd_s32(vreinterpret_s32_s64(vget_low_s64(b)),
21                                vreinterpret_s32_s64(vget_high_s64(b)));
22   return vget_lane_s32(c, 0);
23 }
24 
horizontal_add_s32x4(const int32x4_t v_32x4)25 static INLINE int horizontal_add_s32x4(const int32x4_t v_32x4) {
26   const int64x2_t b = vpaddlq_s32(v_32x4);
27   const int32x2_t c = vadd_s32(vreinterpret_s32_s64(vget_low_s64(b)),
28                                vreinterpret_s32_s64(vget_high_s64(b)));
29   return vget_lane_s32(c, 0);
30 }
31 
horizontal_add_u16x8(const uint16x8_t a)32 static INLINE uint32x2_t horizontal_add_u16x8(const uint16x8_t a) {
33   const uint32x4_t b = vpaddlq_u16(a);
34   const uint64x2_t c = vpaddlq_u32(b);
35   return vadd_u32(vreinterpret_u32_u64(vget_low_u64(c)),
36                   vreinterpret_u32_u64(vget_high_u64(c)));
37 }
38