1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-25 20:57:35 +00:00

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.
This commit is contained in:
Lucas CHOLLET 2023-07-26 17:31:42 -04:00 committed by Andreas Kling
parent ea8384219f
commit c6731b0970

View file

@ -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<TOC> read_toc(LittleEndianInputBitStream& stream, FrameHeader const& frame_header, u64 num_groups, u64 num_lf_groups)