This CL is created from a work initiated at https://webrtc-review.googlesource.com/c/src/+/61160 The purpose of this work is to improve the performance of the echo canceler (AEC3) when the farend signal contains stationary noises: - An stationarity estimator of the farend signal has been added for detecting the portions of the farend signal that are pure noise. - When the echo canceler deals with a portion of the signal that contains basically noise, the echo suppressor is able to back-off and avoid the fading of the nearend speech. Change-Id: Id4b87fc59f4765bf1fca36d1cab39a49aabe104a Bug: webrtc:9193,chromium:836790 Reviewed-on: https://webrtc-review.googlesource.com/64141 Reviewed-by: Per Åhgren <peah@webrtc.org> Commit-Queue: Jesus de Vicente Pena <devicentepena@webrtc.org> Cr-Commit-Position: refs/heads/master@{#23024}
51 lines
1.7 KiB
C++
51 lines
1.7 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/echo_audibility.h"
|
|
|
|
#include <algorithm>
|
|
|
|
#include "modules/audio_processing/aec3/aec3_common.h"
|
|
#include "modules/audio_processing/aec3/stationarity_estimator.h"
|
|
|
|
namespace webrtc {
|
|
|
|
EchoAudibility::EchoAudibility() {
|
|
Reset();
|
|
}
|
|
|
|
void EchoAudibility::Reset() {
|
|
render_stationarity_.Reset();
|
|
}
|
|
|
|
EchoAudibility::~EchoAudibility() = default;
|
|
|
|
void EchoAudibility::Update(const RenderBuffer& render_buffer,
|
|
size_t delay_blocks,
|
|
size_t capture_block_counter) {
|
|
RTC_DCHECK_GT(capture_block_counter, delay_blocks);
|
|
|
|
size_t num_lookahead = std::min(StationarityEstimator::GetMaxNumLookAhead(),
|
|
render_buffer.Headroom() - delay_blocks + 1);
|
|
int render_block_number = capture_block_counter - delay_blocks;
|
|
|
|
for (size_t k = 0; k < (num_lookahead + 1); ++k) {
|
|
// Delay changes can potentially make that not all the farend blocks
|
|
// are seen. That effect is assumed to have a minimum effect in the
|
|
// estimation.
|
|
render_stationarity_.Update(render_buffer.Spectrum(delay_blocks - k),
|
|
render_block_number + k);
|
|
}
|
|
render_stationarity_.UpdateStationarityFlags(render_block_number,
|
|
num_lookahead);
|
|
}
|
|
|
|
} // namespace webrtc
|