Expand description
Elias δ code.
The δ code of a natural number n is the concatenation of the γ code of ⌊log₂(n + 1)⌋ and the binary representation of n + 1 with the most significant bit removed.
The implied distribution of the δ code is ≈ 1/2x(log x)².
The USE_DELTA_TABLE parameter enables or disables the use of pre-computed
tables for decoding δ codes, and the USE_GAMMA_TABLE parameter enables or
disables the use of pre-computed tables for decoding the the initial γ code
in case the whole δ code could not be decoded by tables.
The supported range is [0 . . 2⁶⁴ – 1).
§Table-Based Optimization
Like ω codes, δ codes use a special optimization for partial decoding. Due to the structure of δ codes (a γ code followed by fixed bits), when a complete codeword cannot be read from the table, the table may still provide partial information about the γ prefix that was successfully decoded. This partial state is used to directly read the remaining fixed bits, avoiding re-reading the γ prefix.
§References
Peter Elias, “Universal codeword sets and representations of the integers”. IEEE Transactions on Information Theory, 21(2):194−203, March 1975.
Traits§
- Delta
Read - Trait for reading δ codes.
- Delta
Read Param - Parametric trait for reading δ codes.
- Delta
Write - Trait for writing δ codes.
- Delta
Write Param - Parametric trait for writing δ codes.
Functions§
- len_
delta - Returns the length of the δ code for
nusing a default value forUSE_DELTA_TABLEandUSE_GAMMA_TABLE. - len_
delta_ param - Returns the length of the δ code for
n.