AEC3: Reset the ERLE estimation after a delay change

Bug: webrtc:9685
Change-Id: I3c920bbb07aef513ea14bd0573ac4fd4b278ec89
Reviewed-on: https://webrtc-review.googlesource.com/96681
Reviewed-by: Per Åhgren <peah@webrtc.org>
Commit-Queue: Jesus de Vicente Pena <devicentepena@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#24480}
This commit is contained in:
Jesús de Vicente Peña
2018-08-29 11:15:30 +02:00
committed by Commit Bot
parent 9882495eca
commit 7015bb410d
4 changed files with 20 additions and 2 deletions

View File

@ -73,6 +73,11 @@ bool UseEarlyLimiterDeactivation() {
"WebRTC-Aec3EarlyLimiterDeactivationKillSwitch");
}
bool ResetErleAfterEchoPathChanges() {
return !field_trial::IsEnabled(
"WebRTC-Aec3ResetErleAfterEchoPathChangesKillSwitch");
}
float UncertaintyBeforeConvergence() {
if (LowUncertaintyBeforeConvergence()) {
return 1.f;
@ -117,6 +122,7 @@ AecState::AecState(const EchoCanceller3Config& config)
uncertainty_before_convergence_(UncertaintyBeforeConvergence()),
early_entry_to_converged_mode_(EarlyEntryToConvergedMode()),
early_limiter_deactivation_(UseEarlyLimiterDeactivation()),
reset_erle_after_echo_path_changes_(ResetErleAfterEchoPathChanges()),
erle_estimator_(config.erle.min, config.erle.max_l, config.erle.max_h),
max_render_(config_.filter.main.length_blocks, 0.f),
gain_rampup_increase_(ComputeGainRampupIncrease(config_)),
@ -147,6 +153,9 @@ void AecState::HandleEchoPathChange(
suppression_gain_limiter_.Reset();
blocks_since_converged_filter_ = kBlocksSinceConvergencedFilterInit;
diverged_blocks_ = 0;
if (reset_erle_after_echo_path_changes_) {
erle_estimator_.Reset();
}
};
// TODO(peah): Refine the reset scheme according to the type of gain and

View File

@ -179,6 +179,7 @@ class AecState {
const float uncertainty_before_convergence_;
const bool early_entry_to_converged_mode_;
const bool early_limiter_deactivation_;
const bool reset_erle_after_echo_path_changes_;
ErlEstimator erl_estimator_;
ErleEstimator erle_estimator_;
size_t capture_block_counter_ = 0;

View File

@ -35,6 +35,13 @@ ErleEstimator::ErleEstimator(float min_erle,
max_erle_hf_(max_erle_hf),
erle_freq_inst_(kPointsToAccumulate),
erle_time_inst_(kPointsToAccumulate) {
Reset();
}
ErleEstimator::~ErleEstimator() = default;
void ErleEstimator::Reset() {
erle_time_inst_.Reset();
erle_.fill(min_erle_);
erle_onsets_.fill(min_erle_);
hold_counters_.fill(0);
@ -43,8 +50,6 @@ ErleEstimator::ErleEstimator(float min_erle,
hold_counter_time_domain_ = 0;
}
ErleEstimator::~ErleEstimator() = default;
ErleEstimator::ErleTimeInstantaneous::ErleTimeInstantaneous(
int points_to_accumulate)
: points_to_accumulate_(points_to_accumulate) {

View File

@ -27,6 +27,9 @@ class ErleEstimator {
ErleEstimator(float min_erle, float max_erle_lf, float max_erle_hf);
~ErleEstimator();
// Reset the ERLE estimator.
void Reset();
// Updates the ERLE estimate.
void Update(rtc::ArrayView<const float> render_spectrum,
rtc::ArrayView<const float> capture_spectrum,