词条 | Elias gamma coding | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
释义 |
Elias γ code or Elias gamma code is a universal code encoding positive integers developed by Peter Elias.{{rp|197, 199}} It is used most commonly when coding integers whose upper-bound cannot be determined beforehand. EncodingTo code a number x ≥ 1:
An equivalent way to express the same process:
To represent a number , Elias gamma (γ) uses bits.{{rp|199}} The code begins (the implied probability distribution for the code is added for clarity):
DecodingTo decode an Elias gamma-coded integer:
UsesGamma coding is used in applications where the largest encoded value is not known ahead of time, or to compress data in which small values are much more frequent than large values. Gamma coding is a building block in the Elias delta code. == Generalizations == Gamma coding does not code zero or negative integers. One way of handling zero is to add 1 before coding and then subtract 1 after decoding. Another way is to prefix each nonzero code with a 1 and then code zero as a single 0. One way to code all integers is to set up a bijection, mapping integers (0, −1, 1, −2, 2, −3, 3, ...) to (1, 2, 3, 4, 5, 6, 7, ...) before coding. In software, this is most easily done by mapping non-negative inputs to odd outputs, and negative inputs to even outputs, so the least-significant bit becomes an inverted sign bit: Exponential-Golomb coding generalizes the gamma code to integers with a "flatter" power-law distribution, just as Golomb coding generalizes the unary code. It involves dividing the number by a positive divisor, commonly a power of 2, writing the gamma code for one more than the quotient, and writing out the remainder in an ordinary binary code. See also
References}} Further reading
3 : Numeral systems|Lossless compression algorithms|Articles with example C code |
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
随便看 |
|
开放百科全书收录14589846条英语、德语、日语等多语种百科知识,基本涵盖了大多数领域的百科知识,是一部内容自由、开放的电子版国际百科全书。