From 0612e8ec6a8523bb6cad46f0a19307d055b6321b Mon Sep 17 00:00:00 2001 From: Lucas CHOLLET Date: Wed, 26 Jul 2023 18:06:56 -0400 Subject: [PATCH] LibGfx/JPEGXL: Read data related to extra channels in `FrameHeader` Thanks to previous patches, everything used in `read_frame_header` supports extra channels. The last element to achieve the read of headers of frame with extra channels is to add support in the function itself and the `FrameHeader` struct, which that patch does. --- Userland/Libraries/LibGfx/ImageFormats/JPEGXLLoader.cpp | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/Userland/Libraries/LibGfx/ImageFormats/JPEGXLLoader.cpp b/Userland/Libraries/LibGfx/ImageFormats/JPEGXLLoader.cpp index 022040d51f..52c514380d 100644 --- a/Userland/Libraries/LibGfx/ImageFormats/JPEGXLLoader.cpp +++ b/Userland/Libraries/LibGfx/ImageFormats/JPEGXLLoader.cpp @@ -582,7 +582,7 @@ struct FrameHeader { Array jpeg_upsampling {}; u8 upsampling {}; - Vector ec_upsampling {}; + FixedArray ec_upsampling {}; u8 group_size_shift { 1 }; Passes passes {}; @@ -591,6 +591,7 @@ struct FrameHeader { bool have_crop { false }; BlendingInfo blending_info {}; + FixedArray ec_blending_info {}; u32 duration {}; @@ -631,8 +632,9 @@ static ErrorOr read_frame_header(LittleEndianInputBitStream& stream frame_header.upsampling = U32(1, 2, 4, 8); + frame_header.ec_upsampling = TRY(FixedArray::create(metadata.num_extra_channels)); for (u16 i {}; i < metadata.num_extra_channels; ++i) - TODO(); + frame_header.ec_upsampling[i] = U32(1, 2, 4, 8); } if (frame_header.encoding == FrameHeader::Encoding::kModular) @@ -663,8 +665,9 @@ static ErrorOr read_frame_header(LittleEndianInputBitStream& stream if (normal_frame) { frame_header.blending_info = TRY(read_blending_info(stream, metadata, full_frame)); + frame_header.ec_blending_info = TRY(FixedArray::create(metadata.num_extra_channels)); for (u16 i {}; i < metadata.num_extra_channels; ++i) - TODO(); + frame_header.ec_blending_info[i] = TRY(read_blending_info(stream, metadata, full_frame)); if (metadata.animation.has_value()) TODO();