From c6731b0970331268522988aefd04e55c5ca566df Mon Sep 17 00:00:00 2001 From: Lucas CHOLLET Date: Wed, 26 Jul 2023 17:31:42 -0400 Subject: [PATCH] LibGfx/JPEGXL: Consider the HfGlobal section of the TOC There is always a section for HfGlobal, even if it's empty like with Modular images. I also removed the outdated (and misinterpreted) spec comment and replace it with the name of the section. --- .../Libraries/LibGfx/ImageFormats/JPEGXLLoader.cpp | 10 ++-------- 1 file changed, 2 insertions(+), 8 deletions(-) diff --git a/Userland/Libraries/LibGfx/ImageFormats/JPEGXLLoader.cpp b/Userland/Libraries/LibGfx/ImageFormats/JPEGXLLoader.cpp index 55075bd06f..7332135b54 100644 --- a/Userland/Libraries/LibGfx/ImageFormats/JPEGXLLoader.cpp +++ b/Userland/Libraries/LibGfx/ImageFormats/JPEGXLLoader.cpp @@ -652,17 +652,11 @@ struct TOC { static u64 num_toc_entries(FrameHeader const& frame_header, u64 num_groups, u64 num_lf_groups) { + // F.3.1 - General if (num_groups == 1 && frame_header.passes.num_passes == 1) return 1; - // Otherwise, there is one entry for each of the following sections, - // in the order they are listed: LfGlobal, one per LfGroup in raster - // order, one for HfGlobal followed by HfPass data for all the passes, - // and num_groups * frame_header.passes.num_passes for the PassGroup sections. - - auto const hf_contribution = frame_header.encoding == FrameHeader::Encoding::kVarDCT ? (1 + frame_header.passes.num_passes) : 0; - - return 1 + num_lf_groups + hf_contribution + num_groups * frame_header.passes.num_passes; + return 1 + num_lf_groups + 1 + num_groups * frame_header.passes.num_passes; } static ErrorOr read_toc(LittleEndianInputBitStream& stream, FrameHeader const& frame_header, u64 num_groups, u64 num_lf_groups)