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

Unified Diff: webrtc/modules/audio_processing/aec/aec_core.cc

Issue 1943193002: Broke apart the functionalities in the SubbandCoherence method in the AEC (Closed) Base URL: https://chromium.googlesource.com/external/webrtc.git@RefactorAec4_CL
Patch Set: Created 4 years, 8 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | webrtc/modules/audio_processing/aec/aec_core_internal.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: webrtc/modules/audio_processing/aec/aec_core.cc
diff --git a/webrtc/modules/audio_processing/aec/aec_core.cc b/webrtc/modules/audio_processing/aec/aec_core.cc
index 7b375cfdb8a1679cf0d7ad54e2b52279a171cd5c..3dfcbe9bc28ec98cf351cd39d310ecdb7883dbb8 100644
--- a/webrtc/modules/audio_processing/aec/aec_core.cc
+++ b/webrtc/modules/audio_processing/aec/aec_core.cc
@@ -141,7 +141,8 @@ WebRtcAecFilterFar WebRtcAec_FilterFar;
WebRtcAecScaleErrorSignal WebRtcAec_ScaleErrorSignal;
WebRtcAecFilterAdaptation WebRtcAec_FilterAdaptation;
WebRtcAecOverdriveAndSuppress WebRtcAec_OverdriveAndSuppress;
-WebRtcAecSubBandCoherence WebRtcAec_SubbandCoherence;
+WebRtcAecComputeCoherence WebRtcAec_ComputeCoherence;
+WebRtcAecUpdateCoherenceSpectra WebRtcAec_UpdateCoherenceSpectra;
WebRtcAecStoreAsComplex WebRtcAec_StoreAsComplex;
WebRtcAecPartitionDelay WebRtcAec_PartitionDelay;
WebRtcAecWindowData WebRtcAec_WindowData;
@@ -411,14 +412,14 @@ const float WebRtcAec_kMinFarendPSD = 15;
//
// In addition to updating the PSDs, also the filter diverge state is
// determined.
-static void SmoothedPSD(int mult,
- bool extended_filter_enabled,
- float efw[2][PART_LEN1],
- float dfw[2][PART_LEN1],
- float xfw[2][PART_LEN1],
- CoherenceState* coherence_state,
- short* filter_divergence_state,
- int* extreme_filter_divergence) {
+static void UpdateCoherenceSpectra(int mult,
+ bool extended_filter_enabled,
+ float efw[2][PART_LEN1],
+ float dfw[2][PART_LEN1],
+ float xfw[2][PART_LEN1],
+ CoherenceState* coherence_state,
+ short* filter_divergence_state,
+ int* extreme_filter_divergence) {
// Power estimate smoothing coefficients.
const float* ptrGCoh =
extended_filter_enabled
@@ -495,24 +496,11 @@ __inline static void StoreAsComplex(const float* data,
data_complex[1][PART_LEN] = 0;
}
-static void SubbandCoherence(int mult,
- bool extended_filter_enabled,
- float efw[2][PART_LEN1],
- float dfw[2][PART_LEN1],
- float xfw[2][PART_LEN1],
- float* fft,
+static void ComputeCoherence(const CoherenceState* coherence_state,
float* cohde,
- float* cohxd,
- CoherenceState* coherence_state,
- short* filter_divergence_state,
- int* extreme_filter_divergence) {
- int i;
-
- SmoothedPSD(mult, extended_filter_enabled, efw, dfw, xfw, coherence_state,
- filter_divergence_state, extreme_filter_divergence);
-
+ float* cohxd) {
// Subband coherence
- for (i = 0; i < PART_LEN1; i++) {
+ for (int i = 0; i < PART_LEN1; i++) {
cohde[i] = (coherence_state->sde[i][0] * coherence_state->sde[i][0] +
coherence_state->sde[i][1] * coherence_state->sde[i][1]) /
(coherence_state->sd[i] * coherence_state->se[i] + 1e-10f);
@@ -1068,10 +1056,12 @@ static void EchoSuppression(AecCore* aec,
memcpy(xfw, aec->xfwBuf + aec->delayIdx * PART_LEN1,
sizeof(xfw[0][0]) * 2 * PART_LEN1);
- WebRtcAec_SubbandCoherence(aec->mult, aec->extended_filter_enabled == 1, efw,
- dfw, xfw, fft, cohde, cohxd, &aec->coherence_state,
- &aec->divergeState,
- &aec->extreme_filter_divergence);
+ WebRtcAec_UpdateCoherenceSpectra(aec->mult, aec->extended_filter_enabled == 1,
+ efw, dfw, xfw, &aec->coherence_state,
+ &aec->divergeState,
+ &aec->extreme_filter_divergence);
+
+ WebRtcAec_ComputeCoherence(&aec->coherence_state, cohde, cohxd);
// Select the microphone signal as output if the filter is deemed to have
// diverged.
@@ -1502,7 +1492,8 @@ AecCore* WebRtcAec_CreateAec() {
WebRtcAec_ScaleErrorSignal = ScaleErrorSignal;
WebRtcAec_FilterAdaptation = FilterAdaptation;
WebRtcAec_OverdriveAndSuppress = OverdriveAndSuppress;
- WebRtcAec_SubbandCoherence = SubbandCoherence;
+ WebRtcAec_ComputeCoherence = ComputeCoherence;
+ WebRtcAec_UpdateCoherenceSpectra = UpdateCoherenceSpectra;
WebRtcAec_StoreAsComplex = StoreAsComplex;
WebRtcAec_PartitionDelay = PartitionDelay;
WebRtcAec_WindowData = WindowData;
« no previous file with comments | « no previous file | webrtc/modules/audio_processing/aec/aec_core_internal.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698