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

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

Issue 1499573003: Some minor (bitexact) AEC echo suppressor refactoring (#2) (Closed) Base URL: https://chromium.googlesource.com/external/webrtc.git@ESUP_refactoring_CL
Patch Set: Corrected the positions of the pointer indicators Created 5 years 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
« no previous file with comments | « webrtc/modules/audio_processing/aec/aec_core_neon.c ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /* 1 /*
2 * Copyright (c) 2011 The WebRTC project authors. All Rights Reserved. 2 * Copyright (c) 2011 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 471 matching lines...) Expand 10 before | Expand all | Expand 10 after
482 // - se : residual echo 482 // - se : residual echo
483 // - sx : far-end 483 // - sx : far-end
484 // - sde : cross-PSD of near-end and residual echo 484 // - sde : cross-PSD of near-end and residual echo
485 // - sxd : cross-PSD of near-end and far-end 485 // - sxd : cross-PSD of near-end and far-end
486 // 486 //
487 // In addition to updating the PSDs, also the filter diverge state is determined 487 // In addition to updating the PSDs, also the filter diverge state is determined
488 // upon actions are taken. 488 // upon actions are taken.
489 static void SmoothedPSD(AecCore* aec, 489 static void SmoothedPSD(AecCore* aec,
490 float efw[2][PART_LEN1], 490 float efw[2][PART_LEN1],
491 float dfw[2][PART_LEN1], 491 float dfw[2][PART_LEN1],
492 float xfw[2][PART_LEN1]) { 492 float xfw[2][PART_LEN1],
493 int* extreme_filter_divergence) {
493 // Power estimate smoothing coefficients. 494 // Power estimate smoothing coefficients.
494 const float* ptrGCoh = aec->extended_filter_enabled 495 const float* ptrGCoh = aec->extended_filter_enabled
495 ? WebRtcAec_kExtendedSmoothingCoefficients[aec->mult - 1] 496 ? WebRtcAec_kExtendedSmoothingCoefficients[aec->mult - 1]
496 : WebRtcAec_kNormalSmoothingCoefficients[aec->mult - 1]; 497 : WebRtcAec_kNormalSmoothingCoefficients[aec->mult - 1];
497 int i; 498 int i;
498 float sdSum = 0, seSum = 0; 499 float sdSum = 0, seSum = 0;
499 const __m128 vec_15 = _mm_set1_ps(WebRtcAec_kMinFarendPSD); 500 const __m128 vec_15 = _mm_set1_ps(WebRtcAec_kMinFarendPSD);
500 const __m128 vec_GCoh0 = _mm_set1_ps(ptrGCoh[0]); 501 const __m128 vec_GCoh0 = _mm_set1_ps(ptrGCoh[0]);
501 const __m128 vec_GCoh1 = _mm_set1_ps(ptrGCoh[1]); 502 const __m128 vec_GCoh1 = _mm_set1_ps(ptrGCoh[1]);
502 __m128 vec_sdSum = _mm_set1_ps(0.0f); 503 __m128 vec_sdSum = _mm_set1_ps(0.0f);
(...skipping 98 matching lines...) Expand 10 before | Expand all | Expand 10 after
601 ptrGCoh[0] * aec->sxd[i][0] + 602 ptrGCoh[0] * aec->sxd[i][0] +
602 ptrGCoh[1] * (dfw[0][i] * xfw[0][i] + dfw[1][i] * xfw[1][i]); 603 ptrGCoh[1] * (dfw[0][i] * xfw[0][i] + dfw[1][i] * xfw[1][i]);
603 aec->sxd[i][1] = 604 aec->sxd[i][1] =
604 ptrGCoh[0] * aec->sxd[i][1] + 605 ptrGCoh[0] * aec->sxd[i][1] +
605 ptrGCoh[1] * (dfw[0][i] * xfw[1][i] - dfw[1][i] * xfw[0][i]); 606 ptrGCoh[1] * (dfw[0][i] * xfw[1][i] - dfw[1][i] * xfw[0][i]);
606 607
607 sdSum += aec->sd[i]; 608 sdSum += aec->sd[i];
608 seSum += aec->se[i]; 609 seSum += aec->se[i];
609 } 610 }
610 611
611 // Divergent filter safeguard. 612 // Divergent filter safeguard update.
612 aec->divergeState = (aec->divergeState ? 1.05f : 1.0f) * seSum > sdSum; 613 aec->divergeState = (aec->divergeState ? 1.05f : 1.0f) * seSum > sdSum;
613 614
614 if (aec->divergeState) 615 // Signal extreme filter divergence if the error is significantly larger
615 memcpy(efw, dfw, sizeof(efw[0][0]) * 2 * PART_LEN1); 616 // than the nearend (13 dB).
616 617 *extreme_filter_divergence = (seSum > (19.95f * sdSum));
617 // Reset if error is significantly larger than nearend (13 dB).
618 if (!aec->extended_filter_enabled && seSum > (19.95f * sdSum))
619 memset(aec->wfBuf, 0, sizeof(aec->wfBuf));
620 } 618 }
621 619
622 // Window time domain data to be used by the fft. 620 // Window time domain data to be used by the fft.
623 static void WindowDataSSE2(float* x_windowed, const float* x) { 621 static void WindowDataSSE2(float* x_windowed, const float* x) {
624 int i; 622 int i;
625 for (i = 0; i < PART_LEN; i += 4) { 623 for (i = 0; i < PART_LEN; i += 4) {
626 const __m128 vec_Buf1 = _mm_loadu_ps(&x[i]); 624 const __m128 vec_Buf1 = _mm_loadu_ps(&x[i]);
627 const __m128 vec_Buf2 = _mm_loadu_ps(&x[PART_LEN + i]); 625 const __m128 vec_Buf2 = _mm_loadu_ps(&x[PART_LEN + i]);
628 const __m128 vec_sqrtHanning = _mm_load_ps(&WebRtcAec_sqrtHanning[i]); 626 const __m128 vec_sqrtHanning = _mm_load_ps(&WebRtcAec_sqrtHanning[i]);
629 // A B C D 627 // A B C D
(...skipping 29 matching lines...) Expand all
659 data_complex[0][0] = data[0]; 657 data_complex[0][0] = data[0];
660 data_complex[0][PART_LEN] = data[1]; 658 data_complex[0][PART_LEN] = data[1];
661 } 659 }
662 660
663 static void SubbandCoherenceSSE2(AecCore* aec, 661 static void SubbandCoherenceSSE2(AecCore* aec,
664 float efw[2][PART_LEN1], 662 float efw[2][PART_LEN1],
665 float dfw[2][PART_LEN1], 663 float dfw[2][PART_LEN1],
666 float xfw[2][PART_LEN1], 664 float xfw[2][PART_LEN1],
667 float* fft, 665 float* fft,
668 float* cohde, 666 float* cohde,
669 float* cohxd) { 667 float* cohxd,
668 int* extreme_filter_divergence) {
670 int i; 669 int i;
671 670
672 SmoothedPSD(aec, efw, dfw, xfw); 671 SmoothedPSD(aec, efw, dfw, xfw, extreme_filter_divergence);
673 672
674 { 673 {
675 const __m128 vec_1eminus10 = _mm_set1_ps(1e-10f); 674 const __m128 vec_1eminus10 = _mm_set1_ps(1e-10f);
676 675
677 // Subband coherence 676 // Subband coherence
678 for (i = 0; i + 3 < PART_LEN1; i += 4) { 677 for (i = 0; i + 3 < PART_LEN1; i += 4) {
679 const __m128 vec_sd = _mm_loadu_ps(&aec->sd[i]); 678 const __m128 vec_sd = _mm_loadu_ps(&aec->sd[i]);
680 const __m128 vec_se = _mm_loadu_ps(&aec->se[i]); 679 const __m128 vec_se = _mm_loadu_ps(&aec->se[i]);
681 const __m128 vec_sx = _mm_loadu_ps(&aec->sx[i]); 680 const __m128 vec_sx = _mm_loadu_ps(&aec->sx[i]);
682 const __m128 vec_sdse = _mm_add_ps(vec_1eminus10, 681 const __m128 vec_sdse = _mm_add_ps(vec_1eminus10,
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after
720 void WebRtcAec_InitAec_SSE2(void) { 719 void WebRtcAec_InitAec_SSE2(void) {
721 WebRtcAec_FilterFar = FilterFarSSE2; 720 WebRtcAec_FilterFar = FilterFarSSE2;
722 WebRtcAec_ScaleErrorSignal = ScaleErrorSignalSSE2; 721 WebRtcAec_ScaleErrorSignal = ScaleErrorSignalSSE2;
723 WebRtcAec_FilterAdaptation = FilterAdaptationSSE2; 722 WebRtcAec_FilterAdaptation = FilterAdaptationSSE2;
724 WebRtcAec_OverdriveAndSuppress = OverdriveAndSuppressSSE2; 723 WebRtcAec_OverdriveAndSuppress = OverdriveAndSuppressSSE2;
725 WebRtcAec_SubbandCoherence = SubbandCoherenceSSE2; 724 WebRtcAec_SubbandCoherence = SubbandCoherenceSSE2;
726 WebRtcAec_StoreAsComplex = StoreAsComplexSSE2; 725 WebRtcAec_StoreAsComplex = StoreAsComplexSSE2;
727 WebRtcAec_PartitionDelay = PartitionDelaySSE2; 726 WebRtcAec_PartitionDelay = PartitionDelaySSE2;
728 WebRtcAec_WindowData = WindowDataSSE2; 727 WebRtcAec_WindowData = WindowDataSSE2;
729 } 728 }
OLDNEW
« no previous file with comments | « webrtc/modules/audio_processing/aec/aec_core_neon.c ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698