From 658ad8816b7ef9dafef041a4632a4b106f79ff39 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Per=20=C3=85hgren?= Date: Fri, 27 Apr 2018 14:22:37 +0200 Subject: [PATCH] Removed the updating of the padding data buffer in the AEC3 FFT MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This CL removes the updating of the buffered data used to to pad the 64 sample blocks to 128 samples FFTs. As that padding was used incorrectly in one place this resolves an important issue. Bug: webrtc:9159,chromium:833801,webrtc:9206 Change-Id: Ie6830878ebec6130b61d4e7e3169357f2e253073 Reviewed-on: https://webrtc-review.googlesource.com/73240 Reviewed-by: Gustaf Ullberg Commit-Queue: Per Ã…hgren Cr-Commit-Position: refs/heads/master@{#23059} --- modules/audio_processing/aec3/aec3_fft.cc | 3 +-- modules/audio_processing/aec3/aec3_fft.h | 4 ++-- modules/audio_processing/aec3/aec3_fft_unittest.cc | 1 + 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/modules/audio_processing/aec3/aec3_fft.cc b/modules/audio_processing/aec3/aec3_fft.cc index 5c9a061cba..b02f3425b7 100644 --- a/modules/audio_processing/aec3/aec3_fft.cc +++ b/modules/audio_processing/aec3/aec3_fft.cc @@ -98,7 +98,7 @@ void Aec3Fft::ZeroPaddedFft(rtc::ArrayView x, } void Aec3Fft::PaddedFft(rtc::ArrayView x, - rtc::ArrayView x_old, + rtc::ArrayView x_old, Window window, FftData* X) const { RTC_DCHECK(X); @@ -110,7 +110,6 @@ void Aec3Fft::PaddedFft(rtc::ArrayView x, case Window::kRectangular: std::copy(x_old.begin(), x_old.end(), fft.begin()); std::copy(x.begin(), x.end(), fft.begin() + x_old.size()); - std::copy(x.begin(), x.end(), x_old.begin()); break; case Window::kHanning: RTC_NOTREACHED(); diff --git a/modules/audio_processing/aec3/aec3_fft.h b/modules/audio_processing/aec3/aec3_fft.h index f730284745..b70022255d 100644 --- a/modules/audio_processing/aec3/aec3_fft.h +++ b/modules/audio_processing/aec3/aec3_fft.h @@ -51,14 +51,14 @@ class Aec3Fft { // Concatenates the kFftLengthBy2 values long x and x_old before computing the // Fft. After that, x is copied to x_old. void PaddedFft(rtc::ArrayView x, - rtc::ArrayView x_old, + rtc::ArrayView x_old, FftData* X) const { PaddedFft(x, x_old, Window::kRectangular, X); } // Padded Fft using a time-domain window. void PaddedFft(rtc::ArrayView x, - rtc::ArrayView x_old, + rtc::ArrayView x_old, Window window, FftData* X) const; diff --git a/modules/audio_processing/aec3/aec3_fft_unittest.cc b/modules/audio_processing/aec3/aec3_fft_unittest.cc index 87fe7a8fbb..82d6e766cc 100644 --- a/modules/audio_processing/aec3/aec3_fft_unittest.cc +++ b/modules/audio_processing/aec3/aec3_fft_unittest.cc @@ -199,6 +199,7 @@ TEST(Aec3Fft, PaddedFft) { std::for_each(x_ref.begin(), x_ref.end(), [](float& a) { a *= 64.f; }); fft.PaddedFft(x_in, x_old, &X); + std::copy(x_in.begin(), x_in.end(), x_old.begin()); fft.Ifft(X, &x_out); for (size_t j = 0; j < x_out.size(); ++j) {