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

Side by Side Diff: bench/MatrixConvolutionBench.cpp

Issue 1886523002: distinguish distinct matrixconvolution benchmarks (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: invert Created 4 years, 8 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
« no previous file with comments | « no previous file | 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 /* 1 /*
2 * Copyright 2012 Google Inc. 2 * Copyright 2012 Google Inc.
3 * 3 *
4 * Use of this source code is governed by a BSD-style license that can be 4 * Use of this source code is governed by a BSD-style license that can be
5 * found in the LICENSE file. 5 * found in the LICENSE file.
6 */ 6 */
7 #include "Benchmark.h" 7 #include "Benchmark.h"
8 #include "SkCanvas.h" 8 #include "SkCanvas.h"
9 #include "SkMatrixConvolutionImageFilter.h" 9 #include "SkMatrixConvolutionImageFilter.h"
10 #include "SkPaint.h" 10 #include "SkPaint.h"
11 #include "SkRandom.h" 11 #include "SkRandom.h"
12 #include "SkString.h" 12 #include "SkString.h"
13 13
14 static const char* name(SkMatrixConvolutionImageFilter::TileMode mode) {
15 switch (mode) {
16 case SkMatrixConvolutionImageFilter::kClamp_TileMode: return "cla mp";
17 case SkMatrixConvolutionImageFilter::kRepeat_TileMode: return "rep eat";
18 case SkMatrixConvolutionImageFilter::kClampToBlack_TileMode: return "cla mpToBlack";
19 }
20 return "oops";
21 }
22
14 class MatrixConvolutionBench : public Benchmark { 23 class MatrixConvolutionBench : public Benchmark {
15 public: 24 public:
16 MatrixConvolutionBench(SkMatrixConvolutionImageFilter::TileMode tileMode, bo ol convolveAlpha) 25 MatrixConvolutionBench(SkMatrixConvolutionImageFilter::TileMode tileMode, bo ol convolveAlpha)
17 : fName("matrixconvolution") { 26 : fName(SkStringPrintf("matrixconvolution_%s%s",
27 name(tileMode),
28 convolveAlpha ? "" : "_noConvolveAlpha")) {
18 SkISize kernelSize = SkISize::Make(3, 3); 29 SkISize kernelSize = SkISize::Make(3, 3);
19 SkScalar kernel[9] = { 30 SkScalar kernel[9] = {
20 SkIntToScalar( 1), SkIntToScalar( 1), SkIntToScalar( 1), 31 SkIntToScalar( 1), SkIntToScalar( 1), SkIntToScalar( 1),
21 SkIntToScalar( 1), SkIntToScalar(-7), SkIntToScalar( 1), 32 SkIntToScalar( 1), SkIntToScalar(-7), SkIntToScalar( 1),
22 SkIntToScalar( 1), SkIntToScalar( 1), SkIntToScalar( 1), 33 SkIntToScalar( 1), SkIntToScalar( 1), SkIntToScalar( 1),
23 }; 34 };
24 SkScalar gain = 0.3f, bias = SkIntToScalar(100); 35 SkScalar gain = 0.3f, bias = SkIntToScalar(100);
25 SkIPoint kernelOffset = SkIPoint::Make(1, 1); 36 SkIPoint kernelOffset = SkIPoint::Make(1, 1);
26 fFilter = SkMatrixConvolutionImageFilter::Make(kernelSize, kernel, gain, bias, 37 fFilter = SkMatrixConvolutionImageFilter::Make(kernelSize, kernel, gain, bias,
27 kernelOffset, tileMode, c onvolveAlpha, 38 kernelOffset, tileMode, c onvolveAlpha,
28 nullptr); 39 nullptr);
29 } 40 }
30 41
31 protected: 42 protected:
32 virtual const char* onGetName() { 43 virtual const char* onGetName() {
33 return fName.c_str(); 44 return fName.c_str();
34 } 45 }
35 46
36 virtual void onDraw(int loops, SkCanvas* canvas) { 47 virtual void onDraw(int loops, SkCanvas* canvas) {
(...skipping 13 matching lines...) Expand all
50 sk_sp<SkImageFilter> fFilter; 61 sk_sp<SkImageFilter> fFilter;
51 SkString fName; 62 SkString fName;
52 63
53 typedef Benchmark INHERITED; 64 typedef Benchmark INHERITED;
54 }; 65 };
55 66
56 DEF_BENCH( return new MatrixConvolutionBench(SkMatrixConvolutionImageFilter::kCl amp_TileMode, true); ) 67 DEF_BENCH( return new MatrixConvolutionBench(SkMatrixConvolutionImageFilter::kCl amp_TileMode, true); )
57 DEF_BENCH( return new MatrixConvolutionBench(SkMatrixConvolutionImageFilter::kRe peat_TileMode, true); ) 68 DEF_BENCH( return new MatrixConvolutionBench(SkMatrixConvolutionImageFilter::kRe peat_TileMode, true); )
58 DEF_BENCH( return new MatrixConvolutionBench(SkMatrixConvolutionImageFilter::kCl ampToBlack_TileMode, true); ) 69 DEF_BENCH( return new MatrixConvolutionBench(SkMatrixConvolutionImageFilter::kCl ampToBlack_TileMode, true); )
59 DEF_BENCH( return new MatrixConvolutionBench(SkMatrixConvolutionImageFilter::kCl ampToBlack_TileMode, false); ) 70 DEF_BENCH( return new MatrixConvolutionBench(SkMatrixConvolutionImageFilter::kCl ampToBlack_TileMode, false); )
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698