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

Side by Side Diff: webrtc/modules/audio_processing/aec/aec_core_neon.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
OLDNEW
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
(...skipping 492 matching lines...) Expand 10 before | Expand all | Expand 10 after
503 // - se : residual echo 503 // - se : residual echo
504 // - sx : far-end 504 // - sx : far-end
505 // - sde : cross-PSD of near-end and residual echo 505 // - sde : cross-PSD of near-end and residual echo
506 // - sxd : cross-PSD of near-end and far-end 506 // - sxd : cross-PSD of near-end and far-end
507 // 507 //
508 // In addition to updating the PSDs, also the filter diverge state is determined 508 // In addition to updating the PSDs, also the filter diverge state is determined
509 // upon actions are taken. 509 // upon actions are taken.
510 static void SmoothedPSD(AecCore* aec, 510 static void SmoothedPSD(AecCore* aec,
511 float efw[2][PART_LEN1], 511 float efw[2][PART_LEN1],
512 float dfw[2][PART_LEN1], 512 float dfw[2][PART_LEN1],
513 float xfw[2][PART_LEN1]) { 513 float xfw[2][PART_LEN1],
514 int* extreme_filter_divergence) {
514 // Power estimate smoothing coefficients. 515 // Power estimate smoothing coefficients.
515 const float* ptrGCoh = aec->extended_filter_enabled 516 const float* ptrGCoh = aec->extended_filter_enabled
516 ? WebRtcAec_kExtendedSmoothingCoefficients[aec->mult - 1] 517 ? WebRtcAec_kExtendedSmoothingCoefficients[aec->mult - 1]
517 : WebRtcAec_kNormalSmoothingCoefficients[aec->mult - 1]; 518 : WebRtcAec_kNormalSmoothingCoefficients[aec->mult - 1];
518 int i; 519 int i;
519 float sdSum = 0, seSum = 0; 520 float sdSum = 0, seSum = 0;
520 const float32x4_t vec_15 = vdupq_n_f32(WebRtcAec_kMinFarendPSD); 521 const float32x4_t vec_15 = vdupq_n_f32(WebRtcAec_kMinFarendPSD);
521 float32x4_t vec_sdSum = vdupq_n_f32(0.0f); 522 float32x4_t vec_sdSum = vdupq_n_f32(0.0f);
522 float32x4_t vec_seSum = vdupq_n_f32(0.0f); 523 float32x4_t vec_seSum = vdupq_n_f32(0.0f);
523 524
(...skipping 95 matching lines...) Expand 10 before | Expand all | Expand 10 after
619 ptrGCoh[0] * aec->sxd[i][0] + 620 ptrGCoh[0] * aec->sxd[i][0] +
620 ptrGCoh[1] * (dfw[0][i] * xfw[0][i] + dfw[1][i] * xfw[1][i]); 621 ptrGCoh[1] * (dfw[0][i] * xfw[0][i] + dfw[1][i] * xfw[1][i]);
621 aec->sxd[i][1] = 622 aec->sxd[i][1] =
622 ptrGCoh[0] * aec->sxd[i][1] + 623 ptrGCoh[0] * aec->sxd[i][1] +
623 ptrGCoh[1] * (dfw[0][i] * xfw[1][i] - dfw[1][i] * xfw[0][i]); 624 ptrGCoh[1] * (dfw[0][i] * xfw[1][i] - dfw[1][i] * xfw[0][i]);
624 625
625 sdSum += aec->sd[i]; 626 sdSum += aec->sd[i];
626 seSum += aec->se[i]; 627 seSum += aec->se[i];
627 } 628 }
628 629
629 // Divergent filter safeguard. 630 // Divergent filter safeguard update.
630 aec->divergeState = (aec->divergeState ? 1.05f : 1.0f) * seSum > sdSum; 631 aec->divergeState = (aec->divergeState ? 1.05f : 1.0f) * seSum > sdSum;
631 632
632 if (aec->divergeState) 633 // Signal extreme filter divergence if the error is significantly larger
633 memcpy(efw, dfw, sizeof(efw[0][0]) * 2 * PART_LEN1); 634 // than the nearend (13 dB).
634 635 *extreme_filter_divergence = (seSum > (19.95f * sdSum));
635 // Reset if error is significantly larger than nearend (13 dB).
636 if (!aec->extended_filter_enabled && seSum > (19.95f * sdSum))
637 memset(aec->wfBuf, 0, sizeof(aec->wfBuf));
638 } 636 }
639 637
640 // Window time domain data to be used by the fft. 638 // Window time domain data to be used by the fft.
641 static void WindowDataNEON(float* x_windowed, const float* x) { 639 static void WindowDataNEON(float* x_windowed, const float* x) {
642 int i; 640 int i;
643 for (i = 0; i < PART_LEN; i += 4) { 641 for (i = 0; i < PART_LEN; i += 4) {
644 const float32x4_t vec_Buf1 = vld1q_f32(&x[i]); 642 const float32x4_t vec_Buf1 = vld1q_f32(&x[i]);
645 const float32x4_t vec_Buf2 = vld1q_f32(&x[PART_LEN + i]); 643 const float32x4_t vec_Buf2 = vld1q_f32(&x[PART_LEN + i]);
646 const float32x4_t vec_sqrtHanning = vld1q_f32(&WebRtcAec_sqrtHanning[i]); 644 const float32x4_t vec_sqrtHanning = vld1q_f32(&WebRtcAec_sqrtHanning[i]);
647 // A B C D 645 // A B C D
(...skipping 25 matching lines...) Expand all
673 data_complex[0][0] = data[0]; 671 data_complex[0][0] = data[0];
674 data_complex[0][PART_LEN] = data[1]; 672 data_complex[0][PART_LEN] = data[1];
675 } 673 }
676 674
677 static void SubbandCoherenceNEON(AecCore* aec, 675 static void SubbandCoherenceNEON(AecCore* aec,
678 float efw[2][PART_LEN1], 676 float efw[2][PART_LEN1],
679 float dfw[2][PART_LEN1], 677 float dfw[2][PART_LEN1],
680 float xfw[2][PART_LEN1], 678 float xfw[2][PART_LEN1],
681 float* fft, 679 float* fft,
682 float* cohde, 680 float* cohde,
683 float* cohxd) { 681 float* cohxd,
682 int* extreme_filter_divergence) {
684 int i; 683 int i;
685 684
686 SmoothedPSD(aec, efw, dfw, xfw); 685 SmoothedPSD(aec, efw, dfw, xfw, extreme_filter_divergence);
687 686
688 { 687 {
689 const float32x4_t vec_1eminus10 = vdupq_n_f32(1e-10f); 688 const float32x4_t vec_1eminus10 = vdupq_n_f32(1e-10f);
690 689
691 // Subband coherence 690 // Subband coherence
692 for (i = 0; i + 3 < PART_LEN1; i += 4) { 691 for (i = 0; i + 3 < PART_LEN1; i += 4) {
693 const float32x4_t vec_sd = vld1q_f32(&aec->sd[i]); 692 const float32x4_t vec_sd = vld1q_f32(&aec->sd[i]);
694 const float32x4_t vec_se = vld1q_f32(&aec->se[i]); 693 const float32x4_t vec_se = vld1q_f32(&aec->se[i]);
695 const float32x4_t vec_sx = vld1q_f32(&aec->sx[i]); 694 const float32x4_t vec_sx = vld1q_f32(&aec->sx[i]);
696 const float32x4_t vec_sdse = vmlaq_f32(vec_1eminus10, vec_sd, vec_se); 695 const float32x4_t vec_sdse = vmlaq_f32(vec_1eminus10, vec_sd, vec_se);
(...skipping 25 matching lines...) Expand all
722 void WebRtcAec_InitAec_neon(void) { 721 void WebRtcAec_InitAec_neon(void) {
723 WebRtcAec_FilterFar = FilterFarNEON; 722 WebRtcAec_FilterFar = FilterFarNEON;
724 WebRtcAec_ScaleErrorSignal = ScaleErrorSignalNEON; 723 WebRtcAec_ScaleErrorSignal = ScaleErrorSignalNEON;
725 WebRtcAec_FilterAdaptation = FilterAdaptationNEON; 724 WebRtcAec_FilterAdaptation = FilterAdaptationNEON;
726 WebRtcAec_OverdriveAndSuppress = OverdriveAndSuppressNEON; 725 WebRtcAec_OverdriveAndSuppress = OverdriveAndSuppressNEON;
727 WebRtcAec_SubbandCoherence = SubbandCoherenceNEON; 726 WebRtcAec_SubbandCoherence = SubbandCoherenceNEON;
728 WebRtcAec_StoreAsComplex = StoreAsComplexNEON; 727 WebRtcAec_StoreAsComplex = StoreAsComplexNEON;
729 WebRtcAec_PartitionDelay = PartitionDelayNEON; 728 WebRtcAec_PartitionDelay = PartitionDelayNEON;
730 WebRtcAec_WindowData = WindowDataNEON; 729 WebRtcAec_WindowData = WindowDataNEON;
731 } 730 }
OLDNEW
« no previous file with comments | « webrtc/modules/audio_processing/aec/aec_core_internal.h ('k') | webrtc/modules/audio_processing/aec/aec_core_sse2.c » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698