OLD | NEW |
1 /* | 1 /* |
2 * Copyright (c) 2014 The WebRTC project authors. All Rights Reserved. | 2 * Copyright (c) 2014 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/common_audio/fir_filter.h" | 11 #include "webrtc/common_audio/fir_filter.h" |
12 | 12 |
13 #include <string.h> | 13 #include <string.h> |
14 | 14 |
15 #include <memory> | 15 #include <memory> |
16 | 16 |
17 #include "testing/gtest/include/gtest/gtest.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 kCoefficients[] = {0.2f, 0.3f, 0.5f, 0.7f, 0.11f}; | 22 static const float kCoefficients[] = {0.2f, 0.3f, 0.5f, 0.7f, 0.11f}; |
23 static const size_t kCoefficientsLength = sizeof(kCoefficients) / | 23 static const size_t kCoefficientsLength = sizeof(kCoefficients) / |
24 sizeof(kCoefficients[0]); | 24 sizeof(kCoefficients[0]); |
25 | 25 |
26 static const float kInput[] = {1.f, 2.f, 3.f, 4.f, 5.f, 6.f, 7.f, | 26 static const float kInput[] = {1.f, 2.f, 3.f, 4.f, 5.f, 6.f, 7.f, |
27 8.f, 9.f, 10.f}; | 27 8.f, 9.f, 10.f}; |
(...skipping 174 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
202 filter.reset(FIRFilter::Create( | 202 filter.reset(FIRFilter::Create( |
203 kInput, kCoefficientsLength, kCoefficientsLength)); | 203 kInput, kCoefficientsLength, kCoefficientsLength)); |
204 filter->Filter(kCoefficients, kCoefficientsLength, output_swaped); | 204 filter->Filter(kCoefficients, kCoefficientsLength, output_swaped); |
205 | 205 |
206 for (size_t i = 0 ; i < kCoefficientsLength; ++i) { | 206 for (size_t i = 0 ; i < kCoefficientsLength; ++i) { |
207 EXPECT_FLOAT_EQ(output[i], output_swaped[i]); | 207 EXPECT_FLOAT_EQ(output[i], output_swaped[i]); |
208 } | 208 } |
209 } | 209 } |
210 | 210 |
211 } // namespace webrtc | 211 } // namespace webrtc |
OLD | NEW |