| OLD | NEW |
| 1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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 #include "base/bind.h" | 5 #include "base/bind.h" |
| 6 #include "base/bind_helpers.h" | 6 #include "base/bind_helpers.h" |
| 7 #include "base/cpu.h" | |
| 8 #include "base/time/time.h" | 7 #include "base/time/time.h" |
| 9 #include "media/base/sinc_resampler.h" | 8 #include "media/base/sinc_resampler.h" |
| 10 #include "testing/gmock/include/gmock/gmock.h" | 9 #include "testing/gmock/include/gmock/gmock.h" |
| 11 #include "testing/gtest/include/gtest/gtest.h" | 10 #include "testing/gtest/include/gtest/gtest.h" |
| 12 #include "testing/perf/perf_test.h" | 11 #include "testing/perf/perf_test.h" |
| 13 | 12 |
| 14 namespace media { | 13 namespace media { |
| 15 | 14 |
| 16 static const int kBenchmarkIterations = 50000000; | 15 static const int kBenchmarkIterations = 50000000; |
| 17 | 16 |
| (...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 54 // branding=Chrome so that DCHECKs are compiled out when benchmarking. | 53 // branding=Chrome so that DCHECKs are compiled out when benchmarking. |
| 55 TEST(SincResamplerPerfTest, Convolve) { | 54 TEST(SincResamplerPerfTest, Convolve) { |
| 56 SincResampler resampler(kSampleRateRatio, | 55 SincResampler resampler(kSampleRateRatio, |
| 57 SincResampler::kDefaultRequestSize, | 56 SincResampler::kDefaultRequestSize, |
| 58 base::Bind(&DoNothing)); | 57 base::Bind(&DoNothing)); |
| 59 | 58 |
| 60 RunConvolveBenchmark( | 59 RunConvolveBenchmark( |
| 61 &resampler, SincResampler::Convolve_C, true, "unoptimized_aligned"); | 60 &resampler, SincResampler::Convolve_C, true, "unoptimized_aligned"); |
| 62 | 61 |
| 63 #if defined(CONVOLVE_FUNC) | 62 #if defined(CONVOLVE_FUNC) |
| 64 #if defined(ARCH_CPU_X86_FAMILY) | |
| 65 ASSERT_TRUE(base::CPU().has_sse()); | |
| 66 #endif | |
| 67 RunConvolveBenchmark( | 63 RunConvolveBenchmark( |
| 68 &resampler, SincResampler::CONVOLVE_FUNC, true, "optimized_aligned"); | 64 &resampler, SincResampler::CONVOLVE_FUNC, true, "optimized_aligned"); |
| 69 RunConvolveBenchmark( | 65 RunConvolveBenchmark( |
| 70 &resampler, SincResampler::CONVOLVE_FUNC, false, "optimized_unaligned"); | 66 &resampler, SincResampler::CONVOLVE_FUNC, false, "optimized_unaligned"); |
| 71 #endif | 67 #endif |
| 72 } | 68 } |
| 73 | 69 |
| 74 #undef CONVOLVE_FUNC | 70 #undef CONVOLVE_FUNC |
| 75 | 71 |
| 76 } // namespace media | 72 } // namespace media |
| OLD | NEW |