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

Unified Diff: bench/nanobench.cpp

Issue 1387233002: Update Subset benches to support interlacing and fix bugs (Closed) Base URL: https://skia.googlesource.com/skia.git@limitScaled
Patch Set: Initialize colorCount before reading from it. Created 5 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | bench/subset/SubsetSingleBench.cpp » ('j') | bench/subset/SubsetTranslateBench.cpp » ('J')
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: bench/nanobench.cpp
diff --git a/bench/nanobench.cpp b/bench/nanobench.cpp
index 4ab6ca0b88c238aef127c644c3a3ec93e4ade075..b16fb13b57abe0a23ed5294b80a925b5a455293a 100644
--- a/bench/nanobench.cpp
+++ b/bench/nanobench.cpp
@@ -501,6 +501,27 @@ static Target* is_enabled(Benchmark* bench, const Config& config) {
}
/*
+ * We only run our subset benches on files that are supported by BitmapRegionDecoder:
+ * i.e. PNG, JPEG, and WEBP. We do *not* test WEBP when using codec, since we do not
+ * have a scanline decoder for WEBP, which is necessary for running the subset bench.
+ * (Another bench must be used to test WEBP, which decodes subsets natively.)
+ */
+static bool run_subset_bench(const SkString& path, bool useCodec) {
+ static const char* const exts[] = {
+ "jpg", "jpeg", "png",
+ "JPG", "JPEG", "PNG",
+ };
+
+ for (uint32_t i = 0; i < SK_ARRAY_COUNT(exts); i++) {
+ if (path.endsWith(exts[i])) {
+ return true;
+ }
+ }
+
+ return !useCodec && (path.endsWith("webp") || path.endsWith("WEBP"));
+}
+
+/*
* Returns true if set up for a subset decode succeeds, false otherwise
* If the set-up succeeds, the width and height parameters will be set
*/
@@ -872,8 +893,12 @@ public:
fSourceType = "image";
fBenchType = useCodec ? "skcodec" : "skimagedecoder";
while (fCurrentSubsetImage < fImages.count()) {
+ const SkString& path = fImages[fCurrentSubsetImage];
+ if (!run_subset_bench(path, useCodec)) {
+ fCurrentSubsetImage++;
+ continue;
+ }
while (fCurrentColorType < fColorTypes.count()) {
- const SkString& path = fImages[fCurrentSubsetImage];
SkColorType colorType = fColorTypes[fCurrentColorType];
while (fCurrentSubsetType <= kLast_SubsetType) {
int width = 0;
« no previous file with comments | « no previous file | bench/subset/SubsetSingleBench.cpp » ('j') | bench/subset/SubsetTranslateBench.cpp » ('J')

Powered by Google App Engine
This is Rietveld 408576698