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}
This commit is contained in:
parent
0cb7326b54
commit
3bda2362f1
@ -47,7 +47,7 @@ void VerifyErle(
|
|||||||
float reference_lf,
|
float reference_lf,
|
||||||
float reference_hf) {
|
float reference_hf) {
|
||||||
VerifyErleBands(erle, reference_lf, 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) {
|
void FormFarendTimeFrame(std::vector<std::vector<std::vector<float>>>* x) {
|
||||||
@ -172,7 +172,7 @@ TEST_P(ErleEstimatorMultiChannel, VerifyErleIncreaseAndHold) {
|
|||||||
// Verifies that the ERLE estimate is properly increased to higher values.
|
// Verifies that the ERLE estimate is properly increased to higher values.
|
||||||
FormFarendFrame(*render_delay_buffer->GetRenderBuffer(), kTrueErle, &X2, E2,
|
FormFarendFrame(*render_delay_buffer->GetRenderBuffer(), kTrueErle, &X2, E2,
|
||||||
Y2);
|
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->Insert(x);
|
||||||
render_delay_buffer->PrepareCaptureProcessing();
|
render_delay_buffer->PrepareCaptureProcessing();
|
||||||
estimator.Update(*render_delay_buffer->GetRenderBuffer(),
|
estimator.Update(*render_delay_buffer->GetRenderBuffer(),
|
||||||
@ -237,7 +237,7 @@ TEST_P(ErleEstimatorMultiChannel, VerifyErleTrackingOnOnsets) {
|
|||||||
}
|
}
|
||||||
FormFarendFrame(*render_delay_buffer->GetRenderBuffer(), kTrueErle, &X2, E2,
|
FormFarendFrame(*render_delay_buffer->GetRenderBuffer(), kTrueErle, &X2, E2,
|
||||||
Y2);
|
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->Insert(x);
|
||||||
render_delay_buffer->PrepareCaptureProcessing();
|
render_delay_buffer->PrepareCaptureProcessing();
|
||||||
estimator.Update(*render_delay_buffer->GetRenderBuffer(),
|
estimator.Update(*render_delay_buffer->GetRenderBuffer(),
|
||||||
|
|||||||
@ -34,8 +34,8 @@ FullBandErleEstimator::FullBandErleEstimator(
|
|||||||
const EchoCanceller3Config::Erle& config,
|
const EchoCanceller3Config::Erle& config,
|
||||||
size_t num_capture_channels)
|
size_t num_capture_channels)
|
||||||
: min_erle_log2_(FastApproxLog2f(config.min + kEpsilon)),
|
: min_erle_log2_(FastApproxLog2f(config.min + kEpsilon)),
|
||||||
max_erle_lf_log2(FastApproxLog2f(config.max_l + kEpsilon)),
|
max_erle_lf_log2_(FastApproxLog2f(config.max_l + kEpsilon)),
|
||||||
hold_counters_time_domain_(num_capture_channels, 0),
|
hold_counters_instantaneous_erle_(num_capture_channels, 0),
|
||||||
erle_time_domain_log2_(num_capture_channels, min_erle_log2_),
|
erle_time_domain_log2_(num_capture_channels, min_erle_log2_),
|
||||||
instantaneous_erle_(num_capture_channels, ErleInstantaneous(config)),
|
instantaneous_erle_(num_capture_channels, ErleInstantaneous(config)),
|
||||||
linear_filters_qualities_(num_capture_channels) {
|
linear_filters_qualities_(num_capture_channels) {
|
||||||
@ -52,8 +52,8 @@ void FullBandErleEstimator::Reset() {
|
|||||||
UpdateQualityEstimates();
|
UpdateQualityEstimates();
|
||||||
std::fill(erle_time_domain_log2_.begin(), erle_time_domain_log2_.end(),
|
std::fill(erle_time_domain_log2_.begin(), erle_time_domain_log2_.end(),
|
||||||
min_erle_log2_);
|
min_erle_log2_);
|
||||||
std::fill(hold_counters_time_domain_.begin(),
|
std::fill(hold_counters_instantaneous_erle_.begin(),
|
||||||
hold_counters_time_domain_.end(), 0);
|
hold_counters_instantaneous_erle_.end(), 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
void FullBandErleEstimator::Update(
|
void FullBandErleEstimator::Update(
|
||||||
@ -71,21 +71,17 @@ void FullBandErleEstimator::Update(
|
|||||||
const float E2_sum =
|
const float E2_sum =
|
||||||
std::accumulate(E2[ch].begin(), E2[ch].end(), 0.0f);
|
std::accumulate(E2[ch].begin(), E2[ch].end(), 0.0f);
|
||||||
if (instantaneous_erle_[ch].Update(Y2_sum, E2_sum)) {
|
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] +=
|
erle_time_domain_log2_[ch] +=
|
||||||
0.1f * ((instantaneous_erle_[ch].GetInstErleLog2().value()) -
|
0.05f * ((instantaneous_erle_[ch].GetInstErleLog2().value()) -
|
||||||
erle_time_domain_log2_[ch]);
|
erle_time_domain_log2_[ch]);
|
||||||
erle_time_domain_log2_[ch] = rtc::SafeClamp(
|
|
||||||
erle_time_domain_log2_[ch], min_erle_log2_, max_erle_lf_log2);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
--hold_counters_time_domain_[ch];
|
|
||||||
if (hold_counters_time_domain_[ch] <= 0) {
|
|
||||||
erle_time_domain_log2_[ch] =
|
erle_time_domain_log2_[ch] =
|
||||||
std::max(min_erle_log2_, erle_time_domain_log2_[ch] - 0.044f);
|
std::max(erle_time_domain_log2_[ch], min_erle_log2_);
|
||||||
}
|
}
|
||||||
if (hold_counters_time_domain_[ch] == 0) {
|
}
|
||||||
|
}
|
||||||
|
--hold_counters_instantaneous_erle_[ch];
|
||||||
|
if (hold_counters_instantaneous_erle_[ch] == 0) {
|
||||||
instantaneous_erle_[ch].ResetAccumulators();
|
instantaneous_erle_[ch].ResetAccumulators();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -106,8 +106,8 @@ class FullBandErleEstimator {
|
|||||||
};
|
};
|
||||||
|
|
||||||
const float min_erle_log2_;
|
const float min_erle_log2_;
|
||||||
const float max_erle_lf_log2;
|
const float max_erle_lf_log2_;
|
||||||
std::vector<int> hold_counters_time_domain_;
|
std::vector<int> hold_counters_instantaneous_erle_;
|
||||||
std::vector<float> erle_time_domain_log2_;
|
std::vector<float> erle_time_domain_log2_;
|
||||||
std::vector<ErleInstantaneous> instantaneous_erle_;
|
std::vector<ErleInstantaneous> instantaneous_erle_;
|
||||||
std::vector<absl::optional<float>> linear_filters_qualities_;
|
std::vector<absl::optional<float>> linear_filters_qualities_;
|
||||||
|
|||||||
@ -1 +1 @@
|
|||||||
365a02046fdb30357d649e73766d2f6eb2b33677
|
1dd2c11da1f1dec49f728881628c1348e07a19cd
|
||||||
@ -1 +1 @@
|
|||||||
847035cbe0bc7ee0620c32fa5ac857cc5b2c7ec4
|
16e9d8f3b8b6c23b2b5100a1162acfe67acc37a7
|
||||||
Loading…
x
Reference in New Issue
Block a user