Unary coding

Unary coding

Unary coding is an entropy encoding that represents a natural number, "n", with "n" − 1 ones followed by a zero. For example 5 is represented as 11110. Some representations use "n" − 1 zeros followed by a one. The ones and zeros are interchangeable without loss of generality.

nUnary code
11
201
3001
40001
500001
6000001
70000001
800000001
9000000001
100000000001

Unary coding is an optimally efficient encoding for the following discrete probability distribution

:operatorname{P}(n) = 2^{-n},

for n=1,2,3,....

In symbol-by-symbol coding, it is optimal for any geometric distribution

:operatorname{P}(n) = (k-1)k^{-n},

for which "k" ≥ φ = 1.61803398879…, the golden ratio, or, more generally, for any discrete distribution for which

:operatorname{P}(n) ge operatorname{P}(n+1) + operatorname{P}(n+2),

for n=1,2,3,.... Although it is the optimal symbol-by-symbol coding for such probability distributions, its optimality can, like that of Huffman coding, be over-stated. Arithmetic coding has better compression capability for the last two distributions mentioned above because it does not consider input symbols independently, but rather implicitly groups the inputs.

A modified unary encoding is used in UTF-8. Unary codes are also used in split-index schemes like the Golomb Rice code. Unary coding is prefix-free, and can be uniquely decoded.

References

*Khalid Sayood, "Data Compression", 3rd ed, Morgan Kaufmann.
*Professor K.R Rao, EE5359:"Principles of Digital Video Coding".


Wikimedia Foundation. 2010.

Игры ⚽ Поможем решить контрольную работу

Look at other dictionaries:

  • Unary — * Unary numeral system, the simplest numeral system to represent natural numbers * Unary operation, a kind of mathematical operator that has only one operand * Unary coding, an entropy encoding that represents a number n with n − 1 ones followed… …   Wikipedia

  • unary — 1. adjective a) Consisting of or involving a single element or component. Negation is a unary operation. b) Of an operation, function, procedure or logic g …   Wiktionary

  • Golomb coding — is a data compression scheme invented by Solomon W. Golomb in the 1960s. The scheme is based on entropy encoding and is optimal (in the sense of Shannon s source coding theorem) for alphabets following a geometric distribution, making it highly… …   Wikipedia

  • Elias gamma coding — Elias gamma code is a universal code encoding positive integers. It is used most commonly when coding integers whose upper bound cannot be determined beforehand. To code a number: #Write it in binary. #Subtract 1 from the number of bits written… …   Wikipedia

  • Universal code (data compression) — In data compression, a universal code for integers is a prefix code that maps the positive integers onto binary codewords, with the additional property that whatever the true probability distribution on integers, as long as the distribution is… …   Wikipedia

  • List of algorithms — The following is a list of the algorithms described in Wikipedia. See also the list of data structures, list of algorithm general topics and list of terms relating to algorithms and data structures.If you intend to describe a new algorithm,… …   Wikipedia

  • Entropy encoding — In information theory an entropy encoding is a lossless data compression scheme that is independent of the specific characteristics of the medium. One of the main types of entropy coding creates and assigns a unique prefix free code to each… …   Wikipedia

  • Prefix code — A prefix code is a code, typically a variable length code, with the prefix property : no code word is a prefix of any other code word in the set. A code with code words {0, 10, 11} has the prefix property; a code consisting of {0, 1, 10, 11} does …   Wikipedia

  • List of mathematics articles (U) — NOTOC U U duality U quadratic distribution U statistic UCT Mathematics Competition Ugly duckling theorem Ulam numbers Ulam spiral Ultraconnected space Ultrafilter Ultrafinitism Ultrahyperbolic wave equation Ultralimit Ultrametric space… …   Wikipedia

  • Bit array — A bit array (or bitmap, in some cases) is an array data structure which compactly stores individual bits (boolean values). It implements a simple set data structure storing a subset of {1,2,..., n } and is effective at exploiting bit level… …   Wikipedia

Share the article and excerpts

Direct link
Do a right-click on the link above
and select “Copy Link”