Commit graph

4 commits

Author SHA1 Message Date
Nico Weber
58a5038420 LibGfx: Add a FIXME to WebPImageDecoderPlugin::icc_data() 2023-02-25 16:02:51 +01:00
Nico Weber
65d41f8ed9 LibGfx: Add a WebPLoadingContext::error() helper
No behavior change.

(Well, technically, this now correctly sets the state to Error
if the first chunk is neither of 'VP8 ', 'VP8L', 'VP8X'. But no
*interesting* behavior change.)
2023-02-25 16:02:51 +01:00
Nico Weber
14c0bae704 LibGfx+Tests: Add test for webp ICC loading and fix bug
I drew the two webp files in Photoshop and saved them using the
"Save a Copy..." dialog, with ICC profile and all other boxes checked.

(I also tried saving with all the boxes unchecked, but it still wrote an
extended webp instead of a basic file.)

The lossless file exposed a bug: I didn't handle chunk padding
correctly before this patch.
2023-02-24 20:13:52 +01:00
Nico Weber
f7e152d049 LibGfx: Add scaffolding for a webp decoder
At the moment, this processes the RIFF chunk structure and extracts
the ICCP chunk, so that `icc` can now print ICC profiles embedded
in webp files. (And are image files really more than containers
of icc profiles?)

It doesn't even decode image dimensions yet.

The lossy format is a VP8 video frame. Once we get to that, we
might want to move all the image decoders into a new LibImageDecoders
that depends on both LibGfx and LibVideo. (Other newer image formats
like heic and av1f also use video frames for image data.)
2023-02-24 19:44:20 +01:00