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.
本文分享了作者花费四天时间研究LZ77算法源码的经历。文章详细介绍了LZ77算法的工作原理,包括其与K&M字符串匹配算法的相似之处,以及压缩过程中的动态字典更新机制。此外,还探讨了源码中一些晦涩难懂的部分,并记录了作者为理解这些部分所做的努力。
550

被折叠的 条评论
为什么被折叠?



