Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(245)

Side by Side Diff: webrtc/modules/audio_processing/aec/aec_core_mips.c

Issue 1639283002: Clang format changes (Closed) Base URL: https://chromium.googlesource.com/external/webrtc.git@master
Patch Set: Merged with latest code from master Created 4 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 26 matching lines...) Expand all
37 const float pi2 = 6.28318530717959f; 37 const float pi2 = 6.28318530717959f;
38 const float pi2t = pi2 / 32768; 38 const float pi2t = pi2 / 32768;
39 39
40 // Generate a uniform random array on [0 1] 40 // Generate a uniform random array on [0 1]
41 WebRtcSpl_RandUArray(randW16, PART_LEN, &aec->seed); 41 WebRtcSpl_RandUArray(randW16, PART_LEN, &aec->seed);
42 42
43 int16_t* randWptr = randW16; 43 int16_t* randWptr = randW16;
44 float randTemp, randTemp2, randTemp3, randTemp4; 44 float randTemp, randTemp2, randTemp3, randTemp4;
45 int32_t tmp1s, tmp2s, tmp3s, tmp4s; 45 int32_t tmp1s, tmp2s, tmp3s, tmp4s;
46 46
47 for (i = 0; i < PART_LEN; i+=4) { 47 for (i = 0; i < PART_LEN; i += 4) {
48 __asm __volatile ( 48 __asm __volatile (
49 ".set push \n\t" 49 ".set push \n\t"
50 ".set noreorder \n\t" 50 ".set noreorder \n\t"
51 "lh %[tmp1s], 0(%[randWptr]) \n\t" 51 "lh %[tmp1s], 0(%[randWptr]) \n\t"
52 "lh %[tmp2s], 2(%[randWptr]) \n\t" 52 "lh %[tmp2s], 2(%[randWptr]) \n\t"
53 "lh %[tmp3s], 4(%[randWptr]) \n\t" 53 "lh %[tmp3s], 4(%[randWptr]) \n\t"
54 "lh %[tmp4s], 6(%[randWptr]) \n\t" 54 "lh %[tmp4s], 6(%[randWptr]) \n\t"
55 "mtc1 %[tmp1s], %[randTemp] \n\t" 55 "mtc1 %[tmp1s], %[randTemp] \n\t"
56 "mtc1 %[tmp2s], %[randTemp2] \n\t" 56 "mtc1 %[tmp2s], %[randTemp2] \n\t"
57 "mtc1 %[tmp3s], %[randTemp3] \n\t" 57 "mtc1 %[tmp3s], %[randTemp3] \n\t"
(...skipping 10 matching lines...) Expand all
68 ".set pop \n\t" 68 ".set pop \n\t"
69 : [randWptr] "+r" (randWptr), [randTemp] "=&f" (randTemp), 69 : [randWptr] "+r" (randWptr), [randTemp] "=&f" (randTemp),
70 [randTemp2] "=&f" (randTemp2), [randTemp3] "=&f" (randTemp3), 70 [randTemp2] "=&f" (randTemp2), [randTemp3] "=&f" (randTemp3),
71 [randTemp4] "=&f" (randTemp4), [tmp1s] "=&r" (tmp1s), 71 [randTemp4] "=&f" (randTemp4), [tmp1s] "=&r" (tmp1s),
72 [tmp2s] "=&r" (tmp2s), [tmp3s] "=&r" (tmp3s), 72 [tmp2s] "=&r" (tmp2s), [tmp3s] "=&r" (tmp3s),
73 [tmp4s] "=&r" (tmp4s) 73 [tmp4s] "=&r" (tmp4s)
74 : [pi2t] "f" (pi2t) 74 : [pi2t] "f" (pi2t)
75 : "memory" 75 : "memory"
76 ); 76 );
77 77
78 u[i+1][0] = cosf(randTemp); 78 u[i + 1][0] = cosf(randTemp);
79 u[i+1][1] = sinf(randTemp); 79 u[i + 1][1] = sinf(randTemp);
80 u[i+2][0] = cosf(randTemp2); 80 u[i + 2][0] = cosf(randTemp2);
81 u[i+2][1] = sinf(randTemp2); 81 u[i + 2][1] = sinf(randTemp2);
82 u[i+3][0] = cosf(randTemp3); 82 u[i + 3][0] = cosf(randTemp3);
83 u[i+3][1] = sinf(randTemp3); 83 u[i + 3][1] = sinf(randTemp3);
84 u[i+4][0] = cosf(randTemp4); 84 u[i + 4][0] = cosf(randTemp4);
85 u[i+4][1] = sinf(randTemp4); 85 u[i + 4][1] = sinf(randTemp4);
86 } 86 }
87 87
88 // Reject LF noise 88 // Reject LF noise
89 float* u_ptr = &u[1][0]; 89 float* u_ptr = &u[1][0];
90 float noise2, noise3, noise4; 90 float noise2, noise3, noise4;
91 float tmp1f, tmp2f, tmp3f, tmp4f, tmp5f, tmp6f, tmp7f, tmp8f; 91 float tmp1f, tmp2f, tmp3f, tmp4f, tmp5f, tmp6f, tmp7f, tmp8f;
92 92
93 u[0][0] = 0; 93 u[0][0] = 0;
94 u[0][1] = 0; 94 u[0][1] = 0;
95 for (i = 1; i < PART_LEN1; i+=4) { 95 for (i = 1; i < PART_LEN1; i += 4) {
96 __asm __volatile ( 96 __asm __volatile (
97 ".set push \n\t" 97 ".set push \n\t"
98 ".set noreorder \n\t" 98 ".set noreorder \n\t"
99 "lwc1 %[noise], 4(%[noisePow]) \n\t" 99 "lwc1 %[noise], 4(%[noisePow]) \n\t"
100 "lwc1 %[noise2], 8(%[noisePow]) \n\t" 100 "lwc1 %[noise2], 8(%[noisePow]) \n\t"
101 "lwc1 %[noise3], 12(%[noisePow]) \n\t" 101 "lwc1 %[noise3], 12(%[noisePow]) \n\t"
102 "lwc1 %[noise4], 16(%[noisePow]) \n\t" 102 "lwc1 %[noise4], 16(%[noisePow]) \n\t"
103 "sqrt.s %[noise], %[noise] \n\t" 103 "sqrt.s %[noise], %[noise] \n\t"
104 "sqrt.s %[noise2], %[noise2] \n\t" 104 "sqrt.s %[noise2], %[noise2] \n\t"
105 "sqrt.s %[noise3], %[noise3] \n\t" 105 "sqrt.s %[noise3], %[noise3] \n\t"
(...skipping 151 matching lines...) Expand 10 before | Expand all | Expand 10 after
257 [tmp1f] "=&f" (tmp1f), [tmp2f] "=&f" (tmp2f), [tmp3f] "=&f" (tmp3f), 257 [tmp1f] "=&f" (tmp1f), [tmp2f] "=&f" (tmp2f), [tmp3f] "=&f" (tmp3f),
258 [tmp4f] "=&f" (tmp4f), [tmp5f] "=&f" (tmp5f), 258 [tmp4f] "=&f" (tmp4f), [tmp5f] "=&f" (tmp5f),
259 [tmp6f] "=&f" (tmp6f), [tmp7f] "=&f" (tmp7f), [tmp8f] "=&f" (tmp8f), 259 [tmp6f] "=&f" (tmp6f), [tmp7f] "=&f" (tmp7f), [tmp8f] "=&f" (tmp8f),
260 [tmp9f] "=&f" (tmp9f), [tmp10f] "=&f" (tmp10f) 260 [tmp9f] "=&f" (tmp9f), [tmp10f] "=&f" (tmp10f)
261 : [tmp1c] "f" (tmp1c), [u_ptr_end] "r" (u_ptr_end) 261 : [tmp1c] "f" (tmp1c), [u_ptr_end] "r" (u_ptr_end)
262 : "memory" 262 : "memory"
263 ); 263 );
264 264
265 lambda -= PART_LEN; 265 lambda -= PART_LEN;
266 tmp = sqrtf(WEBRTC_SPL_MAX(1 - lambda[PART_LEN] * lambda[PART_LEN], 0)); 266 tmp = sqrtf(WEBRTC_SPL_MAX(1 - lambda[PART_LEN] * lambda[PART_LEN], 0));
267 //tmp = 1 - lambda[i]; 267 // tmp = 1 - lambda[i];
268 efw[0][PART_LEN] += tmp * u[PART_LEN][0]; 268 efw[0][PART_LEN] += tmp * u[PART_LEN][0];
269 efw[1][PART_LEN] += tmp * u[PART_LEN][1]; 269 efw[1][PART_LEN] += tmp * u[PART_LEN][1];
270 270
271 // For H band comfort noise 271 // For H band comfort noise
272 // TODO: don't compute noise and "tmp" twice. Use the previous results. 272 // TODO: don't compute noise and "tmp" twice. Use the previous results.
273 noiseAvg = 0.0; 273 noiseAvg = 0.0;
274 tmpAvg = 0.0; 274 tmpAvg = 0.0;
275 num = 0; 275 num = 0;
276 if (aec->num_bands > 1) { 276 if (aec->num_bands > 1) {
277 for (i = 0; i < PART_LEN; i++) { 277 for (i = 0; i < PART_LEN; i++) {
(...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after
326 int num_partitions, 326 int num_partitions,
327 int x_fft_buf_block_pos, 327 int x_fft_buf_block_pos,
328 float x_fft_buf[2][kExtendedNumPartitions * PART_LEN1], 328 float x_fft_buf[2][kExtendedNumPartitions * PART_LEN1],
329 float h_fft_buf[2][kExtendedNumPartitions * PART_LEN1], 329 float h_fft_buf[2][kExtendedNumPartitions * PART_LEN1],
330 float y_fft[2][PART_LEN1]) { 330 float y_fft[2][PART_LEN1]) {
331 int i; 331 int i;
332 for (i = 0; i < num_partitions; i++) { 332 for (i = 0; i < num_partitions; i++) {
333 int xPos = (i + x_fft_buf_block_pos) * PART_LEN1; 333 int xPos = (i + x_fft_buf_block_pos) * PART_LEN1;
334 int pos = i * PART_LEN1; 334 int pos = i * PART_LEN1;
335 // Check for wrap 335 // Check for wrap
336 if (i + x_fft_buf_block_pos >= num_partitions) { 336 if (i + x_fft_buf_block_pos >= num_partitions) {
337 xPos -= num_partitions * (PART_LEN1); 337 xPos -= num_partitions * (PART_LEN1);
338 } 338 }
339 float* yf0 = y_fft[0]; 339 float* yf0 = y_fft[0];
340 float* yf1 = y_fft[1]; 340 float* yf1 = y_fft[1];
341 float* aRe = x_fft_buf[0] + xPos; 341 float* aRe = x_fft_buf[0] + xPos;
342 float* aIm = x_fft_buf[1] + xPos; 342 float* aIm = x_fft_buf[1] + xPos;
343 float* bRe = h_fft_buf[0] + pos; 343 float* bRe = h_fft_buf[0] + pos;
344 float* bIm = h_fft_buf[1] + pos; 344 float* bIm = h_fft_buf[1] + pos;
345 float f0, f1, f2, f3, f4, f5, f6, f7, f8, f9, f10, f11, f12, f13; 345 float f0, f1, f2, f3, f4, f5, f6, f7, f8, f9, f10, f11, f12, f13;
346 int len = PART_LEN1 >> 1; 346 int len = PART_LEN1 >> 1;
347 347
(...skipping 93 matching lines...) Expand 10 before | Expand all | Expand 10 after
441 441
442 void WebRtcAec_FilterAdaptation_mips( 442 void WebRtcAec_FilterAdaptation_mips(
443 int num_partitions, 443 int num_partitions,
444 int x_fft_buf_block_pos, 444 int x_fft_buf_block_pos,
445 float x_fft_buf[2][kExtendedNumPartitions * PART_LEN1], 445 float x_fft_buf[2][kExtendedNumPartitions * PART_LEN1],
446 float e_fft[2][PART_LEN1], 446 float e_fft[2][PART_LEN1],
447 float h_fft_buf[2][kExtendedNumPartitions * PART_LEN1]) { 447 float h_fft_buf[2][kExtendedNumPartitions * PART_LEN1]) {
448 float fft[PART_LEN2]; 448 float fft[PART_LEN2];
449 int i; 449 int i;
450 for (i = 0; i < num_partitions; i++) { 450 for (i = 0; i < num_partitions; i++) {
451 int xPos = (i + x_fft_buf_block_pos)*(PART_LEN1); 451 int xPos = (i + x_fft_buf_block_pos) * (PART_LEN1);
452 int pos; 452 int pos;
453 // Check for wrap 453 // Check for wrap
454 if (i + x_fft_buf_block_pos >= num_partitions) { 454 if (i + x_fft_buf_block_pos >= num_partitions) {
455 xPos -= num_partitions * PART_LEN1; 455 xPos -= num_partitions * PART_LEN1;
456 } 456 }
457 457
458 pos = i * PART_LEN1; 458 pos = i * PART_LEN1;
459 float* aRe = x_fft_buf[0] + xPos; 459 float* aRe = x_fft_buf[0] + xPos;
460 float* aIm = x_fft_buf[1] + xPos; 460 float* aIm = x_fft_buf[1] + xPos;
461 float* bRe = e_fft[0]; 461 float* bRe = e_fft[0];
462 float* bIm = e_fft[1]; 462 float* bIm = e_fft[1];
463 float* fft_tmp; 463 float* fft_tmp;
464 464
465 float f0, f1, f2, f3, f4, f5, f6 ,f7, f8, f9, f10, f11, f12; 465 float f0, f1, f2, f3, f4, f5, f6, f7, f8, f9, f10, f11, f12;
466 int len = PART_LEN >> 1; 466 int len = PART_LEN >> 1;
467 467
468 __asm __volatile ( 468 __asm __volatile (
469 ".set push \n\t" 469 ".set push \n\t"
470 ".set noreorder \n\t" 470 ".set noreorder \n\t"
471 "addiu %[fft_tmp], %[fft], 0 \n\t" 471 "addiu %[fft_tmp], %[fft], 0 \n\t"
472 "1: \n\t" 472 "1: \n\t"
473 "lwc1 %[f0], 0(%[aRe]) \n\t" 473 "lwc1 %[f0], 0(%[aRe]) \n\t"
474 "lwc1 %[f1], 0(%[bRe]) \n\t" 474 "lwc1 %[f1], 0(%[bRe]) \n\t"
475 "lwc1 %[f2], 0(%[bIm]) \n\t" 475 "lwc1 %[f2], 0(%[bIm]) \n\t"
(...skipping 302 matching lines...) Expand 10 before | Expand all | Expand 10 after
778 ); 778 );
779 } 779 }
780 780
781 void WebRtcAec_InitAec_mips(void) { 781 void WebRtcAec_InitAec_mips(void) {
782 WebRtcAec_FilterFar = WebRtcAec_FilterFar_mips; 782 WebRtcAec_FilterFar = WebRtcAec_FilterFar_mips;
783 WebRtcAec_FilterAdaptation = WebRtcAec_FilterAdaptation_mips; 783 WebRtcAec_FilterAdaptation = WebRtcAec_FilterAdaptation_mips;
784 WebRtcAec_ScaleErrorSignal = WebRtcAec_ScaleErrorSignal_mips; 784 WebRtcAec_ScaleErrorSignal = WebRtcAec_ScaleErrorSignal_mips;
785 WebRtcAec_ComfortNoise = WebRtcAec_ComfortNoise_mips; 785 WebRtcAec_ComfortNoise = WebRtcAec_ComfortNoise_mips;
786 WebRtcAec_OverdriveAndSuppress = WebRtcAec_OverdriveAndSuppress_mips; 786 WebRtcAec_OverdriveAndSuppress = WebRtcAec_OverdriveAndSuppress_mips;
787 } 787 }
OLDNEW
« no previous file with comments | « webrtc/modules/audio_processing/aec/aec_core_internal.h ('k') | webrtc/modules/audio_processing/aec/aec_core_neon.c » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698