OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 // MSVC++ requires this to be set before any other includes to get M_PI. | 5 // MSVC++ requires this to be set before any other includes to get M_PI. |
6 #define _USE_MATH_DEFINES | 6 #define _USE_MATH_DEFINES |
7 | 7 |
8 #include <cmath> | 8 #include <cmath> |
9 | 9 |
10 #include "base/bind.h" | 10 #include "base/bind.h" |
(...skipping 123 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
134 for (int i = 0; i < resampler.ChunkSize() / 2; ++i) | 134 for (int i = 0; i < resampler.ChunkSize() / 2; ++i) |
135 ASSERT_FLOAT_EQ(resampled_destination[i], 0); | 135 ASSERT_FLOAT_EQ(resampled_destination[i], 0); |
136 } | 136 } |
137 | 137 |
138 TEST(SincResamplerTest, DISABLED_SetRatioBench) { | 138 TEST(SincResamplerTest, DISABLED_SetRatioBench) { |
139 MockSource mock_source; | 139 MockSource mock_source; |
140 SincResampler resampler( | 140 SincResampler resampler( |
141 kSampleRateRatio, SincResampler::kDefaultRequestSize, | 141 kSampleRateRatio, SincResampler::kDefaultRequestSize, |
142 base::Bind(&MockSource::ProvideInput, base::Unretained(&mock_source))); | 142 base::Bind(&MockSource::ProvideInput, base::Unretained(&mock_source))); |
143 | 143 |
144 base::TimeTicks start = base::TimeTicks::HighResNow(); | 144 base::TimeTicks start = base::TimeTicks::Now(); |
145 for (int i = 1; i < 10000; ++i) | 145 for (int i = 1; i < 10000; ++i) |
146 resampler.SetRatio(1.0 / i); | 146 resampler.SetRatio(1.0 / i); |
147 double total_time_c_ms = | 147 double total_time_c_ms = (base::TimeTicks::Now() - start).InMillisecondsF(); |
148 (base::TimeTicks::HighResNow() - start).InMillisecondsF(); | |
149 printf("SetRatio() took %.2fms.\n", total_time_c_ms); | 148 printf("SetRatio() took %.2fms.\n", total_time_c_ms); |
150 } | 149 } |
151 | 150 |
152 | 151 |
153 // Define platform independent function name for Convolve* tests. | 152 // Define platform independent function name for Convolve* tests. |
154 #if defined(ARCH_CPU_X86_FAMILY) | 153 #if defined(ARCH_CPU_X86_FAMILY) |
155 #define CONVOLVE_FUNC Convolve_SSE | 154 #define CONVOLVE_FUNC Convolve_SSE |
156 #elif defined(ARCH_CPU_ARM_FAMILY) && defined(USE_NEON) | 155 #elif defined(ARCH_CPU_ARM_FAMILY) && defined(USE_NEON) |
157 #define CONVOLVE_FUNC Convolve_NEON | 156 #define CONVOLVE_FUNC Convolve_NEON |
158 #endif | 157 #endif |
(...skipping 242 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
401 std::tr1::make_tuple(11025, 192000, kResamplingRMSError, -62.61), | 400 std::tr1::make_tuple(11025, 192000, kResamplingRMSError, -62.61), |
402 std::tr1::make_tuple(16000, 192000, kResamplingRMSError, -63.14), | 401 std::tr1::make_tuple(16000, 192000, kResamplingRMSError, -63.14), |
403 std::tr1::make_tuple(22050, 192000, kResamplingRMSError, -62.42), | 402 std::tr1::make_tuple(22050, 192000, kResamplingRMSError, -62.42), |
404 std::tr1::make_tuple(32000, 192000, kResamplingRMSError, -63.38), | 403 std::tr1::make_tuple(32000, 192000, kResamplingRMSError, -63.38), |
405 std::tr1::make_tuple(44100, 192000, kResamplingRMSError, -62.63), | 404 std::tr1::make_tuple(44100, 192000, kResamplingRMSError, -62.63), |
406 std::tr1::make_tuple(48000, 192000, kResamplingRMSError, -73.44), | 405 std::tr1::make_tuple(48000, 192000, kResamplingRMSError, -73.44), |
407 std::tr1::make_tuple(96000, 192000, kResamplingRMSError, -73.52), | 406 std::tr1::make_tuple(96000, 192000, kResamplingRMSError, -73.52), |
408 std::tr1::make_tuple(192000, 192000, kResamplingRMSError, -73.52))); | 407 std::tr1::make_tuple(192000, 192000, kResamplingRMSError, -73.52))); |
409 | 408 |
410 } // namespace media | 409 } // namespace media |
OLD | NEW |