From 5bb98971ce890be83add3282c7c421ff4f613599 Mon Sep 17 00:00:00 2001 From: Gustaf Ullberg Date: Wed, 25 Apr 2018 12:54:59 +0200 Subject: [PATCH] Remove attenuation of narrow banded peaks MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The code that attenuates narrow banded echo peaks in low frequencies is removed as it affects transparency negatively. Bug: webrtc:9192,chromium:836729 Change-Id: Ib90ce6a3db0a75e8d69bdca432e1f8f8bfbbd988 Reviewed-on: https://webrtc-review.googlesource.com/72380 Reviewed-by: Per Ã…hgren Commit-Queue: Gustaf Ullberg Cr-Commit-Position: refs/heads/master@{#23022} --- .../audio_processing/aec3/suppression_gain.cc | 23 ++----------------- .../audio_processing/aec3/suppression_gain.h | 1 - 2 files changed, 2 insertions(+), 22 deletions(-) diff --git a/modules/audio_processing/aec3/suppression_gain.cc b/modules/audio_processing/aec3/suppression_gain.cc index 110c23279d..fbd2e405d9 100644 --- a/modules/audio_processing/aec3/suppression_gain.cc +++ b/modules/audio_processing/aec3/suppression_gain.cc @@ -26,21 +26,6 @@ namespace webrtc { namespace { -// Reduce gain to avoid narrow band echo leakage. -void NarrowBandAttenuation(int narrow_bin, - const std::array& nearend, - const std::array& echo, - std::array* gain) { - // TODO(peah): Verify that the condition below is not too conservative. - if (10.f * echo[narrow_bin] > nearend[narrow_bin]) { - const int upper_bin = - std::min(narrow_bin + 6, static_cast(kFftLengthBy2Plus1 - 1)); - for (int k = std::max(0, narrow_bin - 6); k <= upper_bin; ++k) { - (*gain)[k] = std::min((*gain)[k], 0.001f); - } - } -} - // Adjust the gains according to the presence of known external filters. void AdjustForExternalFilters(std::array* gain) { // Limit the low frequency gains to avoid the impact of the high-pass filter @@ -271,7 +256,6 @@ void AdjustNonConvergedFrequencies( // TODO(peah): Add further optimizations, in particular for the divisions. void SuppressionGain::LowerBandGain( bool low_noise_render, - const rtc::Optional& narrow_peak_band, const AecState& aec_state, const std::array& nearend, const std::array& echo, @@ -321,9 +305,6 @@ void SuppressionGain::LowerBandGain( linear_echo_estimate, nearend, weighted_echo, masker, min_gain, max_gain, one_by_weighted_echo, gain); AdjustForExternalFilters(gain); - if (narrow_peak_band) { - NarrowBandAttenuation(*narrow_peak_band, nearend, weighted_echo, gain); - } } // Adjust the gain for frequencies which have not yet converged. @@ -379,8 +360,8 @@ void SuppressionGain::GetGain( bool low_noise_render = low_render_detector_.Detect(render); const rtc::Optional narrow_peak_band = render_signal_analyzer.NarrowPeakBand(); - LowerBandGain(low_noise_render, narrow_peak_band, aec_state, nearend_spectrum, - echo_spectrum, comfort_noise_spectrum, low_band_gain); + LowerBandGain(low_noise_render, aec_state, nearend_spectrum, echo_spectrum, + comfort_noise_spectrum, low_band_gain); const float gain_upper_bound = aec_state.SuppressionGainLimit(); if (gain_upper_bound < 1.f) { diff --git a/modules/audio_processing/aec3/suppression_gain.h b/modules/audio_processing/aec3/suppression_gain.h index 59eeb35857..23121a2324 100644 --- a/modules/audio_processing/aec3/suppression_gain.h +++ b/modules/audio_processing/aec3/suppression_gain.h @@ -47,7 +47,6 @@ class SuppressionGain { private: void LowerBandGain(bool stationary_with_low_power, - const rtc::Optional& narrow_peak_band, const AecState& aec_state, const std::array& nearend, const std::array& echo,