From 60e8965b6b891a01dc4e513d0edce986ac557f8e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Per=20=C3=85hgren?= Date: Wed, 20 Dec 2017 17:26:31 +0100 Subject: [PATCH] Removed the redundant functionality for the initial state in AEC3 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Bug: webrtc:8671 Change-Id: I93412675a6b56c20c8d866e64e24560a4546dc66 Reviewed-on: https://webrtc-review.googlesource.com/35200 Commit-Queue: Per Åhgren Reviewed-by: Per Åhgren Reviewed-by: Gustaf Ullberg Cr-Commit-Position: refs/heads/master@{#21391} --- modules/audio_processing/aec3/aec_state.cc | 4 ---- modules/audio_processing/aec3/aec_state.h | 4 ---- .../audio_processing/aec3/residual_echo_estimator.cc | 12 ++++-------- .../audio_processing/aec3/residual_echo_estimator.h | 1 - 4 files changed, 4 insertions(+), 17 deletions(-) diff --git a/modules/audio_processing/aec3/aec_state.cc b/modules/audio_processing/aec3/aec_state.cc index 195f5dcc6f..8edecf7b90 100644 --- a/modules/audio_processing/aec3/aec_state.cc +++ b/modules/audio_processing/aec3/aec_state.cc @@ -73,7 +73,6 @@ void AecState::HandleEchoPathChange( std::fill(max_render_.begin(), max_render_.end(), 0.f); force_zero_gain_counter_ = 0; blocks_with_proper_filter_adaptation_ = 0; - initial_state_ = true; capture_block_counter_ = 0; filter_has_had_time_to_converge_ = false; render_received_ = false; @@ -162,9 +161,6 @@ void AecState::Update( filter_has_had_time_to_converge_ = blocks_with_proper_filter_adaptation_ >= 2 * kNumBlocksPerSecond; - // TODO(peah): Remove. - initial_state_ = capture_block_counter_ < 3 * kNumBlocksPerSecond; - // Flag whether the linear filter estimate is usable. usable_linear_estimate_ = !echo_saturation_ && diff --git a/modules/audio_processing/aec3/aec_state.h b/modules/audio_processing/aec3/aec_state.h index afc55a251b..1479c0ca8f 100644 --- a/modules/audio_processing/aec3/aec_state.h +++ b/modules/audio_processing/aec3/aec_state.h @@ -106,9 +106,6 @@ class AecState { return filter_has_had_time_to_converge_; } - // Returns whether the AEC is in an initial state. - bool InitialState() const { return initial_state_; } - // Updates the aec state. void Update(const std::vector>& adaptive_filter_frequency_response, @@ -169,7 +166,6 @@ class AecState { std::vector max_render_; float reverb_decay_; bool saturating_echo_path_ = false; - bool initial_state_ = true; bool filter_has_had_time_to_converge_ = false; RTC_DISALLOW_COPY_AND_ASSIGN(AecState); diff --git a/modules/audio_processing/aec3/residual_echo_estimator.cc b/modules/audio_processing/aec3/residual_echo_estimator.cc index 95f64e186a..c89084b406 100644 --- a/modules/audio_processing/aec3/residual_echo_estimator.cc +++ b/modules/audio_processing/aec3/residual_echo_estimator.cc @@ -142,10 +142,10 @@ 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.FilterHasHadTimeToConverge(), aec_state.SaturatedEcho(), - config_.ep_strength.bounded_erl, aec_state.TransparentMode(), - aec_state.InitialState(), X2, Y2, R2); + NonLinearEstimate(aec_state.FilterHasHadTimeToConverge(), + aec_state.SaturatedEcho(), + config_.ep_strength.bounded_erl, + aec_state.TransparentMode(), X2, Y2, R2); if (aec_state.ExternalDelay() && aec_state.FilterDelay() && aec_state.SaturatedEcho()) { @@ -195,7 +195,6 @@ void ResidualEchoEstimator::NonLinearEstimate( bool saturated_echo, bool bounded_erl, bool transparent_mode, - bool initial_state, const std::array& X2, const std::array& Y2, std::array* R2) { @@ -215,9 +214,6 @@ void ResidualEchoEstimator::NonLinearEstimate( // If the filter should have been able to converge, and and it is known that // the ERL is bounded, use a very low gain. echo_path_gain_lf = echo_path_gain_mf = echo_path_gain_hf = 0.001f; - } else if (!initial_state) { - // If the AEC is no longer in an initial state, assume a weak echo path. - echo_path_gain_lf = echo_path_gain_mf = echo_path_gain_hf = 0.01f; } else { // In the initial state, use conservative gains. echo_path_gain_lf = config_.ep_strength.lf; diff --git a/modules/audio_processing/aec3/residual_echo_estimator.h b/modules/audio_processing/aec3/residual_echo_estimator.h index 271b1c0886..f2ecea19cc 100644 --- a/modules/audio_processing/aec3/residual_echo_estimator.h +++ b/modules/audio_processing/aec3/residual_echo_estimator.h @@ -52,7 +52,6 @@ class ResidualEchoEstimator { bool saturated_echo, bool bounded_erl, bool transparent_mode, - bool initial_state, const std::array& X2, const std::array& Y2, std::array* R2);