From 45231be79c7ba983fb3d187b444494caba61839e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Per=20=C3=85hgren?= Date: Thu, 16 May 2019 14:43:57 +0200 Subject: [PATCH] AEC3: Removing unused code in the echo subtractor MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Bug: webrtc:8671 Change-Id: I77e9c55fe2e1030e5b74c02d4bc9222de422f6f4 Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/137045 Reviewed-by: Gustaf Ullberg Commit-Queue: Per Ã…hgren Cr-Commit-Position: refs/heads/master@{#28760} --- modules/audio_processing/aec3/subtractor.cc | 25 +++++---------------- 1 file changed, 6 insertions(+), 19 deletions(-) diff --git a/modules/audio_processing/aec3/subtractor.cc b/modules/audio_processing/aec3/subtractor.cc index aa38a34bec..5e6f773911 100644 --- a/modules/audio_processing/aec3/subtractor.cc +++ b/modules/audio_processing/aec3/subtractor.cc @@ -27,29 +27,18 @@ void PredictionError(const Aec3Fft& fft, const FftData& S, rtc::ArrayView y, std::array* e, - std::array* s, - bool* saturation) { + std::array* s) { std::array tmp; fft.Ifft(S, &tmp); constexpr float kScale = 1.0f / kFftLengthBy2; std::transform(y.begin(), y.end(), tmp.begin() + kFftLengthBy2, e->begin(), [&](float a, float b) { return a - b * kScale; }); - *saturation = false; - if (s) { for (size_t k = 0; k < s->size(); ++k) { (*s)[k] = kScale * tmp[k + kFftLengthBy2]; } - auto result = std::minmax_element(s->begin(), s->end()); - *saturation = *result.first <= -32768 || *result.first >= 32767; } - if (!(*saturation)) { - auto result = std::minmax_element(e->begin(), e->end()); - *saturation = *result.first <= -32768 || *result.first >= 32767; - } - - *saturation = false; } void ScaleFilterOutput(rtc::ArrayView y, @@ -141,12 +130,10 @@ void Subtractor::Process(const RenderBuffer& render_buffer, // Form the outputs of the main and shadow filters. main_filter_.Filter(render_buffer, &S); - bool main_saturation = false; - PredictionError(fft_, S, y, &e_main, &output->s_main, &main_saturation); + PredictionError(fft_, S, y, &e_main, &output->s_main); shadow_filter_.Filter(render_buffer, &S); - bool shadow_saturation = false; - PredictionError(fft_, S, y, &e_shadow, &output->s_shadow, &shadow_saturation); + PredictionError(fft_, S, y, &e_shadow, &output->s_shadow); // Compute the signal powers in the subtractor output. output->ComputeMetrics(y); @@ -192,7 +179,7 @@ void Subtractor::Process(const RenderBuffer& render_buffer, // Update the main filter. if (!main_filter_adjusted) { G_main_.Compute(X2_main, render_signal_analyzer, *output, main_filter_, - aec_state.SaturatedCapture() || main_saturation, &G); + aec_state.SaturatedCapture(), &G); } else { G.re.fill(0.f); G.im.fill(0.f); @@ -207,13 +194,13 @@ void Subtractor::Process(const RenderBuffer& render_buffer, if (poor_shadow_filter_counter_ < 5) { G_shadow_.Compute(X2_shadow, render_signal_analyzer, E_shadow, shadow_filter_.SizePartitions(), - aec_state.SaturatedCapture() || shadow_saturation, &G); + aec_state.SaturatedCapture(), &G); } else { poor_shadow_filter_counter_ = 0; shadow_filter_.SetFilter(main_filter_.GetFilter()); G_shadow_.Compute(X2_shadow, render_signal_analyzer, E_main, shadow_filter_.SizePartitions(), - aec_state.SaturatedCapture() || main_saturation, &G); + aec_state.SaturatedCapture(), &G); } shadow_filter_.Adapt(render_buffer, G);