AEC3: High-pass filter delay estimator signals
This CL applies a high pass filter to the delay estimator signals which improves the adaptation of the matched filters in noisy environments. This results in faster delay estimation. Bug: webrtc:9288 Change-Id: I8ffe5442eab7ac2f10a7ba236b08a0f07ec90645 Reviewed-on: https://webrtc-review.googlesource.com/77725 Commit-Queue: Gustaf Ullberg <gustaf@webrtc.org> Reviewed-by: Per Åhgren <peah@webrtc.org> Cr-Commit-Position: refs/heads/master@{#23308}
This commit is contained in:
parent
77995e744b
commit
6bf5a0d5b6
@ -35,6 +35,12 @@ const CascadedBiQuadFilter::BiQuadCoefficients kLowPassFilterCoefficients8 = {
|
|||||||
{-1.56101808f, 0.64135154f}};
|
{-1.56101808f, 0.64135154f}};
|
||||||
constexpr int kNumFilters8 = 4;
|
constexpr int kNumFilters8 = 4;
|
||||||
|
|
||||||
|
// b, a = signal.butter(2, 1000/8000.0, 'highpass', analog=False)
|
||||||
|
const CascadedBiQuadFilter::BiQuadCoefficients kHighPassFilterCoefficients4 = {
|
||||||
|
{0.75707638f, -1.51415275f, 0.75707638f},
|
||||||
|
{-1.45424359f, 0.57406192f}};
|
||||||
|
constexpr int kNumFiltersHP4 = 1;
|
||||||
|
|
||||||
} // namespace
|
} // namespace
|
||||||
|
|
||||||
Decimator::Decimator(size_t down_sampling_factor)
|
Decimator::Decimator(size_t down_sampling_factor)
|
||||||
@ -46,7 +52,8 @@ Decimator::Decimator(size_t down_sampling_factor)
|
|||||||
: kLowPassFilterCoefficients2),
|
: kLowPassFilterCoefficients2),
|
||||||
down_sampling_factor_ == 4
|
down_sampling_factor_ == 4
|
||||||
? kNumFilters4
|
? kNumFilters4
|
||||||
: (down_sampling_factor_ == 8 ? kNumFilters8 : kNumFilters2)) {
|
: (down_sampling_factor_ == 8 ? kNumFilters8 : kNumFilters2)),
|
||||||
|
high_pass_filter_(kHighPassFilterCoefficients4, kNumFiltersHP4) {
|
||||||
RTC_DCHECK(down_sampling_factor_ == 2 || down_sampling_factor_ == 4 ||
|
RTC_DCHECK(down_sampling_factor_ == 2 || down_sampling_factor_ == 4 ||
|
||||||
down_sampling_factor_ == 8);
|
down_sampling_factor_ == 8);
|
||||||
}
|
}
|
||||||
@ -60,6 +67,10 @@ void Decimator::Decimate(rtc::ArrayView<const float> in,
|
|||||||
// Limit the frequency content of the signal to avoid aliasing.
|
// Limit the frequency content of the signal to avoid aliasing.
|
||||||
low_pass_filter_.Process(in, x);
|
low_pass_filter_.Process(in, x);
|
||||||
|
|
||||||
|
// High-pass filter to reduce the impact of near-end noise.
|
||||||
|
if (down_sampling_factor_ == 4)
|
||||||
|
high_pass_filter_.Process(x, x);
|
||||||
|
|
||||||
// Downsample the signal.
|
// Downsample the signal.
|
||||||
for (size_t j = 0, k = 0; j < out.size(); ++j, k += down_sampling_factor_) {
|
for (size_t j = 0, k = 0; j < out.size(); ++j, k += down_sampling_factor_) {
|
||||||
RTC_DCHECK_GT(kBlockSize, k);
|
RTC_DCHECK_GT(kBlockSize, k);
|
||||||
|
|||||||
@ -31,6 +31,7 @@ class Decimator {
|
|||||||
private:
|
private:
|
||||||
const size_t down_sampling_factor_;
|
const size_t down_sampling_factor_;
|
||||||
CascadedBiQuadFilter low_pass_filter_;
|
CascadedBiQuadFilter low_pass_filter_;
|
||||||
|
CascadedBiQuadFilter high_pass_filter_;
|
||||||
|
|
||||||
RTC_DISALLOW_COPY_AND_ASSIGN(Decimator);
|
RTC_DISALLOW_COPY_AND_ASSIGN(Decimator);
|
||||||
};
|
};
|
||||||
|
|||||||
@ -99,21 +99,6 @@ TEST(Decimator, NoLeakageFromUpperFrequencies) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Verifies that the impact of low-frequency content is small during the
|
|
||||||
// downsampling.
|
|
||||||
TEST(Decimator, NoImpactOnLowerFrequencies) {
|
|
||||||
float input_power;
|
|
||||||
float output_power;
|
|
||||||
for (auto rate : {8000, 16000, 32000, 48000}) {
|
|
||||||
for (auto down_sampling_factor : kDownSamplingFactors) {
|
|
||||||
ProduceDebugText(rate);
|
|
||||||
ProduceDecimatedSinusoidalOutputPower(rate, down_sampling_factor, 200.f,
|
|
||||||
&input_power, &output_power);
|
|
||||||
EXPECT_LT(0.7f * input_power, output_power);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
#if RTC_DCHECK_IS_ON && GTEST_HAS_DEATH_TEST && !defined(WEBRTC_ANDROID)
|
#if RTC_DCHECK_IS_ON && GTEST_HAS_DEATH_TEST && !defined(WEBRTC_ANDROID)
|
||||||
// Verifies the check for the input size.
|
// Verifies the check for the input size.
|
||||||
TEST(Decimator, WrongInputSize) {
|
TEST(Decimator, WrongInputSize) {
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user