skia2/bench
scroggo@google.com 8d2392487c Add an option on SkImageDecoder to skip writing 0s.
Only implemented for PNG.

Add a getter and setter, and sets the default to false in the
constructor. Also copies the setting in copyFieldsToOther.

Fix an indpendent bug where fDitherImage was not being copied in
copyFieldsToOther.

In SkScaledBitmapSampler::begin, consolidate the settings passed in
by passing a const reference to the decoder. The decoder can be
referenced for its settings of dither, unpremultiplied, and now
skipping writing zeroes. Update callers to use the new API. In png
decoder, rather than passing around a pointer to an initial
read of getDitherImage, and potentially changing it, look at the
field on the decoder itself, and modify it directly. This is a
change in behavior - now if that same decoder is used to decode
a different image, the dither setting has changed. I think this is
okay because A) the typical use case is to use a new decoder for
each decode, B) we do not make any promises that a decode does not
change the decoder and C) it makes the code in SkScaledBitmapSampler
much cleaner.

In SkScaledBitmapScampler, add new row procs for skipping zeroes. Now
that choosing the row proc has five dimensions (src config, dst config,
dither, skip writing zeroes, unpremultiplied), use a new method: each
src/dst combination has a function for choosing the right proc depending
on the decoder.

SkScaledBitmapScampler::RowProc is now public for convenience.

Remove Sample_Gray_D8888_Unpremul, which is effectively no different
from Sample_Gray_D8888.

In cases where unpremultiplied was trivial, such as 565 and when
sampling from gray, decoding may now succeed.

Add a benchmark (currently disabled) for comparing the speed of skipping
writing zeroes versus not skipping. For this particular image, which is
mostly transparent pixels, normal decoding took about 3.6 milliseconds,
while skipping zeroes in the decode took only about 2.5 milliseconds
(this is on a Nexus 4). Presumably it would be slower on an image
with a small amount of transparency, but there will be no slowdown
for an image which reports that it has no transparency.

In SkImageRef_ashmem, always skip writing zeroes, since ashmem
memory is guaranteed to be initialized to 0.

Add a flag to skip writing zeroes in skimage.

Add a regression test for choosing the rowproc to ensure I did not
change any behavior accidentally.

BUG=skia:1661
R=reed@google.com

Review URL: https://codereview.chromium.org/24269006

