JPEG files with non-interleaved scans are not handled correctly:
- Lepton files produced by Dropbox' implementation cannot be decoded correctly by this project.
- Dropbox' implementation cannot decode Lepton files produced by this project.
To test this, I took cathedral.ppm from https://imagecompression.info/test_images/ and compressed with with cjpeg from libjpeg-turbo (e.g. the libjpeg-turbo-progs package on Ubuntu):
# scan.txt contains "0;1;2;", see https://github.com/libjpeg-turbo/libjpeg-turbo/blob/main/doc/wizard.txt
cjpeg -optimize -outfile cathedral.jpg -scans scan.txt cathedral.ppm
cathedral.jpg
I had to zip the Lepton files otherwise I couldn't upload them to GitHub.
I used the current main branch of this project (adf4f4a).
Compressed with Dropbox's implementation (./lepton cathedral.jpg && mv cathedral.lep cathedral_db.lep): cathedral_db.zip.
Decompressing with this project (./lepton_jpeg_util cathedral_db.lep cathedral_db_ms.jpg) gives a greyscale JPEG:
cathedral_db_ms.jpg. It seems that only the first scan is decoded (can be observed by trying some different scan order, e.g. 2;0;1;).
Compressing with this project (./lepton_jpeg_util cathedral.jpg cathedral_ms.lep): cathedral_ms.zip
Decompressing with Dropbox' implementation (./lepton cathedral_ms.lep) reports ASSERTION_FAILURE and fails.
Note that compression and decompression (roundtripping/validating) with the same project does work correctly.
I haven't looked myself in how the produced Lepton files differ, but I assume that the preferred option is to produce the Lepton file similarly to how Dropbox' implementation does it. Otherwise, the Lepton "specification" is expanded and a Lepton file in the wild has two possible ways of decoding. From my experience, non-interleaved JPEG files aren't very common but I suspect that this will appear more often than the math overflow in the Dropbox implementation.
JPEG files with non-interleaved scans are not handled correctly:
To test this, I took
cathedral.ppmfrom https://imagecompression.info/test_images/ and compressed with withcjpegfromlibjpeg-turbo(e.g. thelibjpeg-turbo-progspackage on Ubuntu):# scan.txt contains "0;1;2;", see https://github.com/libjpeg-turbo/libjpeg-turbo/blob/main/doc/wizard.txt cjpeg -optimize -outfile cathedral.jpg -scans scan.txt cathedral.ppmcathedral.jpgI had to zip the Lepton files otherwise I couldn't upload them to GitHub.
I used the current main branch of this project (adf4f4a).
Compressed with Dropbox's implementation (
./lepton cathedral.jpg && mv cathedral.lep cathedral_db.lep):cathedral_db.zip.Decompressing with this project (
./lepton_jpeg_util cathedral_db.lep cathedral_db_ms.jpg) gives a greyscale JPEG:cathedral_db_ms.jpg. It seems that only the first scan is decoded (can be observed by trying some different scan order, e.g.2;0;1;).Compressing with this project (
./lepton_jpeg_util cathedral.jpg cathedral_ms.lep):cathedral_ms.zipDecompressing with Dropbox' implementation (
./lepton cathedral_ms.lep) reportsASSERTION_FAILUREand fails.Note that compression and decompression (roundtripping/validating) with the same project does work correctly.
I haven't looked myself in how the produced Lepton files differ, but I assume that the preferred option is to produce the Lepton file similarly to how Dropbox' implementation does it. Otherwise, the Lepton "specification" is expanded and a Lepton file in the wild has two possible ways of decoding. From my experience, non-interleaved JPEG files aren't very common but I suspect that this will appear more often than the math overflow in the Dropbox implementation.