Huffman encoding and decoding with simple Serial and Parallel implementations for CPU and GPU (cuda)
- Compression
* Read the input data
* Get the frequencies for each symbol
* Build a tree from the frequencies
* Build a dictionary that store which letter has what frequency
* Check the sequence in the dictionary
* write bits starting from the root node
* one byte is written to file
* Write the frequency and compressed data to the output file
- De-compression
* Read the frequency and compressed data from the file
* Build a tree from the frequencies
* Build a dictionary that store which letter has what frequency
* Check the sequence in the dictionary
* get letter for the bits
* get one byte data
* Write the letters to the output file
- Clone the repo
$ git clone https://github.com/AP-Atul/Huffman-Compression.git
- Run the makefile for the serial
$ make serial
or
$ make -B serial
- Run the binary files on input file to compress
$ ./bin/compress input.txt input.compressed
- Or decompression
$ ./bin/decompress input.compressed input_decompressed.txt
$ make -B cuda
- Compression
$ ./bin/compress_cuda input.txt input.compressed
- Decompression (serial)
$ ./bin/decompress input.compressed input_decompressed.txt
For any help or problems with the code raise an issue.