git-svn-id: http://skia.googlecode.com/svn/trunk@11558 2bbb7eff-a529-9590-31e7-b0007b416f81
2013-10-01 17:27:15 +00:00
..
BenchTool/BenchTool.xcodeproj move main.cpp outside of the xcode project 2009-01-07 11:49:19 +00:00
AAClipBench.cpp Sanitizing source files in Housekeeper-Nightly 2013-09-17 07:01:20 +00:00
bench_analyze.py Adds a script to help analyze bench ranges to add/change in bench/bench_expectations.txt 2012-10-05 14:02:33 +00:00
bench_compare.py bench_compare proper spacing and tab option. 2013-01-30 19:22:51 +00:00
bench_expectations_Perf-Android-Nexus7-Tegra3-Arm7-Release.txt Splits bench_expectations into per-bot files in preparation for growth. 2013-09-17 17:21:02 +00:00
bench_expectations_Perf-Ubuntu12-ShuttleA-ATI5770-x86-Release.txt Splits bench_expectations into per-bot files in preparation for growth. 2013-09-17 17:21:02 +00:00
bench_expectations_Perf-Win7-ShuttleA-HD2000-x86-Release.txt Splits bench_expectations into per-bot files in preparation for growth. 2013-09-17 17:21:02 +00:00
bench_graph_svg.py Deletes bench_expectations.txt and change comments to refer to the new per-bot expectation files. 2013-09-25 20:51:16 +00:00
bench_util.py bench_util: allow optional whitespace in CSV format 2013-08-13 15:12:33 +00:00
BenchGpuTimer_gl.cpp Split GrGLContextInfo into GrGLContext & GrGLContextInfo 2013-02-28 20:16:25 +00:00
BenchGpuTimer_gl.h Split GrGLContextInfo into GrGLContext & GrGLContextInfo 2013-02-28 20:16:25 +00:00
benchmain.cpp Bench baseline for mostly 0 image. 2013-09-25 21:42:12 +00:00
BenchSysTimer_c.cpp Automatic update of all copyright notices to reflect new license terms. 2011-07-28 14:26:00 +00:00
BenchSysTimer_c.h Convert #warning to comment to get iOS compiling 2013-03-28 13:43:16 +00:00
BenchSysTimer_mach.cpp Result of running tools/sanitize_source_files.py (which was added in https://codereview.appspot.com/6465078/) 2012-08-23 18:09:54 +00:00
BenchSysTimer_mach.h Automatic update of all copyright notices to reflect new license terms. 2011-07-28 14:26:00 +00:00
BenchSysTimer_posix.cpp Automatic update of all copyright notices to reflect new license terms. 2011-07-28 14:26:00 +00:00
BenchSysTimer_posix.h Sanitizing source files in Skia_Periodic_House_Keeping 2013-01-26 07:06:02 +00:00
BenchSysTimer_windows.cpp Result of running tools/sanitize_source_files.py (which was added in https://codereview.appspot.com/6465078/) 2012-08-23 18:09:54 +00:00
BenchSysTimer_windows.h Fix two warnings in bench timers. 2011-10-03 20:44:39 +00:00
BenchTimer.cpp extend SkBenchmark to allow a bench to return a durationScale, which allows it to perform fewer actual interations, but report a scale factor to account for that. Thus a very slow bench can be compared head-to-head with a faster one, w/o actually forcing the tool to run for the full duration of the slower test. 2013-05-29 15:39:54 +00:00
BenchTimer.h extend SkBenchmark to allow a bench to return a durationScale, which allows it to perform fewer actual interations, but report a scale factor to account for that. Thus a very slow bench can be compared head-to-head with a faster one, w/o actually forcing the tool to run for the full duration of the slower test. 2013-05-29 15:39:54 +00:00
BicubicBench.cpp Refactoring: get rid of the SkBenchmark void* parameter. 2013-09-13 19:52:27 +00:00
BitmapBench.cpp Refactoring: get rid of the SkBenchmark void* parameter. 2013-09-13 19:52:27 +00:00
BitmapRectBench.cpp Refactoring: get rid of the SkBenchmark void* parameter. 2013-09-13 19:52:27 +00:00
BitmapScaleBench.cpp Refactoring: get rid of the SkBenchmark void* parameter. 2013-09-13 19:52:27 +00:00
BlurBench.cpp Refactoring: get rid of the SkBenchmark void* parameter. 2013-09-13 19:52:27 +00:00
BlurImageFilterBench.cpp Refactoring: get rid of the SkBenchmark void* parameter. 2013-09-13 19:52:27 +00:00
BlurRectBench.cpp Refactoring: get rid of the SkBenchmark void* parameter. 2013-09-13 19:52:27 +00:00
ChartBench.cpp Remove uses of unnamed namespace in bench/ directory. 2013-09-26 19:23:03 +00:00
ChecksumBench.cpp Refactoring: get rid of the SkBenchmark void* parameter. 2013-09-13 19:52:27 +00:00
ChromeBench.cpp Refactoring: get rid of the SkBenchmark void* parameter. 2013-09-13 19:52:27 +00:00
CmapBench.cpp Refactoring: get rid of the SkBenchmark void* parameter. 2013-09-13 19:52:27 +00:00
ColorFilterBench.cpp Refactoring: get rid of the SkBenchmark void* parameter. 2013-09-13 19:52:27 +00:00
DashBench.cpp Refactoring: get rid of the SkBenchmark void* parameter. 2013-09-13 19:52:27 +00:00
DecodeBench.cpp Refactoring: get rid of the SkBenchmark void* parameter. 2013-09-13 19:52:27 +00:00
DeferredCanvasBench.cpp It looks like we're not always running long enough to give the GPU counters time to converge (and possibly the same for CPU too, but GPU is definitely worse off). 2013-09-13 20:11:09 +00:00
DeferredSurfaceCopyBench.cpp promote SkImage::AlphaType to SkAlphaType 2013-09-20 19:33:52 +00:00
DisplacementBench.cpp Refactoring: get rid of the SkBenchmark void* parameter. 2013-09-13 19:52:27 +00:00
FontCacheBench.cpp Refactoring: get rid of the SkBenchmark void* parameter. 2013-09-13 19:52:27 +00:00
FontScalerBench.cpp Refactoring: get rid of the SkBenchmark void* parameter. 2013-09-13 19:52:27 +00:00
FSRectBench.cpp Refactoring: get rid of the SkBenchmark void* parameter. 2013-09-13 19:52:27 +00:00
GameBench.cpp Refactoring: get rid of the SkBenchmark void* parameter. 2013-09-13 19:52:27 +00:00
gen_bench_ranges.py Deletes bench_expectations.txt and change comments to refer to the new per-bot expectation files. 2013-09-25 20:51:16 +00:00
GradientBench.cpp Add 3 color variant to gradient bench, include scale in name, add more benchs 2013-09-30 19:41:09 +00:00
GrMemoryPoolBench.cpp Remove uses of unnamed namespace in bench/ directory. 2013-09-26 19:23:03 +00:00
gUniqueGlyphIDs.h switch array to uint16_t to fix overflows 2013-06-11 19:53:19 +00:00
HairlinePathBench.cpp Refactoring: get rid of the SkBenchmark void* parameter. 2013-09-13 19:52:27 +00:00
ImageCacheBench.cpp Refactoring: get rid of the SkBenchmark void* parameter. 2013-09-13 19:52:27 +00:00
ImageDecodeBench.cpp Refactoring: get rid of the SkBenchmark void* parameter. 2013-09-13 19:52:27 +00:00
InterpBench.cpp Refactoring: get rid of the SkBenchmark void* parameter. 2013-09-13 19:52:27 +00:00
LightingBench.cpp Refactoring: get rid of the SkBenchmark void* parameter. 2013-09-13 19:52:27 +00:00
LineBench.cpp Refactoring: get rid of the SkBenchmark void* parameter. 2013-09-13 19:52:27 +00:00
MagnifierBench.cpp Refactoring: get rid of the SkBenchmark void* parameter. 2013-09-13 19:52:27 +00:00
MathBench.cpp Fix asan build. Duh, don't return a stack address... 2013-09-27 13:39:14 +00:00
Matrix44Bench.cpp Refactoring: get rid of the SkBenchmark void* parameter. 2013-09-13 19:52:27 +00:00
MatrixBench.cpp Refactoring: get rid of the SkBenchmark void* parameter. 2013-09-13 19:52:27 +00:00
MatrixConvolutionBench.cpp Refactoring: get rid of the SkBenchmark void* parameter. 2013-09-13 19:52:27 +00:00
MemoryBench.cpp Add sk_calloc. Remove SkMemory_stdlib, which seems unused. 2013-09-20 14:31:45 +00:00
MemsetBench.cpp Refactoring: get rid of the SkBenchmark void* parameter. 2013-09-13 19:52:27 +00:00
MergeBench.cpp Refactoring: get rid of the SkBenchmark void* parameter. 2013-09-13 19:52:27 +00:00
MorphologyBench.cpp Remove uses of unnamed namespace in bench/ directory. 2013-09-26 19:23:03 +00:00
MutexBench.cpp Refactoring: get rid of the SkBenchmark void* parameter. 2013-09-13 19:52:27 +00:00
PathBench.cpp Refactoring: get rid of the SkBenchmark void* parameter. 2013-09-13 19:52:27 +00:00
PathIterBench.cpp Refactoring: get rid of the SkBenchmark void* parameter. 2013-09-13 19:52:27 +00:00
PathUtilsBench.cpp Refactoring: get rid of the SkBenchmark void* parameter. 2013-09-13 19:52:27 +00:00
PerlinNoiseBench.cpp Refactoring: get rid of the SkBenchmark void* parameter. 2013-09-13 19:52:27 +00:00
PicturePlaybackBench.cpp Refactoring: get rid of the SkBenchmark void* parameter. 2013-09-13 19:52:27 +00:00
PictureRecordBench.cpp also limit loops-per-canvas in picture_record_dictionaries, which has the same problem as unique_paint 2013-09-17 18:58:53 +00:00
PremulAndUnpremulAlphaOpsBench.cpp Refactoring: get rid of the SkBenchmark void* parameter. 2013-09-13 19:52:27 +00:00
ReadPixBench.cpp Refactoring: get rid of the SkBenchmark void* parameter. 2013-09-13 19:52:27 +00:00
RectBench.cpp Refactoring: get rid of the SkBenchmark void* parameter. 2013-09-13 19:52:27 +00:00
RectoriBench.cpp Refactoring: get rid of the SkBenchmark void* parameter. 2013-09-13 19:52:27 +00:00
RefCntBench.cpp Refactoring: get rid of the SkBenchmark void* parameter. 2013-09-13 19:52:27 +00:00
RegionBench.cpp Refactoring: get rid of the SkBenchmark void* parameter. 2013-09-13 19:52:27 +00:00
RegionContainBench.cpp Refactoring: get rid of the SkBenchmark void* parameter. 2013-09-13 19:52:27 +00:00
RepeatTileBench.cpp Refactoring: get rid of the SkBenchmark void* parameter. 2013-09-13 19:52:27 +00:00
RTreeBench.cpp Refactoring: get rid of the SkBenchmark void* parameter. 2013-09-13 19:52:27 +00:00
ScalarBench.cpp Refactoring: get rid of the SkBenchmark void* parameter. 2013-09-13 19:52:27 +00:00
ShaderMaskBench.cpp Refactoring: get rid of the SkBenchmark void* parameter. 2013-09-13 19:52:27 +00:00
SkBenchLogger.cpp Report data from bench_pictures in the same fashion as bench. 2012-09-07 15:21:18 +00:00
SkBenchLogger.h Report data from bench_pictures in the same fashion as bench. 2012-09-07 15:21:18 +00:00
SkBenchmark.cpp Bench baseline for mostly 0 image. 2013-09-25 21:42:12 +00:00
SkBenchmark.h Bench baseline for mostly 0 image. 2013-09-25 21:42:12 +00:00
SkipZeroesBench.cpp Add an option on SkImageDecoder to skip writing 0s. 2013-10-01 17:27:15 +00:00
SortBench.cpp 1) Don't allocate 100,000 ints when we only need 1,000. 2013-09-17 19:37:34 +00:00
StrokeBench.cpp Refactoring: get rid of the SkBenchmark void* parameter. 2013-09-13 19:52:27 +00:00
TableBench.cpp Refactoring: get rid of the SkBenchmark void* parameter. 2013-09-13 19:52:27 +00:00
TextBench.cpp Refactoring: get rid of the SkBenchmark void* parameter. 2013-09-13 19:52:27 +00:00
tile_analyze.py Script to plot tile vs. viewport comparison for given platform and revision. 2013-02-13 23:22:29 +00:00
TileBench.cpp Refactoring: get rid of the SkBenchmark void* parameter. 2013-09-13 19:52:27 +00:00
TimerData.cpp Committed: http://code.google.com/p/skia/source/detail?r=10372 2013-07-31 20:00:56 +00:00
TimerData.h Committed: http://code.google.com/p/skia/source/detail?r=10372 2013-07-31 20:00:56 +00:00
VertBench.cpp Refactoring: get rid of the SkBenchmark void* parameter. 2013-09-13 19:52:27 +00:00
WritePixelsBench.cpp Refactoring: get rid of the SkBenchmark void* parameter. 2013-09-13 19:52:27 +00:00
WriterBench.cpp Refactoring: get rid of the SkBenchmark void* parameter. 2013-09-13 19:52:27 +00:00
XfermodeBench.cpp [External patch] Source-over support for SkLumaXfermode. 2013-09-17 13:09:16 +00:00