microsoft / lepton_jpeg_rust

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

Simplify nonzero edge decoding / encoding #75

Closed mcroomp closed 4 months ago

mcroomp commented 4 months ago

Remove ProbabilityTablesCoefficientContext and calculate the values when actually needed. This means that we can range check the values at the same place that does the array lookup, which means no range check effectively. It also means that we can recycle the absolute value calculation on the best_prior.

Overall this speeds up execution about 1.5% and simplifies the code as well.