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

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

Issue 3003733002: Utilizing the AEC3 config struct for constants. (Closed)
Patch Set: Added comment 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
11 #include "webrtc/modules/audio_processing/aec3/residual_echo_estimator.h" 11 #include "webrtc/modules/audio_processing/aec3/residual_echo_estimator.h"
12 12
13 #include "webrtc/modules/audio_processing/aec3/aec3_fft.h" 13 #include "webrtc/modules/audio_processing/aec3/aec3_fft.h"
14 #include "webrtc/modules/audio_processing/aec3/aec_state.h" 14 #include "webrtc/modules/audio_processing/aec3/aec_state.h"
15 #include "webrtc/modules/audio_processing/include/audio_processing.h"
15 #include "webrtc/modules/audio_processing/test/echo_canceller_test_tools.h" 16 #include "webrtc/modules/audio_processing/test/echo_canceller_test_tools.h"
16 #include "webrtc/rtc_base/random.h" 17 #include "webrtc/rtc_base/random.h"
17 #include "webrtc/test/gtest.h" 18 #include "webrtc/test/gtest.h"
18 19
19 namespace webrtc { 20 namespace webrtc {
20 21
21 #if RTC_DCHECK_IS_ON && GTEST_HAS_DEATH_TEST && !defined(WEBRTC_ANDROID) 22 #if RTC_DCHECK_IS_ON && GTEST_HAS_DEATH_TEST && !defined(WEBRTC_ANDROID)
22 23
23 // Verifies that the check for non-null output residual echo power works. 24 // Verifies that the check for non-null output residual echo power works.
24 TEST(ResidualEchoEstimator, NullResidualEchoPowerOutput) { 25 TEST(ResidualEchoEstimator, NullResidualEchoPowerOutput) {
25 AecState aec_state(0.f); 26 AecState aec_state(AudioProcessing::Config::EchoCanceller3{});
26 RenderBuffer render_buffer(Aec3Optimization::kNone, 3, 10, 27 RenderBuffer render_buffer(Aec3Optimization::kNone, 3, 10,
27 std::vector<size_t>(1, 10)); 28 std::vector<size_t>(1, 10));
28 std::vector<std::array<float, kFftLengthBy2Plus1>> H2; 29 std::vector<std::array<float, kFftLengthBy2Plus1>> H2;
29 std::array<float, kFftLengthBy2Plus1> S2_linear; 30 std::array<float, kFftLengthBy2Plus1> S2_linear;
30 std::array<float, kFftLengthBy2Plus1> Y2; 31 std::array<float, kFftLengthBy2Plus1> Y2;
31 EXPECT_DEATH(ResidualEchoEstimator().Estimate(true, aec_state, render_buffer, 32 EXPECT_DEATH(
32 S2_linear, Y2, nullptr), 33 ResidualEchoEstimator(AudioProcessing::Config::EchoCanceller3{})
33 ""); 34 .Estimate(true, aec_state, render_buffer, S2_linear, Y2, nullptr),
35 "");
34 } 36 }
35 37
36 #endif 38 #endif
37 39
38 TEST(ResidualEchoEstimator, BasicTest) { 40 TEST(ResidualEchoEstimator, BasicTest) {
39 ResidualEchoEstimator estimator; 41 ResidualEchoEstimator estimator(AudioProcessing::Config::EchoCanceller3{});
40 AecState aec_state(0.f); 42 AudioProcessing::Config::EchoCanceller3 config;
43 config.param.ep_strength.default_len = 0.f;
44 AecState aec_state(config);
41 RenderBuffer render_buffer(Aec3Optimization::kNone, 3, 10, 45 RenderBuffer render_buffer(Aec3Optimization::kNone, 3, 10,
42 std::vector<size_t>(1, 10)); 46 std::vector<size_t>(1, 10));
43 std::array<float, kFftLengthBy2Plus1> E2_main; 47 std::array<float, kFftLengthBy2Plus1> E2_main;
44 std::array<float, kFftLengthBy2Plus1> E2_shadow; 48 std::array<float, kFftLengthBy2Plus1> E2_shadow;
45 std::array<float, kFftLengthBy2Plus1> S2_linear; 49 std::array<float, kFftLengthBy2Plus1> S2_linear;
46 std::array<float, kFftLengthBy2Plus1> S2_fallback; 50 std::array<float, kFftLengthBy2Plus1> S2_fallback;
47 std::array<float, kFftLengthBy2Plus1> Y2; 51 std::array<float, kFftLengthBy2Plus1> Y2;
48 std::array<float, kFftLengthBy2Plus1> R2; 52 std::array<float, kFftLengthBy2Plus1> R2;
49 EchoPathVariability echo_path_variability(false, false); 53 EchoPathVariability echo_path_variability(false, false);
50 std::vector<std::vector<float>> x(3, std::vector<float>(kBlockSize, 0.f)); 54 std::vector<std::vector<float>> x(3, std::vector<float>(kBlockSize, 0.f));
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after
83 aec_state.Update(H2, h, rtc::Optional<size_t>(2), render_buffer, E2_main, 87 aec_state.Update(H2, h, rtc::Optional<size_t>(2), render_buffer, E2_main,
84 Y2, x[0], s, false); 88 Y2, x[0], s, false);
85 89
86 estimator.Estimate(true, aec_state, render_buffer, S2_linear, Y2, &R2); 90 estimator.Estimate(true, aec_state, render_buffer, S2_linear, Y2, &R2);
87 } 91 }
88 std::for_each(R2.begin(), R2.end(), 92 std::for_each(R2.begin(), R2.end(),
89 [&](float a) { EXPECT_NEAR(kLevel, a, 0.1f); }); 93 [&](float a) { EXPECT_NEAR(kLevel, a, 0.1f); });
90 } 94 }
91 95
92 } // namespace webrtc 96 } // namespace webrtc
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698