| 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 <memory> |
| 6 |
| 5 #include "base/macros.h" | 7 #include "base/macros.h" |
| 6 #include "base/memory/aligned_memory.h" | 8 #include "base/memory/aligned_memory.h" |
| 7 #include "base/memory/scoped_ptr.h" | |
| 8 #include "base/time/time.h" | 9 #include "base/time/time.h" |
| 9 #include "build/build_config.h" | 10 #include "build/build_config.h" |
| 10 #include "media/base/vector_math.h" | 11 #include "media/base/vector_math.h" |
| 11 #include "media/base/vector_math_testing.h" | 12 #include "media/base/vector_math_testing.h" |
| 12 #include "testing/gtest/include/gtest/gtest.h" | 13 #include "testing/gtest/include/gtest/gtest.h" |
| 13 #include "testing/perf/perf_test.h" | 14 #include "testing/perf/perf_test.h" |
| 14 | 15 |
| 15 using base::TimeTicks; | 16 using base::TimeTicks; |
| 16 using std::fill; | 17 using std::fill; |
| 17 | 18 |
| (...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 68 (TimeTicks::Now() - start).InMillisecondsF(); | 69 (TimeTicks::Now() - start).InMillisecondsF(); |
| 69 perf_test::PrintResult(test_name, | 70 perf_test::PrintResult(test_name, |
| 70 "", | 71 "", |
| 71 trace_name, | 72 trace_name, |
| 72 kEWMABenchmarkIterations / total_time_milliseconds, | 73 kEWMABenchmarkIterations / total_time_milliseconds, |
| 73 "runs/ms", | 74 "runs/ms", |
| 74 true); | 75 true); |
| 75 } | 76 } |
| 76 | 77 |
| 77 protected: | 78 protected: |
| 78 scoped_ptr<float, base::AlignedFreeDeleter> input_vector_; | 79 std::unique_ptr<float, base::AlignedFreeDeleter> input_vector_; |
| 79 scoped_ptr<float, base::AlignedFreeDeleter> output_vector_; | 80 std::unique_ptr<float, base::AlignedFreeDeleter> output_vector_; |
| 80 | 81 |
| 81 DISALLOW_COPY_AND_ASSIGN(VectorMathPerfTest); | 82 DISALLOW_COPY_AND_ASSIGN(VectorMathPerfTest); |
| 82 }; | 83 }; |
| 83 | 84 |
| 84 // Define platform dependent function names for SIMD optimized methods. | 85 // Define platform dependent function names for SIMD optimized methods. |
| 85 #if defined(ARCH_CPU_X86_FAMILY) | 86 #if defined(ARCH_CPU_X86_FAMILY) |
| 86 #define FMAC_FUNC FMAC_SSE | 87 #define FMAC_FUNC FMAC_SSE |
| 87 #define FMUL_FUNC FMUL_SSE | 88 #define FMUL_FUNC FMUL_SSE |
| 88 #define EWMAAndMaxPower_FUNC EWMAAndMaxPower_SSE | 89 #define EWMAAndMaxPower_FUNC EWMAAndMaxPower_SSE |
| 89 #elif defined(ARCH_CPU_ARM_FAMILY) && defined(USE_NEON) | 90 #elif defined(ARCH_CPU_ARM_FAMILY) && defined(USE_NEON) |
| (...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 149 ASSERT_EQ(kVectorSize % (vector_math::kRequiredAlignment / sizeof(float)), | 150 ASSERT_EQ(kVectorSize % (vector_math::kRequiredAlignment / sizeof(float)), |
| 150 0U); | 151 0U); |
| 151 RunBenchmark(vector_math::EWMAAndMaxPower_FUNC, | 152 RunBenchmark(vector_math::EWMAAndMaxPower_FUNC, |
| 152 kVectorSize, | 153 kVectorSize, |
| 153 "vector_math_ewma_and_max_power", | 154 "vector_math_ewma_and_max_power", |
| 154 "optimized_aligned"); | 155 "optimized_aligned"); |
| 155 #endif | 156 #endif |
| 156 } | 157 } |
| 157 | 158 |
| 158 } // namespace media | 159 } // namespace media |
| OLD | NEW |