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

Side by Side Diff: skia/ext/image_operations_bench.cc

Issue 6334070: SIMD implementation of Convolver for Lanczos filter etc. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: try to fix win Created 9 years, 10 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 unified diff | Download patch | Annotate | Revision Log
« skia/ext/image_operations.cc ('K') | « skia/ext/image_operations.cc ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 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 small program is used to measure the performance of the various 5 // This small program is used to measure the performance of the various
6 // resize algorithms offered by the ImageOperations::Resize function. 6 // resize algorithms offered by the ImageOperations::Resize function.
7 // It will generate an empty source bitmap, and rescale it to specified 7 // It will generate an empty source bitmap, and rescale it to specified
8 // dimensions. It will repeat this operation multiple time to get more accurate 8 // dimensions. It will repeat this operation multiple time to get more accurate
9 // average throughput. Because it uses elapsed time to do its math, it is only 9 // average throughput. Because it uses elapsed time to do its math, it is only
10 // accurate on an idle system (but that approach was deemed more accurate 10 // accurate on an idle system (but that approach was deemed more accurate
(...skipping 214 matching lines...) Expand 10 before | Expand all | Expand 10 after
225 } 225 }
226 return true; 226 return true;
227 } 227 }
228 228
229 // actual benchmark. 229 // actual benchmark.
230 bool Benchmark::Run() const { 230 bool Benchmark::Run() const {
231 SkBitmap source; 231 SkBitmap source;
232 source.setConfig(SkBitmap::kARGB_8888_Config, 232 source.setConfig(SkBitmap::kARGB_8888_Config,
233 source_.width(), source_.height()); 233 source_.width(), source_.height());
234 source.allocPixels(); 234 source.allocPixels();
235 source.eraseARGB(0, 0, 0, 0); 235
236 // Randomize the image for testing.
237 srand(time(0));
238 unsigned char* src_ptr = static_cast<unsigned char*>(source.getPixels());
239 for (int y = 0; y < source_.height(); y++) {
240 for (int x = 0; x < source_.width()*4; x++) {
evannier 2011/02/14 23:45:13 I am not much of a fan of the hard coded '4', but
fbarchard 2011/02/15 23:16:45 The width()*4 should also have a space. Maybe you
jiesun 2011/02/17 20:17:58 Done.
jiesun 2011/02/17 20:17:58 Done.
241 src_ptr[x] = rand() % 255;
242 }
243 src_ptr += source.rowBytes();
244 }
236 245
237 SkBitmap dest; 246 SkBitmap dest;
238 247
239 const base::TimeTicks start = base::TimeTicks::Now(); 248 const base::TimeTicks start = base::TimeTicks::Now();
240 249
241 for (int i = 0; i < num_iterations_; ++i) { 250 for (int i = 0; i < num_iterations_; ++i) {
242 dest = skia::ImageOperations::Resize(source, 251 dest = skia::ImageOperations::Resize(source,
243 method_, 252 method_,
244 dest_.width(), dest_.height()); 253 dest_.width(), dest_.height());
245 } 254 }
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after
284 return 1; 293 return 1;
285 } 294 }
286 295
287 if (!bench.Run()) { 296 if (!bench.Run()) {
288 printf("Failed to run benchmark\n"); 297 printf("Failed to run benchmark\n");
289 return 1; 298 return 1;
290 } 299 }
291 300
292 return 0; 301 return 0;
293 } 302 }
OLDNEW
« skia/ext/image_operations.cc ('K') | « skia/ext/image_operations.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698