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

Side by Side Diff: media/tools/scaler_bench/scaler_bench.cc

Issue 9138050: Merge 117748 - Linear sub-rectangle scaler for use in Chromoting. (Closed) Base URL: svn://svn.chromium.org/chrome/branches/963/src/
Patch Set: Created 8 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 | Annotate | Revision Log
« no previous file with comments | « media/base/yuv_convert_unittest.cc ('k') | remoting/base/decoder_vp8.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 (c) 2011 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 // This tool can be used to measure performace of video frame scaling 5 // This tool can be used to measure performace of video frame scaling
6 // code. It times performance of the scaler with and without filtering. 6 // code. It times performance of the scaler with and without filtering.
7 // It also measures performance of the Skia scaler for comparison. 7 // It also measures performance of the Skia scaler for comparison.
8 8
9 #include <iostream> 9 #include <iostream>
10 #include <vector> 10 #include <vector>
11 11
(...skipping 133 matching lines...) Expand 10 before | Expand all | Expand 10 after
145 source_frame->stride(VideoFrame::kUPlane), 145 source_frame->stride(VideoFrame::kUPlane),
146 dest_frame->stride(0), 146 dest_frame->stride(0),
147 media::YV12, 147 media::YV12,
148 media::ROTATE_0, 148 media::ROTATE_0,
149 filter); 149 filter);
150 } 150 }
151 TimeTicks end = TimeTicks::HighResNow(); 151 TimeTicks end = TimeTicks::HighResNow();
152 return static_cast<double>((end - start).InMilliseconds()) / num_frames; 152 return static_cast<double>((end - start).InMilliseconds()) / num_frames;
153 } 153 }
154 154
155 static double BenchmarkScaleWithRect() {
156 std::vector<scoped_refptr<VideoFrame> > source_frames;
157 std::vector<scoped_refptr<VideoFrame> > dest_frames;
158
159 for (int i = 0; i < num_buffers; i++) {
160 source_frames.push_back(
161 VideoFrame::CreateBlackFrame(source_width, source_height));
162
163 dest_frames.push_back(
164 VideoFrame::CreateFrame(VideoFrame::RGB32,
165 dest_width,
166 dest_height,
167 TimeDelta::FromSeconds(0),
168 TimeDelta::FromSeconds(0)));
169 }
170
171 TimeTicks start = TimeTicks::HighResNow();
172 for (int i = 0; i < num_frames; i++) {
173 scoped_refptr<VideoFrame> source_frame = source_frames[i % num_buffers];
174 scoped_refptr<VideoFrame> dest_frame = dest_frames[i % num_buffers];
175
176 media::ScaleYUVToRGB32WithRect(
177 source_frame->data(VideoFrame::kYPlane),
178 source_frame->data(VideoFrame::kUPlane),
179 source_frame->data(VideoFrame::kVPlane),
180 dest_frame->data(0),
181 source_width,
182 source_height,
183 dest_width,
184 dest_height,
185 0, 0,
186 dest_width,
187 dest_height,
188 source_frame->stride(VideoFrame::kYPlane),
189 source_frame->stride(VideoFrame::kUPlane),
190 dest_frame->stride(0));
191 }
192 TimeTicks end = TimeTicks::HighResNow();
193 return static_cast<double>((end - start).InMilliseconds()) / num_frames;
194 }
195
155 int main(int argc, const char** argv) { 196 int main(int argc, const char** argv) {
156 CommandLine::Init(argc, argv); 197 CommandLine::Init(argc, argv);
157 const CommandLine* cmd_line = CommandLine::ForCurrentProcess(); 198 const CommandLine* cmd_line = CommandLine::ForCurrentProcess();
158 199
159 if (!cmd_line->GetArgs().empty()) { 200 if (!cmd_line->GetArgs().empty()) {
160 std::cerr << "Usage: " << argv[0] << " [OPTIONS]\n" 201 std::cerr << "Usage: " << argv[0] << " [OPTIONS]\n"
161 << " --frames=N " 202 << " --frames=N "
162 << "Number of frames\n" 203 << "Number of frames\n"
163 << " --buffers=N " 204 << " --buffers=N "
164 << "Number of buffers\n" 205 << "Number of buffers\n"
(...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after
224 std::cout << "No filtering: " << BenchmarkFilter(media::FILTER_NONE) 265 std::cout << "No filtering: " << BenchmarkFilter(media::FILTER_NONE)
225 << "ms/frame" << std::endl; 266 << "ms/frame" << std::endl;
226 std::cout << "Bilinear Vertical: " 267 std::cout << "Bilinear Vertical: "
227 << BenchmarkFilter(media::FILTER_BILINEAR_V) 268 << BenchmarkFilter(media::FILTER_BILINEAR_V)
228 << "ms/frame" << std::endl; 269 << "ms/frame" << std::endl;
229 std::cout << "Bilinear Horizontal: " 270 std::cout << "Bilinear Horizontal: "
230 << BenchmarkFilter(media::FILTER_BILINEAR_H) 271 << BenchmarkFilter(media::FILTER_BILINEAR_H)
231 << "ms/frame" << std::endl; 272 << "ms/frame" << std::endl;
232 std::cout << "Bilinear: " << BenchmarkFilter(media::FILTER_BILINEAR) 273 std::cout << "Bilinear: " << BenchmarkFilter(media::FILTER_BILINEAR)
233 << "ms/frame" << std::endl; 274 << "ms/frame" << std::endl;
275 std::cout << "Bilinear with rect: " << BenchmarkScaleWithRect()
276 << "ms/frame" << std::endl;
234 277
235 return 0; 278 return 0;
236 } 279 }
OLDNEW
« no previous file with comments | « media/base/yuv_convert_unittest.cc ('k') | remoting/base/decoder_vp8.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698