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

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

Issue 2678423005: Finalization of the first version of EchoCanceller 3 (Closed)
Patch Set: Created 3 years, 10 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
Index: webrtc/modules/audio_processing/aec3/erle_estimator_unittest.cc
diff --git a/webrtc/modules/audio_processing/aec3/erle_estimator_unittest.cc b/webrtc/modules/audio_processing/aec3/erle_estimator_unittest.cc
new file mode 100644
index 0000000000000000000000000000000000000000..b8203f94108e4c090ef8de646ec3aeae145663db
--- /dev/null
+++ b/webrtc/modules/audio_processing/aec3/erle_estimator_unittest.cc
@@ -0,0 +1,72 @@
+/*
+ * Copyright (c) 2017 The WebRTC project authors. All Rights Reserved.
+ *
+ * Use of this source code is governed by a BSD-style license
+ * that can be found in the LICENSE file in the root of the source
+ * tree. An additional intellectual property rights grant can be found
+ * in the file PATENTS. All contributing project authors may
+ * be found in the AUTHORS file in the root of the source tree.
+ */
+
+#include "webrtc/modules/audio_processing/aec3/erle_estimator.h"
+#include "webrtc/test/gtest.h"
+
+namespace webrtc {
+
+// Verifies that the correct ERLE estimates are achieved.
+TEST(ErleEstimator, Estimates) {
+ std::array<float, kFftLengthBy2Plus1> X2;
+ std::array<float, kFftLengthBy2Plus1> E2;
+ std::array<float, kFftLengthBy2Plus1> Y2;
+
+ ErleEstimator estimator;
+
+ // Verifies that the ERLE estimate is properley increased to higher values.
+ X2.fill(500 * 1000.f * 1000.f);
+ E2.fill(1000.f * 1000.f);
+ Y2.fill(10 * E2[0]);
+ for (size_t k = 0; k < 200; ++k) {
+ estimator.Update(X2, Y2, E2);
+ }
+ {
ivoc 2017/02/10 13:52:35 These lines reoccur a few times, it might be a goo
peah-webrtc 2017/02/20 07:37:17 Done.
+ const std::array<float, kFftLengthBy2Plus1>& erle = estimator.Erle();
+ std::for_each(erle.begin(), erle.end(),
+ [](float a) { EXPECT_NEAR(8.f, a, 0.001); });
+ }
+
+ // Verifies that the ERLE is not immediately decreased when the ERLE in the
+ // data decreases.
+ Y2.fill(0.1f * E2[0]);
+ for (size_t k = 0; k < 148; ++k) {
+ estimator.Update(X2, Y2, E2);
+ }
+ {
+ const std::array<float, kFftLengthBy2Plus1>& erle = estimator.Erle();
+ std::for_each(erle.begin(), erle.end(),
+ [](float a) { EXPECT_NEAR(8.f, a, 0.001); });
+ }
+
+ // Verifies that the minimum ERLE is eventually achieved.
+ for (size_t k = 0; k < 1000; ++k) {
+ estimator.Update(X2, Y2, E2);
+ }
+ {
+ const std::array<float, kFftLengthBy2Plus1>& erle = estimator.Erle();
+ std::for_each(erle.begin(), erle.end(),
+ [](float a) { EXPECT_NEAR(1.f, a, 0.001); });
+ }
+
+ // Verifies that the ERLE estimate is is not updated for low-level render
+ // signals.
+ X2.fill(1000.f * 1000.f);
+ Y2.fill(10 * E2[0]);
+ for (size_t k = 0; k < 200; ++k) {
+ estimator.Update(X2, Y2, E2);
+ }
+ {
+ const std::array<float, kFftLengthBy2Plus1>& erle = estimator.Erle();
+ std::for_each(erle.begin(), erle.end(),
+ [](float a) { EXPECT_NEAR(1.f, a, 0.001); });
+ }
+}
+} // namespace webrtc

Powered by Google App Engine
This is Rietveld 408576698