Correcting the usage of the estimated echo path gain in AEC3

This CL corrects the usage of the estimated echo path gain to not be
hardcoded to 1. In order to retain the tuned behavior, the CL for now
maintains the former behavior in the code.

Bug: webrtc:9255,chromium:851187
Change-Id: I7f91c72e476680a8a854c22b74b1771fae446110
Reviewed-on: https://webrtc-review.googlesource.com/75510
Reviewed-by: Gustaf Ullberg <gustaf@webrtc.org>
Commit-Queue: Per Åhgren <peah@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#23190}
This commit is contained in:
Per Åhgren 2018-05-09 11:48:49 +02:00 committed by Commit Bot
parent e05c43cc39
commit ced31ba1cf
4 changed files with 20 additions and 8 deletions

View file

@ -62,9 +62,9 @@ struct EchoCanceller3Config {
} erle; } erle;
struct EpStrength { struct EpStrength {
float lf = 10.f; float lf = 1.f;
float mf = 10.f; float mf = 1.f;
float hf = 10.f; float hf = 1.f;
float default_len = 0.f; float default_len = 0.f;
bool echo_can_saturate = true; bool echo_can_saturate = true;
bool bounded_erl = false; bool bounded_erl = false;

View file

@ -49,7 +49,7 @@ class AecState {
bool UseLinearFilterOutput() const { return use_linear_filter_output_; } bool UseLinearFilterOutput() const { return use_linear_filter_output_; }
// Returns the estimated echo path gain. // Returns the estimated echo path gain.
bool EchoPathGain() const { return filter_analyzer_.Gain(); } float EchoPathGain() const { return filter_analyzer_.Gain(); }
// Returns whether the render signal is currently active. // Returns whether the render signal is currently active.
bool ActiveRender() const { return blocks_with_active_render_ > 200; } bool ActiveRender() const { return blocks_with_active_render_ > 200; }

View file

@ -24,12 +24,17 @@ bool EnableSoftTransparentMode() {
return !field_trial::IsEnabled("WebRTC-Aec3SoftTransparentModeKillSwitch"); return !field_trial::IsEnabled("WebRTC-Aec3SoftTransparentModeKillSwitch");
} }
bool OverrideEstimatedEchoPathGain() {
return !field_trial::IsEnabled("WebRTC-Aec3OverrideEchoPathGainKillSwitch");
}
} // namespace } // namespace
ResidualEchoEstimator::ResidualEchoEstimator(const EchoCanceller3Config& config) ResidualEchoEstimator::ResidualEchoEstimator(const EchoCanceller3Config& config)
: config_(config), : config_(config),
S2_old_(config_.filter.main.length_blocks), S2_old_(config_.filter.main.length_blocks),
soft_transparent_mode_(EnableSoftTransparentMode()) { soft_transparent_mode_(EnableSoftTransparentMode()),
override_estimated_echo_path_gain_(OverrideEstimatedEchoPathGain()) {
Reset(); Reset();
} }
@ -74,9 +79,15 @@ void ResidualEchoEstimator::Estimate(
0.f, a - config_.echo_model.stationary_gate_slope * b); 0.f, a - config_.echo_model.stationary_gate_slope * b);
}); });
float echo_path_gain = aec_state.TransparentMode() && soft_transparent_mode_ float echo_path_gain;
? 0.01f if (override_estimated_echo_path_gain_) {
: aec_state.EchoPathGain(); echo_path_gain =
aec_state.TransparentMode() && soft_transparent_mode_ ? 0.01f : 1.f;
} else {
echo_path_gain = aec_state.TransparentMode() && soft_transparent_mode_
? 0.01f
: aec_state.EchoPathGain();
}
NonLinearEstimate(echo_path_gain, X2, Y2, R2); NonLinearEstimate(echo_path_gain, X2, Y2, R2);
// If the echo is saturated, estimate the echo power as the maximum echo // If the echo is saturated, estimate the echo power as the maximum echo

View file

@ -83,6 +83,7 @@ class ResidualEchoEstimator {
std::array<float, kFftLengthBy2Plus1> X2_noise_floor_; std::array<float, kFftLengthBy2Plus1> X2_noise_floor_;
std::array<int, kFftLengthBy2Plus1> X2_noise_floor_counter_; std::array<int, kFftLengthBy2Plus1> X2_noise_floor_counter_;
const bool soft_transparent_mode_; const bool soft_transparent_mode_;
const bool override_estimated_echo_path_gain_;
RTC_DISALLOW_IMPLICIT_CONSTRUCTORS(ResidualEchoEstimator); RTC_DISALLOW_IMPLICIT_CONSTRUCTORS(ResidualEchoEstimator);
}; };