Skip to content

Huffman encoding and decoding with simple Serial and Parallel implementations for CPU and GPU

License

Notifications You must be signed in to change notification settings

AP-Atul/Huffman-Compression

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

33 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Huffman-Compression

Huffman encoding and decoding with simple Serial and Parallel implementations for CPU and GPU (cuda)

Algorithm

  1. 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
  1. 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

Execution

  1. Clone the repo
$ git clone https://github.com/AP-Atul/Huffman-Compression.git
  1. Run the makefile for the serial
$ make serial
or
$ make -B serial
  1. Run the binary files on input file to compress
$ ./bin/compress input.txt input.compressed
  1. Or decompression
$ ./bin/decompress input.compressed input_decompressed.txt

For parallel with cuda

$ make -B cuda
  • Compression
$ ./bin/compress_cuda input.txt input.compressed
  1. Decompression (serial)
$ ./bin/decompress input.compressed input_decompressed.txt

Issues

For any help or problems with the code raise an issue.

About

Huffman encoding and decoding with simple Serial and Parallel implementations for CPU and GPU

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published