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

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

Issue 2967603002: Added the ability to adjust the AEC3 performance for large rooms (Closed)
Patch Set: Changes in response to reviewer commments Created 3 years, 5 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/base/random.h" 13 #include "webrtc/base/random.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/aec3/aec3_fft.h" 15 #include "webrtc/modules/audio_processing/aec3/aec3_fft.h"
16 #include "webrtc/modules/audio_processing/test/echo_canceller_test_tools.h" 16 #include "webrtc/modules/audio_processing/test/echo_canceller_test_tools.h"
17 #include "webrtc/test/gtest.h" 17 #include "webrtc/test/gtest.h"
18 18
19 namespace webrtc { 19 namespace webrtc {
20 20
21 #if RTC_DCHECK_IS_ON && GTEST_HAS_DEATH_TEST && !defined(WEBRTC_ANDROID) 21 #if RTC_DCHECK_IS_ON && GTEST_HAS_DEATH_TEST && !defined(WEBRTC_ANDROID)
22 22
23 // Verifies that the check for non-null output residual echo power works. 23 // Verifies that the check for non-null output residual echo power works.
24 TEST(ResidualEchoEstimator, NullResidualEchoPowerOutput) { 24 TEST(ResidualEchoEstimator, NullResidualEchoPowerOutput) {
25 AecState aec_state; 25 AecState aec_state(0.f);
26 RenderBuffer render_buffer(Aec3Optimization::kNone, 3, 10, 26 RenderBuffer render_buffer(Aec3Optimization::kNone, 3, 10,
27 std::vector<size_t>(1, 10)); 27 std::vector<size_t>(1, 10));
28 std::vector<std::array<float, kFftLengthBy2Plus1>> H2; 28 std::vector<std::array<float, kFftLengthBy2Plus1>> H2;
29 std::array<float, kFftLengthBy2Plus1> S2_linear; 29 std::array<float, kFftLengthBy2Plus1> S2_linear;
30 std::array<float, kFftLengthBy2Plus1> Y2; 30 std::array<float, kFftLengthBy2Plus1> Y2;
31 EXPECT_DEATH(ResidualEchoEstimator().Estimate(true, aec_state, render_buffer, 31 EXPECT_DEATH(ResidualEchoEstimator().Estimate(true, aec_state, render_buffer,
32 S2_linear, Y2, nullptr), 32 S2_linear, Y2, nullptr),
33 ""); 33 "");
34 } 34 }
35 35
36 #endif 36 #endif
37 37
38 TEST(ResidualEchoEstimator, BasicTest) { 38 TEST(ResidualEchoEstimator, BasicTest) {
39 ResidualEchoEstimator estimator; 39 ResidualEchoEstimator estimator;
40 AecState aec_state; 40 AecState aec_state(0.f);
41 RenderBuffer render_buffer(Aec3Optimization::kNone, 3, 10, 41 RenderBuffer render_buffer(Aec3Optimization::kNone, 3, 10,
42 std::vector<size_t>(1, 10)); 42 std::vector<size_t>(1, 10));
43 std::array<float, kFftLengthBy2Plus1> E2_main; 43 std::array<float, kFftLengthBy2Plus1> E2_main;
44 std::array<float, kFftLengthBy2Plus1> E2_shadow; 44 std::array<float, kFftLengthBy2Plus1> E2_shadow;
45 std::array<float, kFftLengthBy2Plus1> S2_linear; 45 std::array<float, kFftLengthBy2Plus1> S2_linear;
46 std::array<float, kFftLengthBy2Plus1> S2_fallback; 46 std::array<float, kFftLengthBy2Plus1> S2_fallback;
47 std::array<float, kFftLengthBy2Plus1> Y2; 47 std::array<float, kFftLengthBy2Plus1> Y2;
48 std::array<float, kFftLengthBy2Plus1> R2; 48 std::array<float, kFftLengthBy2Plus1> R2;
49 EchoPathVariability echo_path_variability(false, false); 49 EchoPathVariability echo_path_variability(false, false);
50 std::vector<std::vector<float>> x(3, std::vector<float>(kBlockSize, 0.f)); 50 std::vector<std::vector<float>> x(3, std::vector<float>(kBlockSize, 0.f));
(...skipping 26 matching lines...) Expand all
77 aec_state.Update(H2, rtc::Optional<size_t>(2), render_buffer, E2_main, Y2, 77 aec_state.Update(H2, rtc::Optional<size_t>(2), render_buffer, E2_main, Y2,
78 x[0], false); 78 x[0], false);
79 79
80 estimator.Estimate(true, aec_state, render_buffer, S2_linear, Y2, &R2); 80 estimator.Estimate(true, aec_state, render_buffer, S2_linear, Y2, &R2);
81 } 81 }
82 std::for_each(R2.begin(), R2.end(), 82 std::for_each(R2.begin(), R2.end(),
83 [&](float a) { EXPECT_NEAR(kLevel, a, 0.1f); }); 83 [&](float a) { EXPECT_NEAR(kLevel, a, 0.1f); });
84 } 84 }
85 85
86 } // namespace webrtc 86 } // namespace webrtc
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698