diff options
author | jbj <devnull@localhost> | 2003-05-18 18:33:39 +0000 |
---|---|---|
committer | jbj <devnull@localhost> | 2003-05-18 18:33:39 +0000 |
commit | 4ec7ad486eb4cde45127097b23db051f97bc6ecf (patch) | |
tree | 7825c38fb0b0e5a69fa9efdb93aa8d36be86f1e4 /zlib/algorithm.txt | |
parent | 128338204307e65672e4a6bea046e826152a5210 (diff) | |
download | librpm-tizen-4ec7ad486eb4cde45127097b23db051f97bc6ecf.tar.gz librpm-tizen-4ec7ad486eb4cde45127097b23db051f97bc6ecf.tar.bz2 librpm-tizen-4ec7ad486eb4cde45127097b23db051f97bc6ecf.zip |
Upgrade to zlib-1.2.0.1.
CVS patchset: 6860
CVS date: 2003/05/18 18:33:39
Diffstat (limited to 'zlib/algorithm.txt')
-rw-r--r-- | zlib/algorithm.txt | 34 |
1 files changed, 15 insertions, 19 deletions
diff --git a/zlib/algorithm.txt b/zlib/algorithm.txt index cdc830b5d..f64f7c359 100644 --- a/zlib/algorithm.txt +++ b/zlib/algorithm.txt @@ -59,10 +59,10 @@ but saves time since there are both fewer insertions and fewer searches. 2.1 Introduction -The real question is, given a Huffman tree, how to decode fast. The most -important realization is that shorter codes are much more common than -longer codes, so pay attention to decoding the short codes fast, and let -the long codes take longer to decode. +The key question is how to represent a Huffman code (or any prefix code) so +that you can decode fast. The most important characteristic is that shorter +codes are much more common than longer codes, so pay attention to decoding the +short codes fast, and let the long codes take longer to decode. inflate() sets up a first level table that covers some number of bits of input less than the length of longest code. It gets that many bits from the @@ -77,20 +77,16 @@ table took no time (and if you had infinite memory), then there would only be a first level table to cover all the way to the longest code. However, building the table ends up taking a lot longer for more bits since short codes are replicated many times in such a table. What inflate() does is -simply to make the number of bits in the first table a variable, and set it -for the maximum speed. - -inflate() sends new trees relatively often, so it is possibly set for a -smaller first level table than an application that has only one tree for -all the data. For inflate, which has 286 possible codes for the -literal/length tree, the size of the first table is nine bits. Also the -distance trees have 30 possible values, and the size of the first table is -six bits. Note that for each of those cases, the table ended up one bit -longer than the ``average'' code length, i.e. the code length of an -approximately flat code which would be a little more than eight bits for -286 symbols and a little less than five bits for 30 symbols. It would be -interesting to see if optimizing the first level table for other -applications gave values within a bit or two of the flat code size. +simply to make the number of bits in the first table a variable, and then +to set that variable for the maximum speed. + +For inflate, which has 286 possible codes for the literal/length tree, the size +of the first table is nine bits. Also the distance trees have 30 possible +values, and the size of the first table is six bits. Note that for each of +those cases, the table ended up one bit longer than the ``average'' code +length, i.e. the code length of an approximately flat code which would be a +little more than eight bits for 286 symbols and a little less than five bits +for 30 symbols. 2.2 More details on the inflate table lookup @@ -158,7 +154,7 @@ Let's make the first table three bits long (eight entries): 110: -> table X (gobble 3 bits) 111: -> table Y (gobble 3 bits) -Each entry is what the bits decode to and how many bits that is, i.e. how +Each entry is what the bits decode as and how many bits that is, i.e. how many bits to gobble. Or the entry points to another table, with the number of bits to gobble implicit in the size of the table. |