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

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

Issue 2974883002: Robustification of the AEC3 echo removal in the first part of the call (Closed)
Patch Set: Created 3 years, 5 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
« no previous file with comments | « webrtc/modules/audio_processing/aec3/residual_echo_estimator.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: webrtc/modules/audio_processing/aec3/residual_echo_estimator.cc
diff --git a/webrtc/modules/audio_processing/aec3/residual_echo_estimator.cc b/webrtc/modules/audio_processing/aec3/residual_echo_estimator.cc
index 6ec00e40fad6d05f7a13a27b81f3a4d71ba051cd..c2efa7c00239207d5312308c8191a4bcc20431df 100644
--- a/webrtc/modules/audio_processing/aec3/residual_echo_estimator.cc
+++ b/webrtc/modules/audio_processing/aec3/residual_echo_estimator.cc
@@ -136,9 +136,7 @@ void ResidualEchoEstimator::Estimate(
X2.begin(), X2.end(), X2_noise_floor_.begin(), X2.begin(),
[](float a, float b) { return std::max(0.f, a - 10.f * b); });
- NonLinearEstimate(
- aec_state.HeadsetDetected() ? kHeadsetEchoPathGain : kFixedEchoPathGain,
- X2, Y2, R2);
+ NonLinearEstimate(aec_state, X2, Y2, R2);
AddEchoReverb(*R2, aec_state.SaturatedEcho(),
std::min(static_cast<size_t>(kAdaptiveFilterLength),
delay.value_or(kAdaptiveFilterLength)),
@@ -179,13 +177,28 @@ void ResidualEchoEstimator::LinearEstimate(
}
void ResidualEchoEstimator::NonLinearEstimate(
- float echo_path_gain,
+ const AecState& aec_state,
ivoc 2017/07/11 08:46:04 Since the function only uses aec_state.HeadsetDete
peah-webrtc 2017/07/11 08:53:01 Good point! Done.
const std::array<float, kFftLengthBy2Plus1>& X2,
const std::array<float, kFftLengthBy2Plus1>& Y2,
std::array<float, kFftLengthBy2Plus1>* R2) {
+ // Choose gains.
+ const float echo_path_gain_lf =
+ aec_state.HeadsetDetected() ? kHeadsetEchoPathGain : 100;
+ const float echo_path_gain_mf =
+ aec_state.HeadsetDetected() ? kHeadsetEchoPathGain : 1000;
+ const float echo_path_gain_hf =
+ aec_state.HeadsetDetected() ? kHeadsetEchoPathGain : 5000;
+
// Compute preliminary residual echo.
- std::transform(X2.begin(), X2.end(), R2->begin(),
- [echo_path_gain](float a) { return a * echo_path_gain; });
+ std::transform(
+ X2.begin(), X2.begin() + 12, R2->begin(),
+ [echo_path_gain_lf](float a) { return a * echo_path_gain_lf; });
+ std::transform(
+ X2.begin() + 12, X2.begin() + 25, R2->begin() + 12,
+ [echo_path_gain_mf](float a) { return a * echo_path_gain_mf; });
+ std::transform(
+ X2.begin() + 25, X2.end(), R2->begin() + 25,
+ [echo_path_gain_hf](float a) { return a * echo_path_gain_hf; });
for (size_t k = 0; k < R2->size(); ++k) {
// Update hold counter.
« no previous file with comments | « webrtc/modules/audio_processing/aec3/residual_echo_estimator.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698