1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-05-31 12:38:12 +00:00
serenity/Userland/Libraries/LibGfx/ImageFormats
Nico Weber a2d8de180c WebP/Lossy: Add support for images with more than one partition
Each secondary partition has an independent BooleanDecoder.
Their bitstreams interleave per macroblock row, that is the first
macroblock row is read from the first decoder, the second from the
second, ..., until it wraps around again.

All partitions share a single prediction state though: The second
macroblock row (which reads coefficients off the second decoder) is
predicted using the result of decoding the frist macroblock row (which
reads coefficients off the first decoder).

So if I understand things right, in theory the coefficient reading could
be parallelized, but prediction can't be. (IDCT can also be
parallelized, but that's true with just a single partition too.)

I created the test image by running

    examples/cwebp -low_memory -partitions 3 -o foo.webp \
        ~/src/serenity/Tests/LibGfx/test-inputs/4.webp

using a cwebp hacked up as described in #19149. Since creating
multi-partition lossy webps requires hacking up `cwebp`, they're likely
very rare in practice. (But maybe other programs using the libwebp API
create them.)

Fixes #19149.

With this, webp lossy support is complete (*) :^)

And with that, webp support is complete: Lossless, lossy, lossy with
alpha, animated lossless, animated lossy, animated lossy with alpha all
work.

