OLD | NEW |
1 /* | 1 /* |
2 * Copyright (c) 2014 The WebRTC project authors. All Rights Reserved. | 2 * Copyright (c) 2014 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 #include "webrtc/modules/audio_processing/aec/aec_rdft.h" | 11 #include "webrtc/modules/audio_processing/utility/ooura_fft.h" |
| 12 |
| 13 #include "webrtc/modules/audio_processing/utility/ooura_fft_tables_common.h" |
12 #include "webrtc/typedefs.h" | 14 #include "webrtc/typedefs.h" |
13 | 15 |
14 static void bitrv2_128_mips(float* a) { | 16 namespace webrtc { |
| 17 |
| 18 #if defined(MIPS_FPU_LE) |
| 19 void bitrv2_128_mips(float* a) { |
15 // n is 128 | 20 // n is 128 |
16 float xr, xi, yr, yi; | 21 float xr, xi, yr, yi; |
17 | 22 |
18 xr = a[8]; | 23 xr = a[8]; |
19 xi = a[9]; | 24 xi = a[9]; |
20 yr = a[16]; | 25 yr = a[16]; |
21 yi = a[17]; | 26 yi = a[17]; |
22 a[8] = yr; | 27 a[8] = yr; |
23 a[9] = yi; | 28 a[9] = yi; |
24 a[16] = xr; | 29 a[16] = xr; |
(...skipping 236 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
261 xr = a[110]; | 266 xr = a[110]; |
262 xi = a[111]; | 267 xi = a[111]; |
263 yr = a[118]; | 268 yr = a[118]; |
264 yi = a[119]; | 269 yi = a[119]; |
265 a[110] = yr; | 270 a[110] = yr; |
266 a[111] = yi; | 271 a[111] = yi; |
267 a[118] = xr; | 272 a[118] = xr; |
268 a[119] = xi; | 273 a[119] = xi; |
269 } | 274 } |
270 | 275 |
271 static void cft1st_128_mips(float* a) { | 276 void cft1st_128_mips(float* a) { |
272 float f0, f1, f2, f3, f4, f5, f6, f7, f8, f9, f10, f11, f12, f13, f14; | 277 float f0, f1, f2, f3, f4, f5, f6, f7, f8, f9, f10, f11, f12, f13, f14; |
273 int a_ptr, p1_rdft, p2_rdft, count; | 278 int a_ptr, p1_rdft, p2_rdft, count; |
274 const float* first = rdft_wk3ri_first; | 279 const float* first = rdft_wk3ri_first; |
275 const float* second = rdft_wk3ri_second; | 280 const float* second = rdft_wk3ri_second; |
276 | 281 |
277 __asm __volatile ( | 282 __asm __volatile ( |
278 ".set push \n\t" | 283 ".set push \n\t" |
279 ".set noreorder \n\t" | 284 ".set noreorder \n\t" |
280 // first 8 | 285 // first 8 |
281 "lwc1 %[f0], 0(%[a]) \n\t" | 286 "lwc1 %[f0], 0(%[a]) \n\t" |
(...skipping 228 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
510 [f4] "=&f" (f4), [f5] "=&f" (f5), [f6] "=&f" (f6), [f7] "=&f" (f7), | 515 [f4] "=&f" (f4), [f5] "=&f" (f5), [f6] "=&f" (f6), [f7] "=&f" (f7), |
511 [f8] "=&f" (f8), [f9] "=&f" (f9), [f10] "=&f" (f10), [f11] "=&f" (f11), | 516 [f8] "=&f" (f8), [f9] "=&f" (f9), [f10] "=&f" (f10), [f11] "=&f" (f11), |
512 [f12] "=&f" (f12), [f13] "=&f" (f13), [f14] "=&f" (f14), | 517 [f12] "=&f" (f12), [f13] "=&f" (f13), [f14] "=&f" (f14), |
513 [a_ptr] "=&r" (a_ptr), [p1_rdft] "=&r" (p1_rdft), [first] "+r" (first), | 518 [a_ptr] "=&r" (a_ptr), [p1_rdft] "=&r" (p1_rdft), [first] "+r" (first), |
514 [p2_rdft] "=&r" (p2_rdft), [count] "=&r" (count), [second] "+r" (second) | 519 [p2_rdft] "=&r" (p2_rdft), [count] "=&r" (count), [second] "+r" (second) |
515 : [a] "r" (a), [rdft_w] "r" (rdft_w) | 520 : [a] "r" (a), [rdft_w] "r" (rdft_w) |
516 : "memory" | 521 : "memory" |
517 ); | 522 ); |
518 } | 523 } |
519 | 524 |
520 static void cftmdl_128_mips(float* a) { | 525 void cftmdl_128_mips(float* a) { |
521 float f0, f1, f2, f3, f4, f5, f6, f7, f8, f9, f10, f11, f12, f13, f14; | 526 float f0, f1, f2, f3, f4, f5, f6, f7, f8, f9, f10, f11, f12, f13, f14; |
522 int tmp_a, count; | 527 int tmp_a, count; |
523 __asm __volatile ( | 528 __asm __volatile ( |
524 ".set push \n\t" | 529 ".set push \n\t" |
525 ".set noreorder \n\t" | 530 ".set noreorder \n\t" |
526 "addiu %[tmp_a], %[a], 0 \n\t" | 531 "addiu %[tmp_a], %[a], 0 \n\t" |
527 "addiu %[count], $zero, 4 \n\t" | 532 "addiu %[count], $zero, 4 \n\t" |
528 "1: \n\t" | 533 "1: \n\t" |
529 "addiu %[count], %[count], -1 \n\t" | 534 "addiu %[count], %[count], -1 \n\t" |
530 "lwc1 %[f0], 0(%[tmp_a]) \n\t" | 535 "lwc1 %[f0], 0(%[tmp_a]) \n\t" |
(...skipping 265 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
796 ".set pop \n\t" | 801 ".set pop \n\t" |
797 : [f0] "=&f" (f0), [f1] "=&f" (f1), [f2] "=&f" (f2), [f3] "=&f" (f3), | 802 : [f0] "=&f" (f0), [f1] "=&f" (f1), [f2] "=&f" (f2), [f3] "=&f" (f3), |
798 [f4] "=&f" (f4), [f5] "=&f" (f5), [f6] "=&f" (f6), [f7] "=&f" (f7), | 803 [f4] "=&f" (f4), [f5] "=&f" (f5), [f6] "=&f" (f6), [f7] "=&f" (f7), |
799 [f8] "=&f" (f8), [tmp_a] "=&r" (tmp_a), [count] "=&r" (count) | 804 [f8] "=&f" (f8), [tmp_a] "=&r" (tmp_a), [count] "=&r" (count) |
800 : [a] "r" (a), [f9] "f" (f9), [f10] "f" (f10), [f11] "f" (f11), | 805 : [a] "r" (a), [f9] "f" (f9), [f10] "f" (f10), [f11] "f" (f11), |
801 [f12] "f" (f12), [f13] "f" (f13), [f14] "f" (f14) | 806 [f12] "f" (f12), [f13] "f" (f13), [f14] "f" (f14) |
802 : "memory" | 807 : "memory" |
803 ); | 808 ); |
804 } | 809 } |
805 | 810 |
806 static void cftfsub_128_mips(float* a) { | 811 void cftfsub_128_mips(float* a) { |
807 float f0, f1, f2, f3, f4, f5, f6, f7, f8; | 812 float f0, f1, f2, f3, f4, f5, f6, f7, f8; |
808 int tmp_a, count; | 813 int tmp_a, count; |
809 | 814 |
810 cft1st_128(a); | 815 cft1st_128_mips(a); |
811 cftmdl_128(a); | 816 cftmdl_128_mips(a); |
812 | 817 |
813 __asm __volatile ( | 818 __asm __volatile ( |
814 ".set push \n\t" | 819 ".set push \n\t" |
815 ".set noreorder \n\t" | 820 ".set noreorder \n\t" |
816 "addiu %[tmp_a], %[a], 0 \n\t" | 821 "addiu %[tmp_a], %[a], 0 \n\t" |
817 "addiu %[count], $zero, 16 \n\t" | 822 "addiu %[count], $zero, 16 \n\t" |
818 "1: \n\t" | 823 "1: \n\t" |
819 "addiu %[count], %[count], -1 \n\t" | 824 "addiu %[count], %[count], -1 \n\t" |
820 "lwc1 %[f0], 0(%[tmp_a]) \n\t" | 825 "lwc1 %[f0], 0(%[tmp_a]) \n\t" |
821 "lwc1 %[f2], 128(%[tmp_a]) \n\t" | 826 "lwc1 %[f2], 128(%[tmp_a]) \n\t" |
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
854 ".set pop \n\t" | 859 ".set pop \n\t" |
855 : [f0] "=&f" (f0), [f1] "=&f" (f1), [f2] "=&f" (f2), [f3] "=&f" (f3), | 860 : [f0] "=&f" (f0), [f1] "=&f" (f1), [f2] "=&f" (f2), [f3] "=&f" (f3), |
856 [f4] "=&f" (f4), [f5] "=&f" (f5), [f6] "=&f" (f6), [f7] "=&f" (f7), | 861 [f4] "=&f" (f4), [f5] "=&f" (f5), [f6] "=&f" (f6), [f7] "=&f" (f7), |
857 [f8] "=&f" (f8), [tmp_a] "=&r" (tmp_a), | 862 [f8] "=&f" (f8), [tmp_a] "=&r" (tmp_a), |
858 [count] "=&r" (count) | 863 [count] "=&r" (count) |
859 : [a] "r" (a) | 864 : [a] "r" (a) |
860 : "memory" | 865 : "memory" |
861 ); | 866 ); |
862 } | 867 } |
863 | 868 |
864 static void cftbsub_128_mips(float* a) { | 869 void cftbsub_128_mips(float* a) { |
865 float f0, f1, f2, f3, f4, f5, f6, f7, f8; | 870 float f0, f1, f2, f3, f4, f5, f6, f7, f8; |
866 int tmp_a, count; | 871 int tmp_a, count; |
867 | 872 |
868 cft1st_128(a); | 873 cft1st_128_mips(a); |
869 cftmdl_128(a); | 874 cftmdl_128_mips(a); |
870 | 875 |
871 __asm __volatile ( | 876 __asm __volatile ( |
872 ".set push \n\t" | 877 ".set push \n\t" |
873 ".set noreorder \n\t" | 878 ".set noreorder \n\t" |
874 "addiu %[tmp_a], %[a], 0 \n\t" | 879 "addiu %[tmp_a], %[a], 0 \n\t" |
875 "addiu %[count], $zero, 16 \n\t" | 880 "addiu %[count], $zero, 16 \n\t" |
876 "1: \n\t" | 881 "1: \n\t" |
877 "addiu %[count], %[count], -1 \n\t" | 882 "addiu %[count], %[count], -1 \n\t" |
878 "lwc1 %[f0], 0(%[tmp_a]) \n\t" | 883 "lwc1 %[f0], 0(%[tmp_a]) \n\t" |
879 "lwc1 %[f2], 128(%[tmp_a]) \n\t" | 884 "lwc1 %[f2], 128(%[tmp_a]) \n\t" |
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
912 " addiu %[tmp_a], %[tmp_a], 8 \n\t" | 917 " addiu %[tmp_a], %[tmp_a], 8 \n\t" |
913 ".set pop \n\t" | 918 ".set pop \n\t" |
914 : [f0] "=&f" (f0), [f1] "=&f" (f1), [f2] "=&f" (f2), [f3] "=&f" (f3), | 919 : [f0] "=&f" (f0), [f1] "=&f" (f1), [f2] "=&f" (f2), [f3] "=&f" (f3), |
915 [f4] "=&f" (f4), [f5] "=&f" (f5), [f6] "=&f" (f6), [f7] "=&f" (f7), | 920 [f4] "=&f" (f4), [f5] "=&f" (f5), [f6] "=&f" (f6), [f7] "=&f" (f7), |
916 [f8] "=&f" (f8), [tmp_a] "=&r" (tmp_a), [count] "=&r" (count) | 921 [f8] "=&f" (f8), [tmp_a] "=&r" (tmp_a), [count] "=&r" (count) |
917 : [a] "r" (a) | 922 : [a] "r" (a) |
918 : "memory" | 923 : "memory" |
919 ); | 924 ); |
920 } | 925 } |
921 | 926 |
922 static void rftfsub_128_mips(float* a) { | 927 void rftfsub_128_mips(float* a) { |
923 const float* c = rdft_w + 32; | 928 const float* c = rdft_w + 32; |
924 const float f0 = 0.5f; | 929 const float f0 = 0.5f; |
925 float* a1 = &a[2]; | 930 float* a1 = &a[2]; |
926 float* a2 = &a[126]; | 931 float* a2 = &a[126]; |
927 const float* c1 = &c[1]; | 932 const float* c1 = &c[1]; |
928 const float* c2 = &c[31]; | 933 const float* c2 = &c[31]; |
929 float f1, f2, f3 ,f4, f5, f6, f7, f8, f9, f10, f11, f12, f13, f14, f15; | 934 float f1, f2, f3 ,f4, f5, f6, f7, f8, f9, f10, f11, f12, f13, f14, f15; |
930 int count; | 935 int count; |
931 | 936 |
932 __asm __volatile ( | 937 __asm __volatile ( |
(...skipping 106 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1039 [f1] "=&f" (f1), [f2] "=&f" (f2), [f3] "=&f" (f3), [f4] "=&f" (f4), | 1044 [f1] "=&f" (f1), [f2] "=&f" (f2), [f3] "=&f" (f3), [f4] "=&f" (f4), |
1040 [f5] "=&f" (f5), [f6] "=&f" (f6), [f7] "=&f" (f7), [f8] "=&f" (f8), | 1045 [f5] "=&f" (f5), [f6] "=&f" (f6), [f7] "=&f" (f7), [f8] "=&f" (f8), |
1041 [f9] "=&f" (f9), [f10] "=&f" (f10), [f11] "=&f" (f11), [f12] "=&f" (f12), | 1046 [f9] "=&f" (f9), [f10] "=&f" (f10), [f11] "=&f" (f11), [f12] "=&f" (f12), |
1042 [f13] "=&f" (f13), [f14] "=&f" (f14), [f15] "=&f" (f15), | 1047 [f13] "=&f" (f13), [f14] "=&f" (f14), [f15] "=&f" (f15), |
1043 [count] "=&r" (count) | 1048 [count] "=&r" (count) |
1044 : [f0] "f" (f0) | 1049 : [f0] "f" (f0) |
1045 : "memory" | 1050 : "memory" |
1046 ); | 1051 ); |
1047 } | 1052 } |
1048 | 1053 |
1049 static void rftbsub_128_mips(float* a) { | 1054 void rftbsub_128_mips(float* a) { |
1050 const float *c = rdft_w + 32; | 1055 const float *c = rdft_w + 32; |
1051 const float f0 = 0.5f; | 1056 const float f0 = 0.5f; |
1052 float* a1 = &a[2]; | 1057 float* a1 = &a[2]; |
1053 float* a2 = &a[126]; | 1058 float* a2 = &a[126]; |
1054 const float* c1 = &c[1]; | 1059 const float* c1 = &c[1]; |
1055 const float* c2 = &c[31]; | 1060 const float* c2 = &c[31]; |
1056 float f1, f2, f3 ,f4, f5, f6, f7, f8, f9, f10, f11, f12, f13, f14, f15; | 1061 float f1, f2, f3 ,f4, f5, f6, f7, f8, f9, f10, f11, f12, f13, f14, f15; |
1057 int count; | 1062 int count; |
1058 | 1063 |
1059 a[1] = -a[1]; | 1064 a[1] = -a[1]; |
(...skipping 108 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1168 : [a1] "+r" (a1), [a2] "+r" (a2), [c1] "+r" (c1), [c2] "+r" (c2), | 1173 : [a1] "+r" (a1), [a2] "+r" (a2), [c1] "+r" (c1), [c2] "+r" (c2), |
1169 [f1] "=&f" (f1), [f2] "=&f" (f2), [f3] "=&f" (f3), [f4] "=&f" (f4), | 1174 [f1] "=&f" (f1), [f2] "=&f" (f2), [f3] "=&f" (f3), [f4] "=&f" (f4), |
1170 [f5] "=&f" (f5), [f6] "=&f" (f6), [f7] "=&f" (f7), [f8] "=&f" (f8), | 1175 [f5] "=&f" (f5), [f6] "=&f" (f6), [f7] "=&f" (f7), [f8] "=&f" (f8), |
1171 [f9] "=&f" (f9), [f10] "=&f" (f10), [f11] "=&f" (f11), [f12] "=&f" (f12), | 1176 [f9] "=&f" (f9), [f10] "=&f" (f10), [f11] "=&f" (f11), [f12] "=&f" (f12), |
1172 [f13] "=&f" (f13), [f14] "=&f" (f14), [f15] "=&f" (f15), | 1177 [f13] "=&f" (f13), [f14] "=&f" (f14), [f15] "=&f" (f15), |
1173 [count] "=&r" (count) | 1178 [count] "=&r" (count) |
1174 : [f0] "f" (f0) | 1179 : [f0] "f" (f0) |
1175 : "memory" | 1180 : "memory" |
1176 ); | 1181 ); |
1177 } | 1182 } |
| 1183 #endif |
1178 | 1184 |
1179 void aec_rdft_init_mips(void) { | 1185 } // namespace webrtc |
1180 cft1st_128 = cft1st_128_mips; | |
1181 cftmdl_128 = cftmdl_128_mips; | |
1182 rftfsub_128 = rftfsub_128_mips; | |
1183 rftbsub_128 = rftbsub_128_mips; | |
1184 cftfsub_128 = cftfsub_128_mips; | |
1185 cftbsub_128 = cftbsub_128_mips; | |
1186 bitrv2_128 = bitrv2_128_mips; | |
1187 } | |
OLD | NEW |