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

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

Issue 10939010: Cleanup: avoid foo ? true : false, part 1. (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: rebase Created 8 years, 2 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
« no previous file with comments | « media/video/capture/win/video_capture_device_win.cc ('k') | ui/base/win/ime_input.cc » ('j') | 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) 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 #include <string.h> 5 #include <string.h>
6 #include <time.h> 6 #include <time.h>
7 #include <vector> 7 #include <vector>
8 8
9 #include "base/basictypes.h" 9 #include "base/basictypes.h"
10 #include "base/logging.h" 10 #include "base/logging.h"
(...skipping 257 matching lines...) Expand 10 before | Expand all | Expand 10 after
268 for (int alpha = 0; alpha < 2; alpha++) { 268 for (int alpha = 0; alpha < 2; alpha++) {
269 // Convolve using C code. 269 // Convolve using C code.
270 base::TimeTicks resize_start; 270 base::TimeTicks resize_start;
271 base::TimeDelta delta_c, delta_sse; 271 base::TimeDelta delta_c, delta_sse;
272 unsigned char* r1 = static_cast<unsigned char*>(result_c.getPixels()); 272 unsigned char* r1 = static_cast<unsigned char*>(result_c.getPixels());
273 unsigned char* r2 = static_cast<unsigned char*>(result_sse.getPixels()); 273 unsigned char* r2 = static_cast<unsigned char*>(result_sse.getPixels());
274 274
275 resize_start = base::TimeTicks::Now(); 275 resize_start = base::TimeTicks::Now();
276 BGRAConvolve2D(static_cast<const uint8*>(source.getPixels()), 276 BGRAConvolve2D(static_cast<const uint8*>(source.getPixels()),
277 static_cast<int>(source.rowBytes()), 277 static_cast<int>(source.rowBytes()),
278 alpha ? true : false, x_filter, y_filter, 278 (alpha != 0), x_filter, y_filter,
279 static_cast<int>(result_c.rowBytes()), r1, false); 279 static_cast<int>(result_c.rowBytes()), r1, false);
280 delta_c = base::TimeTicks::Now() - resize_start; 280 delta_c = base::TimeTicks::Now() - resize_start;
281 281
282 resize_start = base::TimeTicks::Now(); 282 resize_start = base::TimeTicks::Now();
283 // Convolve using SSE2 code 283 // Convolve using SSE2 code
284 BGRAConvolve2D(static_cast<const uint8*>(source.getPixels()), 284 BGRAConvolve2D(static_cast<const uint8*>(source.getPixels()),
285 static_cast<int>(source.rowBytes()), 285 static_cast<int>(source.rowBytes()),
286 alpha ? true : false, x_filter, y_filter, 286 (alpha != 0), x_filter, y_filter,
287 static_cast<int>(result_sse.rowBytes()), r2, true); 287 static_cast<int>(result_sse.rowBytes()), r2, true);
288 delta_sse = base::TimeTicks::Now() - resize_start; 288 delta_sse = base::TimeTicks::Now() - resize_start;
289 289
290 // Unfortunately I could not enable the performance check now. 290 // Unfortunately I could not enable the performance check now.
291 // Most bots use debug version, and there are great difference between 291 // Most bots use debug version, and there are great difference between
292 // the code generation for intrinsic, etc. In release version speed 292 // the code generation for intrinsic, etc. In release version speed
293 // difference was 150%-200% depend on alpha channel presence; 293 // difference was 150%-200% depend on alpha channel presence;
294 // while in debug version speed difference was 96%-120%. 294 // while in debug version speed difference was 96%-120%.
295 // TODO(jiesun): optimize further until we could enable this for 295 // TODO(jiesun): optimize further until we could enable this for
296 // debug version too. 296 // debug version too.
(...skipping 15 matching lines...) Expand all
312 r1 += result_c.rowBytes(); 312 r1 += result_c.rowBytes();
313 r2 += result_sse.rowBytes(); 313 r2 += result_sse.rowBytes();
314 } 314 }
315 } 315 }
316 } 316 }
317 } 317 }
318 #endif 318 #endif
319 } 319 }
320 320
321 } // namespace skia 321 } // namespace skia
OLDNEW
« no previous file with comments | « media/video/capture/win/video_capture_device_win.cc ('k') | ui/base/win/ime_input.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698