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).
This commit is contained in:
Daniel Novomeský 2022-01-04 13:16:23 +01:00
parent 1b8a5016f3
commit 6da9a71aed
1 changed files with 8 additions and 8 deletions

View File

@ -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;