OLD | NEW |
1 /* | 1 /* |
2 * Copyright (c) 2013 The WebRTC project authors. All Rights Reserved. | 2 * Copyright (c) 2013 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 /* | 11 /* |
12 * The core AEC algorithm, which is presented with time-aligned signals. | 12 * The core AEC algorithm, which is presented with time-aligned signals. |
13 */ | 13 */ |
14 | 14 |
15 #include "webrtc/modules/audio_processing/aec/aec_core.h" | 15 #include "webrtc/modules/audio_processing/aec/aec_core.h" |
16 | 16 |
17 #include <math.h> | 17 #include <math.h> |
18 | 18 |
19 extern "C" { | 19 extern "C" { |
20 #include "webrtc/common_audio/signal_processing/include/signal_processing_librar
y.h" | 20 #include "webrtc/common_audio/signal_processing/include/signal_processing_librar
y.h" |
21 } | 21 } |
22 #include "webrtc/modules/audio_processing/aec/aec_core_optimized_methods.h" | 22 #include "webrtc/modules/audio_processing/aec/aec_core_optimized_methods.h" |
23 #include "webrtc/modules/audio_processing/aec/aec_rdft.h" | 23 #include "webrtc/modules/audio_processing/utility/ooura_fft.h" |
24 | 24 |
25 namespace webrtc { | 25 namespace webrtc { |
26 | 26 |
27 extern const float WebRtcAec_weightCurve[65]; | 27 extern const float WebRtcAec_weightCurve[65]; |
28 extern const float WebRtcAec_overDriveCurve[65]; | 28 extern const float WebRtcAec_overDriveCurve[65]; |
29 | 29 |
30 void WebRtcAec_FilterFar_mips( | 30 void WebRtcAec_FilterFar_mips( |
31 int num_partitions, | 31 int num_partitions, |
32 int x_fft_buf_block_pos, | 32 int x_fft_buf_block_pos, |
33 float x_fft_buf[2][kExtendedNumPartitions * PART_LEN1], | 33 float x_fft_buf[2][kExtendedNumPartitions * PART_LEN1], |
(...skipping 103 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
137 [f9] "=&f" (f9), [f10] "=&f" (f10), [f11] "=&f" (f11), | 137 [f9] "=&f" (f9), [f10] "=&f" (f10), [f11] "=&f" (f11), |
138 [f12] "=&f" (f12), [f13] "=&f" (f13), [aRe] "+r" (aRe), | 138 [f12] "=&f" (f12), [f13] "=&f" (f13), [aRe] "+r" (aRe), |
139 [aIm] "+r" (aIm), [bRe] "+r" (bRe), [bIm] "+r" (bIm), | 139 [aIm] "+r" (aIm), [bRe] "+r" (bRe), [bIm] "+r" (bIm), |
140 [yf0] "+r" (yf0), [yf1] "+r" (yf1), [len] "+r" (len) | 140 [yf0] "+r" (yf0), [yf1] "+r" (yf1), [len] "+r" (len) |
141 : | 141 : |
142 : "memory"); | 142 : "memory"); |
143 } | 143 } |
144 } | 144 } |
145 | 145 |
146 void WebRtcAec_FilterAdaptation_mips( | 146 void WebRtcAec_FilterAdaptation_mips( |
| 147 const OouraFft& ooura_fft, |
147 int num_partitions, | 148 int num_partitions, |
148 int x_fft_buf_block_pos, | 149 int x_fft_buf_block_pos, |
149 float x_fft_buf[2][kExtendedNumPartitions * PART_LEN1], | 150 float x_fft_buf[2][kExtendedNumPartitions * PART_LEN1], |
150 float e_fft[2][PART_LEN1], | 151 float e_fft[2][PART_LEN1], |
151 float h_fft_buf[2][kExtendedNumPartitions * PART_LEN1]) { | 152 float h_fft_buf[2][kExtendedNumPartitions * PART_LEN1]) { |
152 float fft[PART_LEN2]; | 153 float fft[PART_LEN2]; |
153 int i; | 154 int i; |
154 for (i = 0; i < num_partitions; i++) { | 155 for (i = 0; i < num_partitions; i++) { |
155 int xPos = (i + x_fft_buf_block_pos) * (PART_LEN1); | 156 int xPos = (i + x_fft_buf_block_pos) * (PART_LEN1); |
156 int pos; | 157 int pos; |
(...skipping 74 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
231 : [f0] "=&f" (f0), [f1] "=&f" (f1), [f2] "=&f" (f2), | 232 : [f0] "=&f" (f0), [f1] "=&f" (f1), [f2] "=&f" (f2), |
232 [f3] "=&f" (f3), [f4] "=&f" (f4), [f5] "=&f" (f5), | 233 [f3] "=&f" (f3), [f4] "=&f" (f4), [f5] "=&f" (f5), |
233 [f6] "=&f" (f6), [f7] "=&f" (f7), [f8] "=&f" (f8), | 234 [f6] "=&f" (f6), [f7] "=&f" (f7), [f8] "=&f" (f8), |
234 [f9] "=&f" (f9), [f10] "=&f" (f10), [f11] "=&f" (f11), | 235 [f9] "=&f" (f9), [f10] "=&f" (f10), [f11] "=&f" (f11), |
235 [f12] "=&f" (f12), [aRe] "+r" (aRe), [aIm] "+r" (aIm), | 236 [f12] "=&f" (f12), [aRe] "+r" (aRe), [aIm] "+r" (aIm), |
236 [bRe] "+r" (bRe), [bIm] "+r" (bIm), [fft_tmp] "=&r" (fft_tmp), | 237 [bRe] "+r" (bRe), [bIm] "+r" (bIm), [fft_tmp] "=&r" (fft_tmp), |
237 [len] "+r" (len) | 238 [len] "+r" (len) |
238 : [fft] "r" (fft) | 239 : [fft] "r" (fft) |
239 : "memory"); | 240 : "memory"); |
240 | 241 |
241 aec_rdft_inverse_128(fft); | 242 ooura_fft.InverseFft(fft); |
242 memset(fft + PART_LEN, 0, sizeof(float) * PART_LEN); | 243 memset(fft + PART_LEN, 0, sizeof(float) * PART_LEN); |
243 | 244 |
244 // fft scaling | 245 // fft scaling |
245 { | 246 { |
246 float scale = 2.0f / PART_LEN2; | 247 float scale = 2.0f / PART_LEN2; |
247 __asm __volatile( | 248 __asm __volatile( |
248 ".set push \n\t" | 249 ".set push \n\t" |
249 ".set noreorder \n\t" | 250 ".set noreorder \n\t" |
250 "addiu %[fft_tmp], %[fft], 0 \n\t" | 251 "addiu %[fft_tmp], %[fft], 0 \n\t" |
251 "addiu %[len], $zero, 8 \n\t" | 252 "addiu %[len], $zero, 8 \n\t" |
(...skipping 26 matching lines...) Expand all Loading... |
278 "bgtz %[len], 1b \n\t" | 279 "bgtz %[len], 1b \n\t" |
279 " addiu %[fft_tmp], %[fft_tmp], 32 \n\t" | 280 " addiu %[fft_tmp], %[fft_tmp], 32 \n\t" |
280 ".set pop \n\t" | 281 ".set pop \n\t" |
281 : [f0] "=&f" (f0), [f1] "=&f" (f1), [f2] "=&f" (f2), | 282 : [f0] "=&f" (f0), [f1] "=&f" (f1), [f2] "=&f" (f2), |
282 [f3] "=&f" (f3), [f4] "=&f" (f4), [f5] "=&f" (f5), | 283 [f3] "=&f" (f3), [f4] "=&f" (f4), [f5] "=&f" (f5), |
283 [f6] "=&f" (f6), [f7] "=&f" (f7), [len] "=&r" (len), | 284 [f6] "=&f" (f6), [f7] "=&f" (f7), [len] "=&r" (len), |
284 [fft_tmp] "=&r" (fft_tmp) | 285 [fft_tmp] "=&r" (fft_tmp) |
285 : [scale] "f" (scale), [fft] "r" (fft) | 286 : [scale] "f" (scale), [fft] "r" (fft) |
286 : "memory"); | 287 : "memory"); |
287 } | 288 } |
288 aec_rdft_forward_128(fft); | 289 ooura_fft.Fft(fft); |
289 aRe = h_fft_buf[0] + pos; | 290 aRe = h_fft_buf[0] + pos; |
290 aIm = h_fft_buf[1] + pos; | 291 aIm = h_fft_buf[1] + pos; |
291 __asm __volatile( | 292 __asm __volatile( |
292 ".set push \n\t" | 293 ".set push \n\t" |
293 ".set noreorder \n\t" | 294 ".set noreorder \n\t" |
294 "addiu %[fft_tmp], %[fft], 0 \n\t" | 295 "addiu %[fft_tmp], %[fft], 0 \n\t" |
295 "addiu %[len], $zero, 31 \n\t" | 296 "addiu %[len], $zero, 31 \n\t" |
296 "lwc1 %[f0], 0(%[aRe]) \n\t" | 297 "lwc1 %[f0], 0(%[aRe]) \n\t" |
297 "lwc1 %[f1], 0(%[fft_tmp]) \n\t" | 298 "lwc1 %[f1], 0(%[fft_tmp]) \n\t" |
298 "lwc1 %[f2], 256(%[aRe]) \n\t" | 299 "lwc1 %[f2], 256(%[aRe]) \n\t" |
(...skipping 181 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
480 } | 481 } |
481 | 482 |
482 void WebRtcAec_InitAec_mips(void) { | 483 void WebRtcAec_InitAec_mips(void) { |
483 WebRtcAec_FilterFar = WebRtcAec_FilterFar_mips; | 484 WebRtcAec_FilterFar = WebRtcAec_FilterFar_mips; |
484 WebRtcAec_FilterAdaptation = WebRtcAec_FilterAdaptation_mips; | 485 WebRtcAec_FilterAdaptation = WebRtcAec_FilterAdaptation_mips; |
485 WebRtcAec_ScaleErrorSignal = WebRtcAec_ScaleErrorSignal_mips; | 486 WebRtcAec_ScaleErrorSignal = WebRtcAec_ScaleErrorSignal_mips; |
486 WebRtcAec_Overdrive = WebRtcAec_Overdrive_mips; | 487 WebRtcAec_Overdrive = WebRtcAec_Overdrive_mips; |
487 WebRtcAec_Suppress = WebRtcAec_Suppress_mips; | 488 WebRtcAec_Suppress = WebRtcAec_Suppress_mips; |
488 } | 489 } |
489 } // namespace webrtc | 490 } // namespace webrtc |
OLD | NEW |