(*: Loop filtering isn't implemented yet, which has a minor visual
effect on the output. But it's only visible when carefully comparing
a webp decoded without loop filtering to the same decoded with it.
But it's technically a part of the spec that's still missing.

The upsampling of UV in the YUV->RGB code is also low-quality. This
produces somewhat visible banding in practice in some images (e.g.
in the fire breather's face in 5.webp), so we should probably improve
that at some point. Our JPG decoder has the same issue.)
2023-05-31 14:07:15 +02:00
..
BMPLoader.cpp LibGfx+Fuzz: Convert ImageDecoder::initialize to ErrorOr 2023-05-12 09:40:24 +01:00
BMPLoader.h LibGfx+Fuzz: Convert ImageDecoder::initialize to ErrorOr 2023-05-12 09:40:24 +01:00
BMPWriter.cpp LibGfx: Move all image loaders and writers to a subdirectory 2023-03-21 22:39:25 +01:00
BMPWriter.h LibGfx: Move all image loaders and writers to a subdirectory 2023-03-21 22:39:25 +01:00
BooleanDecoder.cpp LibGfx+LibVideo: Make BooleanDecoder usable for both VP8 and VP9 2023-05-27 05:47:42 +02:00
BooleanDecoder.h LibGfx+LibVideo: Make BooleanDecoder usable for both VP8 and VP9 2023-05-27 05:47:42 +02:00
DDSLoader.cpp LibGfx+Fuzz: Convert ImageDecoder::initialize to ErrorOr 2023-05-12 09:40:24 +01:00
DDSLoader.h LibGfx+Fuzz: Convert ImageDecoder::initialize to ErrorOr 2023-05-12 09:40:24 +01:00
GIFLoader.cpp LibGfx+Fuzz: Convert ImageDecoder::initialize to ErrorOr 2023-05-12 09:40:24 +01:00
GIFLoader.h LibGfx+Fuzz: Convert ImageDecoder::initialize to ErrorOr 2023-05-12 09:40:24 +01:00
ICOLoader.cpp LibGfx+Fuzz: Convert ImageDecoder::initialize to ErrorOr 2023-05-12 09:40:24 +01:00
ICOLoader.h LibGfx+Fuzz: Convert ImageDecoder::initialize to ErrorOr 2023-05-12 09:40:24 +01:00
ImageDecoder.cpp LibGfx+Fuzz: Convert ImageDecoder::initialize to ErrorOr 2023-05-12 09:40:24 +01:00
ImageDecoder.h LibGfx+Fuzz: Convert ImageDecoder::initialize to ErrorOr 2023-05-12 09:40:24 +01:00
JPEGLoader.cpp LibGfx+Fuzz: Convert ImageDecoder::initialize to ErrorOr 2023-05-12 09:40:24 +01:00
JPEGLoader.h LibGfx+Fuzz: Convert ImageDecoder::initialize to ErrorOr 2023-05-12 09:40:24 +01:00
PBMLoader.cpp LibGfx/PortableFormat: Propagate errors from read_image_data() 2023-03-24 10:56:58 +01:00
PBMLoader.h LibGfx/PortableFormat: Propagate errors from read_image_data() 2023-03-24 10:56:58 +01:00
PGMLoader.cpp LibGfx/PortableFormat: Use static_cast instead of C-style casts 2023-03-24 10:56:58 +01:00
PGMLoader.h LibGfx/PortableFormat: Propagate errors from read_image_data() 2023-03-24 10:56:58 +01:00
PNGLoader.cpp LibGfx+Fuzz: Convert ImageDecoder::initialize to ErrorOr 2023-05-12 09:40:24 +01:00
PNGLoader.h LibGfx+Fuzz: Convert ImageDecoder::initialize to ErrorOr 2023-05-12 09:40:24 +01:00
PNGShared.h LibGfx: Move all image loaders and writers to a subdirectory 2023-03-21 22:39:25 +01:00
PNGWriter.cpp LibGfx: Move all image loaders and writers to a subdirectory 2023-03-21 22:39:25 +01:00
PNGWriter.h LibGfx: Move all image loaders and writers to a subdirectory 2023-03-21 22:39:25 +01:00
PortableFormatWriter.cpp LibGfx/PortableFormat: Use FixedArray::unchecked_at 2023-05-09 11:18:46 +02:00
PortableFormatWriter.h LibGfx/PortableFormat+image: Make encode take a Stream 2023-05-09 11:18:46 +02:00
PortableImageLoaderCommon.h Everywhere: Remove unused DeprecatedString includes 2023-04-09 22:00:54 +02:00
PortableImageMapLoader.h LibGfx+Fuzz: Convert ImageDecoder::initialize to ErrorOr 2023-05-12 09:40:24 +01:00
PPMLoader.cpp LibGfx/PortableFormat: Use static_cast instead of C-style casts 2023-03-24 10:56:58 +01:00
PPMLoader.h LibGfx/PortableFormat: Propagate errors from read_image_data() 2023-03-24 10:56:58 +01:00
QOILoader.cpp LibGfx+Fuzz: Convert ImageDecoder::initialize to ErrorOr 2023-05-12 09:40:24 +01:00
QOILoader.h LibGfx+Fuzz: Convert ImageDecoder::initialize to ErrorOr 2023-05-12 09:40:24 +01:00
QOIWriter.cpp Everywhere: Remove unused DeprecatedString includes 2023-04-09 22:00:54 +02:00
QOIWriter.h LibGfx: Move all image loaders and writers to a subdirectory 2023-03-21 22:39:25 +01:00
TGALoader.cpp LibGfx+Fuzz: Convert ImageDecoder::initialize to ErrorOr 2023-05-12 09:40:24 +01:00
TGALoader.h LibGfx+Fuzz: Convert ImageDecoder::initialize to ErrorOr 2023-05-12 09:40:24 +01:00
WebPLoader.cpp WebP: Let ALPH replace alpha channel instead of augmenting it 2023-05-22 19:24:49 +02:00
WebPLoader.h LibGfx+Fuzz: Convert ImageDecoder::initialize to ErrorOr 2023-05-12 09:40:24 +01:00
WebPLoaderLossless.cpp LibGfx/WebP: Move lossless decoder to its own file 2023-05-08 12:52:05 +02:00
WebPLoaderLossless.h LibGfx/WebP: Minor cosmetical changes in WebPLoaderLossless.h 2023-05-09 06:35:56 +02:00
WebPLoaderLossy.cpp WebP/Lossy: Add support for images with more than one partition 2023-05-31 14:07:15 +02:00
WebPLoaderLossy.h WebP/Lossy: Implement macroblock coefficient decoding 2023-05-29 10:41:53 -06:00
WebPLoaderLossyTables.h WebP/Lossy: Add function for inverse 4x4 DCT from spec 2023-05-29 19:44:45 +02:00