Expand description
Lorenzo-predictor codec for pointwise (max-abs) bounds, and for RMSE / PSNR targets through rate control of the bound.
Aimed at rough fields with one smooth (or repeating) axis, such as particle trajectories stored time × particle, where interpolating across the rough axis costs more than it predicts.
- Prediction, in row-major order on f32 reconstructions. Mode 0 is
the full N-D Lorenzo predictor (inclusion–exclusion over the axes whose
coordinate is > 0); mode
k + 1is the previous point along axisk(the N-D predictor where that coordinate is 0). The mode is picked by real stream size. - Quantization,
q = round((x − x̃)/2b), checked on the exact f32 reconstruction; failures are escaped raw (as incrate::interp). - Coding. Adaptive binary range coding: a zero flag with contexts
(symbol class of the previous point along the prediction axis and of
the side neighbour,
log₂of the last step along the prediction axis in quanta), a sign bit keyed on the previous point’s sign, and an adaptive Elias-gamma magnitude keyed on the two neighbour classes.
Constants§
- MAGIC
- Stream magic of the Lorenzo codec.
Functions§
- decode
- Decode a Lorenzo stream.
- encode_
f32 - Encode
x(row-major, shapedims) with|x − x̂| ≤ beverywhere, trying each prediction mode and keeping the smallest stream. - encode_
psnr_ f32 encode_rmse_f32atPSNR = 20 log₁₀(range / RMSE)dB.- encode_
rmse_ f32 - Encode for an RMSE target (
rmseabsolute): the mode is picked at the boundrmse·√3, then that mode’s bound is rate controlled as incrate::interp::encode_rmse_f32. The target is checked on the exact reconstruction.