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

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

Issue 3003733002: Utilizing the AEC3 config struct for constants. (Closed)
Patch Set: Added copy assignment Created 3 years, 3 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 11 matching lines...) Expand all
22 22
23 // Verifies that the check for non-null output gains works. 23 // Verifies that the check for non-null output gains works.
24 TEST(SuppressionGain, NullOutputGains) { 24 TEST(SuppressionGain, NullOutputGains) {
25 std::array<float, kFftLengthBy2Plus1> E2; 25 std::array<float, kFftLengthBy2Plus1> E2;
26 std::array<float, kFftLengthBy2Plus1> R2; 26 std::array<float, kFftLengthBy2Plus1> R2;
27 std::array<float, kFftLengthBy2Plus1> N2; 27 std::array<float, kFftLengthBy2Plus1> N2;
28 E2.fill(0.f); 28 E2.fill(0.f);
29 R2.fill(0.f); 29 R2.fill(0.f);
30 N2.fill(0.f); 30 N2.fill(0.f);
31 float high_bands_gain; 31 float high_bands_gain;
32 EXPECT_DEATH(SuppressionGain(DetectOptimization()) 32 EXPECT_DEATH(SuppressionGain(AudioProcessing::Config::EchoCanceller3{},
33 DetectOptimization())
33 .GetGain(E2, R2, N2, RenderSignalAnalyzer(), false, 34 .GetGain(E2, R2, N2, RenderSignalAnalyzer(), false,
34 std::vector<std::vector<float>>( 35 std::vector<std::vector<float>>(
35 3, std::vector<float>(kBlockSize, 0.f)), 36 3, std::vector<float>(kBlockSize, 0.f)),
36 false, &high_bands_gain, nullptr), 37 false, &high_bands_gain, nullptr),
37 ""); 38 "");
38 } 39 }
39 40
40 #endif 41 #endif
41 42
42 // Does a sanity check that the gains are correctly computed. 43 // Does a sanity check that the gains are correctly computed.
43 TEST(SuppressionGain, BasicGainComputation) { 44 TEST(SuppressionGain, BasicGainComputation) {
44 SuppressionGain suppression_gain(DetectOptimization()); 45 SuppressionGain suppression_gain(AudioProcessing::Config::EchoCanceller3(),
46 DetectOptimization());
45 RenderSignalAnalyzer analyzer; 47 RenderSignalAnalyzer analyzer;
46 float high_bands_gain; 48 float high_bands_gain;
47 std::array<float, kFftLengthBy2Plus1> E2; 49 std::array<float, kFftLengthBy2Plus1> E2;
48 std::array<float, kFftLengthBy2Plus1> R2; 50 std::array<float, kFftLengthBy2Plus1> R2;
49 std::array<float, kFftLengthBy2Plus1> N2; 51 std::array<float, kFftLengthBy2Plus1> N2;
50 std::array<float, kFftLengthBy2Plus1> g; 52 std::array<float, kFftLengthBy2Plus1> g;
51 std::vector<std::vector<float>> x(1, std::vector<float>(kBlockSize, 0.f)); 53 std::vector<std::vector<float>> x(1, std::vector<float>(kBlockSize, 0.f));
52 54
53 // Ensure that a strong noise is detected to mask any echoes. 55 // Ensure that a strong noise is detected to mask any echoes.
54 E2.fill(10.f); 56 E2.fill(10.f);
(...skipping 30 matching lines...) Expand all
85 87
86 // Verify the functionality for forcing a zero gain. 88 // Verify the functionality for forcing a zero gain.
87 suppression_gain.GetGain(E2, R2, N2, analyzer, false, x, true, 89 suppression_gain.GetGain(E2, R2, N2, analyzer, false, x, true,
88 &high_bands_gain, &g); 90 &high_bands_gain, &g);
89 std::for_each(g.begin(), g.end(), [](float a) { EXPECT_FLOAT_EQ(0.f, a); }); 91 std::for_each(g.begin(), g.end(), [](float a) { EXPECT_FLOAT_EQ(0.f, a); });
90 EXPECT_FLOAT_EQ(0.f, high_bands_gain); 92 EXPECT_FLOAT_EQ(0.f, high_bands_gain);
91 } 93 }
92 94
93 } // namespace aec3 95 } // namespace aec3
94 } // namespace webrtc 96 } // namespace webrtc
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698