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