[gimp] plug-ins: adjust selection of precision during JXL import



commit 6da9a71aed7c862db3d839da041d0499420921af
Author: Daniel Novomeský <dnovomesky gmail com>
Date:   Tue Jan 4 13:16:23 2022 +0100

    plug-ins: adjust selection of precision during JXL import
    
    There is no change for lossless images, where import precision
    is directly related to bits_per_sample.
    However, according JXL developers, for lossy images
    (which generally use XYB color space), decoded data are not tightly
    bound to bits_per_sample from header, import in 32bit
    float precision can be used for better import quality
    (libjxl works internally in 32bit float precision).

 plug-ins/common/file-jpegxl.c | 16 ++++++++--------
 1 file changed, 8 insertions(+), 8 deletions(-)
---
diff --git a/plug-ins/common/file-jpegxl.c b/plug-ins/common/file-jpegxl.c
index 86802b2ead..aad74eb632 100644
--- a/plug-ins/common/file-jpegxl.c
+++ b/plug-ins/common/file-jpegxl.c
@@ -378,20 +378,20 @@ load_image (GFile        *file,
   pixel_format.endianness = JXL_NATIVE_ENDIAN;
   pixel_format.align = 0;
 
-  if (basicinfo.bits_per_sample <= 8)
-    {
-      pixel_format.data_type = JXL_TYPE_UINT8;
-      channel_depth = 1;
-      precision_linear = GIMP_PRECISION_U8_LINEAR;
-      precision_non_linear = GIMP_PRECISION_U8_NON_LINEAR;
-    }
-  else if (basicinfo.bits_per_sample > 16)
+  if (basicinfo.uses_original_profile == JXL_FALSE || basicinfo.bits_per_sample > 16)
     {
       pixel_format.data_type = JXL_TYPE_FLOAT;
       channel_depth = 4;
       precision_linear = GIMP_PRECISION_FLOAT_LINEAR;
       precision_non_linear = GIMP_PRECISION_FLOAT_NON_LINEAR;
     }
+  else if (basicinfo.bits_per_sample <= 8)
+    {
+      pixel_format.data_type = JXL_TYPE_UINT8;
+      channel_depth = 1;
+      precision_linear = GIMP_PRECISION_U8_LINEAR;
+      precision_non_linear = GIMP_PRECISION_U8_NON_LINEAR;
+    }
   else
     {
       pixel_format.data_type = JXL_TYPE_UINT16;


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]