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 681 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
692 "swc1 %[temp4], -4(%[p_efw1]) \n\t" | 692 "swc1 %[temp4], -4(%[p_efw1]) \n\t" |
693 : [temp1] "=&f" (temp1), [temp2] "=&f" (temp2), [temp3] "=&f" (temp3), | 693 : [temp1] "=&f" (temp1), [temp2] "=&f" (temp2), [temp3] "=&f" (temp3), |
694 [temp4] "=&f" (temp4), [p_efw0] "+r" (p_efw0), [p_efw1] "+r" (p_efw1), | 694 [temp4] "=&f" (temp4), [p_efw0] "+r" (p_efw0), [p_efw1] "+r" (p_efw1), |
695 [p_hNl] "+r" (p_hNl) | 695 [p_hNl] "+r" (p_hNl) |
696 : | 696 : |
697 : "memory" | 697 : "memory" |
698 ); | 698 ); |
699 } | 699 } |
700 } | 700 } |
701 | 701 |
702 void WebRtcAec_ScaleErrorSignal_mips(AecCore* aec, float ef[2][PART_LEN1]) { | 702 void WebRtcAec_ScaleErrorSignal_mips(int extended_filter_enabled, |
703 const float mu = aec->extended_filter_enabled ? kExtendedMu : aec->normal_mu; | 703 float normal_mu, |
704 const float error_threshold = aec->extended_filter_enabled | 704 float normal_error_threshold, |
| 705 float *x_pow, |
| 706 float ef[2][PART_LEN1]) { |
| 707 const float mu = extended_filter_enabled ? kExtendedMu : normal_mu; |
| 708 const float error_threshold = extended_filter_enabled |
705 ? kExtendedErrorThreshold | 709 ? kExtendedErrorThreshold |
706 : aec->normal_error_threshold; | 710 : normal_error_threshold; |
707 int len = (PART_LEN1); | 711 int len = (PART_LEN1); |
708 float* ef0 = ef[0]; | 712 float* ef0 = ef[0]; |
709 float* ef1 = ef[1]; | 713 float* ef1 = ef[1]; |
710 float* xPow = aec->xPow; | |
711 float fac1 = 1e-10f; | 714 float fac1 = 1e-10f; |
712 float err_th2 = error_threshold * error_threshold; | 715 float err_th2 = error_threshold * error_threshold; |
713 float f0, f1, f2; | 716 float f0, f1, f2; |
714 #if !defined(MIPS32_R2_LE) | 717 #if !defined(MIPS32_R2_LE) |
715 float f3; | 718 float f3; |
716 #endif | 719 #endif |
717 | 720 |
718 __asm __volatile ( | 721 __asm __volatile ( |
719 ".set push \n\t" | 722 ".set push \n\t" |
720 ".set noreorder \n\t" | 723 ".set noreorder \n\t" |
721 "1: \n\t" | 724 "1: \n\t" |
722 "lwc1 %[f0], 0(%[xPow]) \n\t" | 725 "lwc1 %[f0], 0(%[x_pow]) \n\t" |
723 "lwc1 %[f1], 0(%[ef0]) \n\t" | 726 "lwc1 %[f1], 0(%[ef0]) \n\t" |
724 "lwc1 %[f2], 0(%[ef1]) \n\t" | 727 "lwc1 %[f2], 0(%[ef1]) \n\t" |
725 "add.s %[f0], %[f0], %[fac1] \n\t" | 728 "add.s %[f0], %[f0], %[fac1] \n\t" |
726 "div.s %[f1], %[f1], %[f0] \n\t" | 729 "div.s %[f1], %[f1], %[f0] \n\t" |
727 "div.s %[f2], %[f2], %[f0] \n\t" | 730 "div.s %[f2], %[f2], %[f0] \n\t" |
728 "mul.s %[f0], %[f1], %[f1] \n\t" | 731 "mul.s %[f0], %[f1], %[f1] \n\t" |
729 #if defined(MIPS32_R2_LE) | 732 #if defined(MIPS32_R2_LE) |
730 "madd.s %[f0], %[f0], %[f2], %[f2] \n\t" | 733 "madd.s %[f0], %[f0], %[f2], %[f2] \n\t" |
731 #else | 734 #else |
732 "mul.s %[f3], %[f2], %[f2] \n\t" | 735 "mul.s %[f3], %[f2], %[f2] \n\t" |
733 "add.s %[f0], %[f0], %[f3] \n\t" | 736 "add.s %[f0], %[f0], %[f3] \n\t" |
734 #endif | 737 #endif |
735 "c.le.s %[f0], %[err_th2] \n\t" | 738 "c.le.s %[f0], %[err_th2] \n\t" |
736 "nop \n\t" | 739 "nop \n\t" |
737 "bc1t 2f \n\t" | 740 "bc1t 2f \n\t" |
738 " nop \n\t" | 741 " nop \n\t" |
739 "sqrt.s %[f0], %[f0] \n\t" | 742 "sqrt.s %[f0], %[f0] \n\t" |
740 "add.s %[f0], %[f0], %[fac1] \n\t" | 743 "add.s %[f0], %[f0], %[fac1] \n\t" |
741 "div.s %[f0], %[err_th], %[f0] \n\t" | 744 "div.s %[f0], %[err_th], %[f0] \n\t" |
742 "mul.s %[f1], %[f1], %[f0] \n\t" | 745 "mul.s %[f1], %[f1], %[f0] \n\t" |
743 "mul.s %[f2], %[f2], %[f0] \n\t" | 746 "mul.s %[f2], %[f2], %[f0] \n\t" |
744 "2: \n\t" | 747 "2: \n\t" |
745 "mul.s %[f1], %[f1], %[mu] \n\t" | 748 "mul.s %[f1], %[f1], %[mu] \n\t" |
746 "mul.s %[f2], %[f2], %[mu] \n\t" | 749 "mul.s %[f2], %[f2], %[mu] \n\t" |
747 "swc1 %[f1], 0(%[ef0]) \n\t" | 750 "swc1 %[f1], 0(%[ef0]) \n\t" |
748 "swc1 %[f2], 0(%[ef1]) \n\t" | 751 "swc1 %[f2], 0(%[ef1]) \n\t" |
749 "addiu %[len], %[len], -1 \n\t" | 752 "addiu %[len], %[len], -1 \n\t" |
750 "addiu %[xPow], %[xPow], 4 \n\t" | 753 "addiu %[x_pow], %[x_pow], 4 \n\t" |
751 "addiu %[ef0], %[ef0], 4 \n\t" | 754 "addiu %[ef0], %[ef0], 4 \n\t" |
752 "bgtz %[len], 1b \n\t" | 755 "bgtz %[len], 1b \n\t" |
753 " addiu %[ef1], %[ef1], 4 \n\t" | 756 " addiu %[ef1], %[ef1], 4 \n\t" |
754 ".set pop \n\t" | 757 ".set pop \n\t" |
755 : [f0] "=&f" (f0), [f1] "=&f" (f1), [f2] "=&f" (f2), | 758 : [f0] "=&f" (f0), [f1] "=&f" (f1), [f2] "=&f" (f2), |
756 #if !defined(MIPS32_R2_LE) | 759 #if !defined(MIPS32_R2_LE) |
757 [f3] "=&f" (f3), | 760 [f3] "=&f" (f3), |
758 #endif | 761 #endif |
759 [xPow] "+r" (xPow), [ef0] "+r" (ef0), [ef1] "+r" (ef1), | 762 [x_pow] "+r" (x_pow), [ef0] "+r" (ef0), [ef1] "+r" (ef1), |
760 [len] "+r" (len) | 763 [len] "+r" (len) |
761 : [fac1] "f" (fac1), [err_th2] "f" (err_th2), [mu] "f" (mu), | 764 : [fac1] "f" (fac1), [err_th2] "f" (err_th2), [mu] "f" (mu), |
762 [err_th] "f" (error_threshold) | 765 [err_th] "f" (error_threshold) |
763 : "memory" | 766 : "memory" |
764 ); | 767 ); |
765 } | 768 } |
766 | 769 |
767 void WebRtcAec_InitAec_mips(void) { | 770 void WebRtcAec_InitAec_mips(void) { |
768 WebRtcAec_FilterFar = WebRtcAec_FilterFar_mips; | 771 WebRtcAec_FilterFar = WebRtcAec_FilterFar_mips; |
769 WebRtcAec_FilterAdaptation = WebRtcAec_FilterAdaptation_mips; | 772 WebRtcAec_FilterAdaptation = WebRtcAec_FilterAdaptation_mips; |
770 WebRtcAec_ScaleErrorSignal = WebRtcAec_ScaleErrorSignal_mips; | 773 WebRtcAec_ScaleErrorSignal = WebRtcAec_ScaleErrorSignal_mips; |
771 WebRtcAec_ComfortNoise = WebRtcAec_ComfortNoise_mips; | 774 WebRtcAec_ComfortNoise = WebRtcAec_ComfortNoise_mips; |
772 WebRtcAec_OverdriveAndSuppress = WebRtcAec_OverdriveAndSuppress_mips; | 775 WebRtcAec_OverdriveAndSuppress = WebRtcAec_OverdriveAndSuppress_mips; |
773 } | 776 } |
774 | |
OLD | NEW |