From de10eea6fccf142978762989aa380ed14bffa560 Mon Sep 17 00:00:00 2001 From: Gustaf Ullberg Date: Wed, 28 Nov 2018 09:44:50 +0100 Subject: [PATCH] AEC3: Fix ENR in the dominant nearend detection MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Correcting a mistake in the dominant nearend detection where the meaning of the echo-to-nearend ratio was inversed. Bug: webrtc:8671 Change-Id: I7f56369fad1784e256150c312b6b3dafcb9d0f71 Reviewed-on: https://webrtc-review.googlesource.com/c/112136 Reviewed-by: Per Ã…hgren Commit-Queue: Gustaf Ullberg Cr-Commit-Position: refs/heads/master@{#25818} --- api/audio/echo_canceller3_config.h | 4 ++-- modules/audio_processing/aec3/suppression_gain.cc | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/api/audio/echo_canceller3_config.h b/api/audio/echo_canceller3_config.h index ea6e51baf9..ffe17f2b8b 100644 --- a/api/audio/echo_canceller3_config.h +++ b/api/audio/echo_canceller3_config.h @@ -182,8 +182,8 @@ struct RTC_EXPORT EchoCanceller3Config { 0.25f); struct DominantNearendDetection { - float enr_threshold = 4.f; - float enr_exit_threshold = .1f; + float enr_threshold = .25f; + float enr_exit_threshold = 10.f; float snr_threshold = 30.f; int hold_duration = 50; int trigger_threshold = 12; diff --git a/modules/audio_processing/aec3/suppression_gain.cc b/modules/audio_processing/aec3/suppression_gain.cc index 88cfc0a01e..c6d2bf6673 100644 --- a/modules/audio_processing/aec3/suppression_gain.cc +++ b/modules/audio_processing/aec3/suppression_gain.cc @@ -419,7 +419,7 @@ void SuppressionGain::DominantNearendDetector::Update( // Detect strong active nearend if the nearend is sufficiently stronger than // the echo and the nearend noise. if ((!initial_state || use_during_initial_phase_) && - ne_sum > enr_threshold_ * echo_sum && + echo_sum < enr_threshold_ * ne_sum && ne_sum > snr_threshold_ * noise_sum) { if (++trigger_counter_ >= trigger_threshold_) { // After a period of strong active nearend activity, flag nearend mode. @@ -432,7 +432,7 @@ void SuppressionGain::DominantNearendDetector::Update( } // Exit nearend-state early at strong echo. - if (ne_sum < enr_exit_threshold_ * echo_sum && + if (echo_sum > enr_exit_threshold_ * ne_sum && echo_sum > snr_threshold_ * noise_sum) { hold_counter_ = 0; }