compressexecutable that can compress and extract arbitrary files with various compression methods (default: Huffman):-
$ build/compress -h Usage: build/compress [options] INPUT_FILENAME -h, --help Show this help message -l, --lzw Use LZW compression instead of Huffman -b, --bwmh Use Burrows-Wheeler, move-to-front, and then Huffman compression instead of only Huffman -x, --extract Extract input file instead of compressing it Examples: build/compress input.txt Compress input.txt with Huffman build/compress -l input.txt Compress input.txt with LZW build/compress -xl input.txt.lzw Extract input.txt.lzw with LZW
-
huffman::compressandhuffman::expandto apply Huffman-style lossless compression to data streamslzw::compressandlzw::expandto apply Lempel–Ziv–Welch (LZW) lossless compression to data streamsBitStreamInas a wrapper to easily read a bit stream fromstd::istreamBitStreamOutas a wrapper to easily write a bit stream tostd::ostreamShortBitSetas a simple bit set with up to 32 bits (stored in auint32_t) and some convenience functionsbw::encodeandbw::decodefor applying the Burrows-Wheeler transform (Note: not the most efficient implementation due to circular suffix array sorting)mtf::encodeandmtf::decodefor applying the Move-to-front transform
- Download submodules (for unit tests):
git submodule update --init --recursive - Compile with
cmake:mkdir build cd build/ cmake .. make - Go to top-level folder again:
cd .. - Run all tests:
find build/ -name "*_gtest" -exec {} \;
- Introduction to Algorithms by Cormen et al.
- Algorithms, Part II by Princeton University (Robert Sedgewick, Kevin Wayne)