Dynamic Markov compression
Dynamic Markov compression (DMC) is a lossless data compression algorithm developed by Gordon Cormack and Nigel Horspool.[src] 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).[src] DMC has a good compression ratio and moderate speed, similar to PPM, but requires somewhat more memory and is not widely implemented.[src] Some recent implementations include the experimental compression programs hook by Nania Francesco Antonio, ocamyd by Frank Schwellinger, and as a submodel in paq8l by Matt Mahoney.[src] These are based on the 1993 implementation in C by Gordon Cormack.[src]
Dynamic Markov compression (DMC) is a lossless data compression algorithm developed by Gordon Cormack and Nigel Horspool.[src] 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).[src] DMC has a good compression ratio and moderate speed, similar to PPM, but requires somewhat more memory and is not widely implemented.[src] Some recent implementations include the experimental compression programs hook by Nania Francesco Antonio, ocamyd by Frank Schwellinger, and as a submodel in paq8l by Matt Mahoney.[src] These are based on the 1993 implementation in C by Gordon Cormack.[src] A bitwise arithmetic coder such as DMC has two components, a predictor and an arithmetic coder.[src] The predictor accepts an n-bit input string x = x 1 x 2 ...x n and assigns it a probability p(x), expressed as a product of a series of predictions, p(x 1 )p(x 2 |x 1 )p(x 3 |x 1 x 2 ) ...[src] p(x n | x 1 x 2 ...x n–1 ).[src] The arithmetic coder maintains two high precision binary numbers, p low and p high , 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.[src] The compressed code for x is p x , the shortest bit string representing a number between p low and p high .[src] It is always possible to find a number in this range no more than one bit longer than the Shannon limit, log 2 1 / p(x).[src] One such number can be obtained from p high by dropping all of the trailing bits after the first bit that differs from p low .[src] Compression proceeds as follows.[src] The initial range is set to p low = 0, p high = 1.[src] For each bit, the predictor estimates p 0 = p(x i = 0|x 1 x 2 ...x i–1 ) and p 1 = 1 − p 0 , the probability of a 0 or 1, respectively.[src] The arithmetic coder then divides the current range, (p low , p high ) into two parts in proportion to p 0 and p 1 .[src] Then the subrange corresponding to the next bit x i becomes the new range.[src] For decompression, the predictor makes an identical series of predictions, given the bits decompressed so far.[src] The arithmetic coder makes an identical series of range splits, then selects the range containing p x and outputs the bit x i corresponding to that subrange.[src] In practice, it is not necessary to keep p low and p high in memory to high precision.[src] As the range narrows the leading bits of both numbers will be the same, and can be output immediately.[src] The DMC predictor is a table which maps (bitwise) contexts to a pair of counts, n 0 and n 1 , representing the number of zeros and ones previously observed in this context.[src] Thus, it predicts that the next bit will be a 0 with probability p 0 = n 0 / n = n 0 / (n 0 + n 1 ) and 1 with probability p 1 = 1 − p 0 = n 1 / n.[src] In addition, each table entry has a pair of pointers to the contexts obtained by appending either a 0 or a 1 to the right of the current context (and possibly dropping bits on the left).[src] Thus, it is never necessary to look up the current context in the table; it is sufficient to maintain a pointer to the current context and follow the links.[src] In the original DMC implementation, the initial table is the set of all contexts of length 8 to 15 bits that begin on a byte boundary.[src] The initial state is any of the 8 bit contexts.[src] The counts are floating point numbers initialized to a small nonzero constant such as 0.2.[src] The counts are not initialized to zero in order to allow values to be coded even if they have not been seen before in the current context.[src] Modeling is the same for compression and decompression.[src] For each bit, p 0 and p 1 are computed, bit x i is coded or decoded, the model is updated by adding 1 to the count corresponding to x i , and the next context is found by traversing the link corresponding to x i .[src] DMC as described above is equivalent to an order-1 context model.[src] However, it is normal to add longer contexts to improve compression.[src] If the current context is A, and the next context B would drop bits on the left, then DMC may add (clone) a new context C from B.[src] C represents the same context as A after appending one bit on the right as with B, but without dropping any bits on the left.[src] The link from A will thus be moved from B to point to C.[src] B and C will both make the same prediction, and both will point to the same pair of next states.[src] The total count, n = n 0 + n 1 for C will be equal to the count n x for A (for input bit x), and that count will be subtracted from B.[src] For example, suppose that state A represents the context 11111.[src] On input bit 0, it transitions to state B representing context 110, obtained by dropping 3 bits on the left.[src] In context A, there have been 4 zero bits and some number of one bits.[src] In context B, there have been 3 zeros and 7 ones (n = 10), which predicts p 1 = 0.7.[src] C is cloned from B.[src] It represents context 111110.[src] Both B and C predict p 1 = 0.7, and both go to the same next states, E and F.[src] The count for C is n = 4, equal to n 0 for A.[src] This leaves n = 6 for B.[src] States are cloned just prior to transitioning to them.[src] In the original DMC, the condition for cloning a state is when the transition from A to B is at least 2, and the count for B is at least 2 more than that.[src] (When the second threshold is greater than 0, it guarantees that other states will still transition to B after cloning).[src] Some implementations such as hook allow these thresholds to be set as parameters.[src] In paq8l, these thresholds increase as memory is used up to slow the growth rate of new states.[src] In most implementations, when memory is exhausted the model is discarded and reinitialized back to the original bytewise order 1 model.[src] Google Developers YouTube channel: Compressor Head Episode 3 (Markov Chain Compression)[src]
59 sentences · 59 cited inline · 0 references stored
References
No reference rows published for this article.
Cite this article
MLA
"Dynamic Markov compression." encyclopegia.org, 2025, https://encyclopegia.org/wiki/dynamic-markov-compression. Accessed 06 December 2026.
Chicago
"Dynamic Markov compression." encyclopegia.org. Accessed December 6, 2026. https://encyclopegia.org/wiki/dynamic-markov-compression.
APA
encyclopegia.org. (2025). Dynamic Markov compression. Retrieved December 6, 2026, from https://encyclopegia.org/wiki/dynamic-markov-compression
Accessed December 6, 2026 · CC BY-SA 4.0 · citation page · JSON