tirr-c / jxl-oxide

Pure Rust implementation of JPEG XL decoder
Apache License 2.0
279 stars 12 forks source link

Lossless JPEG-XL files encoded with effort 8 or 9 sometimes fail to decode. #268

Closed Aerocatia closed 6 months ago

Aerocatia commented 6 months ago

This image encoded with cjxl 0.10.1 fails to decode with jxl-oxide, giving the error frame error: modular stream error: entropy decoder error: error from bitstream: I/O error: unexpected end of file. File: 1225036754354229250_1.zip

If it is encoded with -e 7 it works fine.

I have no idea what is so special about this image, it was just part of a set of images that is having issues with libjxl. There seems to be a bug with lossless compression on libjxl's side, as some images fail to encode at all.

Despite all of this the sample decodes with djxl.

Aerocatia commented 6 months ago

Another sample, this one gives frame error: modular stream error: entropy decoder error: ANS stream verification failed.

Again, efforts <8 do not produce a file that fails in jxl-oxide.

1070025136848351232_1.zip

tirr-c commented 6 months ago

I force decoded the first image with error checks off and got this. Maybe this is caused by #227, will bisect when I have more time.

out

tirr-c commented 6 months ago

Turns out that it has been broken since v0.1.0. I'm going to investigate this, maybe it'll take a while though...

tirr-c commented 6 months ago

There was an unfortunate mistake in libjxl that doesn't quite follow the spec and misses better compression. We need to workaround and match libjxl here...