Implement a more complete JXL features

Based on this following phabricator patch/commits:
- https://phabricator.services.mozilla.com/D119700
- https://phabricator.services.mozilla.com/D122158
- https://phabricator.services.mozilla.com/D122159

Which add the following:
- Proper color profiles support for JPEG XL
- Animated JPEG XL
- Progressive decoding

Co-authored-by: wwwwwwww <wvvwvvvvwvvw@gmail.com>
This commit is contained in:
noaione
2025-02-23 21:12:43 +07:00
parent 576632fbbf
commit f11ae35b07
3 changed files with 363 additions and 0 deletions

View File

@@ -0,0 +1,32 @@
diff --git a/image/DecoderFactory.cpp b/image/DecoderFactory.cpp
index f36f03c7f2..d2cdd79f70 100644
--- a/image/DecoderFactory.cpp
+++ b/image/DecoderFactory.cpp
@@ -244,7 +244,12 @@ nsresult DecoderFactory::CreateAnimationDecoder(
}
MOZ_ASSERT(aType == DecoderType::GIF || aType == DecoderType::PNG ||
- aType == DecoderType::WEBP || aType == DecoderType::AVIF,
+ aType == DecoderType::WEBP || aType == DecoderType::AVIF
+#ifdef MOZ_JXL
+ || aType == DecoderType::JXL,
+#else
+ ,
+#endif
"Calling CreateAnimationDecoder for non-animating DecoderType");
// Create an anonymous decoder. Interaction with the SurfaceCache and the
@@ -299,7 +304,12 @@ already_AddRefed<Decoder> DecoderFactory::CloneAnimationDecoder(
// rediscover it is animated).
DecoderType type = aDecoder->GetType();
MOZ_ASSERT(type == DecoderType::GIF || type == DecoderType::PNG ||
- type == DecoderType::WEBP || type == DecoderType::AVIF,
+ type == DecoderType::WEBP || type == DecoderType::AVIF
+#ifdef MOZ_JXL
+ || aType == DecoderType::JXL,
+#else
+ ,
+#endif
"Calling CloneAnimationDecoder for non-animating DecoderType");
RefPtr<Decoder> decoder = GetDecoder(type, nullptr, /* aIsRedecode = */ true);