Content deleted Content added
IznoRepeat (talk | contribs) m add WP:TEMPLATECAT to remove from template; genfixes |
Add distinguish from Golomb coding |
||
(2 intermediate revisions by 2 users not shown) | |||
Line 1:
{{distinguish|Golomb coding}}
An '''exponential-Golomb code''' (or just '''Exp-Golomb code''') is a type of [[Universal code (data compression)|universal code]]. To encode any [[nonnegative integer]] ''x'' using the exp-Golomb code:
# Write down ''x''+1 in binary
Line 36 ⟶ 38:
In other words, a non-positive integer ''x''≤0 is mapped to an even integer −2''x'', while a positive integer ''x''>0 is mapped to an odd integer 2''x''−1.
Exp-Golomb coding is also used in the [[Dirac (video compression format)|Dirac video codec]].<ref>{{cite web |title = Dirac Specification |url = http://diracvideo.org/download/specification/dirac-spec-latest.pdf |publisher = BBC |access-date = 9 March 2011 |url-status = usurped |archive-url = https://web.archive.org/web/20150503015104/http://diracvideo.org/download/specification/dirac-spec-latest.pdf |archive-date = 2015-05-03 }}</ref>
==Generalization to order ''k''==
To encode larger numbers in fewer bits (at the expense of using more bits to encode smaller numbers), this can be generalized using a [[nonnegative integer]] parameter ''k''. To encode a nonnegative integer ''x'' in an order-''k'' exp-Golomb code:
# Encode ⌊''x''/2<sup>''k''</sup>⌋ using order-0 exp-Golomb code described above, then
# Encode ''x'' mod 2<sup>''k''</sup> in binary with k bits
An equivalent way of expressing this is:
# Encode ''x''+2<sup>''k''</sup>−1 using the order-0 exp-Golomb code (i.e. encode ''x''+2<sup>''k''</sup> using the Elias gamma code), then
|