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

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

Issue 1743223002: Reland "Calculating ERLE in AEC more properly." (Closed) Base URL: https://chromium.googlesource.com/external/webrtc.git@master
Patch Set: fixing the test 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | webrtc/modules/audio_processing/test/audio_processing_unittest.cc » ('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 2cc2968f81c2e2ffc658d15ba048e3890d8a4a47..1a45a0c8c01228d563729c1fb7461d928d283baf 100644
--- a/webrtc/modules/audio_processing/aec/aec_core.cc
+++ b/webrtc/modules/audio_processing/aec/aec_core.cc
@@ -689,12 +689,11 @@ static void UpdateMetrics(AecCore* aec) {
// ERLE
// subtract noise power
- suppressedEcho = 2 * (aec->nlpoutlevel.averagelevel -
- safety * aec->nlpoutlevel.minlevel);
+ suppressedEcho = aec->nlpoutlevel.averagelevel -
+ safety * aec->nlpoutlevel.minlevel;
dtmp = 10 * static_cast<float>(log10(aec->nearlevel.averagelevel /
- (2 * aec->nlpoutlevel.averagelevel) +
- 1e-10f));
+ aec->nlpoutlevel.averagelevel + 1e-10f));
dtmp2 = 10 * static_cast<float>(log10(echo / suppressedEcho + 1e-10f));
dtmp = dtmp2;
@@ -1139,16 +1138,6 @@ static void EchoSuppression(AecCore* aec,
// Inverse error fft.
ScaledInverseFft(efw, fft, 2.0f, 1);
- // TODO(bjornv): Investigate how to take the windowing below into account if
- // needed.
- if (aec->metricsMode == 1) {
- // Note that we have a scaling by two in the time domain |eBuf|.
- // In addition the time domain signal is windowed before transformation,
- // losing half the energy on the average. We take care of the first
- // scaling only in UpdateMetrics().
- UpdateLevel(&aec->nlpoutlevel, CalculatePower(fft, PART_LEN2));
- }
-
// Overlap and add to obtain output.
for (i = 0; i < PART_LEN; i++) {
output[i] = (fft[i] * WebRtcAec_sqrtHanning[i] +
@@ -1358,6 +1347,7 @@ static void ProcessBlock(AecCore* aec) {
EchoSuppression(aec, farend_ptr, echo_subtractor_output, output, outputH_ptr);
if (aec->metricsMode == 1) {
+ UpdateLevel(&aec->nlpoutlevel, CalculatePower(output, PART_LEN));
UpdateMetrics(aec);
}
« no previous file with comments | « no previous file | webrtc/modules/audio_processing/test/audio_processing_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698