aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/codec/SkSwizzler.cpp
Commit message (Collapse)AuthorAge
...
* SkScaledCodec classGravatar emmaleer2015-08-13
| | | | | | | | | | | | | | | | | | | | 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
* Revert of SkScaledCodec class (patchset #32 id:620001 of ↵Gravatar emmaleer2015-08-13
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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
* SkScaledCodec classGravatar emmaleer2015-08-13
| | | | | | | | | | | | | | | | | | 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
* Support decoding PNG to 565.Gravatar scroggo2015-08-06
| | | | | | | | | | | | | | | | | | | | | | | | | 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
* Fix ASAN error for wbmp swizzlesGravatar msarett2015-08-05
| | | | | | BUG=skia: Review URL: https://codereview.chromium.org/1269413006
* Scanline decoding for wbmpGravatar msarett2015-08-05
| | | | | | | | | | | | | | | 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
* Make SkSwizzler::Fill() support 565Gravatar msarett2015-07-29
| | | | | | BUG=skia:4135 Review URL: https://codereview.chromium.org/1267543002
* Pass the destination pointer to next() in SkSwizzlerGravatar msarett2015-07-27
| | | | | | | | | | | 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
* SkCodec no longer inherits from SkImageGenerator.Gravatar scroggo2015-07-09
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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
* SkJpegCodecGravatar msarett2015-04-15
| | | | | | | | | | | | 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
* Implementing filling for SkBmpCodecGravatar msarett2015-04-10
| | | | | | | | | | | | | | | 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
* ***Disables swizzles to 565.Gravatar msarett2015-04-09
| | | | | | | | | | | | | | | | | | | | | | | 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
* Add scanline decoding to SkCodec.Gravatar scroggo2015-03-25
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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
* Adding swizzles for bmp:Gravatar msarett2015-03-18
| | | | | | | | | | 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
* Option for SkCodec to treat dst as all zeroes.Gravatar scroggo2015-03-17
| | | | | | | This recreates SkImageDecoder's feature to skip writing zeroes for SkCodec. Review URL: https://codereview.chromium.org/980903002
* Revert "Revert of fix for invalid for loop syntax broke build (patchset #1 ↵Gravatar msarett2015-03-16
| | | | | | | | | | | | | | | | 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
* Revert "Implementation of image decoding for bmp files, in accordance with ↵Gravatar msarett2015-03-16
| | | | | | | | | | | | | the new API." This reverts commit 3675874468de7228944ce21922e6ec863f5f2310. BUG=skia: NOTREECHECKS=true NOTRY=true TBR= Review URL: https://codereview.chromium.org/1012873002
* Implementation of image decoding for bmp files, in accordance with the new API.Gravatar msarett2015-03-16
| | | | | | | | | | Currently decodes to opaque and unpremul. Tested on local test suite. BUG=skia:3257 Review URL: https://codereview.chromium.org/947283002
* Add SkCodec, including PNG implementation.Gravatar scroggo2015-03-03
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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
* Revert of Add SkCodec, including PNG implementation. (patchset #24 id:460001 ↵Gravatar scroggo2015-03-02
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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
* Add SkCodec, including PNG implementation.Gravatar scroggo2015-03-02
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