Erle metric: avoid the decreasing of the metric when there is no render activity.
This change just affects the ERLE metric that is reported. The rest is unaffected and bitexact.
Bug: webrtc:12280
Change-Id: I2d28ef14a9b704c83aba18b624f67671eec4a042
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/196649
Reviewed-by: Per Åhgren <peah@webrtc.org>
Commit-Queue: Jesus de Vicente Pena <devicentepena@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#32809}
diff --git a/modules/audio_processing/aec3/erle_estimator_unittest.cc b/modules/audio_processing/aec3/erle_estimator_unittest.cc
index 7fbad90..2a5a98d 100644
--- a/modules/audio_processing/aec3/erle_estimator_unittest.cc
+++ b/modules/audio_processing/aec3/erle_estimator_unittest.cc
@@ -47,7 +47,7 @@
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<std::vector<std::vector<float>>>* x) {
@@ -172,7 +172,7 @@
// 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 @@
}
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 e421214..1d7a191 100644
--- a/modules/audio_processing/aec3/fullband_erle_estimator.cc
+++ b/modules/audio_processing/aec3/fullband_erle_estimator.cc
@@ -34,8 +34,8 @@
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 @@
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 @@
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 1580f1a..2b720a4 100644
--- a/modules/audio_processing/aec3/fullband_erle_estimator.h
+++ b/modules/audio_processing/aec3/fullband_erle_estimator.h
@@ -106,8 +106,8 @@
};
const float min_erle_log2_;
- const float max_erle_lf_log2;
- std::vector<int> hold_counters_time_domain_;
+ const float max_erle_lf_log2_;
+ std::vector<int> hold_counters_instantaneous_erle_;
std::vector<float> erle_time_domain_log2_;
std::vector<ErleInstantaneous> instantaneous_erle_;
std::vector<absl::optional<float>> linear_filters_qualities_;
diff --git a/resources/audio_processing/output_data_float.pb.sha1 b/resources/audio_processing/output_data_float.pb.sha1
index c895b96..a19c6c3 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 12ec621..54a5b06 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