| Index: media/tools/scaler_bench/scaler_bench.cc
|
| ===================================================================
|
| --- media/tools/scaler_bench/scaler_bench.cc (revision 118600)
|
| +++ media/tools/scaler_bench/scaler_bench.cc (working copy)
|
| @@ -1,4 +1,4 @@
|
| -// Copyright (c) 2011 The Chromium Authors. All rights reserved.
|
| +// Copyright (c) 2012 The Chromium Authors. All rights reserved.
|
| // Use of this source code is governed by a BSD-style license that can be
|
| // found in the LICENSE file.
|
|
|
| @@ -152,6 +152,47 @@
|
| return static_cast<double>((end - start).InMilliseconds()) / num_frames;
|
| }
|
|
|
| +static double BenchmarkScaleWithRect() {
|
| + std::vector<scoped_refptr<VideoFrame> > source_frames;
|
| + std::vector<scoped_refptr<VideoFrame> > dest_frames;
|
| +
|
| + for (int i = 0; i < num_buffers; i++) {
|
| + source_frames.push_back(
|
| + VideoFrame::CreateBlackFrame(source_width, source_height));
|
| +
|
| + dest_frames.push_back(
|
| + VideoFrame::CreateFrame(VideoFrame::RGB32,
|
| + dest_width,
|
| + dest_height,
|
| + TimeDelta::FromSeconds(0),
|
| + TimeDelta::FromSeconds(0)));
|
| + }
|
| +
|
| + TimeTicks start = TimeTicks::HighResNow();
|
| + for (int i = 0; i < num_frames; i++) {
|
| + scoped_refptr<VideoFrame> source_frame = source_frames[i % num_buffers];
|
| + scoped_refptr<VideoFrame> dest_frame = dest_frames[i % num_buffers];
|
| +
|
| + media::ScaleYUVToRGB32WithRect(
|
| + source_frame->data(VideoFrame::kYPlane),
|
| + source_frame->data(VideoFrame::kUPlane),
|
| + source_frame->data(VideoFrame::kVPlane),
|
| + dest_frame->data(0),
|
| + source_width,
|
| + source_height,
|
| + dest_width,
|
| + dest_height,
|
| + 0, 0,
|
| + dest_width,
|
| + dest_height,
|
| + source_frame->stride(VideoFrame::kYPlane),
|
| + source_frame->stride(VideoFrame::kUPlane),
|
| + dest_frame->stride(0));
|
| + }
|
| + TimeTicks end = TimeTicks::HighResNow();
|
| + return static_cast<double>((end - start).InMilliseconds()) / num_frames;
|
| +}
|
| +
|
| int main(int argc, const char** argv) {
|
| CommandLine::Init(argc, argv);
|
| const CommandLine* cmd_line = CommandLine::ForCurrentProcess();
|
| @@ -231,6 +272,8 @@
|
| << "ms/frame" << std::endl;
|
| std::cout << "Bilinear: " << BenchmarkFilter(media::FILTER_BILINEAR)
|
| << "ms/frame" << std::endl;
|
| + std::cout << "Bilinear with rect: " << BenchmarkScaleWithRect()
|
| + << "ms/frame" << std::endl;
|
|
|
| return 0;
|
| }
|
|
|