فهرست منبع

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.
Lucas CHOLLET 1 سال پیش
والد
کامیت
18c511f54c
1فایلهای تغییر یافته به همراه6 افزوده شده و 2 حذف شده
  1. 6 2
      Userland/Libraries/LibGfx/ImageFormats/JPEGXLLoader.cpp

+ 6 - 2
Userland/Libraries/LibGfx/ImageFormats/JPEGXLLoader.cpp

@@ -1201,8 +1201,12 @@ private:
     ErrorOr<void> read_pre_clustered_distributions(LittleEndianInputBitStream& stream, u8 num_distrib)
     ErrorOr<void> read_pre_clustered_distributions(LittleEndianInputBitStream& stream, u8 num_distrib)
     {
     {
         // C.2.2  Distribution clustering
         // 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));
         TRY(m_clusters.try_resize(num_distrib));