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 97 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
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 |
110 // if run-time Neon detection (WEBRTC_DETECT_NEON) is enabled, the pointers | 110 // if run-time Neon detection (WEBRTC_DETECT_NEON) is enabled, the pointers |
111 // will be assigned to either Neon code or generic C code; otherwise, generic C | 111 // will be assigned to either Neon code or generic C code; otherwise, generic C |
112 // code will be assigned. | 112 // code will be assigned. |
113 // Note that this function MUST be called in any application that uses SPL | 113 // Note that this function MUST be called in any application that uses SPL |
114 // functions. | 114 // functions. |
115 void WebRtcSpl_Init(); | 115 void WebRtcSpl_Init(); |
116 | 116 |
117 int16_t WebRtcSpl_GetScalingSquare(int16_t* in_vector, | 117 int16_t WebRtcSpl_GetScalingSquare(int16_t* in_vector, |
118 int in_vector_length, | 118 size_t in_vector_length, |
119 int times); | 119 size_t times); |
120 | 120 |
121 // Copy and set operations. Implementation in copy_set_operations.c. | 121 // Copy and set operations. Implementation in copy_set_operations.c. |
122 // Descriptions at bottom of file. | 122 // Descriptions at bottom of file. |
123 void WebRtcSpl_MemSetW16(int16_t* vector, | 123 void WebRtcSpl_MemSetW16(int16_t* vector, |
124 int16_t set_value, | 124 int16_t set_value, |
125 int vector_length); | 125 size_t vector_length); |
126 void WebRtcSpl_MemSetW32(int32_t* vector, | 126 void WebRtcSpl_MemSetW32(int32_t* vector, |
127 int32_t set_value, | 127 int32_t set_value, |
128 int vector_length); | 128 size_t vector_length); |
129 void WebRtcSpl_MemCpyReversedOrder(int16_t* out_vector, | 129 void WebRtcSpl_MemCpyReversedOrder(int16_t* out_vector, |
130 int16_t* in_vector, | 130 int16_t* in_vector, |
131 int vector_length); | 131 size_t vector_length); |
132 void WebRtcSpl_CopyFromEndW16(const int16_t* in_vector, | 132 void WebRtcSpl_CopyFromEndW16(const int16_t* in_vector, |
133 int in_vector_length, | 133 size_t in_vector_length, |
134 int samples, | 134 size_t samples, |
135 int16_t* out_vector); | 135 int16_t* out_vector); |
136 void WebRtcSpl_ZerosArrayW16(int16_t* vector, | 136 void WebRtcSpl_ZerosArrayW16(int16_t* vector, |
137 int vector_length); | 137 size_t vector_length); |
138 void WebRtcSpl_ZerosArrayW32(int32_t* vector, | 138 void WebRtcSpl_ZerosArrayW32(int32_t* vector, |
139 int vector_length); | 139 size_t vector_length); |
140 // End: Copy and set operations. | 140 // End: Copy and set operations. |
141 | 141 |
142 | 142 |
143 // Minimum and maximum operation functions and their pointers. | 143 // Minimum and maximum operation functions and their pointers. |
144 // Implementation in min_max_operations.c. | 144 // Implementation in min_max_operations.c. |
145 | 145 |
146 // Returns the largest absolute value in a signed 16-bit vector. | 146 // Returns the largest absolute value in a signed 16-bit vector. |
147 // | 147 // |
148 // Input: | 148 // Input: |
149 // - vector : 16-bit input vector. | 149 // - vector : 16-bit input vector. |
150 // - length : Number of samples in vector. | 150 // - length : Number of samples in vector. |
151 // | 151 // |
152 // Return value : Maximum absolute value in vector; | 152 // Return value : Maximum absolute value in vector; |
153 // or -1, if (vector == NULL || length <= 0). | 153 // or -1, if (vector == NULL || length == 0). |
154 typedef int16_t (*MaxAbsValueW16)(const int16_t* vector, int length); | 154 typedef int16_t (*MaxAbsValueW16)(const int16_t* vector, size_t length); |
155 extern MaxAbsValueW16 WebRtcSpl_MaxAbsValueW16; | 155 extern MaxAbsValueW16 WebRtcSpl_MaxAbsValueW16; |
156 int16_t WebRtcSpl_MaxAbsValueW16C(const int16_t* vector, int length); | 156 int16_t WebRtcSpl_MaxAbsValueW16C(const int16_t* vector, size_t length); |
157 #if (defined WEBRTC_DETECT_NEON) || (defined WEBRTC_HAS_NEON) | 157 #if (defined WEBRTC_DETECT_NEON) || (defined WEBRTC_HAS_NEON) |
158 int16_t WebRtcSpl_MaxAbsValueW16Neon(const int16_t* vector, int length); | 158 int16_t WebRtcSpl_MaxAbsValueW16Neon(const int16_t* vector, size_t length); |
159 #endif | 159 #endif |
160 #if defined(MIPS32_LE) | 160 #if defined(MIPS32_LE) |
161 int16_t WebRtcSpl_MaxAbsValueW16_mips(const int16_t* vector, int length); | 161 int16_t WebRtcSpl_MaxAbsValueW16_mips(const int16_t* vector, size_t length); |
162 #endif | 162 #endif |
163 | 163 |
164 // Returns the largest absolute value in a signed 32-bit vector. | 164 // Returns the largest absolute value in a signed 32-bit vector. |
165 // | 165 // |
166 // Input: | 166 // Input: |
167 // - vector : 32-bit input vector. | 167 // - vector : 32-bit input vector. |
168 // - length : Number of samples in vector. | 168 // - length : Number of samples in vector. |
169 // | 169 // |
170 // Return value : Maximum absolute value in vector; | 170 // Return value : Maximum absolute value in vector; |
171 // or -1, if (vector == NULL || length <= 0). | 171 // or -1, if (vector == NULL || length == 0). |
172 typedef int32_t (*MaxAbsValueW32)(const int32_t* vector, int length); | 172 typedef int32_t (*MaxAbsValueW32)(const int32_t* vector, size_t length); |
173 extern MaxAbsValueW32 WebRtcSpl_MaxAbsValueW32; | 173 extern MaxAbsValueW32 WebRtcSpl_MaxAbsValueW32; |
174 int32_t WebRtcSpl_MaxAbsValueW32C(const int32_t* vector, int length); | 174 int32_t WebRtcSpl_MaxAbsValueW32C(const int32_t* vector, size_t length); |
175 #if (defined WEBRTC_DETECT_NEON) || (defined WEBRTC_HAS_NEON) | 175 #if (defined WEBRTC_DETECT_NEON) || (defined WEBRTC_HAS_NEON) |
176 int32_t WebRtcSpl_MaxAbsValueW32Neon(const int32_t* vector, int length); | 176 int32_t WebRtcSpl_MaxAbsValueW32Neon(const int32_t* vector, size_t length); |
177 #endif | 177 #endif |
178 #if defined(MIPS_DSP_R1_LE) | 178 #if defined(MIPS_DSP_R1_LE) |
179 int32_t WebRtcSpl_MaxAbsValueW32_mips(const int32_t* vector, int length); | 179 int32_t WebRtcSpl_MaxAbsValueW32_mips(const int32_t* vector, size_t length); |
180 #endif | 180 #endif |
181 | 181 |
182 // Returns the maximum value of a 16-bit vector. | 182 // Returns the maximum value of a 16-bit vector. |
183 // | 183 // |
184 // Input: | 184 // Input: |
185 // - vector : 16-bit input vector. | 185 // - vector : 16-bit input vector. |
186 // - length : Number of samples in vector. | 186 // - length : Number of samples in vector. |
187 // | 187 // |
188 // Return value : Maximum sample value in |vector|. | 188 // Return value : Maximum sample value in |vector|. |
189 // If (vector == NULL || length <= 0) WEBRTC_SPL_WORD16_MIN | 189 // If (vector == NULL || length == 0) WEBRTC_SPL_WORD16_MIN |
190 // is returned. Note that WEBRTC_SPL_WORD16_MIN is a feasible | 190 // is returned. Note that WEBRTC_SPL_WORD16_MIN is a feasible |
191 // value and we can't catch errors purely based on it. | 191 // value and we can't catch errors purely based on it. |
192 typedef int16_t (*MaxValueW16)(const int16_t* vector, int length); | 192 typedef int16_t (*MaxValueW16)(const int16_t* vector, size_t length); |
193 extern MaxValueW16 WebRtcSpl_MaxValueW16; | 193 extern MaxValueW16 WebRtcSpl_MaxValueW16; |
194 int16_t WebRtcSpl_MaxValueW16C(const int16_t* vector, int length); | 194 int16_t WebRtcSpl_MaxValueW16C(const int16_t* vector, size_t length); |
195 #if (defined WEBRTC_DETECT_NEON) || (defined WEBRTC_HAS_NEON) | 195 #if (defined WEBRTC_DETECT_NEON) || (defined WEBRTC_HAS_NEON) |
196 int16_t WebRtcSpl_MaxValueW16Neon(const int16_t* vector, int length); | 196 int16_t WebRtcSpl_MaxValueW16Neon(const int16_t* vector, size_t length); |
197 #endif | 197 #endif |
198 #if defined(MIPS32_LE) | 198 #if defined(MIPS32_LE) |
199 int16_t WebRtcSpl_MaxValueW16_mips(const int16_t* vector, int length); | 199 int16_t WebRtcSpl_MaxValueW16_mips(const int16_t* vector, size_t length); |
200 #endif | 200 #endif |
201 | 201 |
202 // Returns the maximum value of a 32-bit vector. | 202 // Returns the maximum value of a 32-bit vector. |
203 // | 203 // |
204 // Input: | 204 // Input: |
205 // - vector : 32-bit input vector. | 205 // - vector : 32-bit input vector. |
206 // - length : Number of samples in vector. | 206 // - length : Number of samples in vector. |
207 // | 207 // |
208 // Return value : Maximum sample value in |vector|. | 208 // Return value : Maximum sample value in |vector|. |
209 // If (vector == NULL || length <= 0) WEBRTC_SPL_WORD32_MIN | 209 // If (vector == NULL || length == 0) WEBRTC_SPL_WORD32_MIN |
210 // is returned. Note that WEBRTC_SPL_WORD32_MIN is a feasible | 210 // is returned. Note that WEBRTC_SPL_WORD32_MIN is a feasible |
211 // value and we can't catch errors purely based on it. | 211 // value and we can't catch errors purely based on it. |
212 typedef int32_t (*MaxValueW32)(const int32_t* vector, int length); | 212 typedef int32_t (*MaxValueW32)(const int32_t* vector, size_t length); |
213 extern MaxValueW32 WebRtcSpl_MaxValueW32; | 213 extern MaxValueW32 WebRtcSpl_MaxValueW32; |
214 int32_t WebRtcSpl_MaxValueW32C(const int32_t* vector, int length); | 214 int32_t WebRtcSpl_MaxValueW32C(const int32_t* vector, size_t length); |
215 #if (defined WEBRTC_DETECT_NEON) || (defined WEBRTC_HAS_NEON) | 215 #if (defined WEBRTC_DETECT_NEON) || (defined WEBRTC_HAS_NEON) |
216 int32_t WebRtcSpl_MaxValueW32Neon(const int32_t* vector, int length); | 216 int32_t WebRtcSpl_MaxValueW32Neon(const int32_t* vector, size_t length); |
217 #endif | 217 #endif |
218 #if defined(MIPS32_LE) | 218 #if defined(MIPS32_LE) |
219 int32_t WebRtcSpl_MaxValueW32_mips(const int32_t* vector, int length); | 219 int32_t WebRtcSpl_MaxValueW32_mips(const int32_t* vector, size_t length); |
220 #endif | 220 #endif |
221 | 221 |
222 // Returns the minimum value of a 16-bit vector. | 222 // Returns the minimum value of a 16-bit vector. |
223 // | 223 // |
224 // Input: | 224 // Input: |
225 // - vector : 16-bit input vector. | 225 // - vector : 16-bit input vector. |
226 // - length : Number of samples in vector. | 226 // - length : Number of samples in vector. |
227 // | 227 // |
228 // Return value : Minimum sample value in |vector|. | 228 // Return value : Minimum sample value in |vector|. |
229 // If (vector == NULL || length <= 0) WEBRTC_SPL_WORD16_MAX | 229 // If (vector == NULL || length == 0) WEBRTC_SPL_WORD16_MAX |
230 // is returned. Note that WEBRTC_SPL_WORD16_MAX is a feasible | 230 // is returned. Note that WEBRTC_SPL_WORD16_MAX is a feasible |
231 // value and we can't catch errors purely based on it. | 231 // value and we can't catch errors purely based on it. |
232 typedef int16_t (*MinValueW16)(const int16_t* vector, int length); | 232 typedef int16_t (*MinValueW16)(const int16_t* vector, size_t length); |
233 extern MinValueW16 WebRtcSpl_MinValueW16; | 233 extern MinValueW16 WebRtcSpl_MinValueW16; |
234 int16_t WebRtcSpl_MinValueW16C(const int16_t* vector, int length); | 234 int16_t WebRtcSpl_MinValueW16C(const int16_t* vector, size_t length); |
235 #if (defined WEBRTC_DETECT_NEON) || (defined WEBRTC_HAS_NEON) | 235 #if (defined WEBRTC_DETECT_NEON) || (defined WEBRTC_HAS_NEON) |
236 int16_t WebRtcSpl_MinValueW16Neon(const int16_t* vector, int length); | 236 int16_t WebRtcSpl_MinValueW16Neon(const int16_t* vector, size_t length); |
237 #endif | 237 #endif |
238 #if defined(MIPS32_LE) | 238 #if defined(MIPS32_LE) |
239 int16_t WebRtcSpl_MinValueW16_mips(const int16_t* vector, int length); | 239 int16_t WebRtcSpl_MinValueW16_mips(const int16_t* vector, size_t length); |
240 #endif | 240 #endif |
241 | 241 |
242 // Returns the minimum value of a 32-bit vector. | 242 // Returns the minimum value of a 32-bit vector. |
243 // | 243 // |
244 // Input: | 244 // Input: |
245 // - vector : 32-bit input vector. | 245 // - vector : 32-bit input vector. |
246 // - length : Number of samples in vector. | 246 // - length : Number of samples in vector. |
247 // | 247 // |
248 // Return value : Minimum sample value in |vector|. | 248 // Return value : Minimum sample value in |vector|. |
249 // If (vector == NULL || length <= 0) WEBRTC_SPL_WORD32_MAX | 249 // If (vector == NULL || length == 0) WEBRTC_SPL_WORD32_MAX |
250 // is returned. Note that WEBRTC_SPL_WORD32_MAX is a feasible | 250 // is returned. Note that WEBRTC_SPL_WORD32_MAX is a feasible |
251 // value and we can't catch errors purely based on it. | 251 // value and we can't catch errors purely based on it. |
252 typedef int32_t (*MinValueW32)(const int32_t* vector, int length); | 252 typedef int32_t (*MinValueW32)(const int32_t* vector, size_t length); |
253 extern MinValueW32 WebRtcSpl_MinValueW32; | 253 extern MinValueW32 WebRtcSpl_MinValueW32; |
254 int32_t WebRtcSpl_MinValueW32C(const int32_t* vector, int length); | 254 int32_t WebRtcSpl_MinValueW32C(const int32_t* vector, size_t length); |
255 #if (defined WEBRTC_DETECT_NEON) || (defined WEBRTC_HAS_NEON) | 255 #if (defined WEBRTC_DETECT_NEON) || (defined WEBRTC_HAS_NEON) |
256 int32_t WebRtcSpl_MinValueW32Neon(const int32_t* vector, int length); | 256 int32_t WebRtcSpl_MinValueW32Neon(const int32_t* vector, size_t length); |
257 #endif | 257 #endif |
258 #if defined(MIPS32_LE) | 258 #if defined(MIPS32_LE) |
259 int32_t WebRtcSpl_MinValueW32_mips(const int32_t* vector, int length); | 259 int32_t WebRtcSpl_MinValueW32_mips(const int32_t* vector, size_t length); |
260 #endif | 260 #endif |
261 | 261 |
262 // Returns the vector index to the largest absolute value of a 16-bit vector. | 262 // Returns the vector index to the largest absolute value of a 16-bit vector. |
263 // | 263 // |
264 // Input: | 264 // Input: |
265 // - vector : 16-bit input vector. | 265 // - vector : 16-bit input vector. |
266 // - length : Number of samples in vector. | 266 // - length : Number of samples in vector. |
267 // | 267 // |
268 // Return value : Index to the maximum absolute value in vector, or -1, | 268 // Return value : Index to the maximum absolute value in vector, or -1, |
269 // if (vector == NULL || length <= 0). | 269 // if (vector == NULL || length == 0). |
270 // If there are multiple equal maxima, return the index of the | 270 // If there are multiple equal maxima, return the index of the |
271 // first. -32768 will always have precedence over 32767 (despite | 271 // first. -32768 will always have precedence over 32767 (despite |
272 // -32768 presenting an int16 absolute value of 32767); | 272 // -32768 presenting an int16 absolute value of 32767); |
273 int WebRtcSpl_MaxAbsIndexW16(const int16_t* vector, int length); | 273 int WebRtcSpl_MaxAbsIndexW16(const int16_t* vector, size_t length); |
274 | 274 |
275 // Returns the vector index to the maximum sample value of a 16-bit vector. | 275 // Returns the vector index to the maximum sample value of a 16-bit vector. |
276 // | 276 // |
277 // Input: | 277 // Input: |
278 // - vector : 16-bit input vector. | 278 // - vector : 16-bit input vector. |
279 // - length : Number of samples in vector. | 279 // - length : Number of samples in vector. |
280 // | 280 // |
281 // Return value : Index to the maximum value in vector (if multiple | 281 // Return value : Index to the maximum value in vector (if multiple |
282 // indexes have the maximum, return the first); | 282 // indexes have the maximum, return the first); |
283 // or -1, if (vector == NULL || length <= 0). | 283 // or -1, if (vector == NULL || length == 0). |
284 int WebRtcSpl_MaxIndexW16(const int16_t* vector, int length); | 284 int WebRtcSpl_MaxIndexW16(const int16_t* vector, size_t length); |
285 | 285 |
286 // Returns the vector index to the maximum sample value of a 32-bit vector. | 286 // Returns the vector index to the maximum sample value of a 32-bit vector. |
287 // | 287 // |
288 // Input: | 288 // Input: |
289 // - vector : 32-bit input vector. | 289 // - vector : 32-bit input vector. |
290 // - length : Number of samples in vector. | 290 // - length : Number of samples in vector. |
291 // | 291 // |
292 // Return value : Index to the maximum value in vector (if multiple | 292 // Return value : Index to the maximum value in vector (if multiple |
293 // indexes have the maximum, return the first); | 293 // indexes have the maximum, return the first); |
294 // or -1, if (vector == NULL || length <= 0). | 294 // or -1, if (vector == NULL || length == 0). |
295 int WebRtcSpl_MaxIndexW32(const int32_t* vector, int length); | 295 int WebRtcSpl_MaxIndexW32(const int32_t* vector, size_t length); |
296 | 296 |
297 // Returns the vector index to the minimum sample value of a 16-bit vector. | 297 // Returns the vector index to the minimum sample value of a 16-bit vector. |
298 // | 298 // |
299 // Input: | 299 // Input: |
300 // - vector : 16-bit input vector. | 300 // - vector : 16-bit input vector. |
301 // - length : Number of samples in vector. | 301 // - length : Number of samples in vector. |
302 // | 302 // |
303 // Return value : Index to the mimimum value in vector (if multiple | 303 // Return value : Index to the mimimum value in vector (if multiple |
304 // indexes have the minimum, return the first); | 304 // indexes have the minimum, return the first); |
305 // or -1, if (vector == NULL || length <= 0). | 305 // or -1, if (vector == NULL || length == 0). |
306 int WebRtcSpl_MinIndexW16(const int16_t* vector, int length); | 306 int WebRtcSpl_MinIndexW16(const int16_t* vector, size_t length); |
307 | 307 |
308 // Returns the vector index to the minimum sample value of a 32-bit vector. | 308 // Returns the vector index to the minimum sample value of a 32-bit vector. |
309 // | 309 // |
310 // Input: | 310 // Input: |
311 // - vector : 32-bit input vector. | 311 // - vector : 32-bit input vector. |
312 // - length : Number of samples in vector. | 312 // - length : Number of samples in vector. |
313 // | 313 // |
314 // Return value : Index to the mimimum value in vector (if multiple | 314 // Return value : Index to the mimimum value in vector (if multiple |
315 // indexes have the minimum, return the first); | 315 // indexes have the minimum, return the first); |
316 // or -1, if (vector == NULL || length <= 0). | 316 // or -1, if (vector == NULL || length == 0). |
317 int WebRtcSpl_MinIndexW32(const int32_t* vector, int length); | 317 int WebRtcSpl_MinIndexW32(const int32_t* vector, size_t length); |
318 | 318 |
319 // End: Minimum and maximum operations. | 319 // End: Minimum and maximum operations. |
320 | 320 |
321 | 321 |
322 // Vector scaling operations. Implementation in vector_scaling_operations.c. | 322 // Vector scaling operations. Implementation in vector_scaling_operations.c. |
323 // Description at bottom of file. | 323 // Description at bottom of file. |
324 void WebRtcSpl_VectorBitShiftW16(int16_t* out_vector, | 324 void WebRtcSpl_VectorBitShiftW16(int16_t* out_vector, |
325 int16_t vector_length, | 325 size_t vector_length, |
326 const int16_t* in_vector, | 326 const int16_t* in_vector, |
327 int16_t right_shifts); | 327 int16_t right_shifts); |
328 void WebRtcSpl_VectorBitShiftW32(int32_t* out_vector, | 328 void WebRtcSpl_VectorBitShiftW32(int32_t* out_vector, |
329 int16_t vector_length, | 329 size_t vector_length, |
330 const int32_t* in_vector, | 330 const int32_t* in_vector, |
331 int16_t right_shifts); | 331 int16_t right_shifts); |
332 void WebRtcSpl_VectorBitShiftW32ToW16(int16_t* out_vector, | 332 void WebRtcSpl_VectorBitShiftW32ToW16(int16_t* out_vector, |
333 int vector_length, | 333 size_t vector_length, |
334 const int32_t* in_vector, | 334 const int32_t* in_vector, |
335 int right_shifts); | 335 int right_shifts); |
336 void WebRtcSpl_ScaleVector(const int16_t* in_vector, | 336 void WebRtcSpl_ScaleVector(const int16_t* in_vector, |
337 int16_t* out_vector, | 337 int16_t* out_vector, |
338 int16_t gain, | 338 int16_t gain, |
339 int16_t vector_length, | 339 size_t vector_length, |
340 int16_t right_shifts); | 340 int16_t right_shifts); |
341 void WebRtcSpl_ScaleVectorWithSat(const int16_t* in_vector, | 341 void WebRtcSpl_ScaleVectorWithSat(const int16_t* in_vector, |
342 int16_t* out_vector, | 342 int16_t* out_vector, |
343 int16_t gain, | 343 int16_t gain, |
344 int16_t vector_length, | 344 size_t vector_length, |
345 int16_t right_shifts); | 345 int16_t right_shifts); |
346 void WebRtcSpl_ScaleAndAddVectors(const int16_t* in_vector1, | 346 void WebRtcSpl_ScaleAndAddVectors(const int16_t* in_vector1, |
347 int16_t gain1, int right_shifts1, | 347 int16_t gain1, int right_shifts1, |
348 const int16_t* in_vector2, | 348 const int16_t* in_vector2, |
349 int16_t gain2, int right_shifts2, | 349 int16_t gain2, int right_shifts2, |
350 int16_t* out_vector, | 350 int16_t* out_vector, |
351 int vector_length); | 351 size_t vector_length); |
352 | 352 |
353 // The functions (with related pointer) perform the vector operation: | 353 // The functions (with related pointer) perform the vector operation: |
354 // out_vector[k] = ((scale1 * in_vector1[k]) + (scale2 * in_vector2[k]) | 354 // out_vector[k] = ((scale1 * in_vector1[k]) + (scale2 * in_vector2[k]) |
355 // + round_value) >> right_shifts, | 355 // + round_value) >> right_shifts, |
356 // where round_value = (1 << right_shifts) >> 1. | 356 // where round_value = (1 << right_shifts) >> 1. |
357 // | 357 // |
358 // Input: | 358 // Input: |
359 // - in_vector1 : Input vector 1 | 359 // - in_vector1 : Input vector 1 |
360 // - in_vector1_scale : Gain to be used for vector 1 | 360 // - in_vector1_scale : Gain to be used for vector 1 |
361 // - in_vector2 : Input vector 2 | 361 // - in_vector2 : Input vector 2 |
362 // - in_vector2_scale : Gain to be used for vector 2 | 362 // - in_vector2_scale : Gain to be used for vector 2 |
363 // - right_shifts : Number of right bit shifts to be applied | 363 // - right_shifts : Number of right bit shifts to be applied |
364 // - length : Number of elements in the input vectors | 364 // - length : Number of elements in the input vectors |
365 // | 365 // |
366 // Output: | 366 // Output: |
367 // - out_vector : Output vector | 367 // - out_vector : Output vector |
368 // Return value : 0 if OK, -1 if (in_vector1 == NULL | 368 // Return value : 0 if OK, -1 if (in_vector1 == NULL |
369 // || in_vector2 == NULL || out_vector == NULL | 369 // || in_vector2 == NULL || out_vector == NULL |
370 // || length <= 0 || right_shift < 0). | 370 // || length <= 0 || right_shift < 0). |
371 typedef int (*ScaleAndAddVectorsWithRound)(const int16_t* in_vector1, | 371 typedef int (*ScaleAndAddVectorsWithRound)(const int16_t* in_vector1, |
372 int16_t in_vector1_scale, | 372 int16_t in_vector1_scale, |
373 const int16_t* in_vector2, | 373 const int16_t* in_vector2, |
374 int16_t in_vector2_scale, | 374 int16_t in_vector2_scale, |
375 int right_shifts, | 375 int right_shifts, |
376 int16_t* out_vector, | 376 int16_t* out_vector, |
377 int length); | 377 size_t length); |
378 extern ScaleAndAddVectorsWithRound WebRtcSpl_ScaleAndAddVectorsWithRound; | 378 extern ScaleAndAddVectorsWithRound WebRtcSpl_ScaleAndAddVectorsWithRound; |
379 int WebRtcSpl_ScaleAndAddVectorsWithRoundC(const int16_t* in_vector1, | 379 int WebRtcSpl_ScaleAndAddVectorsWithRoundC(const int16_t* in_vector1, |
380 int16_t in_vector1_scale, | 380 int16_t in_vector1_scale, |
381 const int16_t* in_vector2, | 381 const int16_t* in_vector2, |
382 int16_t in_vector2_scale, | 382 int16_t in_vector2_scale, |
383 int right_shifts, | 383 int right_shifts, |
384 int16_t* out_vector, | 384 int16_t* out_vector, |
385 int length); | 385 size_t length); |
386 #if defined(MIPS_DSP_R1_LE) | 386 #if defined(MIPS_DSP_R1_LE) |
387 int WebRtcSpl_ScaleAndAddVectorsWithRound_mips(const int16_t* in_vector1, | 387 int WebRtcSpl_ScaleAndAddVectorsWithRound_mips(const int16_t* in_vector1, |
388 int16_t in_vector1_scale, | 388 int16_t in_vector1_scale, |
389 const int16_t* in_vector2, | 389 const int16_t* in_vector2, |
390 int16_t in_vector2_scale, | 390 int16_t in_vector2_scale, |
391 int right_shifts, | 391 int right_shifts, |
392 int16_t* out_vector, | 392 int16_t* out_vector, |
393 int length); | 393 size_t length); |
394 #endif | 394 #endif |
395 // End: Vector scaling operations. | 395 // End: Vector scaling operations. |
396 | 396 |
397 // iLBC specific functions. Implementations in ilbc_specific_functions.c. | 397 // iLBC specific functions. Implementations in ilbc_specific_functions.c. |
398 // Description at bottom of file. | 398 // Description at bottom of file. |
399 void WebRtcSpl_ReverseOrderMultArrayElements(int16_t* out_vector, | 399 void WebRtcSpl_ReverseOrderMultArrayElements(int16_t* out_vector, |
400 const int16_t* in_vector, | 400 const int16_t* in_vector, |
401 const int16_t* window, | 401 const int16_t* window, |
402 int16_t vector_length, | 402 size_t vector_length, |
403 int16_t right_shifts); | 403 int16_t right_shifts); |
404 void WebRtcSpl_ElementwiseVectorMult(int16_t* out_vector, | 404 void WebRtcSpl_ElementwiseVectorMult(int16_t* out_vector, |
405 const int16_t* in_vector, | 405 const int16_t* in_vector, |
406 const int16_t* window, | 406 const int16_t* window, |
407 int16_t vector_length, | 407 size_t vector_length, |
408 int16_t right_shifts); | 408 int16_t right_shifts); |
409 void WebRtcSpl_AddVectorsAndShift(int16_t* out_vector, | 409 void WebRtcSpl_AddVectorsAndShift(int16_t* out_vector, |
410 const int16_t* in_vector1, | 410 const int16_t* in_vector1, |
411 const int16_t* in_vector2, | 411 const int16_t* in_vector2, |
412 int16_t vector_length, | 412 size_t vector_length, |
413 int16_t right_shifts); | 413 int16_t right_shifts); |
414 void WebRtcSpl_AddAffineVectorToVector(int16_t* out_vector, | 414 void WebRtcSpl_AddAffineVectorToVector(int16_t* out_vector, |
415 int16_t* in_vector, | 415 int16_t* in_vector, |
416 int16_t gain, | 416 int16_t gain, |
417 int32_t add_constant, | 417 int32_t add_constant, |
418 int16_t right_shifts, | 418 int16_t right_shifts, |
419 int vector_length); | 419 size_t vector_length); |
420 void WebRtcSpl_AffineTransformVector(int16_t* out_vector, | 420 void WebRtcSpl_AffineTransformVector(int16_t* out_vector, |
421 int16_t* in_vector, | 421 int16_t* in_vector, |
422 int16_t gain, | 422 int16_t gain, |
423 int32_t add_constant, | 423 int32_t add_constant, |
424 int16_t right_shifts, | 424 int16_t right_shifts, |
425 int vector_length); | 425 size_t vector_length); |
426 // End: iLBC specific functions. | 426 // End: iLBC specific functions. |
427 | 427 |
428 // Signal processing operations. | 428 // Signal processing operations. |
429 | 429 |
430 // A 32-bit fix-point implementation of auto-correlation computation | 430 // A 32-bit fix-point implementation of auto-correlation computation |
431 // | 431 // |
432 // Input: | 432 // Input: |
433 // - in_vector : Vector to calculate autocorrelation upon | 433 // - in_vector : Vector to calculate autocorrelation upon |
434 // - in_vector_length : Length (in samples) of |vector| | 434 // - in_vector_length : Length (in samples) of |vector| |
435 // - order : The order up to which the autocorrelation should be | 435 // - order : The order up to which the autocorrelation should be |
436 // calculated | 436 // calculated |
437 // | 437 // |
438 // Output: | 438 // Output: |
439 // - result : auto-correlation values (values should be seen | 439 // - result : auto-correlation values (values should be seen |
440 // relative to each other since the absolute values | 440 // relative to each other since the absolute values |
441 // might have been down shifted to avoid overflow) | 441 // might have been down shifted to avoid overflow) |
442 // | 442 // |
443 // - scale : The number of left shifts required to obtain the | 443 // - scale : The number of left shifts required to obtain the |
444 // auto-correlation in Q0 | 444 // auto-correlation in Q0 |
445 // | 445 // |
446 // Return value : | 446 // Return value : |
447 // - -1, if |order| > |in_vector_length|; | 447 // - -1, if |order| > |in_vector_length|; |
448 // - Number of samples in |result|, i.e. (order+1), otherwise. | 448 // - Number of samples in |result|, i.e. (order+1), otherwise. |
449 int WebRtcSpl_AutoCorrelation(const int16_t* in_vector, | 449 int WebRtcSpl_AutoCorrelation(const int16_t* in_vector, |
450 int in_vector_length, | 450 size_t in_vector_length, |
451 int order, | 451 size_t order, |
452 int32_t* result, | 452 int32_t* result, |
453 int* scale); | 453 int* scale); |
454 | 454 |
455 // A 32-bit fix-point implementation of the Levinson-Durbin algorithm that | 455 // A 32-bit fix-point implementation of the Levinson-Durbin algorithm that |
456 // does NOT use the 64 bit class | 456 // does NOT use the 64 bit class |
457 // | 457 // |
458 // Input: | 458 // Input: |
459 // - auto_corr : Vector with autocorrelation values of length >= |order|+1 | 459 // - auto_corr : Vector with autocorrelation values of length >= |order|+1 |
460 // - order : The LPC filter order (support up to order 20) | 460 // - order : The LPC filter order (support up to order 20) |
461 // | 461 // |
462 // Output: | 462 // Output: |
463 // - lpc_coef : lpc_coef[0..order] LPC coefficients in Q12 | 463 // - lpc_coef : lpc_coef[0..order] LPC coefficients in Q12 |
464 // - refl_coef : refl_coef[0...order-1]| Reflection coefficients in Q15 | 464 // - refl_coef : refl_coef[0...order-1]| Reflection coefficients in Q15 |
465 // | 465 // |
466 // Return value : 1 for stable 0 for unstable | 466 // Return value : 1 for stable 0 for unstable |
467 int16_t WebRtcSpl_LevinsonDurbin(const int32_t* auto_corr, | 467 int16_t WebRtcSpl_LevinsonDurbin(const int32_t* auto_corr, |
468 int16_t* lpc_coef, | 468 int16_t* lpc_coef, |
469 int16_t* refl_coef, | 469 int16_t* refl_coef, |
470 int16_t order); | 470 size_t order); |
471 | 471 |
472 // Converts reflection coefficients |refl_coef| to LPC coefficients |lpc_coef|. | 472 // Converts reflection coefficients |refl_coef| to LPC coefficients |lpc_coef|. |
473 // This version is a 16 bit operation. | 473 // This version is a 16 bit operation. |
474 // | 474 // |
475 // NOTE: The 16 bit refl_coef -> lpc_coef conversion might result in a | 475 // NOTE: The 16 bit refl_coef -> lpc_coef conversion might result in a |
476 // "slightly unstable" filter (i.e., a pole just outside the unit circle) in | 476 // "slightly unstable" filter (i.e., a pole just outside the unit circle) in |
477 // "rare" cases even if the reflection coefficients are stable. | 477 // "rare" cases even if the reflection coefficients are stable. |
478 // | 478 // |
479 // Input: | 479 // Input: |
480 // - refl_coef : Reflection coefficients in Q15 that should be converted | 480 // - refl_coef : Reflection coefficients in Q15 that should be converted |
(...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
533 // become the output Q-domain. | 533 // become the output Q-domain. |
534 // - step_seq2 : How many (positive or negative) steps the | 534 // - step_seq2 : How many (positive or negative) steps the |
535 // |vector2| pointer should be updated for each new | 535 // |vector2| pointer should be updated for each new |
536 // cross-correlation value. | 536 // cross-correlation value. |
537 // | 537 // |
538 // Output: | 538 // Output: |
539 // - cross_correlation : The cross-correlation in Q(-right_shifts) | 539 // - cross_correlation : The cross-correlation in Q(-right_shifts) |
540 typedef void (*CrossCorrelation)(int32_t* cross_correlation, | 540 typedef void (*CrossCorrelation)(int32_t* cross_correlation, |
541 const int16_t* seq1, | 541 const int16_t* seq1, |
542 const int16_t* seq2, | 542 const int16_t* seq2, |
543 int16_t dim_seq, | 543 size_t dim_seq, |
544 int16_t dim_cross_correlation, | 544 size_t dim_cross_correlation, |
545 int right_shifts, | 545 int right_shifts, |
546 int step_seq2); | 546 int step_seq2); |
547 extern CrossCorrelation WebRtcSpl_CrossCorrelation; | 547 extern CrossCorrelation WebRtcSpl_CrossCorrelation; |
548 void WebRtcSpl_CrossCorrelationC(int32_t* cross_correlation, | 548 void WebRtcSpl_CrossCorrelationC(int32_t* cross_correlation, |
549 const int16_t* seq1, | 549 const int16_t* seq1, |
550 const int16_t* seq2, | 550 const int16_t* seq2, |
551 int16_t dim_seq, | 551 size_t dim_seq, |
552 int16_t dim_cross_correlation, | 552 size_t dim_cross_correlation, |
553 int right_shifts, | 553 int right_shifts, |
554 int step_seq2); | 554 int step_seq2); |
555 #if (defined WEBRTC_DETECT_NEON) || (defined WEBRTC_HAS_NEON) | 555 #if (defined WEBRTC_DETECT_NEON) || (defined WEBRTC_HAS_NEON) |
556 void WebRtcSpl_CrossCorrelationNeon(int32_t* cross_correlation, | 556 void WebRtcSpl_CrossCorrelationNeon(int32_t* cross_correlation, |
557 const int16_t* seq1, | 557 const int16_t* seq1, |
558 const int16_t* seq2, | 558 const int16_t* seq2, |
559 int16_t dim_seq, | 559 size_t dim_seq, |
560 int16_t dim_cross_correlation, | 560 size_t dim_cross_correlation, |
561 int right_shifts, | 561 int right_shifts, |
562 int step_seq2); | 562 int step_seq2); |
563 #endif | 563 #endif |
564 #if defined(MIPS32_LE) | 564 #if defined(MIPS32_LE) |
565 void WebRtcSpl_CrossCorrelation_mips(int32_t* cross_correlation, | 565 void WebRtcSpl_CrossCorrelation_mips(int32_t* cross_correlation, |
566 const int16_t* seq1, | 566 const int16_t* seq1, |
567 const int16_t* seq2, | 567 const int16_t* seq2, |
568 int16_t dim_seq, | 568 size_t dim_seq, |
569 int16_t dim_cross_correlation, | 569 size_t dim_cross_correlation, |
570 int right_shifts, | 570 int right_shifts, |
571 int step_seq2); | 571 int step_seq2); |
572 #endif | 572 #endif |
573 | 573 |
574 // Creates (the first half of) a Hanning window. Size must be at least 1 and | 574 // Creates (the first half of) a Hanning window. Size must be at least 1 and |
575 // at most 512. | 575 // at most 512. |
576 // | 576 // |
577 // Input: | 577 // Input: |
578 // - size : Length of the requested Hanning window (1 to 512) | 578 // - size : Length of the requested Hanning window (1 to 512) |
579 // | 579 // |
580 // Output: | 580 // Output: |
581 // - window : Hanning vector in Q14. | 581 // - window : Hanning vector in Q14. |
582 void WebRtcSpl_GetHanningWindow(int16_t* window, int16_t size); | 582 void WebRtcSpl_GetHanningWindow(int16_t* window, size_t size); |
583 | 583 |
584 // Calculates y[k] = sqrt(1 - x[k]^2) for each element of the input vector | 584 // Calculates y[k] = sqrt(1 - x[k]^2) for each element of the input vector |
585 // |in_vector|. Input and output values are in Q15. | 585 // |in_vector|. Input and output values are in Q15. |
586 // | 586 // |
587 // Inputs: | 587 // Inputs: |
588 // - in_vector : Values to calculate sqrt(1 - x^2) of | 588 // - in_vector : Values to calculate sqrt(1 - x^2) of |
589 // - vector_length : Length of vector |in_vector| | 589 // - vector_length : Length of vector |in_vector| |
590 // | 590 // |
591 // Output: | 591 // Output: |
592 // - out_vector : Output values in Q15 | 592 // - out_vector : Output values in Q15 |
593 void WebRtcSpl_SqrtOfOneMinusXSquared(int16_t* in_vector, | 593 void WebRtcSpl_SqrtOfOneMinusXSquared(int16_t* in_vector, |
594 int vector_length, | 594 size_t vector_length, |
595 int16_t* out_vector); | 595 int16_t* out_vector); |
596 // End: Signal processing operations. | 596 // End: Signal processing operations. |
597 | 597 |
598 // Randomization functions. Implementations collected in | 598 // Randomization functions. Implementations collected in |
599 // randomization_functions.c and descriptions at bottom of this file. | 599 // randomization_functions.c and descriptions at bottom of this file. |
600 int16_t WebRtcSpl_RandU(uint32_t* seed); | 600 int16_t WebRtcSpl_RandU(uint32_t* seed); |
601 int16_t WebRtcSpl_RandN(uint32_t* seed); | 601 int16_t WebRtcSpl_RandN(uint32_t* seed); |
602 int16_t WebRtcSpl_RandUArray(int16_t* vector, | 602 int16_t WebRtcSpl_RandUArray(int16_t* vector, |
603 int16_t vector_length, | 603 int16_t vector_length, |
604 uint32_t* seed); | 604 uint32_t* seed); |
605 // End: Randomization functions. | 605 // End: Randomization functions. |
606 | 606 |
607 // Math functions | 607 // Math functions |
608 int32_t WebRtcSpl_Sqrt(int32_t value); | 608 int32_t WebRtcSpl_Sqrt(int32_t value); |
609 int32_t WebRtcSpl_SqrtFloor(int32_t value); | 609 int32_t WebRtcSpl_SqrtFloor(int32_t value); |
610 | 610 |
611 // Divisions. Implementations collected in division_operations.c and | 611 // Divisions. Implementations collected in division_operations.c and |
612 // descriptions at bottom of this file. | 612 // descriptions at bottom of this file. |
613 uint32_t WebRtcSpl_DivU32U16(uint32_t num, uint16_t den); | 613 uint32_t WebRtcSpl_DivU32U16(uint32_t num, uint16_t den); |
614 int32_t WebRtcSpl_DivW32W16(int32_t num, int16_t den); | 614 int32_t WebRtcSpl_DivW32W16(int32_t num, int16_t den); |
615 int16_t WebRtcSpl_DivW32W16ResW16(int32_t num, int16_t den); | 615 int16_t WebRtcSpl_DivW32W16ResW16(int32_t num, int16_t den); |
616 int32_t WebRtcSpl_DivResultInQ31(int32_t num, int32_t den); | 616 int32_t WebRtcSpl_DivResultInQ31(int32_t num, int32_t den); |
617 int32_t WebRtcSpl_DivW32HiLow(int32_t num, int16_t den_hi, int16_t den_low); | 617 int32_t WebRtcSpl_DivW32HiLow(int32_t num, int16_t den_hi, int16_t den_low); |
618 // End: Divisions. | 618 // End: Divisions. |
619 | 619 |
620 int32_t WebRtcSpl_Energy(int16_t* vector, int vector_length, int* scale_factor); | 620 int32_t WebRtcSpl_Energy(int16_t* vector, |
| 621 size_t vector_length, |
| 622 int* scale_factor); |
621 | 623 |
622 // Calculates the dot product between two (int16_t) vectors. | 624 // Calculates the dot product between two (int16_t) vectors. |
623 // | 625 // |
624 // Input: | 626 // Input: |
625 // - vector1 : Vector 1 | 627 // - vector1 : Vector 1 |
626 // - vector2 : Vector 2 | 628 // - vector2 : Vector 2 |
627 // - vector_length : Number of samples used in the dot product | 629 // - vector_length : Number of samples used in the dot product |
628 // - scaling : The number of right bit shifts to apply on each term | 630 // - scaling : The number of right bit shifts to apply on each term |
629 // during calculation to avoid overflow, i.e., the | 631 // during calculation to avoid overflow, i.e., the |
630 // output will be in Q(-|scaling|) | 632 // output will be in Q(-|scaling|) |
631 // | 633 // |
632 // Return value : The dot product in Q(-scaling) | 634 // Return value : The dot product in Q(-scaling) |
633 int32_t WebRtcSpl_DotProductWithScale(const int16_t* vector1, | 635 int32_t WebRtcSpl_DotProductWithScale(const int16_t* vector1, |
634 const int16_t* vector2, | 636 const int16_t* vector2, |
635 int length, | 637 size_t length, |
636 int scaling); | 638 int scaling); |
637 | 639 |
638 // Filter operations. | 640 // Filter operations. |
639 int WebRtcSpl_FilterAR(const int16_t* ar_coef, | 641 size_t WebRtcSpl_FilterAR(const int16_t* ar_coef, |
640 int ar_coef_length, | 642 size_t ar_coef_length, |
641 const int16_t* in_vector, | 643 const int16_t* in_vector, |
642 int in_vector_length, | 644 size_t in_vector_length, |
643 int16_t* filter_state, | 645 int16_t* filter_state, |
644 int filter_state_length, | 646 size_t filter_state_length, |
645 int16_t* filter_state_low, | 647 int16_t* filter_state_low, |
646 int filter_state_low_length, | 648 size_t filter_state_low_length, |
647 int16_t* out_vector, | 649 int16_t* out_vector, |
648 int16_t* out_vector_low, | 650 int16_t* out_vector_low, |
649 int out_vector_low_length); | 651 size_t out_vector_low_length); |
650 | 652 |
651 // WebRtcSpl_FilterMAFastQ12(...) | 653 // WebRtcSpl_FilterMAFastQ12(...) |
652 // | 654 // |
653 // Performs a MA filtering on a vector in Q12 | 655 // Performs a MA filtering on a vector in Q12 |
654 // | 656 // |
655 // Input: | 657 // Input: |
656 // - in_vector : Input samples (state in positions | 658 // - in_vector : Input samples (state in positions |
657 // in_vector[-order] .. in_vector[-1]) | 659 // in_vector[-order] .. in_vector[-1]) |
658 // - ma_coef : Filter coefficients (in Q12) | 660 // - ma_coef : Filter coefficients (in Q12) |
659 // - ma_coef_length : Number of B coefficients (order+1) | 661 // - ma_coef_length : Number of B coefficients (order+1) |
660 // - vector_length : Number of samples to be filtered | 662 // - vector_length : Number of samples to be filtered |
661 // | 663 // |
662 // Output: | 664 // Output: |
663 // - out_vector : Filtered samples | 665 // - out_vector : Filtered samples |
664 // | 666 // |
665 void WebRtcSpl_FilterMAFastQ12(const int16_t* in_vector, | 667 void WebRtcSpl_FilterMAFastQ12(const int16_t* in_vector, |
666 int16_t* out_vector, | 668 int16_t* out_vector, |
667 const int16_t* ma_coef, | 669 const int16_t* ma_coef, |
668 int16_t ma_coef_length, | 670 size_t ma_coef_length, |
669 int16_t vector_length); | 671 size_t vector_length); |
670 | 672 |
671 // Performs a AR filtering on a vector in Q12 | 673 // Performs a AR filtering on a vector in Q12 |
672 // Input: | 674 // Input: |
673 // - data_in : Input samples | 675 // - data_in : Input samples |
674 // - data_out : State information in positions | 676 // - data_out : State information in positions |
675 // data_out[-order] .. data_out[-1] | 677 // data_out[-order] .. data_out[-1] |
676 // - coefficients : Filter coefficients (in Q12) | 678 // - coefficients : Filter coefficients (in Q12) |
677 // - coefficients_length: Number of coefficients (order+1) | 679 // - coefficients_length: Number of coefficients (order+1) |
678 // - data_length : Number of samples to be filtered | 680 // - data_length : Number of samples to be filtered |
679 // Output: | 681 // Output: |
680 // - data_out : Filtered samples | 682 // - data_out : Filtered samples |
681 void WebRtcSpl_FilterARFastQ12(const int16_t* data_in, | 683 void WebRtcSpl_FilterARFastQ12(const int16_t* data_in, |
682 int16_t* data_out, | 684 int16_t* data_out, |
683 const int16_t* __restrict coefficients, | 685 const int16_t* __restrict coefficients, |
684 int coefficients_length, | 686 size_t coefficients_length, |
685 int data_length); | 687 size_t data_length); |
686 | 688 |
687 // The functions (with related pointer) perform a MA down sampling filter | 689 // The functions (with related pointer) perform a MA down sampling filter |
688 // on a vector. | 690 // on a vector. |
689 // Input: | 691 // Input: |
690 // - data_in : Input samples (state in positions | 692 // - data_in : Input samples (state in positions |
691 // data_in[-order] .. data_in[-1]) | 693 // data_in[-order] .. data_in[-1]) |
692 // - data_in_length : Number of samples in |data_in| to be filtered. | 694 // - data_in_length : Number of samples in |data_in| to be filtered. |
693 // This must be at least | 695 // This must be at least |
694 // |delay| + |factor|*(|out_vector_length|-1) + 1) | 696 // |delay| + |factor|*(|out_vector_length|-1) + 1) |
695 // - data_out_length : Number of down sampled samples desired | 697 // - data_out_length : Number of down sampled samples desired |
696 // - coefficients : Filter coefficients (in Q12) | 698 // - coefficients : Filter coefficients (in Q12) |
697 // - coefficients_length: Number of coefficients (order+1) | 699 // - coefficients_length: Number of coefficients (order+1) |
698 // - factor : Decimation factor | 700 // - factor : Decimation factor |
699 // - delay : Delay of filter (compensated for in out_vector) | 701 // - delay : Delay of filter (compensated for in out_vector) |
700 // Output: | 702 // Output: |
701 // - data_out : Filtered samples | 703 // - data_out : Filtered samples |
702 // Return value : 0 if OK, -1 if |in_vector| is too short | 704 // Return value : 0 if OK, -1 if |in_vector| is too short |
703 typedef int (*DownsampleFast)(const int16_t* data_in, | 705 typedef int (*DownsampleFast)(const int16_t* data_in, |
704 int data_in_length, | 706 size_t data_in_length, |
705 int16_t* data_out, | 707 int16_t* data_out, |
706 int data_out_length, | 708 size_t data_out_length, |
707 const int16_t* __restrict coefficients, | 709 const int16_t* __restrict coefficients, |
708 int coefficients_length, | 710 size_t coefficients_length, |
709 int factor, | 711 int factor, |
710 int delay); | 712 size_t delay); |
711 extern DownsampleFast WebRtcSpl_DownsampleFast; | 713 extern DownsampleFast WebRtcSpl_DownsampleFast; |
712 int WebRtcSpl_DownsampleFastC(const int16_t* data_in, | 714 int WebRtcSpl_DownsampleFastC(const int16_t* data_in, |
713 int data_in_length, | 715 size_t data_in_length, |
714 int16_t* data_out, | 716 int16_t* data_out, |
715 int data_out_length, | 717 size_t data_out_length, |
716 const int16_t* __restrict coefficients, | 718 const int16_t* __restrict coefficients, |
717 int coefficients_length, | 719 size_t coefficients_length, |
718 int factor, | 720 int factor, |
719 int delay); | 721 size_t delay); |
720 #if (defined WEBRTC_DETECT_NEON) || (defined WEBRTC_HAS_NEON) | 722 #if (defined WEBRTC_DETECT_NEON) || (defined WEBRTC_HAS_NEON) |
721 int WebRtcSpl_DownsampleFastNeon(const int16_t* data_in, | 723 int WebRtcSpl_DownsampleFastNeon(const int16_t* data_in, |
722 int data_in_length, | 724 size_t data_in_length, |
723 int16_t* data_out, | 725 int16_t* data_out, |
724 int data_out_length, | 726 size_t data_out_length, |
725 const int16_t* __restrict coefficients, | 727 const int16_t* __restrict coefficients, |
726 int coefficients_length, | 728 size_t coefficients_length, |
727 int factor, | 729 int factor, |
728 int delay); | 730 size_t delay); |
729 #endif | 731 #endif |
730 #if defined(MIPS32_LE) | 732 #if defined(MIPS32_LE) |
731 int WebRtcSpl_DownsampleFast_mips(const int16_t* data_in, | 733 int WebRtcSpl_DownsampleFast_mips(const int16_t* data_in, |
732 int data_in_length, | 734 size_t data_in_length, |
733 int16_t* data_out, | 735 int16_t* data_out, |
734 int data_out_length, | 736 size_t data_out_length, |
735 const int16_t* __restrict coefficients, | 737 const int16_t* __restrict coefficients, |
736 int coefficients_length, | 738 size_t coefficients_length, |
737 int factor, | 739 int factor, |
738 int delay); | 740 size_t delay); |
739 #endif | 741 #endif |
740 | 742 |
741 // End: Filter operations. | 743 // End: Filter operations. |
742 | 744 |
743 // FFT operations | 745 // FFT operations |
744 | 746 |
745 int WebRtcSpl_ComplexFFT(int16_t vector[], int stages, int mode); | 747 int WebRtcSpl_ComplexFFT(int16_t vector[], int stages, int mode); |
746 int WebRtcSpl_ComplexIFFT(int16_t vector[], int stages, int mode); | 748 int WebRtcSpl_ComplexIFFT(int16_t vector[], int stages, int mode); |
747 | 749 |
748 // Treat a 16-bit complex data buffer |complex_data| as an array of 32-bit | 750 // Treat a 16-bit complex data buffer |complex_data| as an array of 32-bit |
(...skipping 88 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
837 * resample_fractional.c | 839 * resample_fractional.c |
838 * Functions for internal use in the other resample functions | 840 * Functions for internal use in the other resample functions |
839 * | 841 * |
840 * Includes the following resampling combinations | 842 * Includes the following resampling combinations |
841 * 48 kHz -> 32 kHz | 843 * 48 kHz -> 32 kHz |
842 * 32 kHz -> 24 kHz | 844 * 32 kHz -> 24 kHz |
843 * 44 kHz -> 32 kHz | 845 * 44 kHz -> 32 kHz |
844 * | 846 * |
845 ******************************************************************/ | 847 ******************************************************************/ |
846 | 848 |
847 void WebRtcSpl_Resample48khzTo32khz(const int32_t* In, int32_t* Out, int32_t K); | 849 void WebRtcSpl_Resample48khzTo32khz(const int32_t* In, int32_t* Out, size_t K); |
848 | 850 |
849 void WebRtcSpl_Resample32khzTo24khz(const int32_t* In, int32_t* Out, int32_t K); | 851 void WebRtcSpl_Resample32khzTo24khz(const int32_t* In, int32_t* Out, size_t K); |
850 | 852 |
851 void WebRtcSpl_Resample44khzTo32khz(const int32_t* In, int32_t* Out, int32_t K); | 853 void WebRtcSpl_Resample44khzTo32khz(const int32_t* In, int32_t* Out, size_t K); |
852 | 854 |
853 /******************************************************************* | 855 /******************************************************************* |
854 * resample_48khz.c | 856 * resample_48khz.c |
855 * | 857 * |
856 * Includes the following resampling combinations | 858 * Includes the following resampling combinations |
857 * 48 kHz -> 16 kHz | 859 * 48 kHz -> 16 kHz |
858 * 16 kHz -> 48 kHz | 860 * 16 kHz -> 48 kHz |
859 * 48 kHz -> 8 kHz | 861 * 48 kHz -> 8 kHz |
860 * 8 kHz -> 48 kHz | 862 * 8 kHz -> 48 kHz |
861 * | 863 * |
(...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
911 | 913 |
912 void WebRtcSpl_ResetResample8khzTo48khz(WebRtcSpl_State8khzTo48khz* state); | 914 void WebRtcSpl_ResetResample8khzTo48khz(WebRtcSpl_State8khzTo48khz* state); |
913 | 915 |
914 /******************************************************************* | 916 /******************************************************************* |
915 * resample_by_2.c | 917 * resample_by_2.c |
916 * | 918 * |
917 * Includes down and up sampling by a factor of two. | 919 * Includes down and up sampling by a factor of two. |
918 * | 920 * |
919 ******************************************************************/ | 921 ******************************************************************/ |
920 | 922 |
921 void WebRtcSpl_DownsampleBy2(const int16_t* in, int len, | 923 void WebRtcSpl_DownsampleBy2(const int16_t* in, size_t len, |
922 int16_t* out, int32_t* filtState); | 924 int16_t* out, int32_t* filtState); |
923 | 925 |
924 void WebRtcSpl_UpsampleBy2(const int16_t* in, int len, | 926 void WebRtcSpl_UpsampleBy2(const int16_t* in, size_t len, |
925 int16_t* out, int32_t* filtState); | 927 int16_t* out, int32_t* filtState); |
926 | 928 |
927 /************************************************************ | 929 /************************************************************ |
928 * END OF RESAMPLING FUNCTIONS | 930 * END OF RESAMPLING FUNCTIONS |
929 ************************************************************/ | 931 ************************************************************/ |
930 void WebRtcSpl_AnalysisQMF(const int16_t* in_data, | 932 void WebRtcSpl_AnalysisQMF(const int16_t* in_data, |
931 int in_data_length, | 933 size_t in_data_length, |
932 int16_t* low_band, | 934 int16_t* low_band, |
933 int16_t* high_band, | 935 int16_t* high_band, |
934 int32_t* filter_state1, | 936 int32_t* filter_state1, |
935 int32_t* filter_state2); | 937 int32_t* filter_state2); |
936 void WebRtcSpl_SynthesisQMF(const int16_t* low_band, | 938 void WebRtcSpl_SynthesisQMF(const int16_t* low_band, |
937 const int16_t* high_band, | 939 const int16_t* high_band, |
938 int band_length, | 940 size_t band_length, |
939 int16_t* out_data, | 941 int16_t* out_data, |
940 int32_t* filter_state1, | 942 int32_t* filter_state1, |
941 int32_t* filter_state2); | 943 int32_t* filter_state2); |
942 | 944 |
943 #ifdef __cplusplus | 945 #ifdef __cplusplus |
944 } | 946 } |
945 #endif // __cplusplus | 947 #endif // __cplusplus |
946 #endif // WEBRTC_SPL_SIGNAL_PROCESSING_LIBRARY_H_ | 948 #endif // WEBRTC_SPL_SIGNAL_PROCESSING_LIBRARY_H_ |
947 | 949 |
948 // | 950 // |
(...skipping 706 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1655 // This function multiply a 16-bit word by a 16-bit word, and accumulate this | 1657 // This function multiply a 16-bit word by a 16-bit word, and accumulate this |
1656 // value to a 32-bit integer. | 1658 // value to a 32-bit integer. |
1657 // | 1659 // |
1658 // Input: | 1660 // Input: |
1659 // - a : The value of the first 16-bit word. | 1661 // - a : The value of the first 16-bit word. |
1660 // - b : The value of the second 16-bit word. | 1662 // - b : The value of the second 16-bit word. |
1661 // - c : The value of an 32-bit integer. | 1663 // - c : The value of an 32-bit integer. |
1662 // | 1664 // |
1663 // Return Value: The value of a * b + c. | 1665 // Return Value: The value of a * b + c. |
1664 // | 1666 // |
OLD | NEW |