Content deleted Content added
→DMC model: Added some space and boldness. Now it is better to read. |
Adding short description: "Lossless data compression algorithm" |
||
(3 intermediate revisions by 3 users not shown) | |||
Line 1:
{{Short description|Lossless data compression algorithm}}
'''Dynamic Markov compression''' ('''DMC''') is a lossless [[data compression]] [[algorithm]] developed by [[Gordon Cormack]] and [[Nigel Horspool]].<ref>Gordon Cormack and Nigel Horspool, "Data Compression using Dynamic Markov Modelling", Computer Journal 30:6 (December 1987)</ref> It uses predictive [[arithmetic coding]] similar to [[prediction by partial matching]] (PPM), except that the input is predicted one bit at a time (rather than one byte at a time). DMC has a good compression ratio and moderate speed, similar to PPM, but requires somewhat more memory and is not widely implemented. Some recent implementations include the experimental compression programs [http://cs.fit.edu/~mmahoney/compression/text.html#1781 hook] by Nania Francesco Antonio, [https://web.archive.org/web/20091026235047/http://de.geocities.com/ocamyd/ ocamyd] by Frank Schwellinger, and as a submodel in [[PAQ|paq8l]] by Matt Mahoney. These are based on the [https://web.archive.org/web/20070630111546/http://plg.uwaterloo.ca/~ftp/dmc/dmc.c 1993 implementation] in C by Gordon Cormack.
Line 7 ⟶ 8:
=== Arithmetic coding ===
A bitwise arithmetic coder such as DMC has two components, a predictor and an arithmetic coder. The predictor accepts an ''n''-bit input string ''x'' = ''x''<sub>1</sub>''x''<sub>2</sub>...''x''<sub>''n''</sub> and assigns it a probability ''p''(''x''), expressed as a product of a series of predictions, ''p''(''x''<sub>1</sub>)''p''(''x''<sub>2</sub>'''|'''''x''<sub>1</sub>)''p''(''x''<sub>3</sub>'''|'''''x''<sub>1</sub>''x''<sub>2</sub>) ... ''p''(''x''<sub>''n''</sub>'''|''' ''x''<sub>1</sub>''x''<sub>2</sub>...''x''<sub>''n''–1</sub>). The arithmetic coder maintains two high precision binary numbers, ''p''<sub>low</sub> and ''p''<sub>high</sub>, representing the possible range for the total probability that the model would assign to all strings lexicographically less than ''x'', given the bits of ''x'' seen so far. The compressed code for ''x'' is ''p''<sub>''x''</sub>, the shortest bit string representing a number between ''p''<sub>low</sub> and ''p''<sub>high</sub>. It is always possible to find a number in this range no more than one bit longer than the [[Claude Shannon|Shannon]] limit, log<sub>2</sub> 1 '''/''' ''p''(''x''). One such number can be obtained from ''p''<sub>high</sub> by dropping all of the trailing bits after the first bit that differs from ''p''<sub>low</sub>.
Compression proceeds as follows. The initial range is set to ''p''<sub>low</sub> = 0, ''p''<sub>high</sub> = 1. For each bit, the predictor estimates ''p''<sub>0</sub> = ''p''(''x''<sub>''i''</sub> = 0'''|'''''x''<sub>1</sub>''x''<sub>2</sub>...''x''<sub>''i''–1</sub>) and ''p''<sub>1</sub> = 1 − ''p''<sub>0</sub>, the probability of a 0 or 1, respectively. The arithmetic coder then divides the current range, (''p''<sub>low</sub>, ''p''<sub>high</sub>) into two parts in proportion to ''p''<sub>0</sub> and ''p''<sub>1</sub>. Then the subrange corresponding to the next bit ''x''<sub>''i''</sub> becomes the new range.
Line 13 ⟶ 14:
For decompression, the predictor makes an identical series of predictions, given the bits decompressed so far. The arithmetic coder makes an identical series of range splits, then selects the range containing ''p''<sub>''x''</sub> and outputs the bit ''x''<sub>''i''</sub> corresponding to that subrange.
In practice, it is not necessary to keep ''p''<sub>low</sub> and ''p''<sub>high</sub> in memory to high precision. As the range narrows
=== DMC model ===
Line 22 ⟶ 23:
Modeling is the same for compression and decompression. For each bit, ''p''<sub>0</sub> and ''p''<sub>1</sub> are computed, bit ''x''<sub>''i''</sub> is coded or decoded, the model is updated by adding 1 to the count corresponding to ''x''<sub>''i''</sub>, and the next context is found by traversing the link corresponding to ''x''<sub>''i''</sub>.
=== Adding new contexts ===
Line 94:
[[Category:Lossless compression algorithms]]
[[Category:Markov models]]
[[Category:Data compression]]
|