aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/core/SkColorSpaceXform.cpp
Commit message (Collapse)AuthorAge
* Enable legacy premuls in SkColorSpaceXformGravatar Matt Sarett2017-02-22
| | | | | | | | | | | | | | | | | | | | | ***Will allow for simplified Android framework code, they typically want a color correct transform followed by a gamma encoded premul. ***Chrome does the same, so this will make it easier to replace their codecs. ***Will decrease code size. Both types of premuls are moved off the fast path here - one is essentially unused in production and the other is not "encouraged". ***Will actually make the common case faster: sRGB->sRGB means no color xform, just premul in SkSwizzler. BUG=skia: CQ_INCLUDE_TRYBOTS=skia.primary:Test-Ubuntu-GCC-GCE-CPU-AVX2-x86_64-Release-SKNX_NO_SIMD Change-Id: Ia4ec1d273b6f137151f951d37c0ebf975f6b9a3e Reviewed-on: https://skia-review.googlesource.com/8848 Reviewed-by: Mike Klein <mtklein@chromium.org> Commit-Queue: Matt Sarett <msarett@google.com>
* Move shader register setup to SkRasterPipelineBlitter.Gravatar Mike Klein2017-01-23
| | | | | | | | | | | | | | | | | | | | | We've been seeding the initial values of our registers to x+0.5,y+0.5, 1,0, 0,0,0,0 (useful values for shaders to start with) in all pipelines. This CL changes that to do so only when blitting, and only when we have a shader. The nicest part of this change is that SkRasterPipeline itself no longer needs to have a concept of y, or what x means. It just marches x through [x,x+n), and the blitter handles y and layers the meaning of "dst x coordinate" onto x. This ought to make SkSplicer a little easier to work with too. dm --src gm --config f16 srgb 565 all draws the same. Change-Id: I69d8c1cc14a06e5dfdd6a7493364f43a18f8dec5 Reviewed-on: https://skia-review.googlesource.com/7353 Reviewed-by: Herb Derby <herb@google.com> Commit-Queue: Mike Klein <mtklein@chromium.org>
* Reland "Respect full precision for RGB16 PNGs" (part 2)Gravatar Matt Sarett2017-01-19
| | | | | | | | | | | | | | | | | | | | | This lands all the new xform hooks but no change to src/codec. So the new decode features are turned off. I'm relanding this in pieces to try to bisect a strange MSAN error. 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: I451a2a29c73ca475e9e7a5ded58d4948d6b8be19 Reviewed-on: https://skia-review.googlesource.com/7277 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>
* Fix SkColorSpaceXform F16 behaviorGravatar Matt Sarett2017-01-09
| | | | | | | | | | | | | | | | | | After changing the matrix representation, we are no longer guaranteed that the "a" in "rgba" is zeroed in store_f16_1() opaque. This fixed Gold: https://gold.skia.org/search?blame=26a0543579cf7473de2099ce0d056ac8aba83811&head=true&include=false&limit=50&neg=false&pos=false&query=source_type%3DcolorImage&unt=true Also tacked on an optimization. No need to load alpha when the image is opaque. BUG=skia: Change-Id: I28d80c486b6644eee4a38a7a70f94eb51474e4b0 Reviewed-on: https://skia-review.googlesource.com/6738 Reviewed-by: Mike Klein <mtklein@chromium.org> Commit-Queue: Matt Sarett <msarett@google.com>
* Merge SkColorSpaceXform_XYZ and SkColorSpaceXform_PipelineGravatar Matt Sarett2017-01-04
| | | | | | | | | | | | Use the pipeline implementation to handle F32. This refactor has been broken away from the following mega-CL. https://skia-review.googlesource.com/c/6260/ Change-Id: I79d8992f8c4a7e4dbf674a78484057a6b7f4f123 Reviewed-on: https://skia-review.googlesource.com/6585 Reviewed-by: Mike Klein <mtklein@chromium.org> Commit-Queue: Matt Sarett <msarett@google.com>
* Fix swapped interpretation of c and e in SkColorSpace_ICCGravatar Matt Sarett2016-12-19
| | | | | | | | | | | | | | | | The ICC errata supports the opposite of what we do. http://www.color.org/icc_specs2.xalter TBR=reed@google.com BUG=skia: CQ_INCLUDE_TRYBOTS=skia.primary:Test-Ubuntu-GCC-GCE-CPU-AVX2-x86_64-Release-SKNX_NO_SIMD Change-Id: I18ace7f312926b264e624c30d8cb983eff5c434b Reviewed-on: https://skia-review.googlesource.com/6277 Commit-Queue: Matt Sarett <msarett@google.com> Reviewed-by: Brian Osman <brianosman@google.com>
* Fix max/min errorGravatar Matt Sarett2016-12-04
| | | | | | | | | BUG=skia: Change-Id: I6a690e843476e31077a90a8312f6335d8ef230f4 Reviewed-on: https://skia-review.googlesource.com/5544 Reviewed-by: Matt Sarett <msarett@google.com> Commit-Queue: Matt Sarett <msarett@google.com>
* Fix Chrome Linux - temporarily turn off xform pipelineGravatar Matt Sarett2016-12-02
| | | | | | | | | | BUG:670620 Change-Id: Ic481d09a7112ef05f53fa1f94a7c155870c43408 Reviewed-on: https://skia-review.googlesource.com/5501 Commit-Queue: Matt Sarett <msarett@google.com> Reviewed-by: Brian Osman <brianosman@google.com> Reviewed-by: Jeremy Roman <jbroman@chromium.org>
* SkColorSpaceXform bug fixes attempt 2Gravatar Matt Sarett2016-12-01
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | (1) Clamping If we're going to clamp (8888 outputs), we need to clamp properly to alpha (not 1) when we premultiply. This fix is made in SkColorSpaceXform_XYZ. An alternative fix would move all clamping out of the store functions, to before the gamma encoding. This generally makes sense, but the "to 2.2 conversion" may introduce NaNs and always needs a clamp. So another fix is to just have an extra clamp in the store 2.2 function. Since we have two pipelines, let's try this one in SkColorSpaceXform_Pipeline :). (2) Correctly handle the memcpy() case. This is not changed from a previous (reverted) CL. Looks like this only ever worked for RGBA inputs, never got updated when we added BGRA inputs. This probably flew under the radar because the clients are smart enough to avoid performing a color xform altogether when the color spaces match. BUG=skia: CQ_INCLUDE_TRYBOTS=skia.primary:Test-Ubuntu-GCC-GCE-CPU-AVX2-x86_64-Release-SKNX_NO_SIMD Change-Id: I0b59239d2488ce9fdbe11efbd96567e420bb9813 Reviewed-on: https://skia-review.googlesource.com/5464 Commit-Queue: Matt Sarett <msarett@google.com> Reviewed-by: Mike Klein <mtklein@chromium.org>
* Skip clamps in color xform pipelines if possible.Gravatar Mike Klein2016-12-01
| | | | | | | | | | | | This does skip clamp_0 when converting sRGB to your default colorspace. Each clamp is ~2% of the pipeline runtime, so it's small, but might as well. Change-Id: I2bb0dadf84759c31cc825f9b6b17680e7aa7d9f3 Reviewed-on: https://skia-review.googlesource.com/5467 Reviewed-by: Mike Klein <mtklein@chromium.org> Reviewed-by: Matt Sarett <msarett@google.com> Commit-Queue: Mike Klein <mtklein@chromium.org>
* Optimized gamma table inversion.Gravatar raftias2016-12-01
| | | | | | | | | | | | | | Brought calculation into a central place so the loop did not have to recalculate everything before the previous entry to find the inverse index. O(n) vs O(n^2). Assumes an increasing (or at least non-decreasing) table gamma just as the previous code did. BUG=skia: Change-Id: I7ea200c06511b3d74745fe4a6e3dde706bbee02f Reviewed-on: https://skia-review.googlesource.com/5402 Commit-Queue: Robert Aftias <raftias@google.com> Reviewed-by: Matt Sarett <msarett@google.com>
* Reland "Add RasterPipeline implementation for SkColorSpaceXform"Gravatar Matt Sarett2016-12-01
| | | | | | | | | | | | | | | | | | | This is initially turned on for Linux debug builds, which allows us to start testing. Chrome for Android is a really good candidate for this (will appreciate the code size savings), but I'd first like to run some tests to understand the performance/size tradeoffs a little better. BUG:660416 CQ_INCLUDE_TRYBOTS=skia.primary:Test-Ubuntu-GCC-GCE-CPU-AVX2-x86_64-Release-SKNX_NO_SIMD Change-Id: Ifc80e663767df6bb767abb8b12b1ec5cec644ec5 Reviewed-on: https://skia-review.googlesource.com/5452 Reviewed-by: Matt Sarett <msarett@google.com> Commit-Queue: Matt Sarett <msarett@google.com>
* Revert "SkColorSpaceXform bug fixes"Gravatar Matt Sarett2016-12-01
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This reverts commit d0fdc0f234b8b55cf418f4db9466d3883deadfb1. Reason for revert: <INSERT REASONING HERE> Original change's description: > SkColorSpaceXform bug fixes > > (1) Clamp properly! > > Finally came to this realization: clamping in the > store functions (after gamma encoding) is ridiculous. > It is impossible to know how to clamp premul values > to alpha when they are already gamma encoded. > > I've moved the clamp out of the store function. > Whew, this actually makes the code look simpler. > > And I expect this to fix some buggy images on Gold! > > (2) Correctly handle the memcpy() case. > > Looks like this only ever worked for RGBA inputs, > never got updated when we added BGRA inputs. > > This probably flew under the radar because the > clients are smart enough to avoid performing a > color xform altogether when the color spaces > match. > > BUG=skia: > > Change-Id: I4870048105efcbecc70b4bd5f77c39537006363e > Reviewed-on: https://skia-review.googlesource.com/5389 > Commit-Queue: Mike Klein <mtklein@chromium.org> > Reviewed-by: Mike Klein <mtklein@chromium.org> > TBR=mtklein@chromium.org,mtklein@google.com,msarett@google.com,reviews@skia.org NOPRESUBMIT=true NOTREECHECKS=true NOTRY=true Change-Id: Id9e4cfdaa7b30a3841e83c4cde16aa7d33acc0f2 Reviewed-on: https://skia-review.googlesource.com/5457 Commit-Queue: Matt Sarett <msarett@google.com> Reviewed-by: Matt Sarett <msarett@google.com>
* Revert "Add RasterPipeline implementation for SkColorSpaceXform"Gravatar Brian Osman2016-12-01
| | | | | | | | | | | This reverts commit dd19ac7d10c7c00dd6e9b1f4c4c6aae729c7e6d4. Reason for revert: ASAN Change-Id: I59aacc092398c4db40696a8343d657a5ad7c0f66 Reviewed-on: https://skia-review.googlesource.com/5448 Commit-Queue: Brian Osman <brianosman@google.com> Reviewed-by: Brian Osman <brianosman@google.com>
* Add RasterPipeline implementation for SkColorSpaceXformGravatar Matt Sarett2016-12-01
| | | | | | | | | | | | | | | | | | | This is initially turned on for Linux debug builds, which allows us to start testing. Chrome for Android is a really good candidate for this (will appreciate the code size savings), but I'd first like to run some tests to understand the performance/size tradeoffs a little better. BUG:660416 CQ_INCLUDE_TRYBOTS=skia.primary:Test-Ubuntu-GCC-GCE-CPU-AVX2-x86_64-Release-SKNX_NO_SIMD Change-Id: I0fb2512216dfc0bda2e5388f9865318eec22291e Reviewed-on: https://skia-review.googlesource.com/5348 Commit-Queue: Mike Klein <mtklein@chromium.org> Reviewed-by: Mike Klein <mtklein@chromium.org>
* SkColorSpaceXform bug fixesGravatar Matt Sarett2016-12-01
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | (1) Clamp properly! Finally came to this realization: clamping in the store functions (after gamma encoding) is ridiculous. It is impossible to know how to clamp premul values to alpha when they are already gamma encoded. I've moved the clamp out of the store function. Whew, this actually makes the code look simpler. And I expect this to fix some buggy images on Gold! (2) Correctly handle the memcpy() case. Looks like this only ever worked for RGBA inputs, never got updated when we added BGRA inputs. This probably flew under the radar because the clients are smart enough to avoid performing a color xform altogether when the color spaces match. BUG=skia: Change-Id: I4870048105efcbecc70b4bd5f77c39537006363e Reviewed-on: https://skia-review.googlesource.com/5389 Commit-Queue: Mike Klein <mtklein@chromium.org> Reviewed-by: Mike Klein <mtklein@chromium.org>
* Initial implementation of a SkColorSpace_A2B xformGravatar raftias2016-11-11
| | | | | | | | | | | | | | | | There is support for all features of SkColorSpace_A2B. Tests for these functionality were adapted from the XYZ xform, plus a CLUT-specific test was added. Shared functions used by both SkColorSpaceXform_XYZ and SkColorSpaceXform_A2B have been moved into a shared header. BUG=skia: GOLD_TRYBOT_URL= https://gold.skia.org/search?issue=2449243003 CQ_INCLUDE_TRYBOTS=master.client.skia:Test-Ubuntu-GCC-GCE-CPU-AVX2-x86_64-Release-SKNX_NO_SIMD-Trybot Review-Url: https://codereview.chromium.org/2449243003
* Clamp parametric gamma values to 0-1 rangeGravatar Matt Sarett2016-11-10
| | | | | | | | | | | BUG=skia: GOLD_TRYBOT_URL= https://gold.skia.org/search?issue=4641 Change-Id: I1c6963da956500deea559d5ece31529add89980a Reviewed-on: https://skia-review.googlesource.com/4641 Reviewed-by: Robert Aftias <raftias@google.com> Commit-Queue: Matt Sarett <msarett@google.com>
* Help msvs compile SkColorSpaceXform fasterGravatar Matt Sarett2016-10-24
| | | | | | | | | | | | | | Allowing MSVS to choose to not inline color_xform_RGBA will prevent the complexity from exploding. BUG=skia: GOLD_TRYBOT_URL= https://gold.skia.org/search?issue=3884 Change-Id: I31ab0754c6cc375d6d0e71ceb16afef1927bb4e3 Reviewed-on: https://skia-review.googlesource.com/3884 Reviewed-by: Mike Klein <mtklein@chromium.org> Commit-Queue: Matt Sarett <msarett@google.com>
* Use SK_ALWAYS_INLINE in SkColorSpaceXformGravatar Matt Sarett2016-10-24
| | | | | | | | | | | | | | | | | | | Two reasons for this: (1) We care about the performance of this code, and Windows isn't very good at inlining. Let's make sure we isntruct the compiler to inline. (2) Since landing uses of this in Chrome, we're seeing flaky LayoutTests that appear to be timing related. I'm (very optimistically) hoping that this will help. BUG=skia: GOLD_TRYBOT_URL= https://gold.skia.org/search?issue=3744 Change-Id: Ibb6d9c4252c0b8ce62203fe65c7dd296248982c8 Reviewed-on: https://skia-review.googlesource.com/3744 Commit-Queue: Matt Sarett <msarett@google.com> Reviewed-by: Mike Klein <mtklein@chromium.org>
* Fix for Chrome MSANGravatar Matt Sarett2016-10-21
| | | | | | | | | | | | | | | | | | I believe that the complaints are occurring because the |a| vector might be uninitialized where it is used here. It doesn't actually matter because we won't use or store that value - it's just a placeholder. But we need to make the bot happy. BUG=skia: GOLD_TRYBOT_URL= https://gold.skia.org/search?issue=3800 Change-Id: I1891da9d1d2708008e4606daebf9bb6f96e92fc0 Reviewed-on: https://skia-review.googlesource.com/3800 Commit-Queue: Matt Sarett <msarett@google.com> Reviewed-by: Mike Klein <mtklein@chromium.org>
* Hash the gamut of XYZ color spaces, to speed up comparisonGravatar Brian Osman2016-10-20
| | | | | | | | | | | | | | Also going to use this to allow caching of GrColorSpaceXforms BUG=skia: GOLD_TRYBOT_URL= https://gold.skia.org/search?issue=3670 Change-Id: I56ed2dcbdddc22046263f56d68f2d6aea55547c8 Reviewed-on: https://skia-review.googlesource.com/3670 Commit-Queue: Brian Osman <brianosman@google.com> Reviewed-by: Matt Sarett <msarett@google.com> Reviewed-by: Brian Salomon <bsalomon@google.com>
* Refactored SkColorSpace and added in a Lab PCS GMGravatar raftias2016-10-18
| | | | | | | | | | | | | | | | | | | | The refactoring breaks off A2B0 tag support into a separate subclass of SkColorSpace_Base, while keeping the current (besides CLUT) functionality in a XYZTRC subclass. ICC profile loading is now aware of this and creates the A2B0 subclass when SkColorSpace::NewICC() is called on a profile in need of the A2B0 functionality. The LabPCSDemo GM loads a .icc profile containing a LAB PCS and then runs a Lab->XYZ conversion on an image using it so we can display it and test out the A2B0 SkColorSpace functionality, sans a/b/m-curves, as well as the Lab->XYZ conversion code. BUG=skia: GOLD_TRYBOT_URL= https://gold.skia.org/search?issue=2389983002 Review-Url: https://codereview.chromium.org/2389983002
* Cache dst LUTs in SkColorSpaceXformGravatar Matt Sarett2016-10-16
| | | | | | | | | | | | | | | | | | | | | | This is only useful in the rare case that the dst does not fall into one of our main paths. But it's a good optimization, since this does happen, and typically, the dst won't change. ColorCodecBench z620 --nonstd --xform_only Without Patch 511us With Patch 348us BUG=skia: GOLD_TRYBOT_URL= https://gold.skia.org/search?issue=3400 Change-Id: Ibf68d9ce7072680465662922f4aa15630545e3d6 Reviewed-on: https://skia-review.googlesource.com/3400 Reviewed-by: Mike Klein <mtklein@chromium.org> Reviewed-by: Mike Reed <reed@google.com> Commit-Queue: Matt Sarett <msarett@google.com>
* Refactor color_xform_RGBA() to improve performanceGravatar Matt Sarett2016-10-14
| | | | | | | | | | | | | | | | | | | | | | | | | | | Now that we've identified this as the "fast path", it has become (somewhat) stable, and I'm ready to ship it, I feel comfortable playing games with clang to get the behavior we want. toSRGB Performance on HP z620: Before: 370us or 470us (depending on the mood of my computer) After: 345us (or better, always) My guess is that clang optimizers do a better job of interleaving instructions effectively when we put everything into one function. Regardless of being silly about performance, I also acutally prefer how the code reads this way. BUG=skia: GOLD_TRYBOT_URL= https://gold.skia.org/search?issue=3440 Change-Id: Id7a40fb9966341ab184a5331b3e4da19b3af3344 Reviewed-on: https://skia-review.googlesource.com/3440 Commit-Queue: Matt Sarett <msarett@google.com> Commit-Queue: Mike Klein <mtklein@chromium.org> Reviewed-by: Mike Klein <mtklein@chromium.org>
* Add SkColorSpaceTransferFn to SkColorSpaceGravatar Matt Sarett2016-10-11
| | | | | | | | | | | BUG=skia: GOLD_TRYBOT_URL= https://gold.skia.org/search?issue=3178 Change-Id: I354342d4469cee0e25a7b0d189e925e431da623c Reviewed-on: https://skia-review.googlesource.com/3178 Reviewed-by: Mike Reed <reed@google.com> Commit-Queue: Matt Sarett <msarett@google.com>
* Add SkColorSpaceXform to the public APIGravatar msarett2016-10-11
| | | | | | | BUG=skia: GOLD_TRYBOT_URL= https://gold.skia.org/search?issue=2390263002 Review-Url: https://codereview.chromium.org/2390263002
* Make load4 and store4 part of SkNx properly.Gravatar Mike Klein2016-10-06
| | | | | | | | | | | | | | | Every type now nominally has Load4() and Store4() methods. The ones that we use are implemented. BUG=skia: GOLD_TRYBOT_URL= https://gold.skia.org/search?issue=3046 CQ_INCLUDE_TRYBOTS=master.client.skia:Test-Ubuntu-GCC-GCE-CPU-AVX2-x86_64-Release-SKNX_NO_SIMD-Trybot Change-Id: I7984f0c2063ef8acbc322bd2e968f8f7eaa0d8fd Reviewed-on: https://skia-review.googlesource.com/3046 Reviewed-by: Matt Sarett <msarett@google.com> Commit-Queue: Mike Klein <mtklein@chromium.org>
* Fixed invalid memory access issue in SkColorSpaceXform::apply()Gravatar raftias2016-09-29
| | | | | | | | | | | | | | | | | Passing in a large buffer along with a source colour space that used a CLUT would cause apply() to read freed heap memory, or for smaller buffers read possibly re-used stack memory. The code previously likely lucked out due to optimizations removing most or all of the subsequent stack allocations. BUG=skia: GOLD_TRYBOT_URL= https://gold.skia.org/search?issue=2759 Change-Id: I39f357bce080c4d737a83dd019f0d1ccbc56f995 Reviewed-on: https://skia-review.googlesource.com/2759 Commit-Queue: Robert Aftias <raftias@google.com> Reviewed-by: Matt Sarett <msarett@google.com>
* Move toXYZD50() to SkColorSpace_BaseGravatar msarett2016-09-28
| | | | | | | | | | | | SkColorSpace needs to become more versatile, in order to support profiles that cannot specified with just a "to XYZ D50" matrix. This a just first step to clean up the public API. BUG=skia: GOLD_TRYBOT_URL= https://gold.skia.org/search?issue=2381553002 Review-Url: https://codereview.chromium.org/2381553002
* G instead of R, thanks GoldGravatar msarett2016-09-22
| | | | | | | | | NOTRY=true TBR=mtklein@google.com BUG=skia: GOLD_TRYBOT_URL= https://gold.skia.org/search?issue=2362863002 Review-Url: https://codereview.chromium.org/2362863002
* Add BGRA as input format to SkColorSpaceXformGravatar msarett2016-09-22
| | | | | | | | | | This is immediately useful for webp and I think it's a fair guess that BGRA src formats are not uncommon. BUG=skia: GOLD_TRYBOT_URL= https://gold.skia.org/search?issue=2353363008 Review-Url: https://codereview.chromium.org/2353363008
* Make SkColorSpaceXform::New() take bare ptrsGravatar msarett2016-09-22
| | | | | | | | | | There's no need to take sk_sp if we're not going to ref the ptr. BUG=skia: GOLD_TRYBOT_URL= https://gold.skia.org/search?issue=2360863003 Review-Url: https://codereview.chromium.org/2360863003
* Support Float32 output from SkColorSpaceXformGravatar msarett2016-09-16
| | | | | | | | | | | | | | | * Adds Float32 support to SkColorSpaceXform * Changes API to allows clients to ask for F32, updates clients to new API * Adds Sk4f_load4 and Sk4f_store4 to SkNx * Make use of new xform in SkGr.cpp BUG=skia: GOLD_TRYBOT_URL= https://gold.skia.org/search?issue=2339233003 CQ_INCLUDE_TRYBOTS=master.client.skia:Test-Ubuntu-GCC-GCE-CPU-AVX2-x86_64-Release-SKNX_NO_SIMD-Trybot Committed: https://skia.googlesource.com/skia/+/43d6651111374b5d1e4ddd9030dcf079b448ec47 Review-Url: https://codereview.chromium.org/2339233003
* Revert of Support Float32 output from SkColorSpaceXform (patchset #7 ↵Gravatar msarett2016-09-16
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | id:140001 of https://codereview.chromium.org/2339233003/ ) Reason for revert: Hitting an assert Original issue's description: > Support Float32 output from SkColorSpaceXform > > * Adds Float32 support to SkColorSpaceXform > * Changes API to allows clients to ask for F32, updates clients to > new API > * Adds Sk4f_load4 and Sk4f_store4 to SkNx > * Make use of new xform in SkGr.cpp > > BUG=skia: > GOLD_TRYBOT_URL= https://gold.skia.org/search?issue=2339233003 > CQ_INCLUDE_TRYBOTS=master.client.skia:Test-Ubuntu-GCC-GCE-CPU-AVX2-x86_64-Release-SKNX_NO_SIMD-Trybot > > Committed: https://skia.googlesource.com/skia/+/43d6651111374b5d1e4ddd9030dcf079b448ec47 TBR=brianosman@google.com,mtklein@google.com,scroggo@google.com,mtklein@chromium.org,bsalomon@google.com # Skipping CQ checks because original CL landed less than 1 days ago. NOPRESUBMIT=true NOTREECHECKS=true NOTRY=true BUG=skia: Review-Url: https://codereview.chromium.org/2347473007
* Support Float32 output from SkColorSpaceXformGravatar msarett2016-09-16
| | | | | | | | | | | | | | * Adds Float32 support to SkColorSpaceXform * Changes API to allows clients to ask for F32, updates clients to new API * Adds Sk4f_load4 and Sk4f_store4 to SkNx * Make use of new xform in SkGr.cpp BUG=skia: GOLD_TRYBOT_URL= https://gold.skia.org/search?issue=2339233003 CQ_INCLUDE_TRYBOTS=master.client.skia:Test-Ubuntu-GCC-GCE-CPU-AVX2-x86_64-Release-SKNX_NO_SIMD-Trybot Review-Url: https://codereview.chromium.org/2339233003
* Don't let the compiler complain that |a| is uninitGravatar msarett2016-09-14
| | | | | | | | | TBR=mtklein@google.com NOTRY=true BUG=skia: GOLD_TRYBOT_URL= https://gold.skia.org/search?issue=2339793003 Review-Url: https://codereview.chromium.org/2339793003
* Store SkColorSpaceXform gamma LUTs in a malloced fieldGravatar msarett2016-09-14
| | | | | | | | | | | | | | | | | | In order of likelihood: (1) Tables are never used, since gamma is recognized and named. (2) Only use one table, since all three gammas are the same. (3) Actually need three tables. No reason to waste a bunch of space for these tables on SkColorSpaceXform, when it will likely be unused. This will be more efficient in lots of cases, but is particularly useful when the client really only wants a gamut xform. BUG=skia: GOLD_TRYBOT_URL= https://gold.skia.org/search?issue=2336913005 Review-Url: https://codereview.chromium.org/2336913005
* Convert back to 0-255 scale before storing linear bytesGravatar msarett2016-09-14
| | | | | | | | TBR=mtklein@google.com BUG=skia: GOLD_TRYBOT_URL= https://gold.skia.org/search?issue=2338203005 Review-Url: https://codereview.chromium.org/2338203005
* Reduce overhead for linear color xformsGravatar msarett2016-09-14
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | We used to build src and dst transfer fn tables every time a new xform was created with linear src and dst. Now we don't compute them because we don't need them. This will make SkColorSpaceXform a far better option for any xforms with float or half-float inputs or outputs, particularly on a small number of pixels. This CL also moves SkColorSpaceXform closer to what I anticipate will be the eventual 'API design'. I think apply() will want to take a SrcColorType enum (not created yet because it's not necessary yet) and a DstColorType enum (still using SkColorType because there's not yet a reason not to). Performance changes: toSRGB 341us -> 366us to2Dot2 404us -> 403us toF16 318us -> 304us There's no reason for toSRGB or to2Dot2 to change. The refactor seems to have caused the compiler to order the instructions a little differently... This is something to come back to if we need to squeeze more performance out of sRGB. For now, let's not be held up by something we don't control. F16 likely improves because we are no longer (unnecessarily) building the linear tables. Code size gets a little bigger. Measuring SkColorSpaceXform size as a percentage of src/ size, we go from 0.8% to 1.4%. BUG=skia: GOLD_TRYBOT_URL= https://gold.skia.org/search?issue=2335723002 Review-Url: https://codereview.chromium.org/2335723002
* Fix storage of gamut transform matrices in SkColorSpaceGravatar brianosman2016-09-09
| | | | | | | | | | | | | | | We were effectively storing the transpose, which made all of our operations on individual colors, and our concatenation of matrices awkward and backwards. I'm planning to push this further into Ganesh, where I had incorrectly adjusted to the previous layout, treating colors as row vectors in the shaders. BUG=skia: GOLD_TRYBOT_URL= https://gold.skia.org/search?issue=2324843003 Review-Url: https://codereview.chromium.org/2324843003
* Delete some LUTs from SkColorSpaceXformGravatar msarett2016-09-09
| | | | | | | | | | No need to keep these around. In the rare case that these are needed, we can just go ahead and build them. BUG=skia: GOLD_TRYBOT_URL= https://gold.skia.org/search?issue=2326043002 Review-Url: https://codereview.chromium.org/2326043002
* Cache the inverse matrix on SkColorSpace. Rename xyz() to toXYZ().Gravatar brianosman2016-09-08
| | | | | | | BUG=skia: GOLD_TRYBOT_URL= https://gold.skia.org/search?issue=2323003002 Review-Url: https://codereview.chromium.org/2323003002
* Delete SkColorSpace::gammaNamed() from public APIGravatar msarett2016-09-07
| | | | | | | | | Move fGammaNamed to SkColorSpace_Base. BUG=skia: GOLD_TRYBOT_URL= https://gold.skia.org/search?issue=2318663003 Review-Url: https://codereview.chromium.org/2318663003
* Fix generic color space xform, ColorSpaceXformTestGravatar msarett2016-08-23
| | | | | | | BUG=skia: GOLD_TRYBOT_URL= https://gold.skia.org/search?issue=2275563002 Review-Url: https://codereview.chromium.org/2275563002