Filmie ruginy dzieci kiedy inni chcą jakiegoś szyfru możemy też CTW. CTW is algorithm developed by Frans Willems, Shtarkov and Tjalling Tjalkens 1995 and implemented by Franken and Peeters 2002. the U.S. and Europe it is protected by patents EP0913035B1, EP0855803, US6150966, US5986591, US5864308 owned by Koninklijke KPN NV, Netherlands. CTW, like DMC, predicts one bit at a time using bit count statistics for contexts that begin on byte boundaries. Like PPM and unlike DMC, it combines the predictions of different order contexts from order 0 up to some maximum order D. Each context is associated with two bit counters, n 0 and n 1, and a mixing weight, w. Each context order i from 0 through D computes estimator e i that the next bit be a 1 depending on the two counts. The highest order context predicts p D e D. All of the lower order contexts predict p i which is a weighted average of e i and the next higher order p i+1. The final prediction is either p 0 or p 1. On update with bit y the count n y is incremented and w is updated to favor the more accurate prediction each context, either toward e i or p i+1. Specifically, CTW uses the Krichevski-Trofimov estimator: e i e i 1 e i except for the special case where one of the counts is 0, which we consider later. Then the prediction, expressed as a ratio, is: p D e D p D e D p i p i p i+1 p i+1 i 0 e n 1, n 0 e k k n 1), n 1, n 0 All estimators are symmetric with respect to 0 and 1. The probability of a 1 given the sequence 00000 is the same as the probability of 0 given 11111. The ZR estimator gives a smaller probability for these cases than the KT estimator. The following table gives the probability that a 1 follow n 0 zeros and no ones with each estimator. n 0 KT ZR 0.500000.500000 0 0 2.166667.064103 0 0 4.100000.032984 0 0 6.071429.021089 0 0 8.055556.015032 0 0 10.045455.011441 0 0 1000.000500.000017 For large runs of identical bits, the total code length for KT grows logarithmically but the ZR estimator is bounded to 2 bits. However, ZR adds 1 bit of redundancy when the other bit value eventually occurs. For large n 0, the ZR estimated probability of a 1 approaches 0 at the rate n 0 2. This is faster than n 0 for the KT estimator. The CTW implementation uses a context tree to store the two counts and w. Each count is 8 bits. If one count exceeds 255, then both counts are divided by 2. It stores log rather than w and does all arithmetic the log domain that multiplication and division are implemented using addition and subtraction. The KT and ZR estimators are looked up a table indexed by the two counts. A context tree is a 256-ary tree where each node at depth N+1 from the root represents order-N context. The parent of each node is the suffix obtained by removing one byte. The children of the root node represent the 255 possible partial byte order 0 contexts of length 0 to 7 bits. To save space, children of contexts that have only occurred once are not stored. Each tree node uses 8 bytes, including a 24 bit pointer to the context a separate file buffer. CTW is best suited for stationary sources. The published CTW implementation compresses the Calgary corpus to 767 bytes as 14 separate files 62 seconds with options -n16M -b16M -d12 set for maximum compression. With the same options, it compresses calgary.tar to 965 bytes. -d12 sets the maximum context order to 12. -b16M sets the file buffer to 16 MB. -n16M limits the tree to 16 million nodes. When the tree is full, no new contexts are added but the counts and weights continue to be updated. These settings require 144 MB memory, the maximum that the published implementation can use. Context mixing algorithms based on the PAQ series are top ranked on benchmarks by size, but are very slow. These algorithms predict one bit at a time except that weights are associated with models rather than contexts, and the contexts need not be mixed from longest to shortest context order. Contexts can be arbitrary functions of the history, not just suffixes of different lengths. Often the result is that the combined prediction of independent models compresses better than any of the individuals that contributed to it. DMC, PPM, and CTW are based on the premise that the longest context for which statistics is available is the best predictor. This is usually true for text but not always the case. For example, audio file, a predictor would be better off ignoring the low order bits of the samples its context because they are mostly noise. For image compression, the best predictors are the neighboring pixels two dimensions, which do not form a contiguous context. For text, we can improve compression using some contexts that begin on word boundaries and