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

Unified Diff: webrtc/modules/audio_processing/aec3/suppression_filter.cc

Issue 2718993002: Added post-adjustment of the suppression gains (Closed)
Patch Set: Added post-adjustment of the suppression gains Created 3 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
Index: webrtc/modules/audio_processing/aec3/suppression_filter.cc
diff --git a/webrtc/modules/audio_processing/aec3/suppression_filter.cc b/webrtc/modules/audio_processing/aec3/suppression_filter.cc
index 358aafbdfb3777f0a5cb8fe05076d9cd0a4dc1ee..30e99a6279b7c1c5b4bc070e1828b9e76425ed3b 100644
--- a/webrtc/modules/audio_processing/aec3/suppression_filter.cc
+++ b/webrtc/modules/audio_processing/aec3/suppression_filter.cc
@@ -138,17 +138,14 @@ void SuppressionFilter::ApplyGain(
fft_.Ifft(E, &time_domain_high_band_noise);
// Scale and apply the noise to the signals.
- // TODO(peah): Ensure that the high bands are properly delayed.
- constexpr int kNumBandsAveragingUpperGain = kFftLengthBy2 / 4;
- constexpr float kOneByNumBandsAveragingUpperGain =
- 1.f / kNumBandsAveragingUpperGain;
- float high_bands_gain =
- std::accumulate(suppression_gain.end() - kNumBandsAveragingUpperGain,
- suppression_gain.end(), 0.f) *
- kOneByNumBandsAveragingUpperGain;
+ constexpr int kLowestAnalysisBin = 3;
+ float high_bands_gain = std::accumulate(
hlundin-webrtc 2017/02/27 08:12:52 Iiuc, this is not an accumulation at all. You are
peah-webrtc 2017/02/27 08:25:47 Great suggestion! Thanks! Done.
+ suppression_gain.begin() + kLowestAnalysisBin + 1,
+ suppression_gain.end(), suppression_gain[kLowestAnalysisBin],
+ [](float a, float b) { return std::min(a, b); });
float high_bands_noise_scaling =
- 0.4f * std::max(1.f - high_bands_gain * high_bands_gain, 0.f);
+ 0.4f * std::max(1.f - high_bands_gain, 0.f);
peah-webrtc 2017/02/27 07:55:22 The former computation of high_bands_noise_scaling
hlundin-webrtc 2017/02/27 08:12:51 Acknowledged.
std::transform(
(*e)[1].begin(), (*e)[1].end(), time_domain_high_band_noise.begin(),

Powered by Google App Engine
This is Rietveld 408576698