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

Unified 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « media/base/yuv_convert_unittest.cc ('k') | remoting/base/decoder_vp8.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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;
}
« 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