OLD | NEW |
1 /* | 1 /* |
2 * Copyright (c) 2013 The WebRTC project authors. All Rights Reserved. | 2 * Copyright (c) 2013 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 |
(...skipping 15 matching lines...) Expand all Loading... |
26 EXPECT_EQ(3u, GetOutLengthToDyadicDecimate(6, false)); | 26 EXPECT_EQ(3u, GetOutLengthToDyadicDecimate(6, false)); |
27 EXPECT_EQ(3u, GetOutLengthToDyadicDecimate(6, true)); | 27 EXPECT_EQ(3u, GetOutLengthToDyadicDecimate(6, true)); |
28 EXPECT_EQ(3u, GetOutLengthToDyadicDecimate(5, false)); | 28 EXPECT_EQ(3u, GetOutLengthToDyadicDecimate(5, false)); |
29 EXPECT_EQ(2u, GetOutLengthToDyadicDecimate(5, true)); | 29 EXPECT_EQ(2u, GetOutLengthToDyadicDecimate(5, true)); |
30 } | 30 } |
31 | 31 |
32 | 32 |
33 TEST(DyadicDecimatorTest, DyadicDecimateErrorValues) { | 33 TEST(DyadicDecimatorTest, DyadicDecimateErrorValues) { |
34 size_t out_samples = 0; | 34 size_t out_samples = 0; |
35 | 35 |
36 out_samples = DyadicDecimate(static_cast<int16_t*>(NULL), | 36 out_samples = |
37 kEvenBufferLength, | 37 DyadicDecimate(static_cast<int16_t*>(nullptr), kEvenBufferLength, |
38 false, // Even sequence. | 38 false, // Even sequence. |
39 test_buffer_out, | 39 test_buffer_out, kOutBufferLength); |
40 kOutBufferLength); | |
41 EXPECT_EQ(0u, out_samples); | 40 EXPECT_EQ(0u, out_samples); |
42 | 41 |
43 out_samples = DyadicDecimate(test_buffer_even_len, | 42 out_samples = |
44 kEvenBufferLength, | 43 DyadicDecimate(test_buffer_even_len, kEvenBufferLength, |
45 false, // Even sequence. | 44 false, // Even sequence. |
46 static_cast<int16_t*>(NULL), | 45 static_cast<int16_t*>(nullptr), kOutBufferLength); |
47 kOutBufferLength); | |
48 EXPECT_EQ(0u, out_samples); | 46 EXPECT_EQ(0u, out_samples); |
49 | 47 |
50 // Less than required |out_length|. | 48 // Less than required |out_length|. |
51 out_samples = DyadicDecimate(test_buffer_even_len, | 49 out_samples = DyadicDecimate(test_buffer_even_len, |
52 kEvenBufferLength, | 50 kEvenBufferLength, |
53 false, // Even sequence. | 51 false, // Even sequence. |
54 test_buffer_out, | 52 test_buffer_out, |
55 2); | 53 2); |
56 EXPECT_EQ(0u, out_samples); | 54 EXPECT_EQ(0u, out_samples); |
57 } | 55 } |
(...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
117 test_buffer_out, | 115 test_buffer_out, |
118 kOutBufferLength); | 116 kOutBufferLength); |
119 | 117 |
120 EXPECT_EQ(expected_out_samples, out_samples); | 118 EXPECT_EQ(expected_out_samples, out_samples); |
121 | 119 |
122 EXPECT_EQ(1, test_buffer_out[0]); | 120 EXPECT_EQ(1, test_buffer_out[0]); |
123 EXPECT_EQ(3, test_buffer_out[1]); | 121 EXPECT_EQ(3, test_buffer_out[1]); |
124 } | 122 } |
125 | 123 |
126 } // namespace webrtc | 124 } // namespace webrtc |
OLD | NEW |