Remove attenuation of narrow banded peaks

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 <peah@webrtc.org>
Commit-Queue: Gustaf Ullberg <gustaf@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#23022}
This commit is contained in:
Gustaf Ullberg 2018-04-25 12:54:59 +02:00 committed by Commit Bot
parent 1f433e46db
commit 5bb98971ce
2 changed files with 2 additions and 22 deletions

View File

@ -26,21 +26,6 @@
namespace webrtc {
namespace {
// Reduce gain to avoid narrow band echo leakage.
void NarrowBandAttenuation(int narrow_bin,
const std::array<float, kFftLengthBy2Plus1>& nearend,
const std::array<float, kFftLengthBy2Plus1>& echo,
std::array<float, kFftLengthBy2Plus1>* 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<int>(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<float, kFftLengthBy2Plus1>* 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<int>& narrow_peak_band,
const AecState& aec_state,
const std::array<float, kFftLengthBy2Plus1>& nearend,
const std::array<float, kFftLengthBy2Plus1>& 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<int> 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) {

View File

@ -47,7 +47,6 @@ class SuppressionGain {
private:
void LowerBandGain(bool stationary_with_low_power,
const rtc::Optional<int>& narrow_peak_band,
const AecState& aec_state,
const std::array<float, kFftLengthBy2Plus1>& nearend,
const std::array<float, kFftLengthBy2Plus1>& echo,