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(), |