Bug in decoding of "scalar" Lepton files
Melirius opened this issue · 4 comments
Analyzing merged PR #38 I found out that while current version of library can decode Lepton files, prepared in SIMD version of DropBox Lepton, it cannot decode Lepton files, prepared by its scalar version.
Steps to reproduce:
-
Compile scalar version from https://github.com/dropbox/lepton - it is
lepton-scalar
-
Encode overflowing file from #38 by
lepton-scalar mathoverflow.jpg mathoverflow_scalar.lep
, get mathoverflow_scalar.lep -
Try to decode it by current version of
lepton_jpeg_rust
$ ./lepton_jpeg_util mathoverflow_scalar.lep m.jpg
2023-12-15T12:51:24.441Z INFO [lepton_jpeg_util::structs::lepton_format] decoding 8 multipexed streams with 8 threads
error code: StreamInconsistent 7 numNonzeros7x7 > 49
It appears that lepton_jpeg_rust
uses 16 bit SIMD arithmetics in DC estimates prediction (1, 2), while "scalar" DropBox Lepton uses 32 bit (1, 2). BTW, as a result mathoverflow_32.lep file encoded by lepton_jpeg_rust
cannot be decoded neither by lepton-scalar
, nor by lepton-avx