Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(464)

Side by Side Diff: media/base/yuv_convert_perftest.cc

Issue 864943002: Replaces instances of the deprecated TimeTicks::HighResNow() with TimeTicks::Now(). (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: More changes based on review comments. Created 5 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « media/base/vector_math_perftest.cc ('k') | media/midi/midi_manager_alsa.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 "base/base_paths.h" 5 #include "base/base_paths.h"
6 #include "base/cpu.h" 6 #include "base/cpu.h"
7 #include "base/files/file_util.h" 7 #include "base/files/file_util.h"
8 #include "base/logging.h" 8 #include "base/logging.h"
9 #include "base/path_service.h" 9 #include "base/path_service.h"
10 #include "base/time/time.h" 10 #include "base/time/time.h"
(...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after
60 scoped_ptr<uint8[]> yuv_bytes_; 60 scoped_ptr<uint8[]> yuv_bytes_;
61 scoped_ptr<uint8[]> rgb_bytes_converted_; 61 scoped_ptr<uint8[]> rgb_bytes_converted_;
62 62
63 private: 63 private:
64 DISALLOW_COPY_AND_ASSIGN(YUVConvertPerfTest); 64 DISALLOW_COPY_AND_ASSIGN(YUVConvertPerfTest);
65 }; 65 };
66 66
67 TEST_F(YUVConvertPerfTest, ConvertYUVToRGB32Row_SSE) { 67 TEST_F(YUVConvertPerfTest, ConvertYUVToRGB32Row_SSE) {
68 ASSERT_TRUE(base::CPU().has_sse()); 68 ASSERT_TRUE(base::CPU().has_sse());
69 69
70 base::TimeTicks start = base::TimeTicks::HighResNow(); 70 base::TimeTicks start = base::TimeTicks::Now();
71 for (int i = 0; i < kPerfTestIterations; ++i) { 71 for (int i = 0; i < kPerfTestIterations; ++i) {
72 for (int row = 0; row < kSourceHeight; ++row) { 72 for (int row = 0; row < kSourceHeight; ++row) {
73 int chroma_row = row / 2; 73 int chroma_row = row / 2;
74 ConvertYUVToRGB32Row_SSE( 74 ConvertYUVToRGB32Row_SSE(
75 yuv_bytes_.get() + row * kSourceWidth, 75 yuv_bytes_.get() + row * kSourceWidth,
76 yuv_bytes_.get() + kSourceUOffset + (chroma_row * kSourceWidth / 2), 76 yuv_bytes_.get() + kSourceUOffset + (chroma_row * kSourceWidth / 2),
77 yuv_bytes_.get() + kSourceVOffset + (chroma_row * kSourceWidth / 2), 77 yuv_bytes_.get() + kSourceVOffset + (chroma_row * kSourceWidth / 2),
78 rgb_bytes_converted_.get(), 78 rgb_bytes_converted_.get(),
79 kWidth, 79 kWidth,
80 GetLookupTable(YV12)); 80 GetLookupTable(YV12));
81 } 81 }
82 } 82 }
83 double total_time_seconds = 83 double total_time_seconds = (base::TimeTicks::Now() - start).InSecondsF();
84 (base::TimeTicks::HighResNow() - start).InSecondsF();
85 perf_test::PrintResult( 84 perf_test::PrintResult(
86 "yuv_convert_perftest", "", "ConvertYUVToRGB32Row_SSE", 85 "yuv_convert_perftest", "", "ConvertYUVToRGB32Row_SSE",
87 kPerfTestIterations / total_time_seconds, "runs/s", true); 86 kPerfTestIterations / total_time_seconds, "runs/s", true);
88 media::EmptyRegisterState(); 87 media::EmptyRegisterState();
89 } 88 }
90 89
91 // 64-bit release + component builds on Windows are too smart and optimizes 90 // 64-bit release + component builds on Windows are too smart and optimizes
92 // away the function being tested. 91 // away the function being tested.
93 #if defined(OS_WIN) && (defined(ARCH_CPU_X86) || !defined(COMPONENT_BUILD)) 92 #if defined(OS_WIN) && (defined(ARCH_CPU_X86) || !defined(COMPONENT_BUILD))
94 TEST_F(YUVConvertPerfTest, ScaleYUVToRGB32Row_SSE) { 93 TEST_F(YUVConvertPerfTest, ScaleYUVToRGB32Row_SSE) {
95 ASSERT_TRUE(base::CPU().has_sse()); 94 ASSERT_TRUE(base::CPU().has_sse());
96 95
97 const int kSourceDx = 80000; // This value means a scale down. 96 const int kSourceDx = 80000; // This value means a scale down.
98 97
99 base::TimeTicks start = base::TimeTicks::HighResNow(); 98 base::TimeTicks start = base::TimeTicks::Now();
100 for (int i = 0; i < kPerfTestIterations; ++i) { 99 for (int i = 0; i < kPerfTestIterations; ++i) {
101 for (int row = 0; row < kSourceHeight; ++row) { 100 for (int row = 0; row < kSourceHeight; ++row) {
102 int chroma_row = row / 2; 101 int chroma_row = row / 2;
103 ScaleYUVToRGB32Row_SSE( 102 ScaleYUVToRGB32Row_SSE(
104 yuv_bytes_.get() + row * kSourceWidth, 103 yuv_bytes_.get() + row * kSourceWidth,
105 yuv_bytes_.get() + kSourceUOffset + (chroma_row * kSourceWidth / 2), 104 yuv_bytes_.get() + kSourceUOffset + (chroma_row * kSourceWidth / 2),
106 yuv_bytes_.get() + kSourceVOffset + (chroma_row * kSourceWidth / 2), 105 yuv_bytes_.get() + kSourceVOffset + (chroma_row * kSourceWidth / 2),
107 rgb_bytes_converted_.get(), 106 rgb_bytes_converted_.get(),
108 kWidth, 107 kWidth,
109 kSourceDx, 108 kSourceDx,
110 GetLookupTable(YV12)); 109 GetLookupTable(YV12));
111 } 110 }
112 } 111 }
113 double total_time_seconds = 112 double total_time_seconds = (base::TimeTicks::Now() - start).InSecondsF();
114 (base::TimeTicks::HighResNow() - start).InSecondsF();
115 perf_test::PrintResult( 113 perf_test::PrintResult(
116 "yuv_convert_perftest", "", "ScaleYUVToRGB32Row_SSE", 114 "yuv_convert_perftest", "", "ScaleYUVToRGB32Row_SSE",
117 kPerfTestIterations / total_time_seconds, "runs/s", true); 115 kPerfTestIterations / total_time_seconds, "runs/s", true);
118 media::EmptyRegisterState(); 116 media::EmptyRegisterState();
119 } 117 }
120 118
121 TEST_F(YUVConvertPerfTest, LinearScaleYUVToRGB32Row_SSE) { 119 TEST_F(YUVConvertPerfTest, LinearScaleYUVToRGB32Row_SSE) {
122 ASSERT_TRUE(base::CPU().has_sse()); 120 ASSERT_TRUE(base::CPU().has_sse());
123 121
124 const int kSourceDx = 80000; // This value means a scale down. 122 const int kSourceDx = 80000; // This value means a scale down.
125 123
126 base::TimeTicks start = base::TimeTicks::HighResNow(); 124 base::TimeTicks start = base::TimeTicks::Now();
127 for (int i = 0; i < kPerfTestIterations; ++i) { 125 for (int i = 0; i < kPerfTestIterations; ++i) {
128 for (int row = 0; row < kSourceHeight; ++row) { 126 for (int row = 0; row < kSourceHeight; ++row) {
129 int chroma_row = row / 2; 127 int chroma_row = row / 2;
130 LinearScaleYUVToRGB32Row_SSE( 128 LinearScaleYUVToRGB32Row_SSE(
131 yuv_bytes_.get() + row * kSourceWidth, 129 yuv_bytes_.get() + row * kSourceWidth,
132 yuv_bytes_.get() + kSourceUOffset + (chroma_row * kSourceWidth / 2), 130 yuv_bytes_.get() + kSourceUOffset + (chroma_row * kSourceWidth / 2),
133 yuv_bytes_.get() + kSourceVOffset + (chroma_row * kSourceWidth / 2), 131 yuv_bytes_.get() + kSourceVOffset + (chroma_row * kSourceWidth / 2),
134 rgb_bytes_converted_.get(), 132 rgb_bytes_converted_.get(),
135 kWidth, 133 kWidth,
136 kSourceDx, 134 kSourceDx,
137 GetLookupTable(YV12)); 135 GetLookupTable(YV12));
138 } 136 }
139 } 137 }
140 double total_time_seconds = 138 double total_time_seconds = (base::TimeTicks::Now() - start).InSecondsF();
141 (base::TimeTicks::HighResNow() - start).InSecondsF();
142 perf_test::PrintResult( 139 perf_test::PrintResult(
143 "yuv_convert_perftest", "", "LinearScaleYUVToRGB32Row_SSE", 140 "yuv_convert_perftest", "", "LinearScaleYUVToRGB32Row_SSE",
144 kPerfTestIterations / total_time_seconds, "runs/s", true); 141 kPerfTestIterations / total_time_seconds, "runs/s", true);
145 media::EmptyRegisterState(); 142 media::EmptyRegisterState();
146 } 143 }
147 #endif // defined(OS_WIN) && (ARCH_CPU_X86 || COMPONENT_BUILD) 144 #endif // defined(OS_WIN) && (ARCH_CPU_X86 || COMPONENT_BUILD)
148 145
149 #endif // !defined(ARCH_CPU_ARM_FAMILY) && !defined(ARCH_CPU_MIPS_FAMILY) 146 #endif // !defined(ARCH_CPU_ARM_FAMILY) && !defined(ARCH_CPU_MIPS_FAMILY)
150 147
151 } // namespace media 148 } // namespace media
OLDNEW
« no previous file with comments | « media/base/vector_math_perftest.cc ('k') | media/midi/midi_manager_alsa.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698