Today I finished reading the source of LZ77 algorithm. The most of the source was understood by me. I took
about 4 days to studying. Although the main frame of lz77 algorithm is not hard to understand from the related
to articles. However, no sooner had I seen that source files than I began to forget what I did. There are little
comment in this source. Many time I have to detect what those codes want to do.
The principle of lz77 is similar to the the principle of K&M string match algorithm. It is the main task to
compare those encoded phrases with those waiting encoding phrases. The whole compressing procedure is a dynamic.
Those encoded phrase set is called a dictionary. At the beginning of compression, this dictionary is empty.
With the process of compression, more and more phrase is added into.
The function output a gamma code also puzzled me once. Some codes is used to work out exponent for 2. The
author, obviously, seems to be a hack. The semantic of some codes is not trenchant.
So, I have to add comments many where. Finally, I adjusted the source as my wish, and build it. The binary
program can run correctly. I tested it by a big file about 4.8mb. The speed of compression is not quick, but
decompress its compressed file so quickly.