Module delta

Source
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.

§References

Peter Elias, “Universal codeword sets and representations of the integers”. IEEE Transactions on Information Theory, 21(2):194−203, March 1975.

Traits§

DeltaRead
Trait for reading δ codes.
DeltaReadParam
Parametric trait for reading δ codes.
DeltaWrite
Trait for writing δ codes.
DeltaWriteParam
Parametric trait for writing δ codes.

Functions§

len_delta
Returns the length of the δ code for n using a default value for USE_DELTA_TABLE and USE_GAMMA_TABLE.
len_delta_param
Returns the length of the δ code for n.