| Index: media/tools/scaler_bench/scaler_bench.cc
|
| diff --git a/media/tools/scaler_bench/scaler_bench.cc b/media/tools/scaler_bench/scaler_bench.cc
|
| index aa8e227d5ec0cb00898abda358e81842cb30ff9b..af0e22e2610b2acfabccc8742b12f90dcaaaae54 100644
|
| --- a/media/tools/scaler_bench/scaler_bench.cc
|
| +++ b/media/tools/scaler_bench/scaler_bench.cc
|
| @@ -152,6 +152,47 @@ static double BenchmarkFilter(media::ScaleFilter filter) {
|
| 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 @@ int main(int argc, const char** argv) {
|
| << "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;
|
| }
|
|
|