History log of /external/skia/src/codec/SkSwizzler.cpp
Revision Date Author Comments (<<< Hide modified files) (Show modified files >>>)
9972c424ea5eaa2d78e06ae068abc86fd408e0e3 10-Feb-2016 msarett <msarett@google.com> Clean up comments in SkSwizzler

BUG=skia:
GOLD_TRYBOT_URL= https://gold.skia.org/search2?unt=true&query=source_type%3Dgm&master=false&issue=1690583002

Review URL: https://codereview.chromium.org/1690583002
/external/skia/src/codec/SkSwizzler.cpp
c5c322d8ecfc05718f9f04360956c4f1f9dc33c1 08-Feb-2016 msarett <msarett@google.com> Optimize CMYK->RGBA (BGRA) transform for jpeg decodes

Swizzle Bench Runtime
Nexus 6P 0.14x
Dell Venue 8 0.12x

CMYK Jpeg Decode Runtime
Nexus 6P 0.81x
Dell Venue 8 0.85x

BUG=skia:
GOLD_TRYBOT_URL= https://gold.skia.org/search2?unt=true&query=source_type%3Dgm&master=false&issue=1676773003
CQ_EXTRA_TRYBOTS=client.skia:Test-Ubuntu-GCC-GCE-CPU-AVX2-x86_64-Release-SKNX_NO_SIMD-Trybot

Review URL: https://codereview.chromium.org/1676773003
/external/skia/src/codec/SkSwizzler.cpp
1e06079b259d1091b735492b2f71d9897c14c608 03-Feb-2016 msarett <msarett@google.com> NEON optimizations for GrayAlpha -> RGBA/BGRA Premul/Unpremul

PNG Decode Time Nexus 6P (for a test set of GrayAlpha encoded PNGs)
Regular Unpremul 0.91x
Zero Init Unpremul 0.92x
Regular Premul 0.84x
Zero Init Premul 0.86x

BUG=skia:4767
GOLD_TRYBOT_URL= https://gold.skia.org/search2?unt=true&query=source_type%3Dgm&master=false&issue=1663623002
CQ_EXTRA_TRYBOTS=client.skia:Test-Ubuntu-GCC-GCE-CPU-AVX2-x86_64-Release-SKNX_NO_SIMD-Trybot

Review URL: https://codereview.chromium.org/1663623002
/external/skia/src/codec/SkSwizzler.cpp
93e613d6bdea05d96e232ed261d7bf886c91bb8e 03-Feb-2016 msarett <msarett@google.com> Handle gray alpha conversions in SkSwizzler

Nothing fancy here. By doing the entire conversion ourselves, we
only need to make one conversion pass over each row. Additionally,
we optimize the premultiply since we know each color component of
the pixel is identical.

This will also enable us to follow up with platform specific
optimizations.

PNG Decode Time Nexus 6P (for a test set of GrayAlpha encoded PNGs)
Regular Unpremul 0.95x
Zero Init Unpremul 0.94x
Regular Premul 0.91x
Zero Init Premul 0.90x

BUG=skia:4767
GOLD_TRYBOT_URL= https://gold.skia.org/search2?unt=true&query=source_type%3Dgm&master=false&issue=1665583002

Review URL: https://codereview.chromium.org/1665583002
/external/skia/src/codec/SkSwizzler.cpp
2eff71c9b5f984b58961e5a6b4e66774c4385224 02-Feb-2016 msarett <msarett@google.com> NEON optimizations for gray -> RGBA (or BGRA) conversions

Swizzle Bench Runtime
Nexus 6P 0.32x
Nexus 9 0.89x

PNG Decode Time (for test set of gray encoded PNGs)
Nexus 6P 0.88x
Nexus 9 0.91x

BUG=skia:4767
GOLD_TRYBOT_URL= https://gold.skia.org/search2?unt=true&query=source_type%3Dgm&master=false&issue=1656383002
CQ_EXTRA_TRYBOTS=client.skia:Test-Ubuntu-GCC-GCE-CPU-AVX2-x86_64-Release-SKNX_NO_SIMD-Trybot

Review URL: https://codereview.chromium.org/1656383002
/external/skia/src/codec/SkSwizzler.cpp
f1b8b6ae34e5a1f4b29e423401da39f88f0c117a 22-Jan-2016 msarett <msarett@google.com> Use NEON optimizations for RGB -> RGB(FF) or BGR(FF) in SkSwizzler

Swizzle Bench Runtime Nexus 6P
xxx_xxxa 0.32x
xxx_swaprb_xxxa 0.31x

Swizzle Bench Runtime Nexus 9
xxx_xxxa 1.11x
xxx_swaprb_xxxa 1.14x
(This is a slow down.)

Swizzle Bench Runtime Nexus 5
xxx_xxxa 0.12x
xxx_swaprb 0.12x

RGB PNG Decode Runtime
Nexus 6P 0.94x
Nexus 9 0.98x

I don't know how to explain the fact that the Swizzle Bench was
slower on Nexus 9, but the decode times got faster.

BUG=skia:
GOLD_TRYBOT_URL= https://gold.skia.org/search2?unt=true&query=source_type%3Dgm&master=false&issue=1618003002
CQ_EXTRA_TRYBOTS=client.skia:Test-Ubuntu-GCC-GCE-CPU-AVX2-x86_64-Release-SKNX_NO_SIMD-Trybot

