History log of /external/skia/src/codec/SkJpegCodec.h
Revision Date Author Comments (<<< Hide modified files) (Show modified files >>>)
c6f7a4ffa9522159efc42f7c948bba5e66bb8844 04-Dec-2017 Leon Scroggins III <scroggo@google.com> Hide SkEncodedInfo

Bug: skia:7353
Bug: skia:6839

This contains information that is not necessary for clients to know. The
Color enum tells the number of components in the input, but this is only
interesting internally (to the SkSwizzler).

Similarly, the Alpha enum differs from SkAlphaType in that it has
kBinary instead of kPremul. This is useful information only internally
for determining whether the SkColorSpaceXform needs to premultiply.

The bitsPerComponent is potentially useful for a client; Android (in
SkAndroidCodec) uses it to determine the SkColorType. Rather than
exposing bitsPerComponent, use it to make the same decision that Android
would have made - 16 bits per component means to set the info to F16. Add
a test that computeOutputColorType behaves as expected.

Switch conversionSupported to use an SkColorType, which is enough info.

Replace the SkEncodedInfo::Alpha field on SkCodec::FrameInfo with an
SkAlphaType.

SkCodec still needs an SkEncodedInfo, so move its header (which is
already not SK_API) to include/private.

Change-Id: Ie2cf11339bf999ebfd4390c0f448f7edd6feabda
Reviewed-on: https://skia-review.googlesource.com/79260
Reviewed-by: Mike Reed <reed@google.com>
Reviewed-by: Mike Klein <mtklein@chromium.org>
Commit-Queue: Leon Scroggins <scroggo@google.com>
/external/skia/src/codec/SkJpegCodec.h
b6ab10f34b407d9db9efb69b31849cef010328e3 18-Oct-2017 Leon Scroggins III <scroggo@google.com> Move SkCodec::Origin into its own file

It is now used by SkPixmap and will soon be in SkJpegEncoder. No need
for those to depend on SkCodec.

