diff options
author | 2015-06-17 10:28:22 -0700 | |
---|---|---|
committer | 2015-06-17 10:28:22 -0700 | |
commit | ab80e35fbddd5b534b486cf9d331b5da00e5aa4f (patch) | |
tree | 24bf58b4f90f5911bc3a5d611ccc4de7fb2950ac /bench/nanobench.cpp | |
parent | 6b7f34e34cc0ce397ce5e4ddc0c244f372b4f840 (diff) |
Improved subset benchmarks
I think these changes to the subset benchmarks cover what we discussed yesterday.
I removed the divisor benchmarks (2x2, 3x3) and changed the single subset benchmarks.
Also, we will no longer benchmark subset decodes on small images.
BUG=skia:
Review URL: https://codereview.chromium.org/1188223002
Diffstat (limited to 'bench/nanobench.cpp')
-rw-r--r-- | bench/nanobench.cpp | 43 |
1 files changed, 24 insertions, 19 deletions
diff --git a/bench/nanobench.cpp b/bench/nanobench.cpp index b2b36fa6c7..65d9216e35 100644 --- a/bench/nanobench.cpp +++ b/bench/nanobench.cpp @@ -20,7 +20,6 @@ #include "SKPAnimationBench.h" #include "SKPBench.h" #include "SubsetBenchPriv.h" -#include "SubsetDivisorBench.h" #include "SubsetSingleBench.h" #include "SubsetTranslateBench.h" #include "SubsetZoomBench.h" @@ -496,6 +495,7 @@ static bool valid_subset_bench(const SkString& path, SkColorType colorType, bool SkAutoTUnref<SkData> encoded(SkData::NewFromFileName(path.c_str())); SkAutoTDelete<SkMemoryStream> stream(new SkMemoryStream(encoded)); + // Check that we can create a codec or image decoder. if (useCodec) { SkAutoTDelete<SkCodec> codec(SkCodec::NewFromStream(stream.detach())); if (NULL == codec) { @@ -535,6 +535,13 @@ static bool valid_subset_bench(const SkString& path, SkColorType colorType, bool return false; } } + + // Check if the image is large enough for a meaningful subset benchmark. + if (*width <= 512 && *height <= 512) { + // This should not print a message since it is not an error. + return false; + } + return true; } @@ -812,21 +819,20 @@ public: if (valid_subset_bench(path, colorType, useCodec, &width, &height)) { switch (currentSubsetType) { case kTopLeft_SubsetType: - return new SubsetSingleBench(path, colorType, width/2, - height/2, 0, 0, useCodec); + return new SubsetSingleBench(path, colorType, width/3, + height/3, 0, 0, useCodec); case kTopRight_SubsetType: - return new SubsetSingleBench(path, colorType, width/2, - height/2, width/2, 0, useCodec); + return new SubsetSingleBench(path, colorType, width/3, + height/3, 2*width/3, 0, useCodec); + case kMiddle_SubsetType: + return new SubsetSingleBench(path, colorType, width/3, + height/3, width/3, height/3, useCodec); case kBottomLeft_SubsetType: - return new SubsetSingleBench(path, colorType, width/2, - height/2, 0, height/2, useCodec); + return new SubsetSingleBench(path, colorType, width/3, + height/3, 0, 2*height/3, useCodec); case kBottomRight_SubsetType: - return new SubsetSingleBench(path, colorType, width/2, - height/2, width/2, height/2, useCodec); - case k2x2_SubsetType: - return new SubsetDivisorBench(path, colorType, 2, useCodec); - case k3x3_SubsetType: - return new SubsetDivisorBench(path, colorType, 3, useCodec); + return new SubsetSingleBench(path, colorType, width/3, + height/3, 2*width/3, 2*height/3, useCodec); case kTranslate_SubsetType: return new SubsetTranslateBench(path, colorType, 512, 512, useCodec); @@ -874,12 +880,11 @@ private: enum SubsetType { kTopLeft_SubsetType = 0, kTopRight_SubsetType = 1, - kBottomLeft_SubsetType = 2, - kBottomRight_SubsetType = 3, - k2x2_SubsetType = 4, - k3x3_SubsetType = 5, - kTranslate_SubsetType = 6, - kZoom_SubsetType = 7, + kMiddle_SubsetType = 2, + kBottomLeft_SubsetType = 3, + kBottomRight_SubsetType = 4, + kTranslate_SubsetType = 5, + kZoom_SubsetType = 6, kLast_SubsetType = kZoom_SubsetType }; |