OLD | NEW |
1 /* | 1 /* |
2 * Copyright (c) 2014 The WebRTC project authors. All Rights Reserved. | 2 * Copyright (c) 2014 The WebRTC project authors. All Rights Reserved. |
3 * | 3 * |
4 * Use of this source code is governed by a BSD-style license | 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 | 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 | 6 * tree. An additional intellectual property rights grant can be found |
7 * in the file PATENTS. All contributing project authors may | 7 * in the file PATENTS. All contributing project authors may |
8 * be found in the AUTHORS file in the root of the source tree. | 8 * be found in the AUTHORS file in the root of the source tree. |
9 */ | 9 */ |
10 | 10 |
11 #include <arm_neon.h> | 11 #include <arm_neon.h> |
12 #include <assert.h> | |
13 | 12 |
| 13 #include "webrtc/base/checks.h" |
14 #include "webrtc/modules/audio_coding/codecs/isac/fix/source/codec.h" | 14 #include "webrtc/modules/audio_coding/codecs/isac/fix/source/codec.h" |
15 | 15 |
16 // Autocorrelation function in fixed point. | 16 // Autocorrelation function in fixed point. |
17 // NOTE! Different from SPLIB-version in how it scales the signal. | 17 // NOTE! Different from SPLIB-version in how it scales the signal. |
18 int WebRtcIsacfix_AutocorrNeon(int32_t* __restrict r, | 18 int WebRtcIsacfix_AutocorrNeon(int32_t* __restrict r, |
19 const int16_t* x, | 19 const int16_t* x, |
20 int16_t n, | 20 int16_t n, |
21 int16_t order, | 21 int16_t order, |
22 int16_t* __restrict scale) { | 22 int16_t* __restrict scale) { |
23 int i = 0; | 23 int i = 0; |
24 int16_t scaling = 0; | 24 int16_t scaling = 0; |
25 uint32_t temp = 0; | 25 uint32_t temp = 0; |
26 int64_t prod = 0; | 26 int64_t prod = 0; |
27 int64_t prod_tail = 0; | 27 int64_t prod_tail = 0; |
28 | 28 |
29 assert(n % 4 == 0); | 29 RTC_DCHECK_EQ(0, n % 4); |
30 assert(n >= 8); | 30 RTC_DCHECK_GE(n, 8); |
31 | 31 |
32 // Calculate r[0]. | 32 // Calculate r[0]. |
33 int16x4_t x0_v; | 33 int16x4_t x0_v; |
34 int32x4_t tmpa0_v; | 34 int32x4_t tmpa0_v; |
35 int64x2_t tmpb_v; | 35 int64x2_t tmpb_v; |
36 | 36 |
37 tmpb_v = vdupq_n_s64(0); | 37 tmpb_v = vdupq_n_s64(0); |
38 const int16_t* x_start = x; | 38 const int16_t* x_start = x; |
39 const int16_t* x_end0 = x_start + n; | 39 const int16_t* x_end0 = x_start + n; |
40 while (x_start < x_end0) { | 40 while (x_start < x_end0) { |
(...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
105 } | 105 } |
106 | 106 |
107 r[i] = (int32_t)((prod + prod_tail) >> scaling); | 107 r[i] = (int32_t)((prod + prod_tail) >> scaling); |
108 } | 108 } |
109 | 109 |
110 *scale = scaling; | 110 *scale = scaling; |
111 | 111 |
112 return order + 1; | 112 return order + 1; |
113 } | 113 } |
114 | 114 |
OLD | NEW |