codec / predictor · 2D / lossless
planar
Predict the local surface, not just one direction.
planar uses the west, north and north-west neighbours to continue the local slope: W + N − NW. It works especially well on smooth two-dimensional gradients, where a perfect plane becomes a stream of zeros. Along the top and left edges it falls back to a simple one-direction predictor.
- ctid
- 0x72D703
- header
- uint32 · row width in samples
+ uint32 · plane count, when above one - widths
- 8 · 16 · 32 · 64-bit integers
- decode
- fold N−NW from the row above, then prefix-sum the row
Code
geozl.lossless.Planar(width, planes=1)