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 |
11 #include "webrtc/modules/audio_processing/aec3/comfort_noise_generator.h" | 11 #include "webrtc/modules/audio_processing/aec3/comfort_noise_generator.h" |
12 | 12 |
13 #include <algorithm> | 13 #include <algorithm> |
14 #include <numeric> | 14 #include <numeric> |
15 | 15 |
16 #include "webrtc/rtc_base/random.h" | 16 #include "webrtc/typedefs.h" |
| 17 #include "webrtc/base/random.h" |
17 #include "webrtc/system_wrappers/include/cpu_features_wrapper.h" | 18 #include "webrtc/system_wrappers/include/cpu_features_wrapper.h" |
18 #include "webrtc/test/gtest.h" | 19 #include "webrtc/test/gtest.h" |
19 #include "webrtc/typedefs.h" | |
20 | 20 |
21 namespace webrtc { | 21 namespace webrtc { |
22 namespace aec3 { | 22 namespace aec3 { |
23 namespace { | 23 namespace { |
24 | 24 |
25 float Power(const FftData& N) { | 25 float Power(const FftData& N) { |
26 std::array<float, kFftLengthBy2Plus1> N2; | 26 std::array<float, kFftLengthBy2Plus1> N2; |
27 N.Spectrum(Aec3Optimization::kNone, &N2); | 27 N.Spectrum(Aec3Optimization::kNone, &N2); |
28 return std::accumulate(N2.begin(), N2.end(), 0.f) / N2.size(); | 28 return std::accumulate(N2.begin(), N2.end(), 0.f) / N2.size(); |
29 } | 29 } |
(...skipping 80 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
110 | 110 |
111 for (int k = 0; k < 10000; ++k) { | 111 for (int k = 0; k < 10000; ++k) { |
112 cng.Compute(aec_state, N2, &n_lower, &n_upper); | 112 cng.Compute(aec_state, N2, &n_lower, &n_upper); |
113 } | 113 } |
114 EXPECT_NEAR(N2[0], Power(n_lower), N2[0] / 10.f); | 114 EXPECT_NEAR(N2[0], Power(n_lower), N2[0] / 10.f); |
115 EXPECT_NEAR(N2[0], Power(n_upper), N2[0] / 10.f); | 115 EXPECT_NEAR(N2[0], Power(n_upper), N2[0] / 10.f); |
116 } | 116 } |
117 | 117 |
118 } // namespace aec3 | 118 } // namespace aec3 |
119 } // namespace webrtc | 119 } // namespace webrtc |
OLD | NEW |