Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(2241)

Unified Diff: webrtc/modules/audio_processing/aec3/erle_estimator.cc

Issue 2901253002: Simplified the ERLE computation code in AEC3 (Closed)
Patch Set: Created 3 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: webrtc/modules/audio_processing/aec3/erle_estimator.cc
diff --git a/webrtc/modules/audio_processing/aec3/erle_estimator.cc b/webrtc/modules/audio_processing/aec3/erle_estimator.cc
index 2ceadd3f9e4a6effb5f5a43de1a7716bae4e01f0..c1394126a5441da8d3ae6e6da06c976cafb98fbd 100644
--- a/webrtc/modules/audio_processing/aec3/erle_estimator.cc
+++ b/webrtc/modules/audio_processing/aec3/erle_estimator.cc
@@ -41,11 +41,8 @@ void ErleEstimator::Update(
constexpr float kX2Min = 44015068.0f;
// Update the estimates in a clamped minimum statistics manner.
- size_t k = 1;
- size_t band_limit = kFftLengthBy2 / 2;
- float max_erle = kMaxLfErle;
- for (int j = 0; j < 2; ++j) {
- for (; k < band_limit; ++k) {
+ auto erle_update = [&](size_t start, size_t stop, float max_erle) {
+ for (size_t k = start; k < stop; ++k) {
if (X2[k] > kX2Min && E2[k] > 0.f) {
const float new_erle = Y2[k] / E2[k];
if (new_erle > erle_[k]) {
@@ -55,9 +52,9 @@ void ErleEstimator::Update(
}
}
}
- band_limit = kFftLengthBy2;
- max_erle = kMaxHfErle;
- }
+ };
+ erle_update(1, kFftLengthBy2 / 2, kMaxLfErle);
+ erle_update(kFftLengthBy2 / 2, kFftLengthBy2, kMaxHfErle);
std::for_each(hold_counters_.begin(), hold_counters_.end(),
[](int& a) { --a; });
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698