| 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 |
| (...skipping 304 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 315 for (i = 0; i < PART_LEN1; i++) { | 315 for (i = 0; i < PART_LEN1; i++) { |
| 316 // Use average NLP weight for H band | 316 // Use average NLP weight for H band |
| 317 comfortNoiseHband[i][0] = tmpAvg * u[i][0]; | 317 comfortNoiseHband[i][0] = tmpAvg * u[i][0]; |
| 318 comfortNoiseHband[i][1] = tmpAvg * u[i][1]; | 318 comfortNoiseHband[i][1] = tmpAvg * u[i][1]; |
| 319 } | 319 } |
| 320 } | 320 } |
| 321 } | 321 } |
| 322 | 322 |
| 323 void WebRtcAec_FilterFar_mips( | 323 void WebRtcAec_FilterFar_mips( |
| 324 int num_partitions, | 324 int num_partitions, |
| 325 int xfBufBlockPos, | 325 int x_fft_buf_block_pos, |
| 326 float xfBuf[2][kExtendedNumPartitions * PART_LEN1], | 326 float x_fft_buf[2][kExtendedNumPartitions * PART_LEN1], |
| 327 float wfBuf[2][kExtendedNumPartitions * PART_LEN1], | 327 float h_fft_buf[2][kExtendedNumPartitions * PART_LEN1], |
| 328 float yf[2][PART_LEN1]) { | 328 float y_fft[2][PART_LEN1]) { |
| 329 int i; | 329 int i; |
| 330 for (i = 0; i < num_partitions; i++) { | 330 for (i = 0; i < num_partitions; i++) { |
| 331 int xPos = (i + xfBufBlockPos) * PART_LEN1; | 331 int xPos = (i + x_fft_buf_block_pos) * PART_LEN1; |
| 332 int pos = i * PART_LEN1; | 332 int pos = i * PART_LEN1; |
| 333 // Check for wrap | 333 // Check for wrap |
| 334 if (i + xfBufBlockPos >= num_partitions) { | 334 if (i + x_fft_buf_block_pos >= num_partitions) { |
| 335 xPos -= num_partitions * (PART_LEN1); | 335 xPos -= num_partitions * (PART_LEN1); |
| 336 } | 336 } |
| 337 float* yf0 = yf[0]; | 337 float* yf0 = y_fft[0]; |
| 338 float* yf1 = yf[1]; | 338 float* yf1 = y_fft[1]; |
| 339 float* aRe = xfBuf[0] + xPos; | 339 float* aRe = x_fft_buf[0] + xPos; |
| 340 float* aIm = xfBuf[1] + xPos; | 340 float* aIm = x_fft_buf[1] + xPos; |
| 341 float* bRe = wfBuf[0] + pos; | 341 float* bRe = h_fft_buf[0] + pos; |
| 342 float* bIm = wfBuf[1] + pos; | 342 float* bIm = h_fft_buf[1] + pos; |
| 343 float f0, f1, f2, f3, f4, f5, f6, f7, f8, f9, f10, f11, f12, f13; | 343 float f0, f1, f2, f3, f4, f5, f6, f7, f8, f9, f10, f11, f12, f13; |
| 344 int len = PART_LEN1 >> 1; | 344 int len = PART_LEN1 >> 1; |
| 345 | 345 |
| 346 __asm __volatile ( | 346 __asm __volatile ( |
| 347 ".set push \n\t" | 347 ".set push \n\t" |
| 348 ".set noreorder \n\t" | 348 ".set noreorder \n\t" |
| 349 "1: \n\t" | 349 "1: \n\t" |
| 350 "lwc1 %[f0], 0(%[aRe]) \n\t" | 350 "lwc1 %[f0], 0(%[aRe]) \n\t" |
| 351 "lwc1 %[f1], 0(%[bRe]) \n\t" | 351 "lwc1 %[f1], 0(%[bRe]) \n\t" |
| 352 "lwc1 %[f2], 0(%[bIm]) \n\t" | 352 "lwc1 %[f2], 0(%[bIm]) \n\t" |
| (...skipping 77 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 430 [f9] "=&f" (f9), [f10] "=&f" (f10), [f11] "=&f" (f11), | 430 [f9] "=&f" (f9), [f10] "=&f" (f10), [f11] "=&f" (f11), |
| 431 [f12] "=&f" (f12), [f13] "=&f" (f13), [aRe] "+r" (aRe), | 431 [f12] "=&f" (f12), [f13] "=&f" (f13), [aRe] "+r" (aRe), |
| 432 [aIm] "+r" (aIm), [bRe] "+r" (bRe), [bIm] "+r" (bIm), | 432 [aIm] "+r" (aIm), [bRe] "+r" (bRe), [bIm] "+r" (bIm), |
| 433 [yf0] "+r" (yf0), [yf1] "+r" (yf1), [len] "+r" (len) | 433 [yf0] "+r" (yf0), [yf1] "+r" (yf1), [len] "+r" (len) |
| 434 : | 434 : |
| 435 : "memory" | 435 : "memory" |
| 436 ); | 436 ); |
| 437 } | 437 } |
| 438 } | 438 } |
| 439 | 439 |
| 440 void WebRtcAec_FilterAdaptation_mips(AecCore* aec, | 440 void WebRtcAec_FilterAdaptation_mips( |
| 441 float* fft, | 441 int num_partitions, |
| 442 float ef[2][PART_LEN1]) { | 442 int x_fft_buf_block_pos, |
| 443 float x_fft_buf[2][kExtendedNumPartitions * PART_LEN1], |
| 444 float e_fft[2][PART_LEN1], |
| 445 float h_fft_buf[2][kExtendedNumPartitions * PART_LEN1]) { |
| 446 float fft[PART_LEN2]; |
| 443 int i; | 447 int i; |
| 444 for (i = 0; i < aec->num_partitions; i++) { | 448 for (i = 0; i < num_partitions; i++) { |
| 445 int xPos = (i + aec->xfBufBlockPos)*(PART_LEN1); | 449 int xPos = (i + x_fft_buf_block_pos)*(PART_LEN1); |
| 446 int pos; | 450 int pos; |
| 447 // Check for wrap | 451 // Check for wrap |
| 448 if (i + aec->xfBufBlockPos >= aec->num_partitions) { | 452 if (i + x_fft_buf_block_pos >= num_partitions) { |
| 449 xPos -= aec->num_partitions * PART_LEN1; | 453 xPos -= num_partitions * PART_LEN1; |
| 450 } | 454 } |
| 451 | 455 |
| 452 pos = i * PART_LEN1; | 456 pos = i * PART_LEN1; |
| 453 float* aRe = aec->xfBuf[0] + xPos; | 457 float* aRe = x_fft_buf[0] + xPos; |
| 454 float* aIm = aec->xfBuf[1] + xPos; | 458 float* aIm = x_fft_buf[1] + xPos; |
| 455 float* bRe = ef[0]; | 459 float* bRe = e_fft[0]; |
| 456 float* bIm = ef[1]; | 460 float* bIm = e_fft[1]; |
| 457 float* fft_tmp; | 461 float* fft_tmp; |
| 458 | 462 |
| 459 float f0, f1, f2, f3, f4, f5, f6 ,f7, f8, f9, f10, f11, f12; | 463 float f0, f1, f2, f3, f4, f5, f6 ,f7, f8, f9, f10, f11, f12; |
| 460 int len = PART_LEN >> 1; | 464 int len = PART_LEN >> 1; |
| 461 | 465 |
| 462 __asm __volatile ( | 466 __asm __volatile ( |
| 463 ".set push \n\t" | 467 ".set push \n\t" |
| 464 ".set noreorder \n\t" | 468 ".set noreorder \n\t" |
| 465 "addiu %[fft_tmp], %[fft], 0 \n\t" | 469 "addiu %[fft_tmp], %[fft], 0 \n\t" |
| 466 "1: \n\t" | 470 "1: \n\t" |
| (...skipping 104 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 571 ".set pop \n\t" | 575 ".set pop \n\t" |
| 572 : [f0] "=&f" (f0), [f1] "=&f" (f1), [f2] "=&f" (f2), | 576 : [f0] "=&f" (f0), [f1] "=&f" (f1), [f2] "=&f" (f2), |
| 573 [f3] "=&f" (f3), [f4] "=&f" (f4), [f5] "=&f" (f5), | 577 [f3] "=&f" (f3), [f4] "=&f" (f4), [f5] "=&f" (f5), |
| 574 [f6] "=&f" (f6), [f7] "=&f" (f7), [len] "=&r" (len), | 578 [f6] "=&f" (f6), [f7] "=&f" (f7), [len] "=&r" (len), |
| 575 [fft_tmp] "=&r" (fft_tmp) | 579 [fft_tmp] "=&r" (fft_tmp) |
| 576 : [scale] "f" (scale), [fft] "r" (fft) | 580 : [scale] "f" (scale), [fft] "r" (fft) |
| 577 : "memory" | 581 : "memory" |
| 578 ); | 582 ); |
| 579 } | 583 } |
| 580 aec_rdft_forward_128(fft); | 584 aec_rdft_forward_128(fft); |
| 581 aRe = aec->wfBuf[0] + pos; | 585 aRe = h_fft_buf[0] + pos; |
| 582 aIm = aec->wfBuf[1] + pos; | 586 aIm = h_fft_buf[1] + pos; |
| 583 __asm __volatile ( | 587 __asm __volatile ( |
| 584 ".set push \n\t" | 588 ".set push \n\t" |
| 585 ".set noreorder \n\t" | 589 ".set noreorder \n\t" |
| 586 "addiu %[fft_tmp], %[fft], 0 \n\t" | 590 "addiu %[fft_tmp], %[fft], 0 \n\t" |
| 587 "addiu %[len], $zero, 31 \n\t" | 591 "addiu %[len], $zero, 31 \n\t" |
| 588 "lwc1 %[f0], 0(%[aRe]) \n\t" | 592 "lwc1 %[f0], 0(%[aRe]) \n\t" |
| 589 "lwc1 %[f1], 0(%[fft_tmp]) \n\t" | 593 "lwc1 %[f1], 0(%[fft_tmp]) \n\t" |
| 590 "lwc1 %[f2], 256(%[aRe]) \n\t" | 594 "lwc1 %[f2], 256(%[aRe]) \n\t" |
| 591 "lwc1 %[f3], 4(%[fft_tmp]) \n\t" | 595 "lwc1 %[f3], 4(%[fft_tmp]) \n\t" |
| 592 "lwc1 %[f4], 4(%[aRe]) \n\t" | 596 "lwc1 %[f4], 4(%[aRe]) \n\t" |
| (...skipping 107 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 700 [p_hNl] "+r" (p_hNl) | 704 [p_hNl] "+r" (p_hNl) |
| 701 : | 705 : |
| 702 : "memory" | 706 : "memory" |
| 703 ); | 707 ); |
| 704 } | 708 } |
| 705 } | 709 } |
| 706 | 710 |
| 707 void WebRtcAec_ScaleErrorSignal_mips(int extended_filter_enabled, | 711 void WebRtcAec_ScaleErrorSignal_mips(int extended_filter_enabled, |
| 708 float normal_mu, | 712 float normal_mu, |
| 709 float normal_error_threshold, | 713 float normal_error_threshold, |
| 710 float *x_pow, | 714 float x_pow[PART_LEN1], |
| 711 float ef[2][PART_LEN1]) { | 715 float ef[2][PART_LEN1]) { |
| 712 const float mu = extended_filter_enabled ? kExtendedMu : normal_mu; | 716 const float mu = extended_filter_enabled ? kExtendedMu : normal_mu; |
| 713 const float error_threshold = extended_filter_enabled | 717 const float error_threshold = extended_filter_enabled |
| 714 ? kExtendedErrorThreshold | 718 ? kExtendedErrorThreshold |
| 715 : normal_error_threshold; | 719 : normal_error_threshold; |
| 716 int len = (PART_LEN1); | 720 int len = (PART_LEN1); |
| 717 float* ef0 = ef[0]; | 721 float* ef0 = ef[0]; |
| 718 float* ef1 = ef[1]; | 722 float* ef1 = ef[1]; |
| 719 float fac1 = 1e-10f; | 723 float fac1 = 1e-10f; |
| 720 float err_th2 = error_threshold * error_threshold; | 724 float err_th2 = error_threshold * error_threshold; |
| (...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 772 ); | 776 ); |
| 773 } | 777 } |
| 774 | 778 |
| 775 void WebRtcAec_InitAec_mips(void) { | 779 void WebRtcAec_InitAec_mips(void) { |
| 776 WebRtcAec_FilterFar = WebRtcAec_FilterFar_mips; | 780 WebRtcAec_FilterFar = WebRtcAec_FilterFar_mips; |
| 777 WebRtcAec_FilterAdaptation = WebRtcAec_FilterAdaptation_mips; | 781 WebRtcAec_FilterAdaptation = WebRtcAec_FilterAdaptation_mips; |
| 778 WebRtcAec_ScaleErrorSignal = WebRtcAec_ScaleErrorSignal_mips; | 782 WebRtcAec_ScaleErrorSignal = WebRtcAec_ScaleErrorSignal_mips; |
| 779 WebRtcAec_ComfortNoise = WebRtcAec_ComfortNoise_mips; | 783 WebRtcAec_ComfortNoise = WebRtcAec_ComfortNoise_mips; |
| 780 WebRtcAec_OverdriveAndSuppress = WebRtcAec_OverdriveAndSuppress_mips; | 784 WebRtcAec_OverdriveAndSuppress = WebRtcAec_OverdriveAndSuppress_mips; |
| 781 } | 785 } |
| OLD | NEW |