OLD | NEW |
1 /* | 1 /* |
2 * Copyright (c) 2012 The WebRTC project authors. All Rights Reserved. | 2 * Copyright (c) 2012 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 |
(...skipping 88 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
99 #endif | 99 #endif |
100 | 100 |
101 #define WEBRTC_SPL_MEMCPY_W16(v1, v2, length) \ | 101 #define WEBRTC_SPL_MEMCPY_W16(v1, v2, length) \ |
102 memcpy(v1, v2, (length) * sizeof(int16_t)) | 102 memcpy(v1, v2, (length) * sizeof(int16_t)) |
103 | 103 |
104 // inline functions: | 104 // inline functions: |
105 #include "webrtc/common_audio/signal_processing/include/spl_inl.h" | 105 #include "webrtc/common_audio/signal_processing/include/spl_inl.h" |
106 | 106 |
107 // Initialize SPL. Currently it contains only function pointer initialization. | 107 // Initialize SPL. Currently it contains only function pointer initialization. |
108 // If the underlying platform is known to be ARM-Neon (WEBRTC_HAS_NEON defined), | 108 // If the underlying platform is known to be ARM-Neon (WEBRTC_HAS_NEON defined), |
109 // the pointers will be assigned to code optimized for Neon; otherwise | 109 // the pointers will be assigned to code optimized for Neon; otherwise, generic |
110 // if run-time Neon detection (WEBRTC_DETECT_NEON) is enabled, the pointers | 110 // C code will be assigned. |
111 // will be assigned to either Neon code or generic C code; otherwise, generic C | |
112 // code will be assigned. | |
113 // Note that this function MUST be called in any application that uses SPL | 111 // Note that this function MUST be called in any application that uses SPL |
114 // functions. | 112 // functions. |
115 void WebRtcSpl_Init(); | 113 void WebRtcSpl_Init(); |
116 | 114 |
117 int16_t WebRtcSpl_GetScalingSquare(int16_t* in_vector, | 115 int16_t WebRtcSpl_GetScalingSquare(int16_t* in_vector, |
118 size_t in_vector_length, | 116 size_t in_vector_length, |
119 size_t times); | 117 size_t times); |
120 | 118 |
121 // Copy and set operations. Implementation in copy_set_operations.c. | 119 // Copy and set operations. Implementation in copy_set_operations.c. |
122 // Descriptions at bottom of file. | 120 // Descriptions at bottom of file. |
(...skipping 23 matching lines...) Expand all Loading... |
146 // Returns the largest absolute value in a signed 16-bit vector. | 144 // Returns the largest absolute value in a signed 16-bit vector. |
147 // | 145 // |
148 // Input: | 146 // Input: |
149 // - vector : 16-bit input vector. | 147 // - vector : 16-bit input vector. |
150 // - length : Number of samples in vector. | 148 // - length : Number of samples in vector. |
151 // | 149 // |
152 // Return value : Maximum absolute value in vector. | 150 // Return value : Maximum absolute value in vector. |
153 typedef int16_t (*MaxAbsValueW16)(const int16_t* vector, size_t length); | 151 typedef int16_t (*MaxAbsValueW16)(const int16_t* vector, size_t length); |
154 extern MaxAbsValueW16 WebRtcSpl_MaxAbsValueW16; | 152 extern MaxAbsValueW16 WebRtcSpl_MaxAbsValueW16; |
155 int16_t WebRtcSpl_MaxAbsValueW16C(const int16_t* vector, size_t length); | 153 int16_t WebRtcSpl_MaxAbsValueW16C(const int16_t* vector, size_t length); |
156 #if (defined WEBRTC_DETECT_NEON) || (defined WEBRTC_HAS_NEON) | 154 #if defined(WEBRTC_HAS_NEON) |
157 int16_t WebRtcSpl_MaxAbsValueW16Neon(const int16_t* vector, size_t length); | 155 int16_t WebRtcSpl_MaxAbsValueW16Neon(const int16_t* vector, size_t length); |
158 #endif | 156 #endif |
159 #if defined(MIPS32_LE) | 157 #if defined(MIPS32_LE) |
160 int16_t WebRtcSpl_MaxAbsValueW16_mips(const int16_t* vector, size_t length); | 158 int16_t WebRtcSpl_MaxAbsValueW16_mips(const int16_t* vector, size_t length); |
161 #endif | 159 #endif |
162 | 160 |
163 // Returns the largest absolute value in a signed 32-bit vector. | 161 // Returns the largest absolute value in a signed 32-bit vector. |
164 // | 162 // |
165 // Input: | 163 // Input: |
166 // - vector : 32-bit input vector. | 164 // - vector : 32-bit input vector. |
167 // - length : Number of samples in vector. | 165 // - length : Number of samples in vector. |
168 // | 166 // |
169 // Return value : Maximum absolute value in vector. | 167 // Return value : Maximum absolute value in vector. |
170 typedef int32_t (*MaxAbsValueW32)(const int32_t* vector, size_t length); | 168 typedef int32_t (*MaxAbsValueW32)(const int32_t* vector, size_t length); |
171 extern MaxAbsValueW32 WebRtcSpl_MaxAbsValueW32; | 169 extern MaxAbsValueW32 WebRtcSpl_MaxAbsValueW32; |
172 int32_t WebRtcSpl_MaxAbsValueW32C(const int32_t* vector, size_t length); | 170 int32_t WebRtcSpl_MaxAbsValueW32C(const int32_t* vector, size_t length); |
173 #if (defined WEBRTC_DETECT_NEON) || (defined WEBRTC_HAS_NEON) | 171 #if defined(WEBRTC_HAS_NEON) |
174 int32_t WebRtcSpl_MaxAbsValueW32Neon(const int32_t* vector, size_t length); | 172 int32_t WebRtcSpl_MaxAbsValueW32Neon(const int32_t* vector, size_t length); |
175 #endif | 173 #endif |
176 #if defined(MIPS_DSP_R1_LE) | 174 #if defined(MIPS_DSP_R1_LE) |
177 int32_t WebRtcSpl_MaxAbsValueW32_mips(const int32_t* vector, size_t length); | 175 int32_t WebRtcSpl_MaxAbsValueW32_mips(const int32_t* vector, size_t length); |
178 #endif | 176 #endif |
179 | 177 |
180 // Returns the maximum value of a 16-bit vector. | 178 // Returns the maximum value of a 16-bit vector. |
181 // | 179 // |
182 // Input: | 180 // Input: |
183 // - vector : 16-bit input vector. | 181 // - vector : 16-bit input vector. |
184 // - length : Number of samples in vector. | 182 // - length : Number of samples in vector. |
185 // | 183 // |
186 // Return value : Maximum sample value in |vector|. | 184 // Return value : Maximum sample value in |vector|. |
187 typedef int16_t (*MaxValueW16)(const int16_t* vector, size_t length); | 185 typedef int16_t (*MaxValueW16)(const int16_t* vector, size_t length); |
188 extern MaxValueW16 WebRtcSpl_MaxValueW16; | 186 extern MaxValueW16 WebRtcSpl_MaxValueW16; |
189 int16_t WebRtcSpl_MaxValueW16C(const int16_t* vector, size_t length); | 187 int16_t WebRtcSpl_MaxValueW16C(const int16_t* vector, size_t length); |
190 #if (defined WEBRTC_DETECT_NEON) || (defined WEBRTC_HAS_NEON) | 188 #if defined(WEBRTC_HAS_NEON) |
191 int16_t WebRtcSpl_MaxValueW16Neon(const int16_t* vector, size_t length); | 189 int16_t WebRtcSpl_MaxValueW16Neon(const int16_t* vector, size_t length); |
192 #endif | 190 #endif |
193 #if defined(MIPS32_LE) | 191 #if defined(MIPS32_LE) |
194 int16_t WebRtcSpl_MaxValueW16_mips(const int16_t* vector, size_t length); | 192 int16_t WebRtcSpl_MaxValueW16_mips(const int16_t* vector, size_t length); |
195 #endif | 193 #endif |
196 | 194 |
197 // Returns the maximum value of a 32-bit vector. | 195 // Returns the maximum value of a 32-bit vector. |
198 // | 196 // |
199 // Input: | 197 // Input: |
200 // - vector : 32-bit input vector. | 198 // - vector : 32-bit input vector. |
201 // - length : Number of samples in vector. | 199 // - length : Number of samples in vector. |
202 // | 200 // |
203 // Return value : Maximum sample value in |vector|. | 201 // Return value : Maximum sample value in |vector|. |
204 typedef int32_t (*MaxValueW32)(const int32_t* vector, size_t length); | 202 typedef int32_t (*MaxValueW32)(const int32_t* vector, size_t length); |
205 extern MaxValueW32 WebRtcSpl_MaxValueW32; | 203 extern MaxValueW32 WebRtcSpl_MaxValueW32; |
206 int32_t WebRtcSpl_MaxValueW32C(const int32_t* vector, size_t length); | 204 int32_t WebRtcSpl_MaxValueW32C(const int32_t* vector, size_t length); |
207 #if (defined WEBRTC_DETECT_NEON) || (defined WEBRTC_HAS_NEON) | 205 #if defined(WEBRTC_HAS_NEON) |
208 int32_t WebRtcSpl_MaxValueW32Neon(const int32_t* vector, size_t length); | 206 int32_t WebRtcSpl_MaxValueW32Neon(const int32_t* vector, size_t length); |
209 #endif | 207 #endif |
210 #if defined(MIPS32_LE) | 208 #if defined(MIPS32_LE) |
211 int32_t WebRtcSpl_MaxValueW32_mips(const int32_t* vector, size_t length); | 209 int32_t WebRtcSpl_MaxValueW32_mips(const int32_t* vector, size_t length); |
212 #endif | 210 #endif |
213 | 211 |
214 // Returns the minimum value of a 16-bit vector. | 212 // Returns the minimum value of a 16-bit vector. |
215 // | 213 // |
216 // Input: | 214 // Input: |
217 // - vector : 16-bit input vector. | 215 // - vector : 16-bit input vector. |
218 // - length : Number of samples in vector. | 216 // - length : Number of samples in vector. |
219 // | 217 // |
220 // Return value : Minimum sample value in |vector|. | 218 // Return value : Minimum sample value in |vector|. |
221 typedef int16_t (*MinValueW16)(const int16_t* vector, size_t length); | 219 typedef int16_t (*MinValueW16)(const int16_t* vector, size_t length); |
222 extern MinValueW16 WebRtcSpl_MinValueW16; | 220 extern MinValueW16 WebRtcSpl_MinValueW16; |
223 int16_t WebRtcSpl_MinValueW16C(const int16_t* vector, size_t length); | 221 int16_t WebRtcSpl_MinValueW16C(const int16_t* vector, size_t length); |
224 #if (defined WEBRTC_DETECT_NEON) || (defined WEBRTC_HAS_NEON) | 222 #if defined(WEBRTC_HAS_NEON) |
225 int16_t WebRtcSpl_MinValueW16Neon(const int16_t* vector, size_t length); | 223 int16_t WebRtcSpl_MinValueW16Neon(const int16_t* vector, size_t length); |
226 #endif | 224 #endif |
227 #if defined(MIPS32_LE) | 225 #if defined(MIPS32_LE) |
228 int16_t WebRtcSpl_MinValueW16_mips(const int16_t* vector, size_t length); | 226 int16_t WebRtcSpl_MinValueW16_mips(const int16_t* vector, size_t length); |
229 #endif | 227 #endif |
230 | 228 |
231 // Returns the minimum value of a 32-bit vector. | 229 // Returns the minimum value of a 32-bit vector. |
232 // | 230 // |
233 // Input: | 231 // Input: |
234 // - vector : 32-bit input vector. | 232 // - vector : 32-bit input vector. |
235 // - length : Number of samples in vector. | 233 // - length : Number of samples in vector. |
236 // | 234 // |
237 // Return value : Minimum sample value in |vector|. | 235 // Return value : Minimum sample value in |vector|. |
238 typedef int32_t (*MinValueW32)(const int32_t* vector, size_t length); | 236 typedef int32_t (*MinValueW32)(const int32_t* vector, size_t length); |
239 extern MinValueW32 WebRtcSpl_MinValueW32; | 237 extern MinValueW32 WebRtcSpl_MinValueW32; |
240 int32_t WebRtcSpl_MinValueW32C(const int32_t* vector, size_t length); | 238 int32_t WebRtcSpl_MinValueW32C(const int32_t* vector, size_t length); |
241 #if (defined WEBRTC_DETECT_NEON) || (defined WEBRTC_HAS_NEON) | 239 #if defined(WEBRTC_HAS_NEON) |
242 int32_t WebRtcSpl_MinValueW32Neon(const int32_t* vector, size_t length); | 240 int32_t WebRtcSpl_MinValueW32Neon(const int32_t* vector, size_t length); |
243 #endif | 241 #endif |
244 #if defined(MIPS32_LE) | 242 #if defined(MIPS32_LE) |
245 int32_t WebRtcSpl_MinValueW32_mips(const int32_t* vector, size_t length); | 243 int32_t WebRtcSpl_MinValueW32_mips(const int32_t* vector, size_t length); |
246 #endif | 244 #endif |
247 | 245 |
248 // Returns the vector index to the largest absolute value of a 16-bit vector. | 246 // Returns the vector index to the largest absolute value of a 16-bit vector. |
249 // | 247 // |
250 // Input: | 248 // Input: |
251 // - vector : 16-bit input vector. | 249 // - vector : 16-bit input vector. |
(...skipping 272 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
524 int right_shifts, | 522 int right_shifts, |
525 int step_seq2); | 523 int step_seq2); |
526 extern CrossCorrelation WebRtcSpl_CrossCorrelation; | 524 extern CrossCorrelation WebRtcSpl_CrossCorrelation; |
527 void WebRtcSpl_CrossCorrelationC(int32_t* cross_correlation, | 525 void WebRtcSpl_CrossCorrelationC(int32_t* cross_correlation, |
528 const int16_t* seq1, | 526 const int16_t* seq1, |
529 const int16_t* seq2, | 527 const int16_t* seq2, |
530 size_t dim_seq, | 528 size_t dim_seq, |
531 size_t dim_cross_correlation, | 529 size_t dim_cross_correlation, |
532 int right_shifts, | 530 int right_shifts, |
533 int step_seq2); | 531 int step_seq2); |
534 #if (defined WEBRTC_DETECT_NEON) || (defined WEBRTC_HAS_NEON) | 532 #if defined(WEBRTC_HAS_NEON) |
535 void WebRtcSpl_CrossCorrelationNeon(int32_t* cross_correlation, | 533 void WebRtcSpl_CrossCorrelationNeon(int32_t* cross_correlation, |
536 const int16_t* seq1, | 534 const int16_t* seq1, |
537 const int16_t* seq2, | 535 const int16_t* seq2, |
538 size_t dim_seq, | 536 size_t dim_seq, |
539 size_t dim_cross_correlation, | 537 size_t dim_cross_correlation, |
540 int right_shifts, | 538 int right_shifts, |
541 int step_seq2); | 539 int step_seq2); |
542 #endif | 540 #endif |
543 #if defined(MIPS32_LE) | 541 #if defined(MIPS32_LE) |
544 void WebRtcSpl_CrossCorrelation_mips(int32_t* cross_correlation, | 542 void WebRtcSpl_CrossCorrelation_mips(int32_t* cross_correlation, |
(...skipping 146 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
691 size_t delay); | 689 size_t delay); |
692 extern DownsampleFast WebRtcSpl_DownsampleFast; | 690 extern DownsampleFast WebRtcSpl_DownsampleFast; |
693 int WebRtcSpl_DownsampleFastC(const int16_t* data_in, | 691 int WebRtcSpl_DownsampleFastC(const int16_t* data_in, |
694 size_t data_in_length, | 692 size_t data_in_length, |
695 int16_t* data_out, | 693 int16_t* data_out, |
696 size_t data_out_length, | 694 size_t data_out_length, |
697 const int16_t* __restrict coefficients, | 695 const int16_t* __restrict coefficients, |
698 size_t coefficients_length, | 696 size_t coefficients_length, |
699 int factor, | 697 int factor, |
700 size_t delay); | 698 size_t delay); |
701 #if (defined WEBRTC_DETECT_NEON) || (defined WEBRTC_HAS_NEON) | 699 #if defined(WEBRTC_HAS_NEON) |
702 int WebRtcSpl_DownsampleFastNeon(const int16_t* data_in, | 700 int WebRtcSpl_DownsampleFastNeon(const int16_t* data_in, |
703 size_t data_in_length, | 701 size_t data_in_length, |
704 int16_t* data_out, | 702 int16_t* data_out, |
705 size_t data_out_length, | 703 size_t data_out_length, |
706 const int16_t* __restrict coefficients, | 704 const int16_t* __restrict coefficients, |
707 size_t coefficients_length, | 705 size_t coefficients_length, |
708 int factor, | 706 int factor, |
709 size_t delay); | 707 size_t delay); |
710 #endif | 708 #endif |
711 #if defined(MIPS32_LE) | 709 #if defined(MIPS32_LE) |
(...skipping 924 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1636 // This function multiply a 16-bit word by a 16-bit word, and accumulate this | 1634 // This function multiply a 16-bit word by a 16-bit word, and accumulate this |
1637 // value to a 32-bit integer. | 1635 // value to a 32-bit integer. |
1638 // | 1636 // |
1639 // Input: | 1637 // Input: |
1640 // - a : The value of the first 16-bit word. | 1638 // - a : The value of the first 16-bit word. |
1641 // - b : The value of the second 16-bit word. | 1639 // - b : The value of the second 16-bit word. |
1642 // - c : The value of an 32-bit integer. | 1640 // - c : The value of an 32-bit integer. |
1643 // | 1641 // |
1644 // Return Value: The value of a * b + c. | 1642 // Return Value: The value of a * b + c. |
1645 // | 1643 // |
OLD | NEW |