From 3f6077d22f97a951424c915c0148904a1f7975cf Mon Sep 17 00:00:00 2001 From: Gustaf Ullberg Date: Mon, 24 Sep 2018 14:54:32 +0200 Subject: [PATCH] AEC3: Delay estimator adapts even when estimated echo saturates MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Speeds up adaptation of the matched filter of the delay estimator by allowing the estimated echo and the error signal (microphone minus estimated echo) to be saturated. Only microphone saturation pauses the filter adaptation. Bug: webrtc:9773 Change-Id: I8b8400539fde3ee821f36a95818bece02ddd626b Reviewed-on: https://webrtc-review.googlesource.com/101341 Reviewed-by: Per Ã…hgren Commit-Queue: Gustaf Ullberg Cr-Commit-Position: refs/heads/master@{#24802} --- .../audio_processing/aec3/matched_filter.cc | 18 +++--------------- 1 file changed, 3 insertions(+), 15 deletions(-) diff --git a/modules/audio_processing/aec3/matched_filter.cc b/modules/audio_processing/aec3/matched_filter.cc index 9573d93c87..6744bd5812 100644 --- a/modules/audio_processing/aec3/matched_filter.cc +++ b/modules/audio_processing/aec3/matched_filter.cc @@ -93,11 +93,7 @@ void MatchedFilterCore_NEON(size_t x_start_index, // Compute the matched filter error. float e = y[i] - s; - const bool saturation = y[i] >= 32000.f || y[i] <= -32000.f || - s >= 32000.f || s <= -32000.f || e >= 32000.f || - e <= -32000.f; - - e = std::min(32767.f, std::max(-32768.f, e)); + const bool saturation = y[i] >= 32000.f || y[i] <= -32000.f; (*error_sum) += e * e; // Update the matched filter estimate in an NLMS manner. @@ -209,11 +205,7 @@ void MatchedFilterCore_SSE2(size_t x_start_index, // Compute the matched filter error. float e = y[i] - s; - const bool saturation = y[i] >= 32000.f || y[i] <= -32000.f || - s >= 32000.f || s <= -32000.f || e >= 32000.f || - e <= -32000.f; - - e = std::min(32767.f, std::max(-32768.f, e)); + const bool saturation = y[i] >= 32000.f || y[i] <= -32000.f; (*error_sum) += e * e; // Update the matched filter estimate in an NLMS manner. @@ -281,11 +273,7 @@ void MatchedFilterCore(size_t x_start_index, // Compute the matched filter error. float e = y[i] - s; - const bool saturation = y[i] >= 32000.f || y[i] <= -32000.f || - s >= 32000.f || s <= -32000.f || e >= 32000.f || - e <= -32000.f; - - e = std::min(32767.f, std::max(-32768.f, e)); + const bool saturation = y[i] >= 32000.f || y[i] <= -32000.f; (*error_sum) += e * e; // Update the matched filter estimate in an NLMS manner.