AEC3: Enforcing nonlinear mode when transparent mode is active

This CL ensures that the linear echo prediction mode is not used
when the transparent mode is active.

TBR: saza@webrtc.org,gustaf@webrtc.org
Bug: webrtc:9612,chromium:873074
Change-Id: I25cda5226251df769b6524594ea8a2b78532aaec
Reviewed-on: https://webrtc-review.googlesource.com/93740
Reviewed-by: Per Åhgren <peah@webrtc.org>
Commit-Queue: Per Åhgren <peah@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#24268}
This commit is contained in:
Per Åhgren
2018-08-12 21:46:17 +02:00
committed by Commit Bot
parent 656d609a95
commit f4cf64ec06
2 changed files with 11 additions and 0 deletions

View File

@ -67,6 +67,11 @@ bool EnableUncertaintyUntilSufficientAdapted() {
"WebRTC-Aec3ErleUncertaintyUntilSufficientlyAdaptedKillSwitch");
}
bool TreatTransparentModeAsNonlinear() {
return !field_trial::IsEnabled(
"WebRTC-Aec3TreatTransparentModeAsNonlinearKillSwitch");
}
float ComputeGainRampupIncrease(const EchoCanceller3Config& config) {
const auto& c = config.echo_removal_control.gain_rampup;
return powf(1.f / c.first_non_zero_gain, 1.f / c.non_zero_gain_blocks);
@ -96,6 +101,8 @@ AecState::AecState(const EchoCanceller3Config& config)
no_alignment_required_for_linear_mode_(EnableNoWaitForAlignment()),
use_uncertainty_until_sufficiently_adapted_(
EnableUncertaintyUntilSufficientAdapted()),
transparent_mode_enforces_nonlinear_mode_(
TreatTransparentModeAsNonlinear()),
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_)),
@ -323,6 +330,9 @@ void AecState::Update(
usable_linear_estimate_ = usable_linear_estimate_ && !diverged_filter;
}
}
if (transparent_mode_enforces_nonlinear_mode_) {
usable_linear_estimate_ = usable_linear_estimate_ && !TransparentMode();
}
use_linear_filter_output_ = usable_linear_estimate_ && !TransparentMode();
diverged_linear_filter_ = diverged_filter;

View File

@ -181,6 +181,7 @@ class AecState {
const bool convergence_trigger_linear_mode_;
const bool no_alignment_required_for_linear_mode_;
const bool use_uncertainty_until_sufficiently_adapted_;
const bool transparent_mode_enforces_nonlinear_mode_;
ErlEstimator erl_estimator_;
ErleEstimator erle_estimator_;
size_t capture_block_counter_ = 0;