From 18c511f54cfc28d1699edda5bdfe3e7af4a1d958 Mon Sep 17 00:00:00 2001 From: Lucas CHOLLET Date: Sun, 23 Jul 2023 14:39:02 -0400 Subject: [PATCH] LibGfx/JPEGXL: Support clusters with a single distribution This type of cluster is an exception and has specific rules (but simpler) to be read. This is a requirement to support complex distributions as they use a symbol decoder initialized with a single distribution. --- Userland/Libraries/LibGfx/ImageFormats/JPEGXLLoader.cpp | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/Userland/Libraries/LibGfx/ImageFormats/JPEGXLLoader.cpp b/Userland/Libraries/LibGfx/ImageFormats/JPEGXLLoader.cpp index af8e261224..66a8919ed6 100644 --- a/Userland/Libraries/LibGfx/ImageFormats/JPEGXLLoader.cpp +++ b/Userland/Libraries/LibGfx/ImageFormats/JPEGXLLoader.cpp @@ -1201,8 +1201,12 @@ private: ErrorOr read_pre_clustered_distributions(LittleEndianInputBitStream& stream, u8 num_distrib) { // C.2.2 Distribution clustering - if (num_distrib == 1) - TODO(); + if (num_distrib == 1) { + // If num_dist == 1, then num_clusters = 1 and clusters[0] = 0, and the remainder of this subclause is skipped. + m_clusters = { 0 }; + TRY(m_configs.try_resize(1)); + return {}; + }; TRY(m_clusters.try_resize(num_distrib));