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

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

Issue 2886733002: Transparency increasing tuning for 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 unified diff | Download patch
OLDNEW
1 /* 1 /*
2 * Copyright (c) 2017 The WebRTC project authors. All Rights Reserved. 2 * Copyright (c) 2017 The WebRTC project authors. All Rights Reserved.
3 * 3 *
4 * Use of this source code is governed by a BSD-style license 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 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 6 * tree. An additional intellectual property rights grant can be found
7 * in the file PATENTS. All contributing project authors may 7 * in the file PATENTS. All contributing project authors may
8 * be found in the AUTHORS file in the root of the source tree. 8 * be found in the AUTHORS file in the root of the source tree.
9 */ 9 */
10 10
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after
47 std::array<float, kFftLengthBy2Plus1> R2; 47 std::array<float, kFftLengthBy2Plus1> R2;
48 std::array<float, kFftLengthBy2Plus1> N2; 48 std::array<float, kFftLengthBy2Plus1> N2;
49 std::array<float, kFftLengthBy2Plus1> g; 49 std::array<float, kFftLengthBy2Plus1> g;
50 std::vector<std::vector<float>> x(1, std::vector<float>(kBlockSize, 0.f)); 50 std::vector<std::vector<float>> x(1, std::vector<float>(kBlockSize, 0.f));
51 51
52 // Ensure that a strong noise is detected to mask any echoes. 52 // Ensure that a strong noise is detected to mask any echoes.
53 E2.fill(10.f); 53 E2.fill(10.f);
54 R2.fill(0.1f); 54 R2.fill(0.1f);
55 N2.fill(100.f); 55 N2.fill(100.f);
56 for (int k = 0; k < 10; ++k) { 56 for (int k = 0; k < 10; ++k) {
57 suppression_gain.GetGain(E2, R2, N2, false, x, 1, false, &high_bands_gain, 57 suppression_gain.GetGain(E2, R2, N2, false, x, false, &high_bands_gain, &g);
58 &g);
59 } 58 }
60 std::for_each(g.begin(), g.end(), 59 std::for_each(g.begin(), g.end(),
61 [](float a) { EXPECT_NEAR(1.f, a, 0.001); }); 60 [](float a) { EXPECT_NEAR(1.f, a, 0.001); });
62 61
63 // Ensure that a strong nearend is detected to mask any echoes. 62 // Ensure that a strong nearend is detected to mask any echoes.
64 E2.fill(100.f); 63 E2.fill(100.f);
65 R2.fill(0.1f); 64 R2.fill(0.1f);
66 N2.fill(0.f); 65 N2.fill(0.f);
67 for (int k = 0; k < 10; ++k) { 66 for (int k = 0; k < 10; ++k) {
68 suppression_gain.GetGain(E2, R2, N2, false, x, 1, false, &high_bands_gain, 67 suppression_gain.GetGain(E2, R2, N2, false, x, false, &high_bands_gain, &g);
69 &g);
70 } 68 }
71 std::for_each(g.begin(), g.end(), 69 std::for_each(g.begin(), g.end(),
72 [](float a) { EXPECT_NEAR(1.f, a, 0.001); }); 70 [](float a) { EXPECT_NEAR(1.f, a, 0.001); });
73 71
74 // Ensure that a strong echo is suppressed. 72 // Ensure that a strong echo is suppressed.
75 E2.fill(0.1f); 73 E2.fill(0.1f);
76 R2.fill(100.f); 74 R2.fill(100.f);
77 N2.fill(0.f); 75 N2.fill(0.f);
78 for (int k = 0; k < 10; ++k) { 76 for (int k = 0; k < 10; ++k) {
79 suppression_gain.GetGain(E2, R2, N2, false, x, 1, false, &high_bands_gain, 77 suppression_gain.GetGain(E2, R2, N2, false, x, false, &high_bands_gain, &g);
80 &g);
81 } 78 }
82 std::for_each(g.begin(), g.end(), 79 std::for_each(g.begin(), g.end(),
83 [](float a) { EXPECT_NEAR(0.f, a, 0.001); }); 80 [](float a) { EXPECT_NEAR(0.f, a, 0.001); });
84 81
85 // Verify the functionality for forcing a zero gain. 82 // Verify the functionality for forcing a zero gain.
86 suppression_gain.GetGain(E2, R2, N2, false, x, 1, true, &high_bands_gain, &g); 83 suppression_gain.GetGain(E2, R2, N2, false, x, true, &high_bands_gain, &g);
87 std::for_each(g.begin(), g.end(), [](float a) { EXPECT_FLOAT_EQ(0.f, a); }); 84 std::for_each(g.begin(), g.end(), [](float a) { EXPECT_FLOAT_EQ(0.f, a); });
88 EXPECT_FLOAT_EQ(0.f, high_bands_gain); 85 EXPECT_FLOAT_EQ(0.f, high_bands_gain);
89 } 86 }
90 87
91 } // namespace aec3 88 } // namespace aec3
92 } // namespace webrtc 89 } // namespace webrtc
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698