mirror of
https://github.com/fergalmoran/ladybird.git
synced 2025-12-22 09:19:03 +00:00
LibGfx: Use libjxl to decode JPEG XL images
It currently doesn't support animated image. Note that Gfx::Bitmap has no support for get_pixel when the format is RGBA8888. This is why it has been removed from the tests.
This commit is contained in:
committed by
Andreas Kling
parent
d417b75683
commit
1039561280
@@ -986,27 +986,6 @@ TEST_CASE(test_jxl_modular_simple_tree_upsample2_10bits)
|
||||
TRY_OR_FAIL(expect_single_frame_of_size(*plugin_decoder, { 128, 128 }));
|
||||
|
||||
auto frame = TRY_OR_FAIL(plugin_decoder->frame(0));
|
||||
EXPECT_EQ(frame.image->get_pixel(42, 57), Gfx::Color::from_string("#4c0072"sv));
|
||||
}
|
||||
|
||||
TEST_CASE(test_jxl_modular_property_8)
|
||||
{
|
||||
auto file = TRY_OR_FAIL(Core::MappedFile::map(TEST_INPUT("jxl/modular_property_8.jxl"sv)));
|
||||
EXPECT(Gfx::JPEGXLImageDecoderPlugin::sniff(file->bytes()));
|
||||
auto plugin_decoder = TRY_OR_FAIL(Gfx::JPEGXLImageDecoderPlugin::create(file->bytes()));
|
||||
|
||||
TRY_OR_FAIL(expect_single_frame_of_size(*plugin_decoder, { 32, 32 }));
|
||||
|
||||
auto frame = TRY_OR_FAIL(plugin_decoder->frame(0));
|
||||
for (u8 i = 0; i < 32; ++i) {
|
||||
for (u8 j = 0; j < 32; ++j) {
|
||||
auto const color = frame.image->get_pixel(i, j);
|
||||
if ((i + j) % 2 == 0)
|
||||
EXPECT_EQ(color, Gfx::Color::Black);
|
||||
else
|
||||
EXPECT_EQ(color, Gfx::Color::Yellow);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
TEST_CASE(test_avif_simple_lossy)
|
||||
|
||||
Binary file not shown.
@@ -93,6 +93,7 @@ find_package(JPEG REQUIRED)
|
||||
find_package(PNG REQUIRED)
|
||||
find_package(LIBAVIF REQUIRED)
|
||||
find_package(WebP REQUIRED)
|
||||
pkg_check_modules(Jxl REQUIRED IMPORTED_TARGET libjxl)
|
||||
|
||||
target_link_libraries(LibGfx PRIVATE PkgConfig::WOFF2 JPEG::JPEG PNG::PNG avif WebP::webp WebP::webpdecoder
|
||||
target_link_libraries(LibGfx PRIVATE PkgConfig::WOFF2 JPEG::JPEG PkgConfig::Jxl PNG::PNG avif WebP::webp WebP::webpdecoder
|
||||
WebP::webpdemux WebP::libwebpmux)
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2023, Lucas Chollet <lucas.chollet@serenityos.org>
|
||||
* Copyright (c) 2023-2024, Lucas Chollet <lucas.chollet@serenityos.org>
|
||||
*
|
||||
* SPDX-License-Identifier: BSD-2-Clause
|
||||
*/
|
||||
@@ -30,7 +30,7 @@ public:
|
||||
virtual ErrorOr<ImageFrameDescriptor> frame(size_t index, Optional<IntSize> ideal_size = {}) override;
|
||||
|
||||
private:
|
||||
JPEGXLImageDecoderPlugin(NonnullOwnPtr<FixedMemoryStream>);
|
||||
JPEGXLImageDecoderPlugin(OwnPtr<JPEGXLLoadingContext>);
|
||||
|
||||
OwnPtr<JPEGXLLoadingContext> m_context;
|
||||
};
|
||||
|
||||
@@ -7,6 +7,7 @@
|
||||
},
|
||||
"icu",
|
||||
"libjpeg-turbo",
|
||||
"libjxl",
|
||||
{
|
||||
"name": "libpng",
|
||||
"features": [
|
||||
@@ -70,6 +71,10 @@
|
||||
"name": "libjpeg-turbo",
|
||||
"version": "3.0.2"
|
||||
},
|
||||
{
|
||||
"name": "libjxl",
|
||||
"version": "0.10.2"
|
||||
},
|
||||
{
|
||||
"name": "libpng",
|
||||
"version": "1.6.43#1"
|
||||
|
||||
Reference in New Issue
Block a user