microsoft / lepton_jpeg_rust

Port of DropBox Lepton compression to Rust
Apache License 2.0
129 stars 10 forks source link

Add WrapperDecompressImageEx API that supports use_16bit_dc_estimate #54

Closed gbrovman closed 9 months ago

gbrovman commented 9 months ago

C++ version has a bug where it uses 16 bit math in the SIMD path and 32 bit math in the scalar path depending on the compiler options. This PR adds a new WrapperDecompressImageEx API that supports use_16bit_dc_estimate argument. If use_16bit_dc_estimate=true, the decompression uses a back-compat mode that considers it. The caller should set use_16bit_dc_estimate to true only for images that were compressed by C++ version with relevant compiler options. This approach is preferrable to a previously added retry logic that may miss some cases leading to bad (corrupted) decompression results.