This CL adds a functionality that jump-starts the AEC3 shadow filter whenever it performs consistently worse than the main filter. The jump-start is done such that the shadow filter is re-initialized using the main filter coefficients. The effects of this is a significantly more accurate main linear filter which leads to less echo leakage and better transparency Bug: webrtc:9565, chromium:867873 Change-Id: Ie0b23cd536adc7ce96fc3ed2a7db112aec7437f1 Reviewed-on: https://webrtc-review.googlesource.com/90413 Reviewed-by: Sam Zackrisson <saza@webrtc.org> Commit-Queue: Per Åhgren <peah@webrtc.org> Cr-Commit-Position: refs/heads/master@{#24117}
42 lines
1.2 KiB
C++
42 lines
1.2 KiB
C++
/*
|
|
* Copyright (c) 2018 The WebRTC project authors. All Rights Reserved.
|
|
*
|
|
* Use of this source code is governed by a BSD-style license
|
|
* that can be found in the LICENSE file in the root of the source
|
|
* tree. An additional intellectual property rights grant can be found
|
|
* in the file PATENTS. All contributing project authors may
|
|
* be found in the AUTHORS file in the root of the source tree.
|
|
*/
|
|
|
|
#include "modules/audio_processing/aec3/subtractor_output.h"
|
|
|
|
#include <numeric>
|
|
|
|
namespace webrtc {
|
|
|
|
SubtractorOutput::SubtractorOutput() = default;
|
|
SubtractorOutput::~SubtractorOutput() = default;
|
|
|
|
void SubtractorOutput::Reset() {
|
|
s_main.fill(0.f);
|
|
e_main.fill(0.f);
|
|
e_shadow.fill(0.f);
|
|
E_main.re.fill(0.f);
|
|
E_main.im.fill(0.f);
|
|
E2_main.fill(0.f);
|
|
E2_shadow.fill(0.f);
|
|
e2_main = 0.f;
|
|
e2_shadow = 0.f;
|
|
y2 = 0.f;
|
|
}
|
|
|
|
void SubtractorOutput::UpdatePowers(rtc::ArrayView<const float> y) {
|
|
const auto sum_of_squares = [](float a, float b) { return a + b * b; };
|
|
y2 = std::accumulate(y.begin(), y.end(), 0.f, sum_of_squares);
|
|
e2_main = std::accumulate(e_main.begin(), e_main.end(), 0.f, sum_of_squares);
|
|
e2_shadow =
|
|
std::accumulate(e_shadow.begin(), e_shadow.end(), 0.f, sum_of_squares);
|
|
}
|
|
|
|
} // namespace webrtc
|