OLD | NEW |
1 // Copyright (c) 2012 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> |
(...skipping 106 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
117 std::vector<scoped_refptr<VideoFrame> > dest_frames; | 117 std::vector<scoped_refptr<VideoFrame> > dest_frames; |
118 | 118 |
119 for (int i = 0; i < num_buffers; i++) { | 119 for (int i = 0; i < num_buffers; i++) { |
120 source_frames.push_back( | 120 source_frames.push_back( |
121 VideoFrame::CreateBlackFrame(source_width, source_height)); | 121 VideoFrame::CreateBlackFrame(source_width, source_height)); |
122 | 122 |
123 dest_frames.push_back( | 123 dest_frames.push_back( |
124 VideoFrame::CreateFrame(VideoFrame::RGB32, | 124 VideoFrame::CreateFrame(VideoFrame::RGB32, |
125 dest_width, | 125 dest_width, |
126 dest_height, | 126 dest_height, |
| 127 gfx::Size(dest_width, dest_height), |
127 TimeDelta::FromSeconds(0))); | 128 TimeDelta::FromSeconds(0))); |
128 } | 129 } |
129 | 130 |
130 TimeTicks start = TimeTicks::HighResNow(); | 131 TimeTicks start = TimeTicks::HighResNow(); |
131 for (int i = 0; i < num_frames; i++) { | 132 for (int i = 0; i < num_frames; i++) { |
132 scoped_refptr<VideoFrame> source_frame = source_frames[i % num_buffers]; | 133 scoped_refptr<VideoFrame> source_frame = source_frames[i % num_buffers]; |
133 scoped_refptr<VideoFrame> dest_frame = dest_frames[i % num_buffers]; | 134 scoped_refptr<VideoFrame> dest_frame = dest_frames[i % num_buffers]; |
134 | 135 |
135 media::ScaleYUVToRGB32(source_frame->data(VideoFrame::kYPlane), | 136 media::ScaleYUVToRGB32(source_frame->data(VideoFrame::kYPlane), |
136 source_frame->data(VideoFrame::kUPlane), | 137 source_frame->data(VideoFrame::kUPlane), |
(...skipping 19 matching lines...) Expand all Loading... |
156 std::vector<scoped_refptr<VideoFrame> > dest_frames; | 157 std::vector<scoped_refptr<VideoFrame> > dest_frames; |
157 | 158 |
158 for (int i = 0; i < num_buffers; i++) { | 159 for (int i = 0; i < num_buffers; i++) { |
159 source_frames.push_back( | 160 source_frames.push_back( |
160 VideoFrame::CreateBlackFrame(source_width, source_height)); | 161 VideoFrame::CreateBlackFrame(source_width, source_height)); |
161 | 162 |
162 dest_frames.push_back( | 163 dest_frames.push_back( |
163 VideoFrame::CreateFrame(VideoFrame::RGB32, | 164 VideoFrame::CreateFrame(VideoFrame::RGB32, |
164 dest_width, | 165 dest_width, |
165 dest_height, | 166 dest_height, |
| 167 gfx::Size(dest_width, dest_height), |
166 TimeDelta::FromSeconds(0))); | 168 TimeDelta::FromSeconds(0))); |
167 } | 169 } |
168 | 170 |
169 TimeTicks start = TimeTicks::HighResNow(); | 171 TimeTicks start = TimeTicks::HighResNow(); |
170 for (int i = 0; i < num_frames; i++) { | 172 for (int i = 0; i < num_frames; i++) { |
171 scoped_refptr<VideoFrame> source_frame = source_frames[i % num_buffers]; | 173 scoped_refptr<VideoFrame> source_frame = source_frames[i % num_buffers]; |
172 scoped_refptr<VideoFrame> dest_frame = dest_frames[i % num_buffers]; | 174 scoped_refptr<VideoFrame> dest_frame = dest_frames[i % num_buffers]; |
173 | 175 |
174 media::ScaleYUVToRGB32WithRect( | 176 media::ScaleYUVToRGB32WithRect( |
175 source_frame->data(VideoFrame::kYPlane), | 177 source_frame->data(VideoFrame::kYPlane), |
(...skipping 92 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
268 std::cout << "Bilinear Horizontal: " | 270 std::cout << "Bilinear Horizontal: " |
269 << BenchmarkFilter(media::FILTER_BILINEAR_H) | 271 << BenchmarkFilter(media::FILTER_BILINEAR_H) |
270 << "ms/frame" << std::endl; | 272 << "ms/frame" << std::endl; |
271 std::cout << "Bilinear: " << BenchmarkFilter(media::FILTER_BILINEAR) | 273 std::cout << "Bilinear: " << BenchmarkFilter(media::FILTER_BILINEAR) |
272 << "ms/frame" << std::endl; | 274 << "ms/frame" << std::endl; |
273 std::cout << "Bilinear with rect: " << BenchmarkScaleWithRect() | 275 std::cout << "Bilinear with rect: " << BenchmarkScaleWithRect() |
274 << "ms/frame" << std::endl; | 276 << "ms/frame" << std::endl; |
275 | 277 |
276 return 0; | 278 return 0; |
277 } | 279 } |
OLD | NEW |