microsoft/lepton_jpeg_rust

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:

$ ./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

Does #54 resp. 413877b fix this issue?

Does #54 resp. 413877b fix this issue?

No, it is just a library interface change.

I added #57 to fix this

fixed with #57