OLD | NEW |
(Empty) | |
| 1 /* |
| 2 * Copyright (c) 2015 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 "./vp9_rtcd.h" |
| 13 #include "./vpx_config.h" |
| 14 |
| 15 #include "vpx/vpx_integer.h" |
| 16 |
| 17 static INLINE unsigned int horizontal_add_u16x8(const uint16x8_t v_16x8) { |
| 18 const uint32x4_t a = vpaddlq_u16(v_16x8); |
| 19 const uint64x2_t b = vpaddlq_u32(a); |
| 20 const uint32x2_t c = vadd_u32(vreinterpret_u32_u64(vget_low_u64(b)), |
| 21 vreinterpret_u32_u64(vget_high_u64(b))); |
| 22 return vget_lane_u32(c, 0); |
| 23 } |
| 24 |
| 25 unsigned int vp9_avg_8x8_neon(const uint8_t *s, int p) { |
| 26 uint8x8_t v_s0 = vld1_u8(s); |
| 27 const uint8x8_t v_s1 = vld1_u8(s + p); |
| 28 uint16x8_t v_sum = vaddl_u8(v_s0, v_s1); |
| 29 |
| 30 v_s0 = vld1_u8(s + 2 * p); |
| 31 v_sum = vaddw_u8(v_sum, v_s0); |
| 32 |
| 33 v_s0 = vld1_u8(s + 3 * p); |
| 34 v_sum = vaddw_u8(v_sum, v_s0); |
| 35 |
| 36 v_s0 = vld1_u8(s + 4 * p); |
| 37 v_sum = vaddw_u8(v_sum, v_s0); |
| 38 |
| 39 v_s0 = vld1_u8(s + 5 * p); |
| 40 v_sum = vaddw_u8(v_sum, v_s0); |
| 41 |
| 42 v_s0 = vld1_u8(s + 6 * p); |
| 43 v_sum = vaddw_u8(v_sum, v_s0); |
| 44 |
| 45 v_s0 = vld1_u8(s + 7 * p); |
| 46 v_sum = vaddw_u8(v_sum, v_s0); |
| 47 |
| 48 return (horizontal_add_u16x8(v_sum) + 32) >> 6; |
| 49 } |
OLD | NEW |