Rice Coding
Rice coding is the special case of Golomb coding with m = 2^k, replacing division with shifts; it is simple and efficient, and is widely used for audio and image residual coding.
Purpose
It achieves near-optimal coding with minimal computational cost for geometric distributions whose parameter is a power of two, suiting real-time systems.
Mechanism
For an integer n, compute q = n >> k and r = n & (2^k - 1); q is coded in unary (q ones followed by a zero) and r in k binary bits. The parameter k is chosen adaptively from distribution statistics.
Use cases
- FLAC audio residual coding
- JPEG-LS residuals
- Spatial data compression