This is a command-line program that implements arithmetic coding for lossless data compression. The program consists of two parts: aencode
and adecode
.
To use this program, follow these steps:
- Clone the repository onto your local machine.
- Compile the program using the provided
makefile
. - Run the
aencode
program with the input file as an argument. This will generate a compressed output file. - Run the
adecode
program with the compressed file as an argument. This will decode the compressed file and generate the original input file.
The aencode
program takes an input file and generates a compressed output file. It uses arithmetic coding to compress the data. The program calculates the probability and range values for each character in the input string and builds a look-up table for encoding. The compressed data is output to a file, along with the precision required to decode the data.
The adecode
program takes a compressed file and generates the original input file. It uses arithmetic decoding to decode the compressed data. The program reads the compressed data and the precision from the input file, and builds a look-up table for decoding. It then decodes the compressed data and outputs the original input file.
This program requires the mpfr
and gmp
libraries to be installed on your machine.
./aencode [input file]
./adecode [compressed file]
This program was written by Anant Mahale.