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

Side by Side Diff: webrtc/modules/audio_processing/aec3/erle_estimator_unittest.cc

Issue 2678423005: Finalization of the first version of EchoCanceller 3 (Closed)
Patch Set: Fixed compilation error 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 unified diff | Download patch
OLDNEW
(Empty)
1 /*
2 * Copyright (c) 2017 The WebRTC project authors. All Rights Reserved.
3 *
4 * Use of this source code is governed by a BSD-style license
5 * that can be found in the LICENSE file in the root of the source
6 * tree. An additional intellectual property rights grant can be found
7 * in the file PATENTS. All contributing project authors may
8 * be found in the AUTHORS file in the root of the source tree.
9 */
10
11 #include "webrtc/modules/audio_processing/aec3/erle_estimator.h"
12 #include "webrtc/test/gtest.h"
13
14 namespace webrtc {
15
16 namespace {
17
18 void VerifyErle(const std::array<float, kFftLengthBy2Plus1>& erle,
19 float reference) {
20 std::for_each(erle.begin(), erle.end(),
21 [reference](float a) { EXPECT_NEAR(reference, a, 0.001); });
22 }
23
24 } // namespace
25
26 // Verifies that the correct ERLE estimates are achieved.
27 TEST(ErleEstimator, Estimates) {
28 std::array<float, kFftLengthBy2Plus1> X2;
29 std::array<float, kFftLengthBy2Plus1> E2;
30 std::array<float, kFftLengthBy2Plus1> Y2;
31
32 ErleEstimator estimator;
33
34 // Verifies that the ERLE estimate is properley increased to higher values.
35 X2.fill(500 * 1000.f * 1000.f);
36 E2.fill(1000.f * 1000.f);
37 Y2.fill(10 * E2[0]);
38 for (size_t k = 0; k < 200; ++k) {
39 estimator.Update(X2, Y2, E2);
40 }
41 VerifyErle(estimator.Erle(), 8.f);
42
43 // Verifies that the ERLE is not immediately decreased when the ERLE in the
44 // data decreases.
45 Y2.fill(0.1f * E2[0]);
46 for (size_t k = 0; k < 98; ++k) {
47 estimator.Update(X2, Y2, E2);
48 }
49 VerifyErle(estimator.Erle(), 8.f);
50
51 // Verifies that the minimum ERLE is eventually achieved.
52 for (size_t k = 0; k < 1000; ++k) {
53 estimator.Update(X2, Y2, E2);
54 }
55 VerifyErle(estimator.Erle(), 1.f);
56
57 // Verifies that the ERLE estimate is is not updated for low-level render
58 // signals.
59 X2.fill(1000.f * 1000.f);
60 Y2.fill(10 * E2[0]);
61 for (size_t k = 0; k < 200; ++k) {
62 estimator.Update(X2, Y2, E2);
63 }
64 VerifyErle(estimator.Erle(), 1.f);
65 }
66 } // namespace webrtc
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698