Expand description
Elias γ code.
The γ code of a natural number n is the concatenation of the unary code of ⌊log₂(n + 1)⌋ and of the binary representation of n + 1 with the most significant bit removed.
The implied distribution of the γ code is ≈ 1/2x².
The USE_TABLE
parameter enables or disables the use of pre-computed tables
for decoding.
§References
Peter Elias, “Universal codeword sets and representations of the integers”. IEEE Transactions on Information Theory, 21(2):194−203, March 1975.
Traits§
- Gamma
Read - Trait for reading γ codes.
- Gamma
Read Param - Parametric trait for reading γ codes.
- Gamma
Write - Trait for writing γ codes.
- Gamma
Write Param - Parametric trait for writing γ codes.
Functions§
- len_
gamma - Returns the length of the γ code for
n
using a default value forUSE_TABLE
. - len_
gamma_ param - Returns the length of the γ code for
n
.