| OLD | NEW |
| 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 23 matching lines...) Expand all Loading... |
| 34 std::vector<std::vector<float>>( | 34 std::vector<std::vector<float>>( |
| 35 3, std::vector<float>(kBlockSize, 0.f)), | 35 3, std::vector<float>(kBlockSize, 0.f)), |
| 36 false, &high_bands_gain, nullptr), | 36 false, &high_bands_gain, nullptr), |
| 37 ""); | 37 ""); |
| 38 } | 38 } |
| 39 | 39 |
| 40 #endif | 40 #endif |
| 41 | 41 |
| 42 // Does a sanity check that the gains are correctly computed. | 42 // Does a sanity check that the gains are correctly computed. |
| 43 TEST(SuppressionGain, BasicGainComputation) { | 43 TEST(SuppressionGain, BasicGainComputation) { |
| 44 SuppressionGain suppression_gain(DetectOptimization()); | 44 SuppressionGain suppression_gain(AudioProcessing::Config::EchoCanceller3(), |
| 45 DetectOptimization()); |
| 45 RenderSignalAnalyzer analyzer; | 46 RenderSignalAnalyzer analyzer; |
| 46 float high_bands_gain; | 47 float high_bands_gain; |
| 47 std::array<float, kFftLengthBy2Plus1> E2; | 48 std::array<float, kFftLengthBy2Plus1> E2; |
| 48 std::array<float, kFftLengthBy2Plus1> R2; | 49 std::array<float, kFftLengthBy2Plus1> R2; |
| 49 std::array<float, kFftLengthBy2Plus1> N2; | 50 std::array<float, kFftLengthBy2Plus1> N2; |
| 50 std::array<float, kFftLengthBy2Plus1> g; | 51 std::array<float, kFftLengthBy2Plus1> g; |
| 51 std::vector<std::vector<float>> x(1, std::vector<float>(kBlockSize, 0.f)); | 52 std::vector<std::vector<float>> x(1, std::vector<float>(kBlockSize, 0.f)); |
| 52 | 53 |
| 53 // Ensure that a strong noise is detected to mask any echoes. | 54 // Ensure that a strong noise is detected to mask any echoes. |
| 54 E2.fill(10.f); | 55 E2.fill(10.f); |
| (...skipping 30 matching lines...) Expand all Loading... |
| 85 | 86 |
| 86 // Verify the functionality for forcing a zero gain. | 87 // Verify the functionality for forcing a zero gain. |
| 87 suppression_gain.GetGain(E2, R2, N2, analyzer, false, x, true, | 88 suppression_gain.GetGain(E2, R2, N2, analyzer, false, x, true, |
| 88 &high_bands_gain, &g); | 89 &high_bands_gain, &g); |
| 89 std::for_each(g.begin(), g.end(), [](float a) { EXPECT_FLOAT_EQ(0.f, a); }); | 90 std::for_each(g.begin(), g.end(), [](float a) { EXPECT_FLOAT_EQ(0.f, a); }); |
| 90 EXPECT_FLOAT_EQ(0.f, high_bands_gain); | 91 EXPECT_FLOAT_EQ(0.f, high_bands_gain); |
| 91 } | 92 } |
| 92 | 93 |
| 93 } // namespace aec3 | 94 } // namespace aec3 |
| 94 } // namespace webrtc | 95 } // namespace webrtc |
| OLD | NEW |