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 #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 } |
20 #include "webrtc/modules/audio_processing/aec/aec_core_internal.h" | 22 #include "webrtc/modules/audio_processing/aec/aec_core_internal.h" |
| 23 extern "C" { |
21 #include "webrtc/modules/audio_processing/aec/aec_rdft.h" | 24 #include "webrtc/modules/audio_processing/aec/aec_rdft.h" |
| 25 } |
22 | 26 |
23 extern const float WebRtcAec_weightCurve[65]; | 27 extern const float WebRtcAec_weightCurve[65]; |
24 extern const float WebRtcAec_overDriveCurve[65]; | 28 extern const float WebRtcAec_overDriveCurve[65]; |
25 | 29 |
26 void WebRtcAec_ComfortNoise_mips(AecCore* aec, | 30 void WebRtcAec_ComfortNoise_mips(AecCore* aec, |
27 float efw[2][PART_LEN1], | 31 float efw[2][PART_LEN1], |
28 float comfortNoiseHband[2][PART_LEN1], | 32 float comfortNoiseHband[2][PART_LEN1], |
29 const float* noisePow, | 33 const float* noisePow, |
30 const float* lambda) { | 34 const float* lambda) { |
31 int i, num; | 35 int i, num; |
(...skipping 154 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
186 "lwc1 %[tmp10f], 12(%[u_ptr]) \n\t" | 190 "lwc1 %[tmp10f], 12(%[u_ptr]) \n\t" |
187 #if !defined(MIPS32_R2_LE) | 191 #if !defined(MIPS32_R2_LE) |
188 "mul.s %[tmp3f], %[tmp1f], %[tmp3f] \n\t" | 192 "mul.s %[tmp3f], %[tmp1f], %[tmp3f] \n\t" |
189 "add.s %[tmp2f], %[tmp2f], %[tmp3f] \n\t" | 193 "add.s %[tmp2f], %[tmp2f], %[tmp3f] \n\t" |
190 "mul.s %[tmp3f], %[tmp1f], %[tmp5f] \n\t" | 194 "mul.s %[tmp3f], %[tmp1f], %[tmp5f] \n\t" |
191 "add.s %[tmp4f], %[tmp4f], %[tmp3f] \n\t" | 195 "add.s %[tmp4f], %[tmp4f], %[tmp3f] \n\t" |
192 "mul.s %[tmp3f], %[tmp6f], %[tmp8f] \n\t" | 196 "mul.s %[tmp3f], %[tmp6f], %[tmp8f] \n\t" |
193 "add.s %[tmp7f], %[tmp7f], %[tmp3f] \n\t" | 197 "add.s %[tmp7f], %[tmp7f], %[tmp3f] \n\t" |
194 "mul.s %[tmp3f], %[tmp6f], %[tmp10f] \n\t" | 198 "mul.s %[tmp3f], %[tmp6f], %[tmp10f] \n\t" |
195 "add.s %[tmp9f], %[tmp9f], %[tmp3f] \n\t" | 199 "add.s %[tmp9f], %[tmp9f], %[tmp3f] \n\t" |
196 #else // #if !defined(MIPS32_R2_LE) | 200 #else // #if !defined(MIPS32_R2_LE) |
197 "madd.s %[tmp2f], %[tmp2f], %[tmp1f], %[tmp3f] \n\t" | 201 "madd.s %[tmp2f], %[tmp2f], %[tmp1f], %[tmp3f] \n\t" |
198 "madd.s %[tmp4f], %[tmp4f], %[tmp1f], %[tmp5f] \n\t" | 202 "madd.s %[tmp4f], %[tmp4f], %[tmp1f], %[tmp5f] \n\t" |
199 "madd.s %[tmp7f], %[tmp7f], %[tmp6f], %[tmp8f] \n\t" | 203 "madd.s %[tmp7f], %[tmp7f], %[tmp6f], %[tmp8f] \n\t" |
200 "madd.s %[tmp9f], %[tmp9f], %[tmp6f], %[tmp10f] \n\t" | 204 "madd.s %[tmp9f], %[tmp9f], %[tmp6f], %[tmp10f] \n\t" |
201 #endif // #if !defined(MIPS32_R2_LE) | 205 #endif // #if !defined(MIPS32_R2_LE) |
202 "swc1 %[tmp2f], 0(%[efw_ptr_0]) \n\t" | 206 "swc1 %[tmp2f], 0(%[efw_ptr_0]) \n\t" |
203 "swc1 %[tmp4f], 0(%[efw_ptr_1]) \n\t" | 207 "swc1 %[tmp4f], 0(%[efw_ptr_1]) \n\t" |
204 "swc1 %[tmp7f], 4(%[efw_ptr_0]) \n\t" | 208 "swc1 %[tmp7f], 4(%[efw_ptr_0]) \n\t" |
205 "b 5f \n\t" | 209 "b 5f \n\t" |
206 " swc1 %[tmp9f], 4(%[efw_ptr_1]) \n\t" | 210 " swc1 %[tmp9f], 4(%[efw_ptr_1]) \n\t" |
207 "3: \n\t" | 211 "3: \n\t" |
208 "mul.s %[tmp1f], %[tmp1f], %[tmp1f] \n\t" | 212 "mul.s %[tmp1f], %[tmp1f], %[tmp1f] \n\t" |
209 "sub.s %[tmp1f], %[tmp1c], %[tmp1f] \n\t" | 213 "sub.s %[tmp1f], %[tmp1c], %[tmp1f] \n\t" |
210 "sqrt.s %[tmp1f], %[tmp1f] \n\t" | 214 "sqrt.s %[tmp1f], %[tmp1f] \n\t" |
211 "lwc1 %[tmp2f], 0(%[efw_ptr_0]) \n\t" | 215 "lwc1 %[tmp2f], 0(%[efw_ptr_0]) \n\t" |
212 "lwc1 %[tmp3f], 0(%[u_ptr]) \n\t" | 216 "lwc1 %[tmp3f], 0(%[u_ptr]) \n\t" |
213 "lwc1 %[tmp4f], 0(%[efw_ptr_1]) \n\t" | 217 "lwc1 %[tmp4f], 0(%[efw_ptr_1]) \n\t" |
214 "lwc1 %[tmp5f], 4(%[u_ptr]) \n\t" | 218 "lwc1 %[tmp5f], 4(%[u_ptr]) \n\t" |
215 #if !defined(MIPS32_R2_LE) | 219 #if !defined(MIPS32_R2_LE) |
216 "mul.s %[tmp3f], %[tmp1f], %[tmp3f] \n\t" | 220 "mul.s %[tmp3f], %[tmp1f], %[tmp3f] \n\t" |
217 "add.s %[tmp2f], %[tmp2f], %[tmp3f] \n\t" | 221 "add.s %[tmp2f], %[tmp2f], %[tmp3f] \n\t" |
218 "mul.s %[tmp3f], %[tmp1f], %[tmp5f] \n\t" | 222 "mul.s %[tmp3f], %[tmp1f], %[tmp5f] \n\t" |
219 "add.s %[tmp4f], %[tmp4f], %[tmp3f] \n\t" | 223 "add.s %[tmp4f], %[tmp4f], %[tmp3f] \n\t" |
220 #else // #if !defined(MIPS32_R2_LE) | 224 #else // #if !defined(MIPS32_R2_LE) |
221 "madd.s %[tmp2f], %[tmp2f], %[tmp1f], %[tmp3f] \n\t" | 225 "madd.s %[tmp2f], %[tmp2f], %[tmp1f], %[tmp3f] \n\t" |
222 "madd.s %[tmp4f], %[tmp4f], %[tmp1f], %[tmp5f] \n\t" | 226 "madd.s %[tmp4f], %[tmp4f], %[tmp1f], %[tmp5f] \n\t" |
223 #endif // #if !defined(MIPS32_R2_LE) | 227 #endif // #if !defined(MIPS32_R2_LE) |
224 "swc1 %[tmp2f], 0(%[efw_ptr_0]) \n\t" | 228 "swc1 %[tmp2f], 0(%[efw_ptr_0]) \n\t" |
225 "b 5f \n\t" | 229 "b 5f \n\t" |
226 " swc1 %[tmp4f], 0(%[efw_ptr_1]) \n\t" | 230 " swc1 %[tmp4f], 0(%[efw_ptr_1]) \n\t" |
227 "4: \n\t" | 231 "4: \n\t" |
228 "c.lt.s %[tmp6f], %[tmp1c] \n\t" | 232 "c.lt.s %[tmp6f], %[tmp1c] \n\t" |
229 "bc1f 5f \n\t" | 233 "bc1f 5f \n\t" |
230 " nop \n\t" | 234 " nop \n\t" |
231 "mul.s %[tmp6f], %[tmp6f], %[tmp6f] \n\t" | 235 "mul.s %[tmp6f], %[tmp6f], %[tmp6f] \n\t" |
232 "sub.s %[tmp6f], %[tmp1c], %[tmp6f] \n\t" | 236 "sub.s %[tmp6f], %[tmp1c], %[tmp6f] \n\t" |
233 "sqrt.s %[tmp6f], %[tmp6f] \n\t" | 237 "sqrt.s %[tmp6f], %[tmp6f] \n\t" |
234 "lwc1 %[tmp7f], 4(%[efw_ptr_0]) \n\t" | 238 "lwc1 %[tmp7f], 4(%[efw_ptr_0]) \n\t" |
235 "lwc1 %[tmp8f], 8(%[u_ptr]) \n\t" | 239 "lwc1 %[tmp8f], 8(%[u_ptr]) \n\t" |
236 "lwc1 %[tmp9f], 4(%[efw_ptr_1]) \n\t" | 240 "lwc1 %[tmp9f], 4(%[efw_ptr_1]) \n\t" |
237 "lwc1 %[tmp10f], 12(%[u_ptr]) \n\t" | 241 "lwc1 %[tmp10f], 12(%[u_ptr]) \n\t" |
238 #if !defined(MIPS32_R2_LE) | 242 #if !defined(MIPS32_R2_LE) |
239 "mul.s %[tmp3f], %[tmp6f], %[tmp8f] \n\t" | 243 "mul.s %[tmp3f], %[tmp6f], %[tmp8f] \n\t" |
240 "add.s %[tmp7f], %[tmp7f], %[tmp3f] \n\t" | 244 "add.s %[tmp7f], %[tmp7f], %[tmp3f] \n\t" |
241 "mul.s %[tmp3f], %[tmp6f], %[tmp10f] \n\t" | 245 "mul.s %[tmp3f], %[tmp6f], %[tmp10f] \n\t" |
242 "add.s %[tmp9f], %[tmp9f], %[tmp3f] \n\t" | 246 "add.s %[tmp9f], %[tmp9f], %[tmp3f] \n\t" |
243 #else // #if !defined(MIPS32_R2_LE) | 247 #else // #if !defined(MIPS32_R2_LE) |
244 "madd.s %[tmp7f], %[tmp7f], %[tmp6f], %[tmp8f] \n\t" | 248 "madd.s %[tmp7f], %[tmp7f], %[tmp6f], %[tmp8f] \n\t" |
245 "madd.s %[tmp9f], %[tmp9f], %[tmp6f], %[tmp10f] \n\t" | 249 "madd.s %[tmp9f], %[tmp9f], %[tmp6f], %[tmp10f] \n\t" |
246 #endif // #if !defined(MIPS32_R2_LE) | 250 #endif // #if !defined(MIPS32_R2_LE) |
247 "swc1 %[tmp7f], 4(%[efw_ptr_0]) \n\t" | 251 "swc1 %[tmp7f], 4(%[efw_ptr_0]) \n\t" |
248 "swc1 %[tmp9f], 4(%[efw_ptr_1]) \n\t" | 252 "swc1 %[tmp9f], 4(%[efw_ptr_1]) \n\t" |
249 "5: \n\t" | 253 "5: \n\t" |
250 "addiu %[u_ptr], %[u_ptr], 16 \n\t" | 254 "addiu %[u_ptr], %[u_ptr], 16 \n\t" |
251 "addiu %[efw_ptr_0], %[efw_ptr_0], 8 \n\t" | 255 "addiu %[efw_ptr_0], %[efw_ptr_0], 8 \n\t" |
252 "bne %[u_ptr], %[u_ptr_end], 1b \n\t" | 256 "bne %[u_ptr], %[u_ptr_end], 1b \n\t" |
253 " addiu %[efw_ptr_1], %[efw_ptr_1], 8 \n\t" | 257 " addiu %[efw_ptr_1], %[efw_ptr_1], 8 \n\t" |
254 ".set pop \n\t" | 258 ".set pop \n\t" |
255 : [lambda] "+r" (lambda), [u_ptr] "+r" (u_ptr), | 259 : [lambda] "+r" (lambda), [u_ptr] "+r" (u_ptr), |
256 [efw_ptr_0] "+r" (efw_ptr_0), [efw_ptr_1] "+r" (efw_ptr_1), | 260 [efw_ptr_0] "+r" (efw_ptr_0), [efw_ptr_1] "+r" (efw_ptr_1), |
257 [tmp1f] "=&f" (tmp1f), [tmp2f] "=&f" (tmp2f), [tmp3f] "=&f" (tmp3f), | 261 [tmp1f] "=&f" (tmp1f), [tmp2f] "=&f" (tmp2f), [tmp3f] "=&f" (tmp3f), |
258 [tmp4f] "=&f" (tmp4f), [tmp5f] "=&f" (tmp5f), | 262 [tmp4f] "=&f" (tmp4f), [tmp5f] "=&f" (tmp5f), |
259 [tmp6f] "=&f" (tmp6f), [tmp7f] "=&f" (tmp7f), [tmp8f] "=&f" (tmp8f), | 263 [tmp6f] "=&f" (tmp6f), [tmp7f] "=&f" (tmp7f), [tmp8f] "=&f" (tmp8f), |
260 [tmp9f] "=&f" (tmp9f), [tmp10f] "=&f" (tmp10f) | 264 [tmp9f] "=&f" (tmp9f), [tmp10f] "=&f" (tmp10f) |
261 : [tmp1c] "f" (tmp1c), [u_ptr_end] "r" (u_ptr_end) | 265 : [tmp1c] "f" (tmp1c), [u_ptr_end] "r" (u_ptr_end) |
262 : "memory" | 266 : "memory" |
263 ); | 267 ); |
264 | 268 |
265 lambda -= PART_LEN; | 269 lambda -= PART_LEN; |
266 tmp = sqrtf(WEBRTC_SPL_MAX(1 - lambda[PART_LEN] * lambda[PART_LEN], 0)); | 270 tmp = sqrtf(WEBRTC_SPL_MAX(1 - lambda[PART_LEN] * lambda[PART_LEN], 0)); |
267 // tmp = 1 - lambda[i]; | 271 // tmp = 1 - lambda[i]; |
268 efw[0][PART_LEN] += tmp * u[PART_LEN][0]; | 272 efw[0][PART_LEN] += tmp * u[PART_LEN][0]; |
269 efw[1][PART_LEN] += tmp * u[PART_LEN][1]; | 273 efw[1][PART_LEN] += tmp * u[PART_LEN][1]; |
270 | 274 |
271 // For H band comfort noise | 275 // For H band comfort noise |
272 // TODO: don't compute noise and "tmp" twice. Use the previous results. | 276 // TODO(peah): don't compute noise and "tmp" twice. Use the previous results. |
273 noiseAvg = 0.0; | 277 noiseAvg = 0.0; |
274 tmpAvg = 0.0; | 278 tmpAvg = 0.0; |
275 num = 0; | 279 num = 0; |
276 if (aec->num_bands > 1) { | 280 if (aec->num_bands > 1) { |
277 for (i = 0; i < PART_LEN; i++) { | 281 for (i = 0; i < PART_LEN; i++) { |
278 rand[i] = ((float)randW16[i]) / 32768; | 282 rand[i] = (static_cast<float>(randW16[i])) / 32768; |
279 } | 283 } |
280 | 284 |
281 // average noise scale | 285 // average noise scale |
282 // average over second half of freq spectrum (i.e., 4->8khz) | 286 // average over second half of freq spectrum (i.e., 4->8khz) |
283 // TODO: we shouldn't need num. We know how many elements we're summing. | 287 // TODO(peah): we shouldn't need num. We know how many elements we're |
| 288 // summing. |
284 for (i = PART_LEN1 >> 1; i < PART_LEN1; i++) { | 289 for (i = PART_LEN1 >> 1; i < PART_LEN1; i++) { |
285 num++; | 290 num++; |
286 noiseAvg += sqrtf(noisePow[i]); | 291 noiseAvg += sqrtf(noisePow[i]); |
287 } | 292 } |
288 noiseAvg /= (float)num; | 293 noiseAvg /= static_cast<float>(num); |
289 | 294 |
290 // average nlp scale | 295 // average nlp scale |
291 // average over second half of freq spectrum (i.e., 4->8khz) | 296 // average over second half of freq spectrum (i.e., 4->8khz) |
292 // TODO: we shouldn't need num. We know how many elements we're summing. | 297 // TODO(peah): we shouldn't need num. We know how many elements we're |
| 298 // summing. |
293 num = 0; | 299 num = 0; |
294 for (i = PART_LEN1 >> 1; i < PART_LEN1; i++) { | 300 for (i = PART_LEN1 >> 1; i < PART_LEN1; i++) { |
295 num++; | 301 num++; |
296 tmpAvg += sqrtf(WEBRTC_SPL_MAX(1 - lambda[i] * lambda[i], 0)); | 302 tmpAvg += sqrtf(WEBRTC_SPL_MAX(1 - lambda[i] * lambda[i], 0)); |
297 } | 303 } |
298 tmpAvg /= (float)num; | 304 tmpAvg /= static_cast<float>(num); |
299 | 305 |
300 // Use average noise for H band | 306 // Use average noise for H band |
301 // TODO: we should probably have a new random vector here. | 307 // TODO(peah): we should probably have a new random vector here. |
302 // Reject LF noise | 308 // Reject LF noise |
303 u[0][0] = 0; | 309 u[0][0] = 0; |
304 u[0][1] = 0; | 310 u[0][1] = 0; |
305 for (i = 1; i < PART_LEN1; i++) { | 311 for (i = 1; i < PART_LEN1; i++) { |
306 tmp = pi2 * rand[i - 1]; | 312 tmp = pi2 * rand[i - 1]; |
307 | 313 |
308 // Use average noise for H band | 314 // Use average noise for H band |
309 u[i][0] = noiseAvg * (float)cos(tmp); | 315 u[i][0] = noiseAvg * static_cast<float>(cos(tmp)); |
310 u[i][1] = -noiseAvg * (float)sin(tmp); | 316 u[i][1] = -noiseAvg * static_cast<float>(sin(tmp)); |
311 } | 317 } |
312 u[PART_LEN][1] = 0; | 318 u[PART_LEN][1] = 0; |
313 | 319 |
314 for (i = 0; i < PART_LEN1; i++) { | 320 for (i = 0; i < PART_LEN1; i++) { |
315 // Use average NLP weight for H band | 321 // Use average NLP weight for H band |
316 comfortNoiseHband[0][i] = tmpAvg * u[i][0]; | 322 comfortNoiseHband[0][i] = tmpAvg * u[i][0]; |
317 comfortNoiseHband[1][i] = tmpAvg * u[i][1]; | 323 comfortNoiseHband[1][i] = tmpAvg * u[i][1]; |
318 } | 324 } |
319 } else { | 325 } else { |
320 memset(comfortNoiseHband, 0, | 326 memset(comfortNoiseHband, 0, |
(...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
369 "addiu %[aIm], %[aIm], 8 \n\t" | 375 "addiu %[aIm], %[aIm], 8 \n\t" |
370 "addiu %[len], %[len], -1 \n\t" | 376 "addiu %[len], %[len], -1 \n\t" |
371 "sub.s %[f8], %[f8], %[f12] \n\t" | 377 "sub.s %[f8], %[f8], %[f12] \n\t" |
372 "mul.s %[f12], %[f7], %[f5] \n\t" | 378 "mul.s %[f12], %[f7], %[f5] \n\t" |
373 "lwc1 %[f2], 0(%[yf0]) \n\t" | 379 "lwc1 %[f2], 0(%[yf0]) \n\t" |
374 "add.s %[f1], %[f0], %[f1] \n\t" | 380 "add.s %[f1], %[f0], %[f1] \n\t" |
375 "lwc1 %[f3], 0(%[yf1]) \n\t" | 381 "lwc1 %[f3], 0(%[yf1]) \n\t" |
376 "sub.s %[f9], %[f9], %[f11] \n\t" | 382 "sub.s %[f9], %[f9], %[f11] \n\t" |
377 "lwc1 %[f6], 4(%[yf0]) \n\t" | 383 "lwc1 %[f6], 4(%[yf0]) \n\t" |
378 "add.s %[f4], %[f4], %[f12] \n\t" | 384 "add.s %[f4], %[f4], %[f12] \n\t" |
379 #else // #if !defined(MIPS32_R2_LE) | 385 #else // #if !defined(MIPS32_R2_LE) |
380 "addiu %[aRe], %[aRe], 8 \n\t" | 386 "addiu %[aRe], %[aRe], 8 \n\t" |
381 "addiu %[aIm], %[aIm], 8 \n\t" | 387 "addiu %[aIm], %[aIm], 8 \n\t" |
382 "addiu %[len], %[len], -1 \n\t" | 388 "addiu %[len], %[len], -1 \n\t" |
383 "nmsub.s %[f8], %[f8], %[f2], %[f3] \n\t" | 389 "nmsub.s %[f8], %[f8], %[f2], %[f3] \n\t" |
384 "lwc1 %[f2], 0(%[yf0]) \n\t" | 390 "lwc1 %[f2], 0(%[yf0]) \n\t" |
385 "madd.s %[f1], %[f0], %[f3], %[f1] \n\t" | 391 "madd.s %[f1], %[f0], %[f3], %[f1] \n\t" |
386 "lwc1 %[f3], 0(%[yf1]) \n\t" | 392 "lwc1 %[f3], 0(%[yf1]) \n\t" |
387 "nmsub.s %[f9], %[f9], %[f6], %[f7] \n\t" | 393 "nmsub.s %[f9], %[f9], %[f6], %[f7] \n\t" |
388 "lwc1 %[f6], 4(%[yf0]) \n\t" | 394 "lwc1 %[f6], 4(%[yf0]) \n\t" |
389 "madd.s %[f4], %[f4], %[f7], %[f5] \n\t" | 395 "madd.s %[f4], %[f4], %[f7], %[f5] \n\t" |
390 #endif // #if !defined(MIPS32_R2_LE) | 396 #endif // #if !defined(MIPS32_R2_LE) |
391 "lwc1 %[f5], 4(%[yf1]) \n\t" | 397 "lwc1 %[f5], 4(%[yf1]) \n\t" |
392 "add.s %[f2], %[f2], %[f8] \n\t" | 398 "add.s %[f2], %[f2], %[f8] \n\t" |
393 "addiu %[bRe], %[bRe], 8 \n\t" | 399 "addiu %[bRe], %[bRe], 8 \n\t" |
394 "addiu %[bIm], %[bIm], 8 \n\t" | 400 "addiu %[bIm], %[bIm], 8 \n\t" |
395 "add.s %[f3], %[f3], %[f1] \n\t" | 401 "add.s %[f3], %[f3], %[f1] \n\t" |
396 "add.s %[f6], %[f6], %[f9] \n\t" | 402 "add.s %[f6], %[f6], %[f9] \n\t" |
397 "add.s %[f5], %[f5], %[f4] \n\t" | 403 "add.s %[f5], %[f5], %[f4] \n\t" |
398 "swc1 %[f2], 0(%[yf0]) \n\t" | 404 "swc1 %[f2], 0(%[yf0]) \n\t" |
399 "swc1 %[f3], 0(%[yf1]) \n\t" | 405 "swc1 %[f3], 0(%[yf1]) \n\t" |
400 "swc1 %[f6], 4(%[yf0]) \n\t" | 406 "swc1 %[f6], 4(%[yf0]) \n\t" |
401 "swc1 %[f5], 4(%[yf1]) \n\t" | 407 "swc1 %[f5], 4(%[yf1]) \n\t" |
402 "addiu %[yf0], %[yf0], 8 \n\t" | 408 "addiu %[yf0], %[yf0], 8 \n\t" |
403 "bgtz %[len], 1b \n\t" | 409 "bgtz %[len], 1b \n\t" |
404 " addiu %[yf1], %[yf1], 8 \n\t" | 410 " addiu %[yf1], %[yf1], 8 \n\t" |
405 "lwc1 %[f0], 0(%[aRe]) \n\t" | 411 "lwc1 %[f0], 0(%[aRe]) \n\t" |
406 "lwc1 %[f1], 0(%[bRe]) \n\t" | 412 "lwc1 %[f1], 0(%[bRe]) \n\t" |
407 "lwc1 %[f2], 0(%[bIm]) \n\t" | 413 "lwc1 %[f2], 0(%[bIm]) \n\t" |
408 "lwc1 %[f3], 0(%[aIm]) \n\t" | 414 "lwc1 %[f3], 0(%[aIm]) \n\t" |
409 "mul.s %[f8], %[f0], %[f1] \n\t" | 415 "mul.s %[f8], %[f0], %[f1] \n\t" |
410 "mul.s %[f0], %[f0], %[f2] \n\t" | 416 "mul.s %[f0], %[f0], %[f2] \n\t" |
411 #if !defined(MIPS32_R2_LE) | 417 #if !defined(MIPS32_R2_LE) |
412 "mul.s %[f12], %[f2], %[f3] \n\t" | 418 "mul.s %[f12], %[f2], %[f3] \n\t" |
413 "mul.s %[f1], %[f3], %[f1] \n\t" | 419 "mul.s %[f1], %[f3], %[f1] \n\t" |
414 "sub.s %[f8], %[f8], %[f12] \n\t" | 420 "sub.s %[f8], %[f8], %[f12] \n\t" |
415 "lwc1 %[f2], 0(%[yf0]) \n\t" | 421 "lwc1 %[f2], 0(%[yf0]) \n\t" |
416 "add.s %[f1], %[f0], %[f1] \n\t" | 422 "add.s %[f1], %[f0], %[f1] \n\t" |
417 "lwc1 %[f3], 0(%[yf1]) \n\t" | 423 "lwc1 %[f3], 0(%[yf1]) \n\t" |
418 #else // #if !defined(MIPS32_R2_LE) | 424 #else // #if !defined(MIPS32_R2_LE) |
419 "nmsub.s %[f8], %[f8], %[f2], %[f3] \n\t" | 425 "nmsub.s %[f8], %[f8], %[f2], %[f3] \n\t" |
420 "lwc1 %[f2], 0(%[yf0]) \n\t" | 426 "lwc1 %[f2], 0(%[yf0]) \n\t" |
421 "madd.s %[f1], %[f0], %[f3], %[f1] \n\t" | 427 "madd.s %[f1], %[f0], %[f3], %[f1] \n\t" |
422 "lwc1 %[f3], 0(%[yf1]) \n\t" | 428 "lwc1 %[f3], 0(%[yf1]) \n\t" |
423 #endif // #if !defined(MIPS32_R2_LE) | 429 #endif // #if !defined(MIPS32_R2_LE) |
424 "add.s %[f2], %[f2], %[f8] \n\t" | 430 "add.s %[f2], %[f2], %[f8] \n\t" |
425 "add.s %[f3], %[f3], %[f1] \n\t" | 431 "add.s %[f3], %[f3], %[f1] \n\t" |
426 "swc1 %[f2], 0(%[yf0]) \n\t" | 432 "swc1 %[f2], 0(%[yf0]) \n\t" |
427 "swc1 %[f3], 0(%[yf1]) \n\t" | 433 "swc1 %[f3], 0(%[yf1]) \n\t" |
428 ".set pop \n\t" | 434 ".set pop \n\t" |
429 : [f0] "=&f" (f0), [f1] "=&f" (f1), [f2] "=&f" (f2), | 435 : [f0] "=&f" (f0), [f1] "=&f" (f1), [f2] "=&f" (f2), |
430 [f3] "=&f" (f3), [f4] "=&f" (f4), [f5] "=&f" (f5), | 436 [f3] "=&f" (f3), [f4] "=&f" (f4), [f5] "=&f" (f5), |
431 [f6] "=&f" (f6), [f7] "=&f" (f7), [f8] "=&f" (f8), | 437 [f6] "=&f" (f6), [f7] "=&f" (f7), [f8] "=&f" (f8), |
432 [f9] "=&f" (f9), [f10] "=&f" (f10), [f11] "=&f" (f11), | 438 [f9] "=&f" (f9), [f10] "=&f" (f10), [f11] "=&f" (f11), |
433 [f12] "=&f" (f12), [f13] "=&f" (f13), [aRe] "+r" (aRe), | 439 [f12] "=&f" (f12), [f13] "=&f" (f13), [aRe] "+r" (aRe), |
(...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
489 "mul.s %[f1], %[f3], %[f1] \n\t" | 495 "mul.s %[f1], %[f3], %[f1] \n\t" |
490 "mul.s %[f11], %[f7], %[f6] \n\t" | 496 "mul.s %[f11], %[f7], %[f6] \n\t" |
491 "mul.s %[f5], %[f7], %[f5] \n\t" | 497 "mul.s %[f5], %[f7], %[f5] \n\t" |
492 "addiu %[aIm], %[aIm], 8 \n\t" | 498 "addiu %[aIm], %[aIm], 8 \n\t" |
493 "addiu %[bIm], %[bIm], 8 \n\t" | 499 "addiu %[bIm], %[bIm], 8 \n\t" |
494 "addiu %[len], %[len], -1 \n\t" | 500 "addiu %[len], %[len], -1 \n\t" |
495 "add.s %[f8], %[f8], %[f10] \n\t" | 501 "add.s %[f8], %[f8], %[f10] \n\t" |
496 "sub.s %[f1], %[f0], %[f1] \n\t" | 502 "sub.s %[f1], %[f0], %[f1] \n\t" |
497 "add.s %[f9], %[f9], %[f11] \n\t" | 503 "add.s %[f9], %[f9], %[f11] \n\t" |
498 "sub.s %[f5], %[f4], %[f5] \n\t" | 504 "sub.s %[f5], %[f4], %[f5] \n\t" |
499 #else // #if !defined(MIPS32_R2_LE) | 505 #else // #if !defined(MIPS32_R2_LE) |
500 "addiu %[aIm], %[aIm], 8 \n\t" | 506 "addiu %[aIm], %[aIm], 8 \n\t" |
501 "addiu %[bIm], %[bIm], 8 \n\t" | 507 "addiu %[bIm], %[bIm], 8 \n\t" |
502 "addiu %[len], %[len], -1 \n\t" | 508 "addiu %[len], %[len], -1 \n\t" |
503 "madd.s %[f8], %[f8], %[f3], %[f2] \n\t" | 509 "madd.s %[f8], %[f8], %[f3], %[f2] \n\t" |
504 "nmsub.s %[f1], %[f0], %[f3], %[f1] \n\t" | 510 "nmsub.s %[f1], %[f0], %[f3], %[f1] \n\t" |
505 "madd.s %[f9], %[f9], %[f7], %[f6] \n\t" | 511 "madd.s %[f9], %[f9], %[f7], %[f6] \n\t" |
506 "nmsub.s %[f5], %[f4], %[f7], %[f5] \n\t" | 512 "nmsub.s %[f5], %[f4], %[f7], %[f5] \n\t" |
507 #endif // #if !defined(MIPS32_R2_LE) | 513 #endif // #if !defined(MIPS32_R2_LE) |
508 "swc1 %[f8], 0(%[fft_tmp]) \n\t" | 514 "swc1 %[f8], 0(%[fft_tmp]) \n\t" |
509 "swc1 %[f1], 4(%[fft_tmp]) \n\t" | 515 "swc1 %[f1], 4(%[fft_tmp]) \n\t" |
510 "swc1 %[f9], 8(%[fft_tmp]) \n\t" | 516 "swc1 %[f9], 8(%[fft_tmp]) \n\t" |
511 "swc1 %[f5], 12(%[fft_tmp]) \n\t" | 517 "swc1 %[f5], 12(%[fft_tmp]) \n\t" |
512 "bgtz %[len], 1b \n\t" | 518 "bgtz %[len], 1b \n\t" |
513 " addiu %[fft_tmp], %[fft_tmp], 16 \n\t" | 519 " addiu %[fft_tmp], %[fft_tmp], 16 \n\t" |
514 "lwc1 %[f0], 0(%[aRe]) \n\t" | 520 "lwc1 %[f0], 0(%[aRe]) \n\t" |
515 "lwc1 %[f1], 0(%[bRe]) \n\t" | 521 "lwc1 %[f1], 0(%[bRe]) \n\t" |
516 "lwc1 %[f2], 0(%[bIm]) \n\t" | 522 "lwc1 %[f2], 0(%[bIm]) \n\t" |
517 "lwc1 %[f3], 0(%[aIm]) \n\t" | 523 "lwc1 %[f3], 0(%[aIm]) \n\t" |
518 "mul.s %[f8], %[f0], %[f1] \n\t" | 524 "mul.s %[f8], %[f0], %[f1] \n\t" |
519 #if !defined(MIPS32_R2_LE) | 525 #if !defined(MIPS32_R2_LE) |
520 "mul.s %[f10], %[f3], %[f2] \n\t" | 526 "mul.s %[f10], %[f3], %[f2] \n\t" |
521 "add.s %[f8], %[f8], %[f10] \n\t" | 527 "add.s %[f8], %[f8], %[f10] \n\t" |
522 #else // #if !defined(MIPS32_R2_LE) | 528 #else // #if !defined(MIPS32_R2_LE) |
523 "madd.s %[f8], %[f8], %[f3], %[f2] \n\t" | 529 "madd.s %[f8], %[f8], %[f3], %[f2] \n\t" |
524 #endif // #if !defined(MIPS32_R2_LE) | 530 #endif // #if !defined(MIPS32_R2_LE) |
525 "swc1 %[f8], 4(%[fft]) \n\t" | 531 "swc1 %[f8], 4(%[fft]) \n\t" |
526 ".set pop \n\t" | 532 ".set pop \n\t" |
527 : [f0] "=&f" (f0), [f1] "=&f" (f1), [f2] "=&f" (f2), | 533 : [f0] "=&f" (f0), [f1] "=&f" (f1), [f2] "=&f" (f2), |
528 [f3] "=&f" (f3), [f4] "=&f" (f4), [f5] "=&f" (f5), | 534 [f3] "=&f" (f3), [f4] "=&f" (f4), [f5] "=&f" (f5), |
529 [f6] "=&f" (f6), [f7] "=&f" (f7), [f8] "=&f" (f8), | 535 [f6] "=&f" (f6), [f7] "=&f" (f7), [f8] "=&f" (f8), |
530 [f9] "=&f" (f9), [f10] "=&f" (f10), [f11] "=&f" (f11), | 536 [f9] "=&f" (f9), [f10] "=&f" (f10), [f11] "=&f" (f11), |
531 [f12] "=&f" (f12), [aRe] "+r" (aRe), [aIm] "+r" (aIm), | 537 [f12] "=&f" (f12), [aRe] "+r" (aRe), [aIm] "+r" (aIm), |
532 [bRe] "+r" (bRe), [bIm] "+r" (bIm), [fft_tmp] "=&r" (fft_tmp), | 538 [bRe] "+r" (bRe), [bIm] "+r" (bIm), [fft_tmp] "=&r" (fft_tmp), |
533 [len] "+r" (len) | 539 [len] "+r" (len) |
534 : [fft] "r" (fft) | 540 : [fft] "r" (fft) |
(...skipping 116 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
651 const float one = 1.0; | 657 const float one = 1.0; |
652 float* p_hNl; | 658 float* p_hNl; |
653 float* p_efw0; | 659 float* p_efw0; |
654 float* p_efw1; | 660 float* p_efw1; |
655 float* p_WebRtcAec_wC; | 661 float* p_WebRtcAec_wC; |
656 float temp1, temp2, temp3, temp4; | 662 float temp1, temp2, temp3, temp4; |
657 | 663 |
658 p_hNl = &hNl[0]; | 664 p_hNl = &hNl[0]; |
659 p_efw0 = &efw[0][0]; | 665 p_efw0 = &efw[0][0]; |
660 p_efw1 = &efw[1][0]; | 666 p_efw1 = &efw[1][0]; |
661 p_WebRtcAec_wC = (float*)&WebRtcAec_weightCurve[0]; | 667 p_WebRtcAec_wC = reinterpret_cast<float*>(&WebRtcAec_weightCurve[0]); |
662 | 668 |
663 for (i = 0; i < PART_LEN1; i++) { | 669 for (i = 0; i < PART_LEN1; i++) { |
664 // Weight subbands | 670 // Weight subbands |
665 __asm __volatile ( | 671 __asm __volatile ( |
666 ".set push \n\t" | 672 ".set push \n\t" |
667 ".set noreorder \n\t" | 673 ".set noreorder \n\t" |
668 "lwc1 %[temp1], 0(%[p_hNl]) \n\t" | 674 "lwc1 %[temp1], 0(%[p_hNl]) \n\t" |
669 "lwc1 %[temp2], 0(%[p_wC]) \n\t" | 675 "lwc1 %[temp2], 0(%[p_wC]) \n\t" |
670 "c.lt.s %[hNlFb], %[temp1] \n\t" | 676 "c.lt.s %[hNlFb], %[temp1] \n\t" |
671 "bc1f 1f \n\t" | 677 "bc1f 1f \n\t" |
672 " mul.s %[temp3], %[temp2], %[hNlFb] \n\t" | 678 " mul.s %[temp3], %[temp2], %[hNlFb] \n\t" |
673 "sub.s %[temp4], %[one], %[temp2] \n\t" | 679 "sub.s %[temp4], %[one], %[temp2] \n\t" |
674 #if !defined(MIPS32_R2_LE) | 680 #if !defined(MIPS32_R2_LE) |
675 "mul.s %[temp1], %[temp1], %[temp4] \n\t" | 681 "mul.s %[temp1], %[temp1], %[temp4] \n\t" |
676 "add.s %[temp1], %[temp3], %[temp1] \n\t" | 682 "add.s %[temp1], %[temp3], %[temp1] \n\t" |
677 #else // #if !defined(MIPS32_R2_LE) | 683 #else // #if !defined(MIPS32_R2_LE) |
678 "madd.s %[temp1], %[temp3], %[temp1], %[temp4] \n\t" | 684 "madd.s %[temp1], %[temp3], %[temp1], %[temp4] \n\t" |
679 #endif // #if !defined(MIPS32_R2_LE) | 685 #endif // #if !defined(MIPS32_R2_LE) |
680 "swc1 %[temp1], 0(%[p_hNl]) \n\t" | 686 "swc1 %[temp1], 0(%[p_hNl]) \n\t" |
681 "1: \n\t" | 687 "1: \n\t" |
682 "addiu %[p_wC], %[p_wC], 4 \n\t" | 688 "addiu %[p_wC], %[p_wC], 4 \n\t" |
683 ".set pop \n\t" | 689 ".set pop \n\t" |
684 : [temp1] "=&f" (temp1), [temp2] "=&f" (temp2), [temp3] "=&f" (temp3), | 690 : [temp1] "=&f" (temp1), [temp2] "=&f" (temp2), [temp3] "=&f" (temp3), |
685 [temp4] "=&f" (temp4), [p_wC] "+r" (p_WebRtcAec_wC) | 691 [temp4] "=&f" (temp4), [p_wC] "+r" (p_WebRtcAec_wC) |
686 : [hNlFb] "f" (hNlFb), [one] "f" (one), [p_hNl] "r" (p_hNl) | 692 : [hNlFb] "f" (hNlFb), [one] "f" (one), [p_hNl] "r" (p_hNl) |
687 : "memory" | 693 : "memory" |
688 ); | 694 ); |
689 | 695 |
(...skipping 88 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
778 ); | 784 ); |
779 } | 785 } |
780 | 786 |
781 void WebRtcAec_InitAec_mips(void) { | 787 void WebRtcAec_InitAec_mips(void) { |
782 WebRtcAec_FilterFar = WebRtcAec_FilterFar_mips; | 788 WebRtcAec_FilterFar = WebRtcAec_FilterFar_mips; |
783 WebRtcAec_FilterAdaptation = WebRtcAec_FilterAdaptation_mips; | 789 WebRtcAec_FilterAdaptation = WebRtcAec_FilterAdaptation_mips; |
784 WebRtcAec_ScaleErrorSignal = WebRtcAec_ScaleErrorSignal_mips; | 790 WebRtcAec_ScaleErrorSignal = WebRtcAec_ScaleErrorSignal_mips; |
785 WebRtcAec_ComfortNoise = WebRtcAec_ComfortNoise_mips; | 791 WebRtcAec_ComfortNoise = WebRtcAec_ComfortNoise_mips; |
786 WebRtcAec_OverdriveAndSuppress = WebRtcAec_OverdriveAndSuppress_mips; | 792 WebRtcAec_OverdriveAndSuppress = WebRtcAec_OverdriveAndSuppress_mips; |
787 } | 793 } |
OLD | NEW |