aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/codec/SkSwizzler.cpp
Commit message (Collapse)AuthorAge
* move a bunch of helpers from SkImageInfo.h into privGravatar Mike Reed2018-02-09
| | | | | | | | | Bug: skia: Change-Id: I8c91cfdb89e4f22448d1201d391556fe43d86dca Reviewed-on: https://skia-review.googlesource.com/105289 Commit-Queue: Mike Reed <reed@google.com> Reviewed-by: Mike Klein <mtklein@chromium.org> Reviewed-by: Cary Clark <caryclark@google.com>
* encode kAlpha_8 as grayalpha with sigbits for gray==1Gravatar Mike Reed2017-11-30
| | | | | | | | Bug: skia: Change-Id: Ib61e8e0f62af92d8746f5e73469002e7804a8447 Reviewed-on: https://skia-review.googlesource.com/78481 Reviewed-by: Leon Scroggins <scroggo@google.com> Commit-Queue: Mike Reed <reed@google.com>
* Remove static initializers in SkCodecGravatar Leon Scroggins III2017-10-03
| | | | | | | | | | | | Bug: 768878 Switch const declarations to constexpr where appropriate. Speculative fix for crbug.com/768878. Change-Id: I7fc356e623ce7a0f2b87e92e9a8ed95d5c423d79 Reviewed-on: https://skia-review.googlesource.com/54101 Commit-Queue: Leon Scroggins <scroggo@google.com> Reviewed-by: Chris Blume <cblume@chromium.org>
* make most of SkColorPriv.h privateGravatar Cary Clark2017-09-15
| | | | | | | | | | | | | created new file src/core/SkColorData.h for internal consumption. Note that many of the functions there are unused as well. Bug: skia: 6898 R: reed@google.com Change-Id: I25bfd5a9c21f53558c4ca65a77eb5d322d897c6d Reviewed-on: https://skia-review.googlesource.com/46848 Commit-Queue: Cary Clark <caryclark@google.com> Reviewed-by: Mike Reed <reed@google.com>
* Index8 is dead, remove guarded codeGravatar Mike Reed2017-07-17
| | | | | | | | | | Needs google3 to be updated before this can land. Bug: skia:6828 Change-Id: I2c16be13c6937ffa48768cc24f9f980171c824d6 Reviewed-on: https://skia-review.googlesource.com/23940 Reviewed-by: Leon Scroggins <scroggo@google.com> Commit-Queue: Mike Reed <reed@google.com>
* Guard to remove kIndex_8_SkColorTypeGravatar Mike Reed2017-07-13
| | | | | | | | | Bug: skia:6828 Change-Id: Ia942a36abb18213184f8d436555a658270d97d47 Reviewed-on: https://skia-review.googlesource.com/22721 Commit-Queue: Mike Reed <reed@google.com> Reviewed-by: Florin Malita <fmalita@chromium.org> Reviewed-by: Herb Derby <herb@google.com>
* Reland "Respect full precision for RGB16 PNGs" (part 3)Gravatar Matt Sarett2017-01-20
| | | | | | | | | | | | | | | | | | This lands the rest of the original CL. It fixes some flawed logic in SkSwizzler handling Gray8 images. Original CL: https://skia-review.googlesource.com/c/7085/ BUG=skia: CQ_INCLUDE_TRYBOTS=skia.primary:Test-Ubuntu-Clang-GCE-CPU-AVX2-x86_64-Debug-MSAN,Test-Ubuntu-GCC-GCE-CPU-AVX2-x86_64-Release-SKNX_NO_SIMD,Build-Ubuntu-Clang-x86_64-Release-Fast Change-Id: Ie2f0c545ea474f1872f284dfb286987b6eadf03d Reviewed-on: https://skia-review.googlesource.com/7320 Reviewed-by: Matt Sarett <msarett@google.com> Commit-Queue: Matt Sarett <msarett@google.com>
* Revert "Respect full precision for RGB16 PNGs"Gravatar Matt Sarett2017-01-18
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This reverts commit 7a090c403da1dad6a2e19f2011158bd894a62d91. Reason for revert: <INSERT REASONING HERE> Original change's description: > Respect full precision for RGB16 PNGs > > BUG=skia: > > CQ_INCLUDE_TRYBOTS=skia.primary:Test-Ubuntu-GCC-GCE-CPU-AVX2-x86_64-Release-SKNX_NO_SIMD > > Change-Id: If58d201daae97bce2f8efbc453c2ec452e682493 > Reviewed-on: https://skia-review.googlesource.com/7085 > Commit-Queue: Matt Sarett <msarett@google.com> > Reviewed-by: Mike Klein <mtklein@chromium.org> > Reviewed-by: Leon Scroggins <scroggo@google.com> > Reviewed-by: Mike Reed <reed@google.com> > TBR=mtklein@chromium.org,mtklein@google.com,msarett@google.com,scroggo@google.com,reed@google.com NOPRESUBMIT=true NOTREECHECKS=true NOTRY=true BUG=skia: CQ_INCLUDE_TRYBOTS=skia.primary:Test-Ubuntu-GCC-GCE-CPU-AVX2-x86_64-Release-SKNX_NO_SIMD Change-Id: Ibd9879bc4f65ca0c2457dd0bfb5eb008d9a8f672 Reviewed-on: https://skia-review.googlesource.com/7183 Commit-Queue: Matt Sarett <msarett@google.com> Reviewed-by: Matt Sarett <msarett@google.com>
* Respect full precision for RGB16 PNGsGravatar Matt Sarett2017-01-18
| | | | | | | | | | | | | BUG=skia: CQ_INCLUDE_TRYBOTS=skia.primary:Test-Ubuntu-GCC-GCE-CPU-AVX2-x86_64-Release-SKNX_NO_SIMD Change-Id: If58d201daae97bce2f8efbc453c2ec452e682493 Reviewed-on: https://skia-review.googlesource.com/7085 Commit-Queue: Matt Sarett <msarett@google.com> Reviewed-by: Mike Klein <mtklein@chromium.org> Reviewed-by: Leon Scroggins <scroggo@google.com> Reviewed-by: Mike Reed <reed@google.com>
* Use RasterPipeline to support full precision on 16-bit RGBA pngsGravatar Matt Sarett2017-01-13
| | | | | | | | | | | | Reland of Original Change: https://skia-review.googlesource.com/6260 CQ_INCLUDE_TRYBOTS=skia.primary:Test-Ubuntu-GCC-GCE-CPU-AVX2-x86_64-Release-SKNX_NO_SIMD Change-Id: I809984dd9af225103bfbe83492a17c19da7c5e40 Reviewed-on: https://skia-review.googlesource.com/6980 Reviewed-by: Matt Sarett <msarett@google.com> Commit-Queue: Matt Sarett <msarett@google.com>
* Revert "Use RasterPipeline to support full precision on 16-bit RGBA pngs"Gravatar Matt Sarett2017-01-12
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This reverts commit bb2339da39ab3ee59121acd911920dafcd4a2f72. Reason for revert: Breaks MSAN Original change's description: > Use RasterPipeline to support full precision on 16-bit RGBA pngs > > TODO: Support more precision on 16-bit RGB pngs > > BUG=skia: > > CQ_INCLUDE_TRYBOTS=skia.primary:Test-Ubuntu-GCC-GCE-CPU-AVX2-x86_64-Release-SKNX_NO_SIMD > > Change-Id: I89dfef3b4887b9c4895c17309933883ab90ffa4d > Reviewed-on: https://skia-review.googlesource.com/6260 > Reviewed-by: Mike Reed <reed@google.com> > Reviewed-by: Leon Scroggins <scroggo@google.com> > Reviewed-by: Mike Klein <mtklein@chromium.org> > Commit-Queue: Matt Sarett <msarett@google.com> > TBR=mtklein@chromium.org,mtklein@google.com,msarett@google.com,scroggo@google.com,reed@google.com,reviews@skia.org BUG=skia: NOPRESUBMIT=true NOTREECHECKS=true NOTRY=true Change-Id: I47579c20af033a75883e2b35567cb9c690ce54b0 Reviewed-on: https://skia-review.googlesource.com/6975 Commit-Queue: Matt Sarett <msarett@google.com> Reviewed-by: Matt Sarett <msarett@google.com>
* Use RasterPipeline to support full precision on 16-bit RGBA pngsGravatar Matt Sarett2017-01-12
| | | | | | | | | | | | | | | TODO: Support more precision on 16-bit RGB pngs BUG=skia: CQ_INCLUDE_TRYBOTS=skia.primary:Test-Ubuntu-GCC-GCE-CPU-AVX2-x86_64-Release-SKNX_NO_SIMD Change-Id: I89dfef3b4887b9c4895c17309933883ab90ffa4d Reviewed-on: https://skia-review.googlesource.com/6260 Reviewed-by: Mike Reed <reed@google.com> Reviewed-by: Leon Scroggins <scroggo@google.com> Reviewed-by: Mike Klein <mtklein@chromium.org> Commit-Queue: Matt Sarett <msarett@google.com>
* SkPngCodec: Add support for 16-bit pngs (step 1)Gravatar Matt Sarett2016-12-14
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | Android plans to use 16-bit png to encode higher precision assets. This CL should not change any behavior or cause diffs on Gold. It simply moves the 16-bit -> 8-bit strip from libpng to SkSwizzler. As a follow-up, I plan to add support for 16-bit input to SkColorSpaceXform. This will require a new swizzler function that just samples or subsets 16-bit values (but does not strip to 8-bit). An alternative implementation could avoid the additional swizzler functions by deciding whether or not to call png_set_strip() at decode time (we would still need the swizzler fn to sample/subset 16-bit values). I find this strategy to be cleaner than that. I would rather handle 16-bit rgb(a) all the time than *some* of the time. And this is implementation is also more efficient than libpng. Though it is also more skia code. Gray and gray alpha are left alone until I know whether anyone wants high precision gray support. b/32984164 Change-Id: I44e307473526de3f4bba06879c5fffa25d480f56 Reviewed-on: https://skia-review.googlesource.com/6020 Reviewed-by: Leon Scroggins <scroggo@google.com> Commit-Queue: Matt Sarett <msarett@google.com>
* Fix double CMYK->RGBA conversion on swizzled jpeg decodesGravatar Matt Sarett2016-12-13
| | | | | | | | | BUG=skia: Change-Id: I4e8c4128f974cc491fcef0bbc1137b5d62b6f967 Reviewed-on: https://skia-review.googlesource.com/5933 Commit-Queue: Matt Sarett <msarett@google.com> Reviewed-by: Leon Scroggins <scroggo@google.com>
* Finish color space support for SkCodecGravatar Matt Sarett2016-11-07
| | | | | | | | | | | | | Implements color space xforms and F16 for SkRawCodec and SkWbmpCodec. BUG=skia:4895 GOLD_TRYBOT_URL= https://gold.skia.org/search?issue=4459 Change-Id: I8c72918e46387350b49a9811ce654d26b1ab352a Reviewed-on: https://skia-review.googlesource.com/4459 Commit-Queue: Matt Sarett <msarett@google.com> Reviewed-by: Leon Scroggins <scroggo@google.com>
* Remove SkEncodedInfo kPreSwizzled_Color from public APIGravatar msarett2016-04-25
| | | | | | | BUG=skia: GOLD_TRYBOT_URL= https://gold.skia.org/search2?unt=true&query=source_type%3Dgm&master=false&issue=1918943002 Review URL: https://codereview.chromium.org/1918943002
* Support the non-native (RGBA/BGRA) swizzleGravatar msarett2016-04-22
| | | | | | | BUG=skia:4456 GOLD_TRYBOT_URL= https://gold.skia.org/search2?unt=true&query=source_type%3Dgm&master=false&issue=1907593004 Review URL: https://codereview.chromium.org/1907593004
* Use SkEncodedInfo in place of SkSwizzler::SrcConfigGravatar msarett2016-04-22
| | | | | | | BUG=skia: GOLD_TRYBOT_URL= https://gold.skia.org/search2?unt=true&query=source_type%3Dgm&master=false&issue=1911613002 Review URL: https://codereview.chromium.org/1911613002
* Clean up comments in SkSwizzlerGravatar msarett2016-02-10
| | | | | | | 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
* Optimize CMYK->RGBA (BGRA) transform for jpeg decodesGravatar msarett2016-02-08
| | | | | | | | | | | | | | | | 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
* NEON optimizations for GrayAlpha -> RGBA/BGRA Premul/UnpremulGravatar msarett2016-02-03
| | | | | | | | | | | | | | 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
* Handle gray alpha conversions in SkSwizzlerGravatar msarett2016-02-03
| | | | | | | | | | | | | | | | | | | | | 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
* NEON optimizations for gray -> RGBA (or BGRA) conversionsGravatar msarett2016-02-02
| | | | | | | | | | | | | | | | 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
* Use NEON optimizations for RGB -> RGB(FF) or BGR(FF) in SkSwizzlerGravatar msarett2016-01-22
| | | | | | | | | | | | | | | | | | | | | | | | | | | | 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
* Refactor swizzle names and types.Gravatar mtklein2016-01-22
| | | | | | | | | | | | | | | | | | | - 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
* Use fActualProc to choose fFastProc or fSlowProc in SkSwizzlerGravatar msarett2016-01-21
| | | | | | | | | | | | | | | | | | (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
* Clean up unused or overly complex modes in SkSwizzlerGravatar msarett2016-01-19
| | | | | | | 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
* Add NEON swap opts and use opts in SkSwizzlerGravatar msarett2016-01-15
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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
* Use SkOpts routines in SkSwizzlerGravatar msarett2016-01-12
| | | | | | | | | | | 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
* SkSwizzler: Factor skipping zeros out into a helper function.Gravatar mtklein2016-01-11
| | | | | | | | | | | | | | | 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
* Delete reallyHasAlpha() from SkCodecGravatar msarett2016-01-11
| | | | | | | | 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
* Might as well inline these premultiplies.Gravatar mtklein2016-01-11
| | | | | | | | | | | | | | | 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
* Make SkAndroidCodec support gifGravatar msarett2015-11-17
| | | | | | | | | 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
* Use SkSwizzler to convert from CMYKGravatar scroggo2015-10-23
| | | | | | | | | | | | | 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
* Revert of Use SkSwizzler to convert from CMYK (patchset #4 id:60001 of ↵Gravatar scroggo2015-10-23
| | | | | | | | | | | | | | | | | | | | | | | | | | | 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
* Use SkSwizzler to convert from CMYKGravatar scroggo2015-10-23
| | | | | | | | | | | 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
* Create an SkAndroidCodec API separate from SkCodecGravatar msarett2015-10-21
| | | | | | | | | | | | 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
* Fix SkSwizzler bugGravatar msarett2015-10-16
| | | | | | | | | | | | | | | 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
* Reenable warnings in src/codecGravatar msarett2015-10-15
| | | | | | BUG=skia: Review URL: https://codereview.chromium.org/1400343005
* Add subsetting to SkScanlineDecoderGravatar msarett2015-10-13
| | | | | | | | | | | | 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
* Fill incomplete images in SkCodec parent classGravatar msarett2015-10-09
| | | | | | | | | | | | | | | | | | | | | | | | | 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
* Move all knowledge of X sampling into SkScaledCodecGravatar scroggo2015-10-02
| | | | | | | | | | | | | | | | | | | | | | | 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
* Scanline decoding for bmpGravatar msarett2015-08-31
| | | | | | | | | | | | | 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
* Style Change: NULL->nullptrGravatar halcanary2015-08-27
| | | | | | DOCS_PREVIEW= https://skia.org/?cl=1316233002 Review URL: https://codereview.chromium.org/1316233002
* Style Change: SkNEW->new; SkDELETE->deleteGravatar halcanary2015-08-26
| | | | | | DOCS_PREVIEW= https://skia.org/?cl=1316123003 Review URL: https://codereview.chromium.org/1316123003
* Support more swizzles to 565 in SkCodecGravatar scroggo2015-08-14
| | | | | | | | | | | | | | | | | | | | | | | 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
* SkScaledCodec classGravatar emmaleer2015-08-14
| | | | | | | | | | | | | | | | | | | | | | | | 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
* Revert of SkScaledCodec class (patchset #35 id:680001 of ↵Gravatar egdaniel2015-08-14
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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
* SkScaledCodec classGravatar emmaleer2015-08-14
| | | | | | | | | | | | | | | | | | | | | | 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
* Revert of SkScaledCodec class (patchset #34 id:660001 of ↵Gravatar emmaleer2015-08-13
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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