Skip to content

Commit 18c511f

Browse files
LucasCholletawesomekling
authored andcommitted
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.
1 parent a8857c0 commit 18c511f

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

Userland/Libraries/LibGfx/ImageFormats/JPEGXLLoader.cpp

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1201,8 +1201,12 @@ class EntropyDecoder {
12011201
ErrorOr<void> read_pre_clustered_distributions(LittleEndianInputBitStream& stream, u8 num_distrib)
12021202
{
12031203
// C.2.2 Distribution clustering
1204-
if (num_distrib == 1)
1205-
TODO();
1204+
if (num_distrib == 1) {
1205+
// If num_dist == 1, then num_clusters = 1 and clusters[0] = 0, and the remainder of this subclause is skipped.
1206+
m_clusters = { 0 };
1207+
TRY(m_configs.try_resize(1));
1208+
return {};
1209+
};
12061210

12071211
TRY(m_clusters.try_resize(num_distrib));
12081212

0 commit comments

Comments
 (0)