Use SkCodec internally in GIFImageDecoder
Previously, GIFImageDecoder used GIFImageReader internally. SkCodec uses a modified version of that class (SkGifImageReader; adapted in crrev.com/2045293002). SkCodec provides the following benefits: - SIMD optimized code for writing pixels - an API that allows the client to handle caching - flexibility regarding the required frame to use - the ability to decode scaled versions of images - subset decoding (i.e. issue 468914) (not fully implemented for GIF) - the ability to decode to half-width float format In addition, this patch enables sharing code between Android, Skia, and Chromium. This means that new features/bug fixes in Android benefit Chromium and vice versa. For larger images (above ~60x60), the SIMD optimizations show a much bigger benefit (up to 24% in one case). For most images, decoding speed is about the same. Images with many frames that contain tiny update regions are a hair slower. The mean decode time across all tested images showed an improvement. Raw performance numbers can be found here: https://docs.google.com/spreadsheets/d/1JqCPdYmbasOwKRdvuG6ZI4gwq9dPvnJA9oDquh7SxOQ/edit?usp=sharing GIFImageDecoder still handles the cached frames currently, but this change will allow future changes in Blink to make wiser caching Decisions (such as keeping all frames of a 3-frame animation if those frames are small). Full road map: https://docs.google.com/a/chromium.org/document/d/1T06pxiff3oy8KDqWGqWL-_nZqUJ8AMppouPQ_DLrvpk/edit?usp=sharing This results in some behavior changes: - SkCodec does not check the alpha of each pixel during decode (for speed and simplicity). As a result, GIFImageDecoder no longer corrects opacity or the required frame after decoding a frame. No performance penalty has been observed for incorrectly leaving a frame marked as having transparency. - SkCodec guesses transparency based on the presence of a transparent index (in addition to being subset) and uses this to potentially determine an earlier required frame. BUG=715812 Review-Url: https://codereview.chromium.org/2565323003 Cr-Commit-Position: refs/heads/master@{#495230}
Showing
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
Please register or sign in to comment