lomont.org

(Also lomonster.com and clomont.com)

 

 

 

 

Chris Lomont's Mini Compression Code

Download C++ code and sample exe (29K rar file).

 

This code implements modified LZ77/LZSS type of compression/decompression routines, and has a sample program to show how they are used.

 

The RAR file contains a Visual Studio 2005 project, and the exe included probably needs the runtime DLLs installed. The C++ compression/decompression files should run on almost any platform with minimal hassle.

 

The compression is not straight LZ77 (as far as I can tell), since I was reinventing the wheel and found a method to compress literal runs better than standard LZ77. Not being interested in researching all the literature, I assume someone else has thought of the techniques in the code. If you find this to be true, please tell me.

 

There are two compression routines, each in a standalone file. One is a greedy matching one, and the other finds an optimal compression (under the parameters required by the decompressor). The greedy one requires little extra memory and is faster than the optimal one.

 

The decompressor is fast, small, and decompresses into the output buffer with very little memory overhead, so is well suited for constrained systems like embedded systems, handheld devices, etc.

 

If you want to use this code in a commercial application contact me. Feel free to use it anywhere else. I may be inclined to LGPL it one of these days.

 

Also, given inspiration and time I might detail the algorithm, which was driven by requiring a fast, small, minimal overhead decompressor. I used this to compress data on the PC side, and decompress on a small embedded system and it worked out fine.