OLD | NEW |
1 /* | 1 /* |
2 * Copyright (c) 2015 The WebRTC project authors. All Rights Reserved. | 2 * Copyright (c) 2015 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 <memory> | 11 #include <memory> |
12 | 12 |
13 #include "webrtc/common_audio/sparse_fir_filter.h" | 13 #include "webrtc/common_audio/sparse_fir_filter.h" |
14 | 14 |
15 #include "webrtc/test/gtest.h" | |
16 #include "webrtc/base/arraysize.h" | 15 #include "webrtc/base/arraysize.h" |
17 #include "webrtc/common_audio/fir_filter.h" | 16 #include "webrtc/common_audio/fir_filter.h" |
| 17 #include "webrtc/test/gtest.h" |
18 | 18 |
19 namespace webrtc { | 19 namespace webrtc { |
20 namespace { | 20 namespace { |
21 | 21 |
22 static const float kCoeffs[] = {0.2f, 0.3f, 0.5f, 0.7f, 0.11f}; | 22 static const float kCoeffs[] = {0.2f, 0.3f, 0.5f, 0.7f, 0.11f}; |
23 static const float kInput[] = | 23 static const float kInput[] = |
24 {1.f, 2.f, 3.f, 4.f, 5.f, 6.f, 7.f, 8.f, 9.f, 10.f}; | 24 {1.f, 2.f, 3.f, 4.f, 5.f, 6.f, 7.f, 8.f, 9.f, 10.f}; |
25 | 25 |
26 template <size_t N> | 26 template <size_t N> |
27 void VerifyOutput(const float (&expected_output)[N], const float (&output)[N]) { | 27 void VerifyOutput(const float (&expected_output)[N], const float (&output)[N]) { |
(...skipping 194 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
222 kSparsity, | 222 kSparsity, |
223 kOffset); | 223 kOffset); |
224 filter->Filter(kInput, arraysize(kInput), output); | 224 filter->Filter(kInput, arraysize(kInput), output); |
225 sparse_filter.Filter(kInput, arraysize(kInput), sparse_output); | 225 sparse_filter.Filter(kInput, arraysize(kInput), sparse_output); |
226 for (size_t i = 0; i < arraysize(kInput); ++i) { | 226 for (size_t i = 0; i < arraysize(kInput); ++i) { |
227 EXPECT_FLOAT_EQ(output[i], sparse_output[i]); | 227 EXPECT_FLOAT_EQ(output[i], sparse_output[i]); |
228 } | 228 } |
229 } | 229 } |
230 | 230 |
231 } // namespace webrtc | 231 } // namespace webrtc |
OLD | NEW |