Review URL: https://codereview.chromium.org/1618003002
/external/skia/src/codec/SkSwizzler.cpp
8bf7b79cf9776b4edb3f6810e5ab8c80c49d3480 22-Jan-2016 mtklein <mtklein@chromium.org> Refactor swizzle names and types.

- Plant a flag to say "pretend all the inputs are RGBA".
This is how libpng thinks.
This is the opposite of what the implementation had been doing,
so I've rearranged everything to reflect the new orientation.

- Rewrite the names to be less mysterious looking. No more Xs.

- Make the src type uniformly const void*, to allow for 888 (RGB) srcs.

This should be performance and pixel neutral. (Please revert if it's not.)

BUG=skia:
GOLD_TRYBOT_URL= https://gold.skia.org/search2?unt=true&query=source_type%3Dgm&master=false&issue=1626463002
CQ_EXTRA_TRYBOTS=client.skia:Test-Ubuntu-GCC-GCE-CPU-AVX2-x86_64-Release-SKNX_NO_SIMD-Trybot

Review URL: https://codereview.chromium.org/1626463002
/external/skia/src/codec/SkSwizzler.cpp
19032f72165f5c6eab5c2149dae98905f41e3943 21-Jan-2016 msarett <msarett@google.com> Use fActualProc to choose fFastProc or fSlowProc in SkSwizzler

(1) We will now (correctly) choose fFastProc if the client
calls setSampleX(1).
(2) The logic to choose between fFastProc and fSlowProc
is now performed once, rather than every time we call
swizzle().
(3) This will be easier to extend when we add
fFastSampleProcs for different sample sizes.

This comes from Leon's suggestion in:
https://codereview.chromium.org/1582083005

BUG=skia:
GOLD_TRYBOT_URL= https://gold.skia.org/search2?unt=true&query=source_type%3Dgm&master=false&issue=1616753003

Review URL: https://codereview.chromium.org/1616753003
/external/skia/src/codec/SkSwizzler.cpp
bda86098ab2784968d0a1222dd1f4c18d18fe050 19-Jan-2016 msarett <msarett@google.com> Clean up unused or overly complex modes in SkSwizzler

BUG=skia:
GOLD_TRYBOT_URL= https://gold.skia.org/search2?unt=true&query=source_type%3Dgm&master=false&issue=1582083005

Review URL: https://codereview.chromium.org/1582083005
/external/skia/src/codec/SkSwizzler.cpp
03108de163354fa574679ad153b58ce57126b2ba 15-Jan-2016 msarett <msarett@google.com> Add NEON swap opts and use opts in SkSwizzler

All RGBA, RGBX, BGRA, BGRX routines in SkSwizzler now use fast
options (with the exception of conversions to 565).

Swizzle Time for swap_rb
0.94x Nexus 9
0.81x Nexus 6P

Unpremul Decode Time for RGBA PNGs***
ZeroInit 0.93x Nexus 9
Regular 0.94x Nexus 9
ZeroInit 0.97x Nexus 6P
ZeroInit 0.95x Nexus 6P

***Two Notes:
The improvements here are actually due to taking advantage of
memcpy() (no need to swap, the bytes are already in the proper
order).
ZeroInit skips writing zeros to zero initialized memory. This
is a memory use opt in Android.

BMP decodes should also benefit from these improvements.

I am relying on Gold to help test all possible cases.

BUG=skia:
GOLD_TRYBOT_URL= https://gold.skia.org/search2?unt=true&query=source_type%3Dgm&master=false&issue=1581933006
CQ_EXTRA_TRYBOTS=client.skia:Test-Ubuntu-GCC-GCE-CPU-AVX2-x86_64-Release-SKNX_NO_SIMD-Trybot

Review URL: https://codereview.chromium.org/1581933006
/external/skia/src/codec/SkSwizzler.cpp
a51e7782b2e028a38712a159c412e6151eca1666 12-Jan-2016 msarett <msarett@google.com> Use SkOpts routines in SkSwizzler

This is a bit tricky because we don't intend to support sampling
in SkOpts. The swizzler will fallback to a default routine in
the event that sampling is requested.

BUG=skia:4767
GOLD_TRYBOT_URL= https://gold.skia.org/search2?unt=true&query=source_type%3Dgm&master=false&issue=1563393002

Review URL: https://codereview.chromium.org/1563393002
/external/skia/src/codec/SkSwizzler.cpp
8604ca2d84cfa9527705c69d74a8449b532e0ee4 11-Jan-2016 mtklein <mtklein@chromium.org> SkSwizzler: Factor skipping zeros out into a helper function.

I figure something like this lets us not worry about it in the new opts.

This skips only leading zeros per-scanline, not all zeros, but my bet is that
leading zeros are all that matters: it's got to be rare that a scanline is both
larger than 1024 pixels and has runs of 1024 transparent pixels in the middle.
I bet the big bang for the buck comes from skipping full scanlines (or even
multiple adjacent scanlines).

BUG=skia:4767
GOLD_TRYBOT_URL= https://gold.skia.org/search2?unt=true&query=source_type%3Dgm&master=false&issue=1566653007

Review URL: https://codereview.chromium.org/1566653007
/external/skia/src/codec/SkSwizzler.cpp
a4970dc973459d2607ce80623452bf8470adf6f1 11-Jan-2016 msarett <msarett@google.com> Delete reallyHasAlpha() from SkCodec

TBR=reed
BUG=skia:3582
GOLD_TRYBOT_URL= https://gold.skia.org/search2?unt=true&query=source_type%3Dgm&master=false&issue=1557403002

Review URL: https://codereview.chromium.org/1557403002
/external/skia/src/codec/SkSwizzler.cpp
3d00db39c6637607a2a1f184be2f31e4fe17d9ad 11-Jan-2016 mtklein <mtklein@chromium.org> Might as well inline these premultiplies.

We're paying quite a bit of function-call overhead per pixel.

On one test image we spend 3.5% of our total time in swizzle_rgba_to_n32_premul() and 8.8% of our total time in SkPreMultiplyARGB(). That turns into just 8.8% of our total time in swizzle_rgba_to_n32_premul() after inlining.

That's about a 30% speedup.

This will make SIMD procs look worse, so it's nice to land this first.

BUG=skia:4767
GOLD_TRYBOT_URL= https://gold.skia.org/search2?unt=true&query=source_type%3Dgm&master=false&issue=1571923002

Review URL: https://codereview.chromium.org/1571923002
/external/skia/src/codec/SkSwizzler.cpp
5af4e0bc8fd17944f3c0527462aeba367f6d590a 17-Nov-2015 msarett <msarett@google.com> Make SkAndroidCodec support gif

Involves a few bug fixes in SkCodec_libgif and a bit more
complexity in SkSwizzler.

BUG=skia:4405

Review URL: https://codereview.chromium.org/1445313002
/external/skia/src/codec/SkSwizzler.cpp
ef27d89b076ce7ab81703c9c08ce1f5c44106ee6 23-Oct-2015 scroggo <scroggo@chromium.org> Use SkSwizzler to convert from CMYK

Move convert_CMYK_to_RGBA into two functions in SkSwizzler: one for 565
and one for 8888.

For simplicity, when converting to 8888, we no longer convert in place.

BUG=skia:4476

Committed: https://skia.googlesource.com/skia/+/450ee8f26d39f975cf6af37a27de658ae5a9fa10

Review URL: https://codereview.chromium.org/1411083009
/external/skia/src/codec/SkSwizzler.cpp
b7f1251775390cdcf58197fd904d7676b9508128 23-Oct-2015 scroggo <scroggo@google.com> Revert of Use SkSwizzler to convert from CMYK (patchset #4 id:60001 of https://codereview.chromium.org/1411083009/ )

Reason for revert:
Breaking ASAN. See http://build.chromium.org/p/client.skia/builders/Test-Ubuntu-GCC-GCE-CPU-AVX2-x86_64-Debug-ASAN/builds/2879

Original issue's description:
> Use SkSwizzler to convert from CMYK
>
> Move convert_CMYK_to_RGBA into two functions in SkSwizzler: one for 565
> and one for 8888.
>
> For simplicity, when converting to 8888, we no longer convert in place.
>
> BUG=skia:4476
>
> Committed: https://skia.googlesource.com/skia/+/450ee8f26d39f975cf6af37a27de658ae5a9fa10

TBR=msarett@google.com,scroggo@chromium.org
NOPRESUBMIT=true
NOTREECHECKS=true
NOTRY=true
BUG=skia:4476

Review URL: https://codereview.chromium.org/1411193006
/external/skia/src/codec/SkSwizzler.cpp
450ee8f26d39f975cf6af37a27de658ae5a9fa10 23-Oct-2015 scroggo <scroggo@chromium.org> Use SkSwizzler to convert from CMYK

Move convert_CMYK_to_RGBA into two functions in SkSwizzler: one for 565
and one for 8888.

For simplicity, when converting to 8888, we no longer convert in place.

BUG=skia:4476

Review URL: https://codereview.chromium.org/1411083009
/external/skia/src/codec/SkSwizzler.cpp
3d9d7a7213748761d46ade183e11aa7cb55313c1 21-Oct-2015 msarett <msarett@google.com> Create an SkAndroidCodec API separate from SkCodec

We will implement this API using SkCodecs.

SkAndroidCodecs will be used to implement the
BitmapRegionDecoder Java API (and possibly
BitmapFactory).

BUG=skia:

Review URL: https://codereview.chromium.org/1406223002
/external/skia/src/codec/SkSwizzler.cpp
80803ff615e4293e8af2dc5d094a1f4fa81ec396 16-Oct-2015 msarett <msarett@google.com> Fix SkSwizzler bug

Now, that we are subsetting, fX0 is not necessarily less than
fSrcWidth (since fSrcWidth is really the subset width).

Ex: We may want a 10 pixel subset starting twenty pixels from the
left edge. In that case, fX0=20 and fSrcWidth=10.

Let's rename the width as fSubsetWidth to avoid confusion
and remove the check.

BUG=skia:

Review URL: https://codereview.chromium.org/1407603003
/external/skia/src/codec/SkSwizzler.cpp
f724b99435e0c7a6a95112229cc44a2ba813ecc9 15-Oct-2015 msarett <msarett@google.com> Reenable warnings in src/codec

BUG=skia:

Review URL: https://codereview.chromium.org/1400343005
/external/skia/src/codec/SkSwizzler.cpp
fdb47571a3b5e72469b67de44e32ac14d9352ab4 13-Oct-2015 msarett <msarett@google.com> Add subsetting to SkScanlineDecoder

This CL allows the SkScanlineDecoder to decode partial
scanlines.

This is a first step in efficiently implementing subsetting
in SkScaledCodec.

BUG=skia:4209

Review URL: https://codereview.chromium.org/1390213002
/external/skia/src/codec/SkSwizzler.cpp
e6dd004c1b8a81dc37a370570877b8b7d6dbe308 09-Oct-2015 msarett <msarett@google.com> Fill incomplete images in SkCodec parent class

Rather than implementing some sort of "fill" in every
SkCodec subclass for incomplete images, let's make the
parent class handle this situation.

This includes an API change to SkCodec.h

SkCodec::getScanlines() now returns the number of lines it
read successfully, rather than an SkCodec::Result enum.
getScanlines() most often fails on an incomplete input, in
which case it is useful to know how many lines were
successfully decoded - this provides more information than
kIncomplete vs kSuccess. We do lose information when the
API is used improperly, as we are no longer able to return
kInvalidParameter or kScanlineNotStarted.

Known Issues:
Does not work for incomplete fFrameIsSubset gifs.
Does not work for incomplete icos.

BUG=skia:

Review URL: https://codereview.chromium.org/1332053002
/external/skia/src/codec/SkSwizzler.cpp
e7fc14b55bb8c41ba054abf0bfa09cdd6ec84671 02-Oct-2015 scroggo <scroggo@google.com> Move all knowledge of X sampling into SkScaledCodec

Prior to this CL, each SkCodec subclass that allows sampling does an
extra check in onStartScanlineDecode to determine whether the X dimension
is supported for sampling. Remove this check, and provide a way for
SkScaledCodec to directly access the SkSwizzler, and update it to do
sampling. This way, the SkCodec knows nothing of sampling, but we can
still save the extra step of sampling afterwards.

FIXME: SkBmpRLECodec still calls SkScaledCodec::DimensionsSupported. It
seems like it could directly support sampling, rather than dealing with
SkScaledCodec (partially).

Add a new base class for SkSwizzler. It allows updating the swizzler
after it was created, which is done by SkScaledCodec. Modify SkSwizzler's
constructor/factory function to stop taking any info about sampling,
assume the sample size is one, and move modifying that into a virtual
function overridden from the base class.

BUG=skia:4284

Review URL: https://codereview.chromium.org/1372973002
/external/skia/src/codec/SkSwizzler.cpp
5406d6f39ad042e7a0a0d4ea16beca4fe2b66492 31-Aug-2015 msarett <msarett@google.com> Scanline decoding for bmp

Redesigns SkScanlineDecoder.h to indicate the ordering
in which the scanlines are provided

Refactors SkSwizzler::Fill() to include the zeroInit check
and to actually be correct.

BUG=skia:3257
BUG=skia:4198

Review URL: https://codereview.chromium.org/1287423002
/external/skia/src/codec/SkSwizzler.cpp
96fcdcc219d2a0d3579719b84b28bede76efba64 27-Aug-2015 halcanary <halcanary@google.com> Style Change: NULL->nullptr
DOCS_PREVIEW= https://skia.org/?cl=1316233002

Review URL: https://codereview.chromium.org/1316233002
/external/skia/src/codec/SkSwizzler.cpp
385fe4d4b62d7d1dd76116dd570df3290a2f487b 26-Aug-2015 halcanary <halcanary@google.com> Style Change: SkNEW->new; SkDELETE->delete
DOCS_PREVIEW= https://skia.org/?cl=1316123003

Review URL: https://codereview.chromium.org/1316123003
/external/skia/src/codec/SkSwizzler.cpp
cc2feb161f756c4035a407296567654d86bc7be7 14-Aug-2015 scroggo <scroggo@chromium.org> Support more swizzles to 565 in SkCodec

Add more swizzling functions for swizzling to 565. Much of this
code was revived from crrev.com/1055743003 (for BMP). Also added
swizzling functions for WBMP.

Consolidate the static function conversion_possible.

In SkCodec::getPixels, check that the alphatype corresponds to the
colorType. This prevents requesting 565 + non-opaque.

In SkIcoCodec, report that the image is unpremul (instead of
whatever the largest embedded codec thinks), but modify the
requested info to have the alpha type expected/required by the
embedded codec.

Add tests for decoding to 565.

BUG=skia:3257
BUG=skia:3683

Review URL: https://codereview.chromium.org/1277213002
/external/skia/src/codec/SkSwizzler.cpp
8f4ba76742c329bc4d5e1b8ca376d27922bd00b1 14-Aug-2015 emmaleer <emmaleer@google.com> SkScaledCodec class

This class does scaling by using a scanlineDecoder.
getScanlines and skipScanlines are used for y sampling,
the swizzler is used for x sampling

this class is currently only working for png and jpeg images
I will update other Codec types to work soon

For SkJpegCodec to implement width wise swizzling it now
uses a swizzler. I ran performance tests on this change.
Here are the performance test results:
https://docs.google.com/a/google.com/spreadsheets/d/1D7-Q_GXD_dI68LZO005NNvb8Wq2Ee0wEBEPG72671yw/edit?usp=sharing

BUG=skia:

Committed: https://skia.googlesource.com/skia/+/0944100ac89f797714eeae0cf2875e2335ff52ee

Committed: https://skia.googlesource.com/skia/+/d518ea7927f9f4e0ed5b4134d1b4f48243855a47

Committed: https://skia.googlesource.com/skia/+/b157917507d4f7d2651f0aeb566d31603cc02240

Review URL: https://codereview.chromium.org/1260673002
/external/skia/src/codec/SkSwizzler.cpp
b0a32cc38fcd8f37a23dfa19e928aeca529eaf14 14-Aug-2015 egdaniel <egdaniel@google.com> Revert of SkScaledCodec class (patchset #35 id:680001 of https://codereview.chromium.org/1260673002/ )

Reason for revert:
breaking ubuntu bots

Original issue's description:
> SkScaledCodec class
>
> This class does scaling by using a scanlineDecoder.
> getScanlines and skipScanlines are used for y sampling,
> the swizzler is used for x sampling
>
> this class is currently only working for png and jpeg images
> I will update other Codec types to work soon
>
> For SkJpegCodec to implement width wise swizzling it now
> uses a swizzler. I ran performance tests on this change.
> Here are the performance test results:
> https://docs.google.com/a/google.com/spreadsheets/d/1D7-Q_GXD_dI68LZO005NNvb8Wq2Ee0wEBEPG72671yw/edit?usp=sharing
>
> BUG=skia:
>
> Committed: https://skia.googlesource.com/skia/+/0944100ac89f797714eeae0cf2875e2335ff52ee
>
> Committed: https://skia.googlesource.com/skia/+/d518ea7927f9f4e0ed5b4134d1b4f48243855a47
>
> Committed: https://skia.googlesource.com/skia/+/b157917507d4f7d2651f0aeb566d31603cc02240

TBR=scroggo@google.com,msarett@google.com,djsollen@google.com,mtklein@google.com,emmaleer@google.com
NOPRESUBMIT=true
NOTREECHECKS=true
NOTRY=true
BUG=skia:

Review URL: https://codereview.chromium.org/1285173003
/external/skia/src/codec/SkSwizzler.cpp
b157917507d4f7d2651f0aeb566d31603cc02240 14-Aug-2015 emmaleer <emmaleer@google.com> SkScaledCodec class

This class does scaling by using a scanlineDecoder.
getScanlines and skipScanlines are used for y sampling,
the swizzler is used for x sampling

this class is currently only working for png and jpeg images
I will update other Codec types to work soon

For SkJpegCodec to implement width wise swizzling it now
uses a swizzler. I ran performance tests on this change.
Here are the performance test results:
https://docs.google.com/a/google.com/spreadsheets/d/1D7-Q_GXD_dI68LZO005NNvb8Wq2Ee0wEBEPG72671yw/edit?usp=sharing

BUG=skia:

Committed: https://skia.googlesource.com/skia/+/0944100ac89f797714eeae0cf2875e2335ff52ee

Committed: https://skia.googlesource.com/skia/+/d518ea7927f9f4e0ed5b4134d1b4f48243855a47

Review URL: https://codereview.chromium.org/1260673002
/external/skia/src/codec/SkSwizzler.cpp
c7993d747fff40328b6666845761efbbbfe720b7 13-Aug-2015 emmaleer <emmaleer@google.com> Revert of SkScaledCodec class (patchset #34 id:660001 of https://codereview.chromium.org/1260673002/ )

Reason for revert:
Seg-faulting:
http://build.chromium.org/p/client.skia/builders/Test-Ubuntu-GCC-GCE-CPU-AVX2-x86-Release/builds/1608/steps/dm/logs/stdio

Original issue's description:
> SkScaledCodec class
>
> This class does scaling by using a scanlineDecoder.
> getScanlines and skipScanlines are used for y sampling,
> the swizzler is used for x sampling
>
> this class is currently only working for png and jpeg images
> I will update other Codec types to work soon
>
> For SkJpegCodec to implement width wise swizzling it now
> uses a swizzler. I ran performance tests on this change.
> Here are the performance test results:
> https://docs.google.com/a/google.com/spreadsheets/d/1D7-Q_GXD_dI68LZO005NNvb8Wq2Ee0wEBEPG72671yw/edit?usp=sharing
>
> BUG=skia:
>
> Committed: https://skia.googlesource.com/skia/+/0944100ac89f797714eeae0cf2875e2335ff52ee
>
> Committed: https://skia.googlesource.com/skia/+/d518ea7927f9f4e0ed5b4134d1b4f48243855a47

TBR=scroggo@google.com,msarett@google.com,djsollen@google.com,mtklein@google.com
NOPRESUBMIT=true
NOTREECHECKS=true
NOTRY=true
BUG=skia:

Review URL: https://codereview.chromium.org/1294613002
/external/skia/src/codec/SkSwizzler.cpp
d518ea7927f9f4e0ed5b4134d1b4f48243855a47 13-Aug-2015 emmaleer <emmaleer@google.com> SkScaledCodec class

This class does scaling by using a scanlineDecoder.
getScanlines and skipScanlines are used for y sampling,
the swizzler is used for x sampling

this class is currently only working for png and jpeg images
I will update other Codec types to work soon

For SkJpegCodec to implement width wise swizzling it now
uses a swizzler. I ran performance tests on this change.
Here are the performance test results:
https://docs.google.com/a/google.com/spreadsheets/d/1D7-Q_GXD_dI68LZO005NNvb8Wq2Ee0wEBEPG72671yw/edit?usp=sharing

BUG=skia:

Committed: https://skia.googlesource.com/skia/+/0944100ac89f797714eeae0cf2875e2335ff52ee

Review URL: https://codereview.chromium.org/1260673002
/external/skia/src/codec/SkSwizzler.cpp
e5aaa07c351815f023a0842820eb769c6d4b4ed3 13-Aug-2015 emmaleer <emmaleer@google.com> Revert of SkScaledCodec class (patchset #32 id:620001 of https://codereview.chromium.org/1260673002/ )

Reason for revert:
Segfaulting:
http://build.chromium.org/p/client.skia/builders/Test-Ubuntu-GCC-GCE-CPU-AVX2-x86-Release/builds/1605/steps/dm/logs/stdio

Original issue's description:
> SkScaledCodec class
>
> This class does scaling by using a scanlineDecoder.
> getScanlines and skipScanlines are used for y sampling,
> the swizzler is used for x sampling
>
> this class is currently only working for png and jpeg images
> I will update other Codec types to work soon
>
> For SkJpegCodec to implement width wise swizzling it now
> uses a swizzler. I ran performance tests on this change.
> Here are the performance test results:
> https://docs.google.com/a/google.com/spreadsheets/d/1D7-Q_GXD_dI68LZO005NNvb8Wq2Ee0wEBEPG72671yw/edit?usp=sharing
>
> BUG=skia:
>
> Committed: https://skia.googlesource.com/skia/+/0944100ac89f797714eeae0cf2875e2335ff52ee

TBR=scroggo@google.com,msarett@google.com,djsollen@google.com,mtklein@google.com
NOPRESUBMIT=true
NOTREECHECKS=true
NOTRY=true
BUG=skia:

Review URL: https://codereview.chromium.org/1294593002
/external/skia/src/codec/SkSwizzler.cpp
0944100ac89f797714eeae0cf2875e2335ff52ee 13-Aug-2015 emmaleer <emmaleer@google.com> SkScaledCodec class

This class does scaling by using a scanlineDecoder.
getScanlines and skipScanlines are used for y sampling,
the swizzler is used for x sampling

this class is currently only working for png and jpeg images
I will update other Codec types to work soon

For SkJpegCodec to implement width wise swizzling it now
uses a swizzler. I ran performance tests on this change.
Here are the performance test results:
https://docs.google.com/a/google.com/spreadsheets/d/1D7-Q_GXD_dI68LZO005NNvb8Wq2Ee0wEBEPG72671yw/edit?usp=sharing

BUG=skia:

Review URL: https://codereview.chromium.org/1260673002
/external/skia/src/codec/SkSwizzler.cpp
ab60c5bd9f360e9d58f0f34683b92fb841a514b1 06-Aug-2015 scroggo <scroggo@chromium.org> Support decoding PNG to 565.

Although we initially discussed not supporting 565, SkCodec needs to
support Android's BitmapFactory and BitmapRegionDecoder, which need to
support 565.

We could instead implement 565 on top of SkCodec, but this would require
more memory and run more slowly.

An open question is whether to support dithering, and how. In order to
support dithering, we need to pass y to RowProc, which I believe means
we will need to pass y to SkSwizzler::swizzle().

I dislike having an option which is typically ignored - SkImageDecoder
allows you to turn on dithering when decoding to any color type, but it
is only meaningful only if the output color type is 565.

We could also make the client implement dithering, which I believe would
mean forcing them to do the conversion to 565 (since we have already
thrown away data when we convered to 565 without dithering).

BUG=skia:3257

Review URL: https://codereview.chromium.org/1277593002
/external/skia/src/codec/SkSwizzler.cpp
cbb12ca953c8db8030e4e52bb12e2dae98d2692b 05-Aug-2015 msarett <msarett@google.com> Fix ASAN error for wbmp swizzles

BUG=skia:

Review URL: https://codereview.chromium.org/1269413006
/external/skia/src/codec/SkSwizzler.cpp
99f567e617b6c5a81e6b822c30ccb0d357db21fc 05-Aug-2015 msarett <msarett@google.com> Scanline decoding for wbmp

We are also changing the wbmp to use SkSwizzler. This
will allow us to take advantage of the sampling routines
that are being implemented in SkSwizzler.

The image in this upload came from:
https://commons.wikimedia.org/wiki/File:Android_robot.png

It is licensed under the Creative Commons Attribution-Share Alike 3.0 Unported license.

BUG=skia:

Review URL: https://codereview.chromium.org/1254483004
/external/skia/src/codec/SkSwizzler.cpp
fdb788cbfcdccac65d8d1f535920c7f2fdba1ead 29-Jul-2015 msarett <msarett@google.com> Make SkSwizzler::Fill() support 565

BUG=skia:4135

Review URL: https://codereview.chromium.org/1267543002
/external/skia/src/codec/SkSwizzler.cpp
614aa072cbb055a29f37fa25a657313bccc5d666 28-Jul-2015 msarett <msarett@google.com> Pass the destination pointer to next() in SkSwizzler

Per our discussion, we can make the swizzler simpler and more usable
for SkCodec and SkScanlineDecoder by only having a single version of
next() which takes a pointer to the srcRow and a pointer to the
dstRow.

BUG=skia:

Review URL: https://codereview.chromium.org/1256373002
/external/skia/src/codec/SkSwizzler.cpp
eb602a5c94078fb2956c9bdc64bbf47a31b9c0e5 09-Jul-2015 scroggo <scroggo@chromium.org> SkCodec no longer inherits from SkImageGenerator.

SkImageGenerator makes some assumptions that are not necessarily valid
for SkCodec. For example, SkCodec does not assume that it can always be
rewound.

We also have an ongoing question of what an SkCodec should report as
its default settings (i.e. the return from getInfo). It makes sense for
an SkCodec to report that its pixels are unpremultiplied, if that is
the case for the underlying data, but if a client of SkImageGenerator
uses the default settings (as many do), they will receive
unpremultiplied pixels which cannot (currently) be drawn with Skia. We
may ultimately decide to revisit SkCodec reporting an SkImageInfo, but
I have left it unchanged for now.

Import features of SkImageGenerator used by SkCodec into SkCodec.

I have left SkImageGenerator unchanged for now, but it no longer needs
Result or Options. This will require changes to Chromium.

Manually handle the lifetime of fScanlineDecoder, so SkScanlineDecoder.h
can include SkCodec.h (where Result is), and SkCodec.h does not need
to include it (to delete fScanlineDecoder).

In many places, make the following simple changes:
- Now include SkScanlineDecoder.h, which is no longer included by
SkCodec.h
- Use the enums in SkCodec, rather than SkImageGenerator
- Stop including SkImageGenerator.h where no longer needed

Review URL: https://codereview.chromium.org/1220733013
/external/skia/src/codec/SkSwizzler.cpp
e16b04aa6041efb6507546547737e9603fa1606e 15-Apr-2015 msarett <msarett@google.com> SkJpegCodec

Enables basic decoding for jpegs

Includes rewinding

565, YUV, and Jpeg encoding are not yet implemented

BUG=skia:3257

Review URL: https://codereview.chromium.org/1076923002
/external/skia/src/codec/SkSwizzler.cpp
3c309db75bb8c4c2b58724a0e2f6f3b387ca842c 10-Apr-2015 msarett <msarett@google.com> Implementing filling for SkBmpCodec

The bmp codec currently returns kIncompleteInput
when the stream is truncated, which we treat as a
partial success. However, we neglect the fill the
remaining pixels in the image, leaving these
uninitialized.

This CL addresses this problem by initializing the
remaining pixels in the image to default values.

BUG=skia:3257

Review URL: https://codereview.chromium.org/1075243003
/external/skia/src/codec/SkSwizzler.cpp
438b2adefb9e9213e0ddaf0609405d3087a1cf0a 09-Apr-2015 msarett <msarett@google.com> ***Disables swizzles to 565.
We may want to enable swizzles to 565
for images that are encoded in a format
similar to 565, however, we do not want
to take images that decode naturally to
kN32 and then convert them to 565.

***Enable swizzles to kIndex_8. For images
encoded in a color table format, we suggest
that they be decoded to kIndex_8. When we
decode, we only allow conversion to kIndex_8
if it matches the suggested color type (except
wbmp which seems good as is).

***Modify dm to test images that decode to
kIndex_8.

BUG=skia:3257
BUG=skia:3440

Review URL: https://codereview.chromium.org/1055743003
/external/skia/src/codec/SkSwizzler.cpp
05245900bf6d49068b1668da1b38890a41e09bc5 25-Mar-2015 scroggo <scroggo@google.com> Add scanline decoding to SkCodec.

Add an interface for decoding scanlines, and implement that interface
in the PNG decoder.

Use a separate method to determine whether an image that used a type
with alpha was actually opaque.

SkScanlineDecoder.h:
New interface for decoding scanlines.

SkCodec.h:
Add getScanlineDecoder.
Add a virtual function (with non-virtual caller) for determining
whether the image truly had alpha. The client can call this to
determine if the image was actually opaque if it reported having alpha.
Remove code to sneakily change the passed in alpha type.

SkCodec_libpng.*:
Split up code onGetPixels into helper functions that can be shared with
the scanline decoder.
Implement scanline decoding.
Implement onReallyHasAlpha.

SkSwizzler.*:
Add a new SrcConfig as a default, which is invalid.
Add a function for setting fDstRow directly.
Assert fDstRow is not NULL.

BUG=skia:3257

Review URL: https://codereview.chromium.org/1010903003
/external/skia/src/codec/SkSwizzler.cpp
eed039b5ffbdff958053ac80b09451ad6caa1787 18-Mar-2015 msarett <msarett@google.com> Adding swizzles for bmp:
We now support kN32 and kRGB_565 color types.
Additionally, we support premul, unpremul, and opaque alpha types.
Unpremul is currently untested as we cannot currently draw to unpremul.

BUG=skia:

Review URL: https://codereview.chromium.org/1013743003
/external/skia/src/codec/SkSwizzler.cpp
9552662e9fee5eb0ef435e52ab9db505d7ebe4ad 17-Mar-2015 scroggo <scroggo@google.com> Option for SkCodec to treat dst as all zeroes.

This recreates SkImageDecoder's feature to skip writing zeroes for
SkCodec.

Review URL: https://codereview.chromium.org/980903002
/external/skia/src/codec/SkSwizzler.cpp
741143878b23d22cd9cb7b9cba8055179115ce17 16-Mar-2015 msarett <msarett@google.com> Revert "Revert of fix for invalid for loop syntax broke build (patchset #1 id:1 of https://codereview.chromium.org/1007373003/)"

This reverts commit d18475854ce232de71c5463e0654f459d4abfd43.

Revert "Revert "Implementation of image decoding for bmp files, in accordance with the new API.""

This reverts commit dfdec78a5d02e8690998741a9fe5b71a08ca3232.

BUG=skia:

TBR=

Review URL: https://codereview.chromium.org/1016443003
/external/skia/src/codec/SkSwizzler.cpp
dfdec78a5d02e8690998741a9fe5b71a08ca3232 16-Mar-2015 msarett <msarett@google.com> Revert "Implementation of image decoding for bmp files, in accordance with the new API."

This reverts commit 3675874468de7228944ce21922e6ec863f5f2310.

BUG=skia:
NOTREECHECKS=true
NOTRY=true
TBR=

Review URL: https://codereview.chromium.org/1012873002
/external/skia/src/codec/SkSwizzler.cpp
3675874468de7228944ce21922e6ec863f5f2310 16-Mar-2015 msarett <msarett@google.com> Implementation of image decoding for bmp files, in accordance with the new API.

Currently decodes to opaque and unpremul.

Tested on local test suite.

BUG=skia:3257

Review URL: https://codereview.chromium.org/947283002
/external/skia/src/codec/SkSwizzler.cpp
f24f2247c25b842327e12c70e44efe4cc1b28dfa 03-Mar-2015 scroggo <scroggo@google.com> Add SkCodec, including PNG implementation.

DM:
Add a flag to use SkCodec instead of SkImageDecoder.

SkCodec:
Base class for codecs, allowing creation from an SkStream or an SkData.
An SkCodec, on creation, knows properties of the data like its width and height. Further calls can be used to generate the image.
TODO: Add scanline iterator

SkPngCodec:
New decoder for png. Wraps libpng. The code has been repurposed from SkImageDecoder_libpng.
TODO: Handle other destination colortypes
TODO: Substitute the transpose color
TODO: Allow silencing warnings
TODO: Use RGB instead of filler?
TODO: sRGB

SkSwizzler:
Simplified version of SkScaledSampler. Unlike the sampler, this object does no sampling.
TODO: Implement other swizzles.

Requires a gclient sync to pull down libpng.

BUG=skia:3257

Committed: https://skia.googlesource.com/skia/+/ca358852b4fed656d11107b2aaf28318a4518b49
(and then reverted)

Review URL: https://codereview.chromium.org/930283002
/external/skia/src/codec/SkSwizzler.cpp
ee1a726aed980016a9371ffa4768e0844c360eb2 02-Mar-2015 scroggo <scroggo@google.com> Revert of Add SkCodec, including PNG implementation. (patchset #24 id:460001 of https://codereview.chromium.org/930283002/)

Reason for revert:
Breaking windows bots all over the place :(

Original issue's description:
> Add SkCodec, including PNG implementation.
>
> DM:
> Add a flag to use SkCodec instead of SkImageDecoder.
>
> SkCodec:
> Base class for codecs, allowing creation from an SkStream or an SkData.
> An SkCodec, on creation, knows properties of the data like its width and height. Further calls can be used to generate the image.
> TODO: Add scanline iterator
>
> SkPngCodec:
> New decoder for png. Wraps libpng. The code has been repurposed from SkImageDecoder_libpng.
> TODO: Handle other destination colortypes
> TODO: Substitute the transpose color
> TODO: Allow silencing warnings
> TODO: Use RGB instead of filler?
> TODO: sRGB
>
> SkSwizzler:
> Simplified version of SkScaledSampler. Unlike the sampler, this object does no sampling.
> TODO: Implement other swizzles.
>
> BUG=skia:3257
>
> Committed: https://skia.googlesource.com/skia/+/ca358852b4fed656d11107b2aaf28318a4518b49

TBR=reed@google.com,djsollen@google.com,msarett@google.com,mtklein@google.com
NOPRESUBMIT=true
NOTREECHECKS=true
NOTRY=true
BUG=skia:3257

Review URL: https://codereview.chromium.org/972743003
/external/skia/src/codec/SkSwizzler.cpp
ca358852b4fed656d11107b2aaf28318a4518b49 02-Mar-2015 scroggo <scroggo@google.com> Add SkCodec, including PNG implementation.

DM:
Add a flag to use SkCodec instead of SkImageDecoder.

SkCodec:
Base class for codecs, allowing creation from an SkStream or an SkData.
An SkCodec, on creation, knows properties of the data like its width and height. Further calls can be used to generate the image.
TODO: Add scanline iterator

SkPngCodec:
New decoder for png. Wraps libpng. The code has been repurposed from SkImageDecoder_libpng.
TODO: Handle other destination colortypes
TODO: Substitute the transpose color
TODO: Allow silencing warnings
TODO: Use RGB instead of filler?
TODO: sRGB

SkSwizzler:
Simplified version of SkScaledSampler. Unlike the sampler, this object does no sampling.
TODO: Implement other swizzles.

BUG=skia:3257

Review URL: https://codereview.chromium.org/930283002
/external/skia/src/codec/SkSwizzler.cpp