Bug: 768878
TBR=reed@google.com
(reed@ already approved the API change in
https://skia-review.googlesource.com/60721)
Change-Id: If1a6e1d5b60a7a3d8c97818e15a48d28ba804668
Reviewed-on: https://skia-review.googlesource.com/61680
Reviewed-by: Leon Scroggins <scroggo@google.com>
Commit-Queue: Leon Scroggins <scroggo@google.com>
/external/skia/src/codec/SkJpegCodec.h
021e5c70160c9682e8d8ab6e2c36a3cb3f57604a 18-Oct-2017 Ben Wagner <benjaminwagner@google.com> Revert "Add an Option for orientation on JPEG encodes"

This reverts commit 5411a60e0d7370a5d47b5049de845a06fe52e98b.

Reason for revert: ASAN and Coverage failing: https://chromium-swarm.appspot.com/task?id=394978f3b7d44610
Flutter_Android failing.

Original change's description:
> Add an Option for orientation on JPEG encodes
>
> Move Origin to its own header so that SkPixmap and SkJpegEncoder need
> not depend on SkCodec.
>
> Add libexif, which is already used by Android, and use it to write the
> orientation. Write a makefile based on the Android.bp in Android, minus
> warnings. (libexif has an LGPL license.)
>
> Add a test that verifies all the orientations work.
>
> Optionally enable writing the orientation (and therefore including
> libexif). Chromium does not currently need it, and Android does not
> expose an API that would allow using it. Disable on Windows, where we
> still have build errors to fix.
>
> Bug: skia:7138
> Change-Id: Iaeff44c36aebe0e639666979dc00e1b7594bbeb1
> Reviewed-on: https://skia-review.googlesource.com/60721
> Commit-Queue: Leon Scroggins <scroggo@google.com>
> Reviewed-by: Mike Klein <mtklein@chromium.org>
> Reviewed-by: Mike Reed <reed@google.com>

TBR=mtklein@chromium.org,mtklein@google.com,scroggo@google.com,reed@google.com

Change-Id: I05b7ae8d1c5bbd1de1642d9ef024943500256273
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Bug: skia:7138
Reviewed-on: https://skia-review.googlesource.com/61620
Reviewed-by: Ben Wagner <benjaminwagner@google.com>
Commit-Queue: Ben Wagner <benjaminwagner@google.com>
/external/skia/src/codec/SkJpegCodec.h
5411a60e0d7370a5d47b5049de845a06fe52e98b 18-Oct-2017 Leon Scroggins III <scroggo@google.com> Add an Option for orientation on JPEG encodes

Move Origin to its own header so that SkPixmap and SkJpegEncoder need
not depend on SkCodec.

Add libexif, which is already used by Android, and use it to write the
orientation. Write a makefile based on the Android.bp in Android, minus
warnings. (libexif has an LGPL license.)

Add a test that verifies all the orientations work.

Optionally enable writing the orientation (and therefore including
libexif). Chromium does not currently need it, and Android does not
expose an API that would allow using it. Disable on Windows, where we
still have build errors to fix.

Bug: skia:7138
Change-Id: Iaeff44c36aebe0e639666979dc00e1b7594bbeb1
Reviewed-on: https://skia-review.googlesource.com/60721
Commit-Queue: Leon Scroggins <scroggo@google.com>
Reviewed-by: Mike Klein <mtklein@chromium.org>
Reviewed-by: Mike Reed <reed@google.com>
/external/skia/src/codec/SkJpegCodec.h
0741818e7ab4e9ea8505b8a8687412f0e3804c65 15-Aug-2017 Leon Scroggins III <scroggo@google.com> Move calls to conversion_possible to SkCodec

Move common code into the base class, so subclasses need not call
conversion_possible.

Use SkEncodedInfo rather than SkImageInfo, and use the proper frame.

API Changes:
- SkAndroidCodec:
- Add getEncodedInfo(), for SkBitmapRegionCodec
- SkEncodedInfo:
- Add opaque() helper
- SkBitmapRegionDecoder:
- Remove unused conversionSupported

(Split off from skia-review.googlesource.com/c/25746)

Bug: skia:5601
Change-Id: If4a40d4b98a3dd0afde2b6058f92315a393a5baf
Reviewed-on: https://skia-review.googlesource.com/34361
Reviewed-by: Mike Klein <mtklein@google.com>
Reviewed-by: Derek Sollenberger <djsollen@google.com>
Commit-Queue: Leon Scroggins <scroggo@google.com>
/external/skia/src/codec/SkJpegCodec.h
ede7bac43fbc69b9fdf1c178890ba6353f5bb140 23-Jul-2017 Mike Reed <reed@google.com> use unique_ptr for codec factories

Will need guards for android (at least)

Bug: skia:
Change-Id: I2bb8e656997984489ef1f2e41cd3d301c4e7b947
Reviewed-on: https://skia-review.googlesource.com/26040
Reviewed-by: Mike Klein <mtklein@chromium.org>
Commit-Queue: Mike Reed <reed@google.com>
/external/skia/src/codec/SkJpegCodec.h
588fb040b3ad410cdb10c87f9a7884b6eb825e90 14-Jul-2017 Leon Scroggins III <scroggo@google.com> Report error on failure to create SkCodec

Update NewFromStream to report an error on failure to create an
SkCodec, so that a client can distinguish between
- not enough data
- invalid data

In Chromium, this will allow blink::ImageDecoder to call SetFailed if
the stream is invalid early and we never create an SkCodec. Without
this, ImageDecoder will keep trying to create an SkCodec when it
receives more data.

Change-Id: I4f505c56d91c982be36a828fd0f7db17b1596588
Reviewed-on: https://skia-review.googlesource.com/22642
Commit-Queue: Leon Scroggins <scroggo@google.com>
Reviewed-by: Derek Sollenberger <djsollen@google.com>
Reviewed-by: Chris Blume <cblume@chromium.org>
/external/skia/src/codec/SkJpegCodec.h
571b30f6117eede6d64cd2b924dc1f6aaa59e70e 11-Jul-2017 Leon Scroggins <scroggo@google.com> Reland "Remove support for decoding to kIndex_8"

Original change's description:
> > Remove support for decoding to kIndex_8
> >
> > Fix up callsites, and remove tests that no longer make sense.
> >
> > Bug: skia:6828
> > Change-Id: I2548c4b7528b7b1be7412563156f27b52c9d4295
> > Reviewed-on: https://skia-review.googlesource.com/21664
> > Reviewed-by: Derek Sollenberger <djsollen@google.com>
> > Commit-Queue: Leon Scroggins <scroggo@google.com>
>
> TBR=djsollen@google.com,scroggo@google.com
>
> Change-Id: I1bc669441f250690884e75a9a61427fdf75c6907
> No-Presubmit: true
> No-Tree-Checks: true
> No-Try: true
> Bug: skia:6828
> Reviewed-on: https://skia-review.googlesource.com/22120
> Reviewed-by: Leon Scroggins <scroggo@google.com>
> Commit-Queue: Leon Scroggins <scroggo@google.com>

TBR=djsollen@google.com,scroggo@google.com

Bug: skia:6828
Change-Id: I36ff5a11c529d29e8adc95f43b8edc6fd1dbf5b8
Reviewed-on: https://skia-review.googlesource.com/22320
Reviewed-by: Leon Scroggins <scroggo@google.com>
Commit-Queue: Leon Scroggins <scroggo@google.com>
/external/skia/src/codec/SkJpegCodec.h
8321f7585b6aded0c35e50e9af8709b25fdce3f6 10-Jul-2017 Leon Scroggins <scroggo@google.com> Revert "Remove support for decoding to kIndex_8"

This reverts commit 742a3e298fda669006147e4a305bab8452369b1f.

Reason for revert: Breaking Android roll:
frameworks/base/core/jni/android/graphics/BitmapFactory.cpp:453:18: error: no member named 'fColorPtr' in 'SkAndroidCodec::AndroidOptions'
codecOptions.fColorPtr = colorPtr;
~~~~~~~~~~~~ ^
frameworks/base/core/jni/android/graphics/BitmapFactory.cpp:454:18: error: no member named 'fColorCount' in 'SkAndroidCodec::AndroidOptions'
codecOptions.fColorCount = colorCount;
~~~~~~~~~~~~ ^

Original change's description:
> Remove support for decoding to kIndex_8
>
> Fix up callsites, and remove tests that no longer make sense.
>
> Bug: skia:6828
> Change-Id: I2548c4b7528b7b1be7412563156f27b52c9d4295
> Reviewed-on: https://skia-review.googlesource.com/21664
> Reviewed-by: Derek Sollenberger <djsollen@google.com>
> Commit-Queue: Leon Scroggins <scroggo@google.com>

TBR=djsollen@google.com,scroggo@google.com

Change-Id: I1bc669441f250690884e75a9a61427fdf75c6907
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Bug: skia:6828
Reviewed-on: https://skia-review.googlesource.com/22120
Reviewed-by: Leon Scroggins <scroggo@google.com>
Commit-Queue: Leon Scroggins <scroggo@google.com>
/external/skia/src/codec/SkJpegCodec.h
742a3e298fda669006147e4a305bab8452369b1f 10-Jul-2017 Leon Scroggins III <scroggo@google.com> Remove support for decoding to kIndex_8

Fix up callsites, and remove tests that no longer make sense.

Bug: skia:6828
Change-Id: I2548c4b7528b7b1be7412563156f27b52c9d4295
Reviewed-on: https://skia-review.googlesource.com/21664
Reviewed-by: Derek Sollenberger <djsollen@google.com>
Commit-Queue: Leon Scroggins <scroggo@google.com>
/external/skia/src/codec/SkJpegCodec.h
7f15b682f4e3e0f61a56d3bbdb8163d3a54b997c 24-Feb-2017 Matt Sarett <msarett@google.com> Fix bug handling CMYK images without color profiles

We need the swizzler to convert CMYK->RGB in some
cases where we do have a color xform.

BUG=skia:

Change-Id: Id467ad03df64368fd5a6c3bd5461566582eb492e
Reviewed-on: https://skia-review.googlesource.com/8973
Commit-Queue: Matt Sarett <msarett@google.com>
Reviewed-by: Leon Scroggins <scroggo@google.com>
/external/skia/src/codec/SkJpegCodec.h
c5eabe7d22834189c77fe95ebaf72fed0ef2bb8e 24-Feb-2017 Matt Sarett <msarett@google.com> Read color space info from raw exif data

b/35516531

Change-Id: I86ad40b059f300375b0293bd96ecb967811f3a07
Reviewed-on: https://skia-review.googlesource.com/8951
Reviewed-by: Leon Scroggins <scroggo@google.com>
Commit-Queue: Matt Sarett <msarett@google.com>
/external/skia/src/codec/SkJpegCodec.h
c8c901fc36816b9a2603a8c129cdca1d2b4d7fe2 24-Jan-2017 Matt Sarett <msarett@google.com> Use appropriate options in SkJpegCodec readRows()

b/34637813

Change-Id: Ibebac2ef8cfe004beb2272c266b580946cedcb08
Reviewed-on: https://skia-review.googlesource.com/7451
Commit-Queue: Matt Sarett <msarett@google.com>
Reviewed-by: Leon Scroggins <scroggo@google.com>
/external/skia/src/codec/SkJpegCodec.h
db6830162eca5b94e61d9825ec93306fc615d204 23-Nov-2016 Hal Canary <halcanary@google.com> SkImageEncoder: simplify API

(re-land 248ff02 & 2cb6cb7, with changes)

- Hide SkImageEncoder class in private header.
- SkImageEncoder::Type becomes SkEncodedImageFormat
- SkEncodedFormat becomes SkEncodedImageFormat
- SkImageEncoder static functions replaced with
single function EncodeImage()
- utility wrappers for EncodeImage() are in
sk_tool_utils.h

TODO: remove link-time registration mechanism.
TODO: clean up clients use of API and flip the flag.
TODO: implement EncodeImage() in chromeium/skia/ext

Change-Id: I47d451e50be4d5c6c130869c7fa7c2857243d9f0
Reviewed-on: https://skia-review.googlesource.com/4909
Reviewed-by: Mike Reed <reed@google.com>
Reviewed-by: Leon Scroggins <scroggo@google.com>
Reviewed-on: https://skia-review.googlesource.com/5186
Commit-Queue: Hal Canary <halcanary@google.com>
Reviewed-by: Hal Canary <halcanary@google.com>
/external/skia/src/codec/SkJpegCodec.h
a2b4bdce8cfd1a91407595a25683ecff982af22e 22-Nov-2016 Hal Canary <halcanary@google.com> Revert 248ff023 & 2cb6cb72

Revert "SkImageEncoder: simplify API"
This reverts commit 248ff02331d7f73ee4b6c5a7eabeae1080c16cd4.
Revert "Fix bug: can't convert nullptr -> bool"
This reverts commit 2cb6cb7218171b357bb5c934f032ba69c7b78401.
GOLD_TRYBOT_URL= https://gold.skia.org/search?issue=5151
NOTRY=true

Change-Id: I5f6414392d6545f74db0b5bb50608d04f053a8ec
Reviewed-on: https://skia-review.googlesource.com/5151
Commit-Queue: Hal Canary <halcanary@google.com>
Reviewed-by: Hal Canary <halcanary@google.com>
/external/skia/src/codec/SkJpegCodec.h
248ff02331d7f73ee4b6c5a7eabeae1080c16cd4 22-Nov-2016 Hal Canary <halcanary@google.com> SkImageEncoder: simplify API

- Hide SkImageEncoder class in private header.
- SkImageEncoder::Type becomes SkEncodedImageFormat
- SkEncodedFormat becomes SkEncodedImageFormat
- SkImageEncoder static functions replaced with
single function EncodeImage()
- utility wrappers for EncodeImage() are in
sk_tool_utils.h

TODO: remove link-time registration mechanism.
TODO: clean up clients use of API and flip the flag.
TODO: implement EncodeImage() in chromeium/skia/ext

GOLD_TRYBOT_URL= https://gold.skia.org/search?issue=4909

Change-Id: Ib48b31fdc05cf23cda7f56ebfd67c841c149ce70
Reviewed-on: https://skia-review.googlesource.com/4909
Reviewed-by: Mike Reed <reed@google.com>
Reviewed-by: Leon Scroggins <scroggo@google.com>
Commit-Queue: Hal Canary <halcanary@google.com>
/external/skia/src/codec/SkJpegCodec.h
145dbcd165d9d27298eb8888bc240e2d06a95464 03-Nov-2016 Ben Wagner <bungeman@google.com> Remove SkAutoTDelete.

Replace with std::unique_ptr.

Change-Id: I5806cfbb30515fcb20e5e66ce13fb5f3b8728176
Reviewed-on: https://skia-review.googlesource.com/4381
Commit-Queue: Ben Wagner <bungeman@google.com>
Reviewed-by: Mike Klein <mtklein@chromium.org>
/external/skia/src/codec/SkJpegCodec.h
a9e9bfc6e40894c0447c044a380c74061cb9e15e 01-Nov-2016 Matt Sarett <msarett@google.com> Delete qcms

This was always intended to be a temporary dependency to use for
testing. It has served its purpose.

Also, this has already been dropped (accidentally, I think) by
the new GN build.

TBR=reed@google.com

BUG=skia:

GOLD_TRYBOT_URL= https://gold.skia.org/search?issue=4220

Change-Id: Ic72ee08bbfaf86ed86a4122fd38be2921eb1327e
Reviewed-on: https://skia-review.googlesource.com/4220
Reviewed-by: Matt Sarett <msarett@google.com>
Reviewed-by: Leon Scroggins <scroggo@google.com>
Commit-Queue: Matt Sarett <msarett@google.com>
/external/skia/src/codec/SkJpegCodec.h
313c4635e3f1005e6807f5b0ad52805f30902d66 20-Oct-2016 Matt Sarett <msarett@google.com> Safely handle unsupported color xforms in SkCodec

(1) The transformation code *should* support any src SkColorSpace
that we successfully parse. This is agreed upon internally and
by clients. The fact that we currently don't is just a bug...
(2) We cannot and will not support all SkColorSpaces as dsts.

So if we fail to make a SkColorSpaceXform, we should assume that
it was caused by a bad dst color space. The correct response in
this case is to return kInvalidConversion. I've rewritten the CL
to do this.

The fact that weird src spaces will sometimes trigger a
kInvalidConversion is just a bug that is being actively worked on.

TBR=reed@google.com

BUG=skia:

GOLD_TRYBOT_URL= https://gold.skia.org/search?issue=3661

Change-Id: Iac2b45120507ec71b1b3d555c61931f7348dad9e
Reviewed-on: https://skia-review.googlesource.com/3661
Commit-Queue: Matt Sarett <msarett@google.com>
Reviewed-by: Leon Scroggins <scroggo@google.com>
Reviewed-by: Robert Aftias <raftias@google.com>
/external/skia/src/codec/SkJpegCodec.h
2ecc35ffa5feb56cd088478589ba1e48382b2e1f 08-Sep-2016 msarett <msarett@google.com> Checking for valid colorType, alphaType, colorSpace in SkCodec

* Refactor to share code between SkPngCodec and SkWebpCodec
* Didn't end up sharing with SkJpegCodec but did refactor
that code a bit
* Disallow conversions to F16 with non-linear color spaces
* Fail to decode if we fail to create a SkColorSpaceXform
(should be an assert soon). We used to fallback on a
legacy decode if we failed to create the transform.
* A bunch of name changes

BUG=skia:
GOLD_TRYBOT_URL= https://gold.skia.org/search?issue=2319293003

Committed: https://skia.googlesource.com/skia/+/7a9900d6d34e437bb24beb5524a1f6488ae138c9
Review-Url: https://codereview.chromium.org/2319293003
/external/skia/src/codec/SkJpegCodec.h
85c922acec37726ac64e9be9a79de697c677f35d 08-Sep-2016 msarett <msarett@google.com> Revert of Checking for valid colorType, alphaType, colorSpace in SkCodec (patchset #2 id:100001 of https://codereview.chromium.org/2319293003/ )

Reason for revert:
Broken perf bots

Original issue's description:
> Checking for valid colorType, alphaType, colorSpace in SkCodec
>
> * Refactor to share code between SkPngCodec and SkWebpCodec
> * Didn't end up sharing with SkJpegCodec but did refactor
> that code a bit
> * Disallow conversions to F16 with non-linear color spaces
> * Fail to decode if we fail to create a SkColorSpaceXform
> (should be an assert soon). We used to fallback on a
> legacy decode if we failed to create the transform.
> * A bunch of name changes
>
> BUG=skia:
> GOLD_TRYBOT_URL= https://gold.skia.org/search?issue=2319293003
>
> Committed: https://skia.googlesource.com/skia/+/7a9900d6d34e437bb24beb5524a1f6488ae138c9

TBR=scroggo@google.com,brianosman@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/2328663002
/external/skia/src/codec/SkJpegCodec.h
7a9900d6d34e437bb24beb5524a1f6488ae138c9 08-Sep-2016 msarett <msarett@google.com> Checking for valid colorType, alphaType, colorSpace in SkCodec

* Refactor to share code between SkPngCodec and SkWebpCodec
* Didn't end up sharing with SkJpegCodec but did refactor
that code a bit
* Disallow conversions to F16 with non-linear color spaces
* Fail to decode if we fail to create a SkColorSpaceXform
(should be an assert soon). We used to fallback on a
legacy decode if we failed to create the transform.
* A bunch of name changes

BUG=skia:
GOLD_TRYBOT_URL= https://gold.skia.org/search?issue=2319293003

Review-Url: https://codereview.chromium.org/2319293003
/external/skia/src/codec/SkJpegCodec.h
da19f6f3b5f1375c854a9bde947c12099afc25c7 23-Aug-2016 mtklein <mtklein@chromium.org> Assume all TURBO_HAS_* are true.

Should be everyone's on libjpeg-turbo >= 1.5.0.

BUG=skia:
GOLD_TRYBOT_URL= https://gold.skia.org/search?issue=2274643002

Review-Url: https://codereview.chromium.org/2274643002
/external/skia/src/codec/SkJpegCodec.h
6fd4c05aaf6f409b8c97ec97eb1041c0dd6a15b4 02-Aug-2016 msarett <msarett@google.com> Fix SkJpegCodec::onSkipScanlines when TURBO_HAS_SKIP is not defined

I think I just broke this in:
https://codereview.chromium.org/2174493002/

BUG=skia:
GOLD_TRYBOT_URL= https://gold.skia.org/search?issue=2202763002

Review-Url: https://codereview.chromium.org/2202763002
/external/skia/src/codec/SkJpegCodec.h
50ce1f28ffede3fa3e38d330d4114ee52b387848 29-Jul-2016 msarett <msarett@google.com> Add color space xform support to SkJpegCodec (includes F16!)

Also changes SkColorXform to support:
RGBA->RGBA
RGBA->BGRA

Instead of:
RGBA->SkPMColor

TBR=reed@google.com
BUG=skia:
GOLD_TRYBOT_URL= https://gold.skia.org/search?issue=2174493002
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/+/73d55332e2846dd05e9efdaa2f017bcc3872884b
Review-Url: https://codereview.chromium.org/2174493002
/external/skia/src/codec/SkJpegCodec.h
39979d8c6b97889f600a212cfc9b063360f3de2f 29-Jul-2016 msarett <msarett@google.com> Revert of Add color space xform support to SkJpegCodec (includes F16!) (patchset #9 id:260001 of https://codereview.chromium.org/2174493002/ )

Reason for revert:
Breaking MSAN

Original issue's description:
> Add color space xform support to SkJpegCodec (includes F16!)
>
> Also changes SkColorXform to support:
> RGBA->RGBA
> RGBA->BGRA
>
> Instead of:
> RGBA->SkPMColor
>
> TBR=reed@google.com
> BUG=skia:
> GOLD_TRYBOT_URL= https://gold.skia.org/search?issue=2174493002
> 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/+/73d55332e2846dd05e9efdaa2f017bcc3872884b

TBR=mtklein@google.com,reed@google.com,herb@google.com,brianosman@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/2195523002
/external/skia/src/codec/SkJpegCodec.h
73d55332e2846dd05e9efdaa2f017bcc3872884b 29-Jul-2016 msarett <msarett@google.com> Add color space xform support to SkJpegCodec (includes F16!)

Also changes SkColorXform to support:
RGBA->RGBA
RGBA->BGRA

Instead of:
RGBA->SkPMColor

TBR=reed@google.com
BUG=skia:
GOLD_TRYBOT_URL= https://gold.skia.org/search?issue=2174493002
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/2174493002
/external/skia/src/codec/SkJpegCodec.h
9876ac5b3016e5353c072378ac1545a0a2270757 01-Jun-2016 msarett <msarett@google.com> Create SkColorSpaceXform to handle color conversions

Also adds testing of qcms color correction, so we can compare
SkColorSpaceXform outputs to qcms outputs.

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

Committed: https://skia.googlesource.com/skia/+/740cc88ee3d63c75e52d31238f2a32600cc57a8c

Review-Url: https://codereview.chromium.org/1952063002
/external/skia/src/codec/SkJpegCodec.h
4a603fc591dcd36b3cb47344c244ecbbbaf179f4 01-Jun-2016 msarett <msarett@google.com> Revert of Create SkColorSpaceXform to handle color conversions (patchset #10 id:260001 of https://codereview.chromium.org/1952063002/ )

Reason for revert:
Google3 can't find qcms

Original issue's description:
> Create SkColorSpaceXform to handle color conversions
>
> Also adds testing of qcms color correction, so we can compare
> SkColorSpaceXform outputs to qcms outputs.
>
> BUG=skia:
> GOLD_TRYBOT_URL= https://gold.skia.org/search2?unt=true&query=source_type%3Dgm&master=false&issue=1952063002
>
> Committed: https://skia.googlesource.com/skia/+/740cc88ee3d63c75e52d31238f2a32600cc57a8c

TBR=reed@google.com,scroggo@google.com,mtklein@google.com,herb@google.com,brianosman@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/2023093004
/external/skia/src/codec/SkJpegCodec.h
740cc88ee3d63c75e52d31238f2a32600cc57a8c 01-Jun-2016 msarett <msarett@google.com> Create SkColorSpaceXform to handle color conversions

Also adds testing of qcms color correction, so we can compare
SkColorSpaceXform outputs to qcms outputs.

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

Review-Url: https://codereview.chromium.org/1952063002
/external/skia/src/codec/SkJpegCodec.h
c30c418f4eb75f365c7d7a32d5419b41ca780ba8 20-Apr-2016 msarett <msarett@google.com> Add SkEncodedInfo to report properties of encoded image data

All this does is build an SkEncodedInfo for each codec, and
then convert it to an SkImageInfo.

In future steps I intend to:
(1) Use SkEncodedInfo in place of SrcConfig in SkSwizzler.
(2) Support more conversions in SkSwizzler (non-native
BGRA/RGBA, 16-bit components, float, fixed point)
(3) Investigate optimizing conversions from encoded data
to linear color spaces.

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

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

Review URL: https://codereview.chromium.org/1820073002
/external/skia/src/codec/SkJpegCodec.h
3c920243f831de5892857f86618fd9c4f9655ba2 19-Apr-2016 robertphillips <robertphillips@google.com> Revert of Add SkEncodedInfo to report properties of encoded image data (patchset #6 id:200001 of https://codereview.chromium.org/1820073002/ )

Reason for revert:
Lots of bots failing

Original issue's description:
> Add SkEncodedInfo to report properties of encoded image data
>
> All this does is build an SkEncodedInfo for each codec, and
> then convert it to an SkImageInfo.
>
> In future steps I intend to:
> (1) Use SkEncodedInfo in place of SrcConfig in SkSwizzler.
> (2) Support more conversions in SkSwizzler (non-native
> BGRA/RGBA, 16-bit components, float, fixed point)
> (3) Investigate optimizing conversions from encoded data
> to linear color spaces.
>
> BUG=skia:4133
> GOLD_TRYBOT_URL= https://gold.skia.org/search2?unt=true&query=source_type%3Dgm&master=false&issue=1820073002
>
> Committed: https://skia.googlesource.com/skia/+/f682d9ad70d690a343bc15e26ef321d86770be41

TBR=scroggo@google.com,reed@google.com,msarett@google.com
# Skipping CQ checks because original CL landed less than 1 days ago.
NOPRESUBMIT=true
NOTREECHECKS=true
NOTRY=true
BUG=skia:4133

Review URL: https://codereview.chromium.org/1895383002
/external/skia/src/codec/SkJpegCodec.h
f682d9ad70d690a343bc15e26ef321d86770be41 19-Apr-2016 msarett <msarett@google.com> Add SkEncodedInfo to report properties of encoded image data

All this does is build an SkEncodedInfo for each codec, and
then convert it to an SkImageInfo.

In future steps I intend to:
(1) Use SkEncodedInfo in place of SrcConfig in SkSwizzler.
(2) Support more conversions in SkSwizzler (non-native
BGRA/RGBA, 16-bit components, float, fixed point)
(3) Investigate optimizing conversions from encoded data
to linear color spaces.

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

Review URL: https://codereview.chromium.org/1820073002
/external/skia/src/codec/SkJpegCodec.h
0e6274f54084d816abd70d445dded8657eb01abd 21-Mar-2016 msarett <msarett@google.com> Parse icc profiles and exif orientation from jpeg markers

New resources should be fine to add since they are already
checked into chromium.

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

Review URL: https://codereview.chromium.org/1813273002
/external/skia/src/codec/SkJpegCodec.h
4984c3c95f18eda44492a2126c9958e447f2cca8 10-Mar-2016 msarett <msarett@google.com> Update Skia's YUV API

We should match the recently designed API in SkCodec.
https://codereview.chromium.org/1549473003/

This requires changes in Chromium as well.

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

Committed: https://skia.googlesource.com/skia/+/095d31c8a0eeb5d491febf064bc3c8a44e22b94f

Review URL: https://codereview.chromium.org/1716523002
/external/skia/src/codec/SkJpegCodec.h
1590f3b32890f6455b30494308633177b54db347 07-Mar-2016 msarett <msarett@google.com> Revert of Update Skia's YUV API (patchset #5 id:160001 of https://codereview.chromium.org/1716523002/ )

Reason for revert:
Blimp failures with manual roll in Chrome.

Original issue's description:
> Update Skia's YUV API
>
> We should match the recently designed API in SkCodec.
> https://codereview.chromium.org/1549473003/
>
> This requires changes in Chromium as well.
>
> BUG=skia:
> GOLD_TRYBOT_URL= https://gold.skia.org/search2?unt=true&query=source_type%3Dgm&master=false&issue=1716523002
>
> Committed: https://skia.googlesource.com/skia/+/095d31c8a0eeb5d491febf064bc3c8a44e22b94f

TBR=scroggo@google.com,reed@google.com,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/1775493002
/external/skia/src/codec/SkJpegCodec.h
095d31c8a0eeb5d491febf064bc3c8a44e22b94f 07-Mar-2016 msarett <msarett@google.com> Update Skia's YUV API

We should match the recently designed API in SkCodec.
https://codereview.chromium.org/1549473003/

This requires changes in Chromium as well.

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

Review URL: https://codereview.chromium.org/1716523002
/external/skia/src/codec/SkJpegCodec.h
ad8bcfeac4a684a64db3a7447aeea5bc35155f16 07-Mar-2016 msarett <msarett@google.com> Use a smart pointer for SkColorSpace factories

This should fix master-skia in Android because we no longer need
to include src/core for SkCodec.h.

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

Review URL: https://codereview.chromium.org/1766413002
/external/skia/src/codec/SkJpegCodec.h
91c22b2ea6bd13a31321ead01645467f21858cd0 22-Feb-2016 msarett <msarett@google.com> Use new jpeg_crop_scanlines() API to optimize jpeg subset decodes

This was adapted from:
https://codereview.chromium.org/1530933003

Subset Decode Runtime (Original / Optimized) on Nexus 6P
TopLeft 0.51x
TopRight 0.56x
Middle 0.71x
BottomLeft 0.79x
BottomRight 0.79x

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

Review URL: https://codereview.chromium.org/1719073002
/external/skia/src/codec/SkJpegCodec.h
39b2d5a1ac4171aba0e92cb3f9882f62e5730e3e 17-Feb-2016 msarett <msarett@google.com> Individually enable and disable SkCodecs

BUG=skia:4956
GOLD_TRYBOT_URL= https://gold.skia.org/search2?unt=true&query=source_type%3Dgm&master=false&issue=1702533004
CQ_EXTRA_TRYBOTS=client.skia.compile:Build-Ubuntu-GCC-x86_64-Release-CMake-Trybot

Review URL: https://codereview.chromium.org/1702533004
/external/skia/src/codec/SkJpegCodec.h
b714fb0199e8727ef2b6cddbee7eba6046f01554 22-Jan-2016 msarett <msarett@google.com> Add getYUV8Planes() API to SkCodec

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

Review URL: https://codereview.chromium.org/1549473003
/external/skia/src/codec/SkJpegCodec.h
565901db954c231840750ea955ed31b820b9ade8 10-Dec-2015 scroggo <scroggo@google.com> Switch SkAutoMalloc to SkAutoTMalloc to avoid cast

Make SkAutoTMalloc's interface look more like SkAutoMalloc:
- add free(), which does what you expect
- make reset() return a pointer fPtr

No public API changes (SkAutoTMalloc is in include/private)

BUG=skia:2148

Review URL: https://codereview.chromium.org/1516833003
/external/skia/src/codec/SkJpegCodec.h
db30be2f9470d21fe37b63d145c1fcca9a6ad98c 09-Dec-2015 scroggo <scroggo@google.com> Make SkCodec support peek() and read()

- Update SkCodec's dox to point out that some of the data must be
read twice in order to decode
- Add an accessor that reports how much is needed for reading twice
- Make SkCodec default to use peek()
If an input stream supports peek()ing, peek() instead of reading.
This way the stream need not implement rewind()
- Make SkCodec use read() + rewind() as a backup
So that streams without peek() implemented can still function
properly (assuming they can rewind).
- read everything we may need to determine the format once
In SkCodec::NewFromStream, peek()/read() 14 bytes, which is enough
to read all of the types we support. Pass the buffer to each subtype,
which will have enough info to determine whether it is the right
type. This simplifies the code and results in less reading and
rewinding.
- NOTE: SkWbmpCodec needs the following number of bytes for the header
+ 1 (type)
+ 1 (reserved)
+ 3 (width - bytes needed to support up to 0xFFFF)
+ 3 (height - bytes needed to support up to 0xFFFF)
= 8
- in SkWebpCodec, support using read + rewind as a backup if peek does
not work.

A change in Android will add peek() to JavaInputStreamAdapter.

BUG=skia:3257

Review URL: https://codereview.chromium.org/1472123002
/external/skia/src/codec/SkJpegCodec.h
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/SkJpegCodec.h
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/SkJpegCodec.h
19ae315dd06b01312de8fd40b8388aae4de9f05e 02-Oct-2015 msarett <msarett@google.com> Stop calling jpeg_finish_decompress()

jpeg_finish_decompress() does several things:
(1) Reads to the end of the image stream.
(2) Calls term_src(), a client provided function that
indicates we are done with the memory stream. Our current
implementation of term_src() does nothing.
(3) Calls jpeg_abort() which aborts the decode and cleans
up some memory.

I don't think we need to call this anymore.

(1) seems irrelevant.

It seems a little dangerous to get rid of (2), but it is
fine while our implementation of term_src() does nothing.

(3) We will call jpeg_destroy() on destruction of the
JpegDecoderManager. This should free all the memory,
making it unnecessary to call jpeg_abort() beforehand.

BUG=skia:4040

Review URL: https://codereview.chromium.org/1370323004
/external/skia/src/codec/SkJpegCodec.h
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/SkJpegCodec.h
46c574725676b26ada63ac15e42cda309dcd5090 30-Sep-2015 scroggo <scroggo@google.com> Merge SkCodec with SkScanlineDecoder

Benefits:
- This mimics other decoding APIs (including the ones SkCodec relies
on, e.g. a png_struct, which can be used to decode an entire image or
one line at a time).

- It allows a client to ask us to do what we can do efficiently - i.e.
start from encoded data and either decode the whole thing or scanlines.

- It removes the duplicate methods which appeared in both SkCodec and
SkScanlineDecoder (some of which, e.g. in SkJpegScanlineDecoder, just
call fCodec->sameMethod()).

- It simplifies moving more checks into the base class (e.g. the
examples in skbug.com/4284).

BUG=skia:4175
BUG=skia:4284

=====================================================================

SkScanlineDecoder.h/.cpp:
Removed.

SkCodec.h/.cpp:
Add methods, enums, and variables which were previously in
SkScanlineDecoder.
Default fCurrScanline to -1, as a sentinel that start has not been
called.

General changes:
Convert SkScanlineDecoders to SkCodecs.

General changes in SkCodec subclasses:
Merge SkScanlineDecoder implementation into SkCodec. Most (all?) owned
an SkCodec, so they now call this-> instead of fCodec->.

SkBmpCodec.h/.cpp:
Replace the unused rowOrder method with an override for
onGetScanlineOrder.
Make getDstRow const, since it is called by onGetY, which is const.

SkCodec_libpng.h/.cpp:
Make SkPngCodec an abstract class, with two subclasses which handle
scanline decoding separately (they share code for decoding the entire
image). Reimplement onReallyHasAlpha so that it can return the most
recent result (e.g. after a scanline decode which only decoded part
of the image) or a better answer (e.g. if the whole image is known to
be opaque).
Compute fNumberPasses early, so we know which subclass to instantiate.
Make SkPngInterlaceScanlineDecoder use the base class' fCurrScanline
rather than a separate variable.

CodexTest.cpp:
Add tests for the state changes in SkCodec (need to call start before
decoding scanlines; calling getPixels means that start will need to
be called again before decoding more scanlines).
Add a test which decodes in stripes, currently only used for an
interlaced PNG.

TODO: Add tests for onReallyHasAlpha.

Review URL: https://codereview.chromium.org/1365313002
/external/skia/src/codec/SkJpegCodec.h
fbccb5995dcda645a3a8af51805639cb0c0d2300 01-Sep-2015 msarett <msarett@google.com> Call standard libjpeg/libjpeg-turbo APIs

BUG=skia:

Review URL: https://codereview.chromium.org/1322623004
/external/skia/src/codec/SkJpegCodec.h
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/SkJpegCodec.h
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/SkJpegCodec.h
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/SkJpegCodec.h
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/SkJpegCodec.h
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/SkJpegCodec.h
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/SkJpegCodec.h
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/SkJpegCodec.h
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/SkJpegCodec.h
b427db1d457a083f2652756a453fbb91bc6a7447 12-Aug-2015 scroggo <scroggo@chromium.org> Consolidate SkCodec functions for handling rewind

Previously, many of our codec implementations followed the same
pattern (often in a function named handleRewind):

switch (this->rewindIfNeeded()) {
case CouldNotRewind:
return CouldNotRewind;
case NoRewindNecessary:
// keep going
break;
case Rewound:
<re-read header etc>
break;
}

In this CL, remove the enum, and put the piece that happens in the
Rewound case into a virtual function, onRewind. rewindIfNeeded now
contains the common pieces from various functions named handleRewind.

In SkBmpCodec, add a function that returns whether the BMP is in ICO,
so it can have a common implementation for onRewind.

BUG=skia:3257

Review URL: https://codereview.chromium.org/1288483002
/external/skia/src/codec/SkJpegCodec.h
1c005e4a38e29d648ecebada25d3a718155043a3 04-Aug-2015 scroggo <scroggo@chromium.org> Create a scanline decoder without creating a codec

Prior to this CL, if a client wanted to decode scanlines, they had to
create an SkCodec in order to get an SkScanlineDecoder. This introduces
complications if input data is not easily shared between the two
objects.

Instead, add methods to SkScanlineDecoder for creating a new one from
input data, and remove the creation functions from SkCodec.

Update DM and tests.

Review URL: https://codereview.chromium.org/1267583002
/external/skia/src/codec/SkJpegCodec.h
9b2cdbf4811477487f107a78edc130c733b309ea 10-Jul-2015 scroggo <scroggo@chromium.org> Allow creating multiple scanline decoders.

Make getScanlineDecoder return a new object each time, which is
owned by the caller, and independent from any existing scanline
decoders and the SkCodec itself.

Since the SkCodec already contains the entire state machine, and it
is used by the scanline decoders, simply create a new SkCodec which
is now owned by the scanline decoder.

Move code that cleans up after using a scanline decoder into its
destructor

One side effect is that creating the first scanline decoder requires
a duplication of the stream and re-reading the header. (With some
more complexity/changes, we could pass the state machine to the
scanline decoder and make the SkCodec recreate its own state machine
instead.) The typical client of the scanline decoder (region decoder)
uses an SkMemoryStream, so the duplication is cheap, although we
should consider the extra time to reread the header/recreate the state
machine. (If/when we use the scanline decoder for other purposes,
where the stream may not be cheaply duplicated, we should consider
passing the state machine.)

One (intended) result of this change is that a client can create a
new scanline decoder in a new thread, and decode different pieces of
the image simultaneously.

In SkPngCodec::decodePalette, use fBitDepth rather than a parameter.

Review URL: https://codereview.chromium.org/1230033004
/external/skia/src/codec/SkJpegCodec.h
1c8a587120fd33854974457cf2a795ead98183a9 07-Jul-2015 msarett <msarett@google.com> Add libjpeg-turbo library (depends on yasm)
Mangle external function names to avoid conflict with libjpeg
Take advantage of direct color conversion (RGBA, BGRA, 565)
Prepare to use jpeg_skip_scanlines (when it is upstreamed)

BUG=skia:

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

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

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

Committed: https://skia.googlesource.com/skia/+/40141b57f061fbfcc2fa38da942d9efe25aca4d0

Review URL: https://codereview.chromium.org/1180983002
/external/skia/src/codec/SkJpegCodec.h
94a2fbc6cf7cc14d7e6149eb22455db6aca06b8f 02-Jul-2015 jvanverth <jvanverth@google.com> Revert of Switch SkJpegCode to libjpeg-turbo (patchset #29 id:750001 of https://codereview.chromium.org/1180983002/)

Reason for revert:
DEPS roll failing

Original issue's description:
> Add libjpeg-turbo library (depends on yasm)
> Mangle external function names to avoid conflict with libjpeg
> Take advantage of direct color conversion (RGBA, BGRA, 565)
> Prepare to use jpeg_skip_scanlines (when it is upstreamed)
>
> BUG=skia:
>
> Committed: https://skia.googlesource.com/skia/+/b60c3f8291529303299262dba19b1a896060bd2d
>
> Committed: https://skia.googlesource.com/skia/+/f8bf9181d7b0463c8e371755cfbb9ece90b34fc5
>
> Committed: https://skia.googlesource.com/skia/+/e9e3ee33f30c14c31afd5fc3fe4dda7f15783c75
>
> Committed: https://skia.googlesource.com/skia/+/40141b57f061fbfcc2fa38da942d9efe25aca4d0

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

Review URL: https://codereview.chromium.org/1226543003
/external/skia/src/codec/SkJpegCodec.h
40141b57f061fbfcc2fa38da942d9efe25aca4d0 01-Jul-2015 msarett <msarett@google.com> Add libjpeg-turbo library (depends on yasm)
Mangle external function names to avoid conflict with libjpeg
Take advantage of direct color conversion (RGBA, BGRA, 565)
Prepare to use jpeg_skip_scanlines (when it is upstreamed)

BUG=skia:

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

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

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

Review URL: https://codereview.chromium.org/1180983002
/external/skia/src/codec/SkJpegCodec.h
aa2a7de0ffaf8f864a7afc68bbd34ccb25876246 01-Jul-2015 msarett <msarett@google.com> Revert of Switch SkJpegCode to libjpeg-turbo (patchset #28 id:710001 of https://codereview.chromium.org/1180983002/)

Reason for revert:
Broke iOS build.

Original issue's description:
> Add libjpeg-turbo library (depends on yasm)
> Mangle external function names to avoid conflict with libjpeg
> Take advantage of direct color conversion (RGBA, BGRA, 565)
> Prepare to use jpeg_skip_scanlines (when it is upstreamed)
>
> BUG=skia:
>
> Committed: https://skia.googlesource.com/skia/+/b60c3f8291529303299262dba19b1a896060bd2d
>
> Committed: https://skia.googlesource.com/skia/+/f8bf9181d7b0463c8e371755cfbb9ece90b34fc5
>
> Committed: https://skia.googlesource.com/skia/+/e9e3ee33f30c14c31afd5fc3fe4dda7f15783c75

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

Review URL: https://codereview.chromium.org/1213093003
/external/skia/src/codec/SkJpegCodec.h
e9e3ee33f30c14c31afd5fc3fe4dda7f15783c75 01-Jul-2015 msarett <msarett@google.com> Add libjpeg-turbo library (depends on yasm)
Mangle external function names to avoid conflict with libjpeg
Take advantage of direct color conversion (RGBA, BGRA, 565)
Prepare to use jpeg_skip_scanlines (when it is upstreamed)

BUG=skia:

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

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

Review URL: https://codereview.chromium.org/1180983002
/external/skia/src/codec/SkJpegCodec.h
c0e80c139e15496a8a96eec7848689b6f0e7bcc1 01-Jul-2015 msarett <msarett@google.com> In the case of subset decodes, we will often not decode to
the bottom of the image. In our code before this patch,
this would result in cleanup code in onFinish() never being
called.

We can allow subclasses to take ownership of the
SkScanlineDecoder in order to make sure that it is
finished/deleted before deleting the decode manager.

BUG=skia:

Review URL: https://codereview.chromium.org/1212593003
/external/skia/src/codec/SkJpegCodec.h
f657b1093ef22390d3ce1eb56686a8185408a84f 29-Jun-2015 msarett <msarett@google.com> Revert of Switch SkJpegCode to libjpeg-turbo (patchset #25 id:680001 of https://codereview.chromium.org/1180983002/)

Reason for revert:
yasm is leaking memory :(.

https://uberchromegw.corp.google.com/i/client.skia/builders/Test-Ubuntu-GCC-GCE-CPU-AVX2-x86_64-Debug-ASAN/builds/926/steps/build%20dm/logs/stdio

Original issue's description:
> Add libjpeg-turbo library (depends on yasm)
> Mangle external function names to avoid conflict with libjpeg
> Take advantage of direct color conversion (RGBA, BGRA, 565)
> Prepare to use jpeg_skip_scanlines (when it is upstreamed)
>
> BUG=skia:
>
> Committed: https://skia.googlesource.com/skia/+/b60c3f8291529303299262dba19b1a896060bd2d
>
> Committed: https://skia.googlesource.com/skia/+/f8bf9181d7b0463c8e371755cfbb9ece90b34fc5

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

Review URL: https://codereview.chromium.org/1214023003
/external/skia/src/codec/SkJpegCodec.h
f8bf9181d7b0463c8e371755cfbb9ece90b34fc5 29-Jun-2015 msarett <msarett@google.com> Add libjpeg-turbo library (depends on yasm)
Mangle external function names to avoid conflict with libjpeg
Take advantage of direct color conversion (RGBA, BGRA, 565)
Prepare to use jpeg_skip_scanlines (when it is upstreamed)

BUG=skia:

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

Review URL: https://codereview.chromium.org/1180983002
/external/skia/src/codec/SkJpegCodec.h
c0bdecb920a957665f66adefd3f3fb865e32e5d0 25-Jun-2015 mtklein <mtklein@google.com> Revert of Switch SkJpegCode to libjpeg-turbo (patchset #11 id:540001 of https://codereview.chromium.org/1180983002/)

Reason for revert:
https://uberchromegw.corp.google.com/i/client.skia.compile/builders/Build-Ubuntu-GCC-MipsDSP2-Debug-Android/builds/1136/steps/build%20most/logs/stdio

Original issue's description:
> Add libjpeg-turbo library (depends on yasm)
> Mangle external function names to avoid conflict with libjpeg
> Take advantage of direct color conversion (RGBA, BGRA, 565)
> Prepare to use jpeg_skip_scanlines (when it is upstreamed)
>
> BUG=skia:
>
> Committed: https://skia.googlesource.com/skia/+/b60c3f8291529303299262dba19b1a896060bd2d

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

Review URL: https://codereview.chromium.org/1199253006
/external/skia/src/codec/SkJpegCodec.h
b60c3f8291529303299262dba19b1a896060bd2d 25-Jun-2015 msarett <msarett@google.com> Add libjpeg-turbo library (depends on yasm)
Mangle external function names to avoid conflict with libjpeg
Take advantage of direct color conversion (RGBA, BGRA, 565)
Prepare to use jpeg_skip_scanlines (when it is upstreamed)

BUG=skia:

Review URL: https://codereview.chromium.org/1180983002
/external/skia/src/codec/SkJpegCodec.h
525e90ab92fed79ac11afbb6e13d56867157fa70 18-Jun-2015 mtklein <mtklein@chromium.org> Try again to rename one SkJpegUtility.h to remove ambiguity.

This time rename the new codec one, which is not referenced externally.

BUG=skia:

Review URL: https://codereview.chromium.org/1181093008
/external/skia/src/codec/SkJpegCodec.h
97fdea6c4393cf0102d7eee5790782509fb4f57b 29-Apr-2015 msarett <msarett@google.com> Implementing a scanline decoder for jpeg

BUG=skia:3257

Review URL: https://codereview.chromium.org/1092303003
/external/skia/src/codec/SkJpegCodec.h
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/SkJpegCodec.h