Basic Compression Library

v1.2.0   -   2006-07-22


The Basic Compression Library is a set of open source implementations of several well known lossless compression algorithms, such as Huffman and RLE, written in portable ANSI C.

Currently, RLE (Run Length Encoding), Huffman, Rice, Lempel-Ziv (LZ77) and Shannon-Fano compression algorithms are implemented.

The library itself is not intended to serve as a competitor to advanced general purpose compression tools, but rather as a reference or a set of building blocks for custom compression algorithms. The library comes with rich documentation, and the source code is well commented, so it should be easy to use and adapt to specific needs.

The Basic Compression Library is completely independent of system functions, such as file I/O or memory allocation routines. As such it can be used in almost any system, ranging from Windows, Mac OS X and Linux-systems to embedded systems.


The Basic Compression Library can be used for educational purposes, as a starting point for building your own compression algorithm, or just as it is for simple general purpose compression.

An example of a field where customized compression algorithms can be be useful is the compression of digitized media (such as images or audio), for which you usually have lots of a priori information, and can tailor an efficient method based on entropy reduction (e.g. differentiation) followed by simple entropy coding (e.g. Huffman coding).

In many cases entropy reduction results in data that is NOT easily compressed with advanced dictionary based general purpose entropy coders, such as gzip or bzip2, since data often becomes very noisy after entropy reduction. Even a simple Huffman coder can give better compression results than the most advanced dictionary based coders under these circumstances.


OSI certified [tm]

The Basic Compression Library is released under the zlib license, which means that it is free for anyone to use, modify and redistribute, either in source code or binary form. The complete (yet short) license text can be found in the library distribution.

For a definition of the term "Open Source", click on the "OSI certified" logo (the zlib license is an OSI certified Open Source license).

Repository Hosting


The source code for the Basic Compression Library is under version control in a Subversion repository that is hosted by Sourceforge.net. Many thanks for the excellent service!