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

Unified Diff: bench/CodecSubsetBench.h

Issue 1160953002: Subset decoding benchmarks (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Created 5 years, 7 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | bench/CodecSubsetBench.cpp » ('j') | bench/CodecSubsetBench.cpp » ('J')
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: bench/CodecSubsetBench.h
diff --git a/bench/CodecSubsetBench.h b/bench/CodecSubsetBench.h
new file mode 100644
index 0000000000000000000000000000000000000000..2d49a4ee4c36c0b80c48bcd4a353987978c760ac
--- /dev/null
+++ b/bench/CodecSubsetBench.h
@@ -0,0 +1,69 @@
+/*
+ * Copyright 2015 Google Inc.
+ *
+ * Use of this source code is governed by a BSD-style license that can be
+ * found in the LICENSE file.
+ */
+
+#include "Benchmark.h"
+#include "SkImageDecoder.h"
+#include "SkImageInfo.h"
+#include "SkStream.h"
+#include "SkString.h"
+
+/*
+ *
+ * This benchmark is designed to test the performance of subset decoding.
+ *
+ */
+class CodecSubsetBench : public Benchmark {
+public:
+
+ // Defines the style of the subset decoding benchmark.
+ enum SubsetMode {
+ // Use an input width, height, left, and top to decode a single subset.
+ // Must specify: subsetWidth, subsetHeight, offsetLeft, offsetTop
scroggo 2015/05/29 15:36:03 It might be clearer to have different constructors
msarett 2015/06/01 14:03:25 I am splitting the benchmark into separate subclas
+ kSingle_SubsetMode,
+
+ // Use a divisor to decode the entire image in a grid of divisor x divisor blocks.
+ // Must specify: divisor
+ kDivisor_SubsetMode,
+
+ // Use input dimensions to decode the entire image where each block is susbetW x subsetH.
+ // Must specify: subsetWidth, subsetHeight
+ kTranslate_SubsetMode,
+
+ // Choose subsets to mimic a user zooming out on a photo
scroggo 2015/05/29 15:36:03 nit: zooming in* ?
msarett 2015/06/01 14:03:25 It mimics zooming out. The subsets get bigger eac
+ // Must specify: subsetWidth, subsetHeight
+ kScale_SubsetMode
+ };
+
+ CodecSubsetBench(SkString* path,
+ SubsetMode subsetMode,
+ SkColorType colorType,
+ uint32_t subsetWidth,
+ uint32_t subsetHeight,
+ uint32_t offsetLeft,
+ uint32_t offsetTop,
+ uint32_t divisor,
+ bool useCodec);
+
+protected:
+ const char* onGetName() override;
+ bool isSuitableFor(Backend backend) override;
+ void onDraw(const int n, SkCanvas* canvas) override;
+
+private:
+
+ SkString fName;
+ SubsetMode fSubsetMode;
+ SkColorType fColorType;
+ const uint32_t fSubsetWidth;
+ const uint32_t fSubsetHeight;
+ const uint32_t fOffsetLeft;
+ const uint32_t fOffsetTop;
+ const uint32_t fDivisor;
+ const bool fUseCodec;
+ SkAutoTDelete<SkMemoryStream> fStream;
+ typedef Benchmark INHERITED;
+};
« no previous file with comments | « no previous file | bench/CodecSubsetBench.cpp » ('j') | bench/CodecSubsetBench.cpp » ('J')

Powered by Google App Engine
This is Rietveld 408576698