Encoding float16 lossless appears to produce artifacts for specific values #3881
Labels
bug
Something isn't working
encoder
Related to the libjxl encoder
unrelated to 1.0
Things that need not be done before the 1.0 version milestone
Describe the bug
When using lossless float16 encoding, specific ranges of binary values appear to be corrupted. Specifically, it appears that all values with a binary representation corresponding to the uint16 ranges
[512:1023]
,[31745:32767]
,[33280:33793]
, and[64513:65534]
are changed during an encode-decode cycle.To Reproduce
Steps to reproduce the behavior:
[512:1023]
,[31745:32767]
,[33280:33793]
, and[64513:65534]
.Expected behavior
Values should not change during a lossless encode-decode cycle. I've tested float32 encoding with all possible values and it works as expected.
Screenshots


Affected value ranges in yellow:
Bit values (yellow = True) for all 65536 float16 values with affected ranges between red and blue lines.
Environment
Additional context
I found this issue using the
imagecodes
Python package. Original issue is cgohlke/imagecodecs#114.As mentioned in the issue linked above, I've not been able to test for the issue using cjxl/djxl or GIMP due to a lack of float16 support.
The text was updated successfully, but these errors were encountered: