Hi. This is an exercise to help me learn how basic data compression algorithms work.
I've followed the steps laid out in wikipedia for the huffman algorithm.
I've read multiple sources to help understand arithmetic coding: This paper was pretty useful to understand the basic concept. I've also spent time looking at this repo to help fix one off errors.
Usage is as follows
$ make
$ ./cpress -m <coding_method> <input_file_name> <output_file_name>
<coding_method>
can be one of huffman
or arithmetic
.
To decompress, simply run the other half of this exercise:
$ ./dpress -m <coding_method> <input_file_name> <output_file_name>
The <coding_method>
should be the same as the one provided in the compression
This should produce a file with the original contents of the compressed file
There is a unit testing suite for this project. If you'd like to run it, just run ./testsuite
after make
, adding -s
if you'd like more verbose results (includes info about tests that passed).
This assumes you've added catch.hpp
to your usr/local/include
.