| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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 <stdint.h> | 5 #include <stdint.h> |
| 6 | 6 |
| 7 #include <memory> |
| 8 |
| 7 #include "base/base_paths.h" | 9 #include "base/base_paths.h" |
| 8 #include "base/cpu.h" | 10 #include "base/cpu.h" |
| 9 #include "base/files/file_util.h" | 11 #include "base/files/file_util.h" |
| 10 #include "base/logging.h" | 12 #include "base/logging.h" |
| 11 #include "base/macros.h" | 13 #include "base/macros.h" |
| 12 #include "base/memory/scoped_ptr.h" | |
| 13 #include "base/path_service.h" | 14 #include "base/path_service.h" |
| 14 #include "base/time/time.h" | 15 #include "base/time/time.h" |
| 15 #include "build/build_config.h" | 16 #include "build/build_config.h" |
| 16 #include "media/base/simd/convert_yuv_to_rgb.h" | 17 #include "media/base/simd/convert_yuv_to_rgb.h" |
| 17 #include "media/base/yuv_convert.h" | 18 #include "media/base/yuv_convert.h" |
| 18 #include "testing/gtest/include/gtest/gtest.h" | 19 #include "testing/gtest/include/gtest/gtest.h" |
| 19 #include "testing/perf/perf_test.h" | 20 #include "testing/perf/perf_test.h" |
| 20 #include "third_party/libyuv/include/libyuv/row.h" | 21 #include "third_party/libyuv/include/libyuv/row.h" |
| 21 | 22 |
| 22 namespace media { | 23 namespace media { |
| (...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 56 base::GetFileSize(path, &actual_size); | 57 base::GetFileSize(path, &actual_size); |
| 57 CHECK_EQ(actual_size, kYUV12Size); | 58 CHECK_EQ(actual_size, kYUV12Size); |
| 58 | 59 |
| 59 // Verify bytes read are correct. | 60 // Verify bytes read are correct. |
| 60 int bytes_read = base::ReadFile( | 61 int bytes_read = base::ReadFile( |
| 61 path, reinterpret_cast<char*>(yuv_bytes_.get()), kYUV12Size); | 62 path, reinterpret_cast<char*>(yuv_bytes_.get()), kYUV12Size); |
| 62 | 63 |
| 63 CHECK_EQ(bytes_read, kYUV12Size); | 64 CHECK_EQ(bytes_read, kYUV12Size); |
| 64 } | 65 } |
| 65 | 66 |
| 66 scoped_ptr<uint8_t[]> yuv_bytes_; | 67 std::unique_ptr<uint8_t[]> yuv_bytes_; |
| 67 scoped_ptr<uint8_t[]> rgb_bytes_converted_; | 68 std::unique_ptr<uint8_t[]> rgb_bytes_converted_; |
| 68 | 69 |
| 69 private: | 70 private: |
| 70 DISALLOW_COPY_AND_ASSIGN(YUVConvertPerfTest); | 71 DISALLOW_COPY_AND_ASSIGN(YUVConvertPerfTest); |
| 71 }; | 72 }; |
| 72 | 73 |
| 73 TEST_F(YUVConvertPerfTest, ConvertYUVToRGB32Row_SSE) { | 74 TEST_F(YUVConvertPerfTest, ConvertYUVToRGB32Row_SSE) { |
| 74 ASSERT_TRUE(base::CPU().has_sse()); | 75 ASSERT_TRUE(base::CPU().has_sse()); |
| 75 | 76 |
| 76 base::TimeTicks start = base::TimeTicks::Now(); | 77 base::TimeTicks start = base::TimeTicks::Now(); |
| 77 for (int i = 0; i < kPerfTestIterations; ++i) { | 78 for (int i = 0; i < kPerfTestIterations; ++i) { |
| (...skipping 134 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 212 double total_time_seconds = (base::TimeTicks::Now() - start).InSecondsF(); | 213 double total_time_seconds = (base::TimeTicks::Now() - start).InSecondsF(); |
| 213 perf_test::PrintResult( | 214 perf_test::PrintResult( |
| 214 "yuv_convert_perftest", "", "LinearScaleYUVToRGB32Row_SSE", | 215 "yuv_convert_perftest", "", "LinearScaleYUVToRGB32Row_SSE", |
| 215 kPerfTestIterations / total_time_seconds, "runs/s", true); | 216 kPerfTestIterations / total_time_seconds, "runs/s", true); |
| 216 } | 217 } |
| 217 #endif // defined(OS_WIN) && (ARCH_CPU_X86 || COMPONENT_BUILD) | 218 #endif // defined(OS_WIN) && (ARCH_CPU_X86 || COMPONENT_BUILD) |
| 218 | 219 |
| 219 #endif // !defined(ARCH_CPU_ARM_FAMILY) && !defined(ARCH_CPU_MIPS_FAMILY) | 220 #endif // !defined(ARCH_CPU_ARM_FAMILY) && !defined(ARCH_CPU_MIPS_FAMILY) |
| 220 | 221 |
| 221 } // namespace media | 222 } // namespace media |
| OLD | NEW |