Balancing the transparency in AEC3 between saturating and low echo paths

This CL balances the NLP tradeoff in AEC3 to properly handle the cases
when the echo path is so strong that it saturates the echo and when it
is so weak that the echo is very low compared to nearend.

Bug: webrtc:8411, webrtc:8412, chromium:775653
Change-Id: I5aff74dfadd51cac1ce71b1cb935d68a5be6918d
Reviewed-on: https://webrtc-review.googlesource.com/14120
Commit-Queue: Per Åhgren <peah@webrtc.org>
Reviewed-by: Per Åhgren <peah@webrtc.org>
Reviewed-by: Gustaf Ullberg <gustaf@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#20418}
This commit is contained in:
Per Åhgren
2017-10-25 02:59:45 +02:00
committed by Commit Bot
parent d9f99c1e7a
commit 7ddd46386a
11 changed files with 276 additions and 133 deletions

View File

@ -67,6 +67,9 @@ class AecState {
// Returns whether the echo signal is saturated.
bool SaturatedEcho() const { return echo_saturation_; }
// Returns whether the echo path can saturate.
bool SaturatingEchoPath() const { return saturating_echo_path_; }
// Updates the capture signal saturation.
void UpdateCaptureSaturation(bool capture_signal_saturation) {
capture_signal_saturation_ = capture_signal_saturation;
@ -93,20 +96,14 @@ class AecState {
}
// Returns whether the linear filter should have been able to adapt properly.
bool SufficientFilterUpdates() const {
return blocks_with_filter_adaptation_ >= kEchoPathChangeConvergenceBlocks;
}
bool SufficientFilterUpdates() const { return sufficient_filter_updates_; }
// Returns whether the echo subtractor can be used to determine the residual
// echo.
bool LinearEchoEstimate() const {
return UsableLinearEstimate() && !TransparentMode();
}
bool LinearEchoEstimate() const { return linear_echo_estimate_; }
// Returns whether the AEC is in an initial state.
bool InitialState() const {
return capture_block_counter_ < 3 * kNumBlocksPerSecond;
}
bool InitialState() const { return initial_state_; }
// Updates the aec state.
void Update(const std::vector<std::array<float, kFftLengthBy2Plus1>>&
@ -147,12 +144,14 @@ class AecState {
ErleEstimator erle_estimator_;
size_t capture_block_counter_ = 0;
size_t blocks_with_filter_adaptation_ = 0;
size_t blocks_with_strong_render_ = 0;
bool usable_linear_estimate_ = false;
bool echo_leakage_detected_ = false;
bool capture_signal_saturation_ = false;
bool echo_saturation_ = false;
bool transparent_mode_ = false;
float previous_max_sample_ = 0.f;
std::array<float, kAdaptiveFilterLength> max_render_;
size_t max_render_index_ = 0;
bool force_zero_gain_ = false;
bool render_received_ = false;
size_t force_zero_gain_counter_ = 0;
@ -165,6 +164,11 @@ class AecState {
EchoAudibility echo_audibility_;
const EchoCanceller3Config config_;
float reverb_decay_;
bool saturating_echo_path_ = false;
int saturating_echo_path_counter_ = 0;
bool initial_state_ = true;
bool linear_echo_estimate_ = false;
bool sufficient_filter_updates_ = false;
RTC_DISALLOW_COPY_AND_ASSIGN(AecState);
};