diff --git a/modules/audio_processing/aec3/erle_estimator_unittest.cc b/modules/audio_processing/aec3/erle_estimator_unittest.cc index 7fbad90065..2a5a98d29f 100644 --- a/modules/audio_processing/aec3/erle_estimator_unittest.cc +++ b/modules/audio_processing/aec3/erle_estimator_unittest.cc @@ -47,7 +47,7 @@ void VerifyErle( float reference_lf, float reference_hf) { VerifyErleBands(erle, reference_lf, reference_hf); - EXPECT_NEAR(reference_lf, erle_time_domain, 0.5); + EXPECT_NEAR(kTrueErle, erle_time_domain, 0.5); } void FormFarendTimeFrame(std::vector>>* x) { @@ -172,7 +172,7 @@ TEST_P(ErleEstimatorMultiChannel, VerifyErleIncreaseAndHold) { // Verifies that the ERLE estimate is properly increased to higher values. FormFarendFrame(*render_delay_buffer->GetRenderBuffer(), kTrueErle, &X2, E2, Y2); - for (size_t k = 0; k < 200; ++k) { + for (size_t k = 0; k < 1000; ++k) { render_delay_buffer->Insert(x); render_delay_buffer->PrepareCaptureProcessing(); estimator.Update(*render_delay_buffer->GetRenderBuffer(), @@ -237,7 +237,7 @@ TEST_P(ErleEstimatorMultiChannel, VerifyErleTrackingOnOnsets) { } FormFarendFrame(*render_delay_buffer->GetRenderBuffer(), kTrueErle, &X2, E2, Y2); - for (size_t k = 0; k < 200; ++k) { + for (size_t k = 0; k < 1000; ++k) { render_delay_buffer->Insert(x); render_delay_buffer->PrepareCaptureProcessing(); estimator.Update(*render_delay_buffer->GetRenderBuffer(), diff --git a/modules/audio_processing/aec3/fullband_erle_estimator.cc b/modules/audio_processing/aec3/fullband_erle_estimator.cc index e421214821..1d7a191a89 100644 --- a/modules/audio_processing/aec3/fullband_erle_estimator.cc +++ b/modules/audio_processing/aec3/fullband_erle_estimator.cc @@ -34,8 +34,8 @@ FullBandErleEstimator::FullBandErleEstimator( const EchoCanceller3Config::Erle& config, size_t num_capture_channels) : min_erle_log2_(FastApproxLog2f(config.min + kEpsilon)), - max_erle_lf_log2(FastApproxLog2f(config.max_l + kEpsilon)), - hold_counters_time_domain_(num_capture_channels, 0), + max_erle_lf_log2_(FastApproxLog2f(config.max_l + kEpsilon)), + hold_counters_instantaneous_erle_(num_capture_channels, 0), erle_time_domain_log2_(num_capture_channels, min_erle_log2_), instantaneous_erle_(num_capture_channels, ErleInstantaneous(config)), linear_filters_qualities_(num_capture_channels) { @@ -52,8 +52,8 @@ void FullBandErleEstimator::Reset() { UpdateQualityEstimates(); std::fill(erle_time_domain_log2_.begin(), erle_time_domain_log2_.end(), min_erle_log2_); - std::fill(hold_counters_time_domain_.begin(), - hold_counters_time_domain_.end(), 0); + std::fill(hold_counters_instantaneous_erle_.begin(), + hold_counters_instantaneous_erle_.end(), 0); } void FullBandErleEstimator::Update( @@ -71,21 +71,17 @@ void FullBandErleEstimator::Update( const float E2_sum = std::accumulate(E2[ch].begin(), E2[ch].end(), 0.0f); if (instantaneous_erle_[ch].Update(Y2_sum, E2_sum)) { - hold_counters_time_domain_[ch] = kBlocksToHoldErle; + hold_counters_instantaneous_erle_[ch] = kBlocksToHoldErle; erle_time_domain_log2_[ch] += - 0.1f * ((instantaneous_erle_[ch].GetInstErleLog2().value()) - - erle_time_domain_log2_[ch]); - erle_time_domain_log2_[ch] = rtc::SafeClamp( - erle_time_domain_log2_[ch], min_erle_log2_, max_erle_lf_log2); + 0.05f * ((instantaneous_erle_[ch].GetInstErleLog2().value()) - + erle_time_domain_log2_[ch]); + erle_time_domain_log2_[ch] = + std::max(erle_time_domain_log2_[ch], min_erle_log2_); } } } - --hold_counters_time_domain_[ch]; - if (hold_counters_time_domain_[ch] <= 0) { - erle_time_domain_log2_[ch] = - std::max(min_erle_log2_, erle_time_domain_log2_[ch] - 0.044f); - } - if (hold_counters_time_domain_[ch] == 0) { + --hold_counters_instantaneous_erle_[ch]; + if (hold_counters_instantaneous_erle_[ch] == 0) { instantaneous_erle_[ch].ResetAccumulators(); } } diff --git a/modules/audio_processing/aec3/fullband_erle_estimator.h b/modules/audio_processing/aec3/fullband_erle_estimator.h index 1580f1a8a5..2b720a4de4 100644 --- a/modules/audio_processing/aec3/fullband_erle_estimator.h +++ b/modules/audio_processing/aec3/fullband_erle_estimator.h @@ -106,8 +106,8 @@ class FullBandErleEstimator { }; const float min_erle_log2_; - const float max_erle_lf_log2; - std::vector hold_counters_time_domain_; + const float max_erle_lf_log2_; + std::vector hold_counters_instantaneous_erle_; std::vector erle_time_domain_log2_; std::vector instantaneous_erle_; std::vector> linear_filters_qualities_; diff --git a/resources/audio_processing/output_data_float.pb.sha1 b/resources/audio_processing/output_data_float.pb.sha1 index c895b963f4..a19c6c3b60 100644 --- a/resources/audio_processing/output_data_float.pb.sha1 +++ b/resources/audio_processing/output_data_float.pb.sha1 @@ -1 +1 @@ -365a02046fdb30357d649e73766d2f6eb2b33677 \ No newline at end of file +1dd2c11da1f1dec49f728881628c1348e07a19cd \ No newline at end of file diff --git a/resources/audio_processing/output_data_float_avx2.pb.sha1 b/resources/audio_processing/output_data_float_avx2.pb.sha1 index 12ec621bba..54a5b06963 100644 --- a/resources/audio_processing/output_data_float_avx2.pb.sha1 +++ b/resources/audio_processing/output_data_float_avx2.pb.sha1 @@ -1 +1 @@ -847035cbe0bc7ee0620c32fa5ac857cc5b2c7ec4 \ No newline at end of file +16e9d8f3b8b6c23b2b5100a1162acfe67acc37a7 \ No newline at end of file