From 0df01dea4a7a1017739d0d84562f67f4065983e2 Mon Sep 17 00:00:00 2001 From: Nico Weber Date: Mon, 8 Apr 2024 21:17:11 -0400 Subject: [PATCH] LibGfx/JPEG2000: Add two spec comments --- Userland/Libraries/LibGfx/ImageFormats/JPEG2000Loader.cpp | 3 +++ 1 file changed, 3 insertions(+) diff --git a/Userland/Libraries/LibGfx/ImageFormats/JPEG2000Loader.cpp b/Userland/Libraries/LibGfx/ImageFormats/JPEG2000Loader.cpp index 47b04af7040..635054f9455 100644 --- a/Userland/Libraries/LibGfx/ImageFormats/JPEG2000Loader.cpp +++ b/Userland/Libraries/LibGfx/ImageFormats/JPEG2000Loader.cpp @@ -555,11 +555,14 @@ static ErrorOr parse_codestream_main_header(JPEG2000LoadingContext& contex } case J2K_SOT: { // SOT terminates the main header. + // A.4.2: "There shall be at least one SOT in a codestream." if (!saw_COD_marker) return Error::from_string_literal("JPEG2000ImageDecoderPlugin: Required COD marker not present in main header"); if (!saw_QCD_marker) return Error::from_string_literal("JPEG2000ImageDecoderPlugin: Required QCD marker not present in main header"); + // A.6.4: "there is not necessarily a correspondence with the number of sub-bands present because the sub-bands + // can be truncated with no requirement to correct [the QCD] marker segment." size_t step_sizes_count = context.qcd.step_sizes.visit( [](Empty) -> size_t { VERIFY_NOT_REACHED(); }, [](Vector const& step_sizes) { return step_sizes.size(); },