This is a C++ Library which implements a number of algorithms that are used for compression of multimedia objects.
I took a course in my sixth semester called "Multimedia Systems and Applications" which motivated me to start this project. The algorithms implemented in this repository are:
- Lossless Compression Algorithms
- Huffman Coding
- Lempel-Ziv Coding
- Run-Length Encoding and BitPlane conversion
- Lossless Predictive Coding
- Lossy Compression Algorithms
- Lossy Predictive Coding
- Differential Pulse Code Modulation (in
lossy/lossy_pred)
- Transform-Domain Coding
- K-L Transform
- Discrete Cosine Transform (DCT) and its inverse
- Bit allocation methods for DCT (Zonal and Threshold coding)
- Wavelets and MultiResolution Analysis
- Subband coding with 4 bands and reconstruction
- And by extension, the DWT since it can be computed by changing the filters in the subband coding architecture
- Embedded Zerotree Wavelet (EZW) coding
We use BitMap (.bmp) image files for testing the algorithms because they are in the most uncompressed form.
- Clone the repository and
cdinto it. - Create the CMake build files in a directory called
buildby running the commandcmake -B build -G "MinGW Makefiles" -DOpenCV_DIR=<YOUR_OPENCV_DIRECTORY>. The placeholderYOUR_OPENCV_DIRECTORYshould contain the location of your opencv installation, for me it wasC:/opencv/buildsince I installed it manually. cdinto thebuildfolder. Build usingcmake --build .- Run the executable.
- The compression achieved via lossless predictive coding, combined with Huffman encoding of the error values, is extremely substantial, with a randomly chosen coefficient set of [0, 1, 3, 2] (before normalization) yielding 81% compression for the grayscale image
grayscale.bmp, as compared to 8% with only Huffman encoding. - Quantization improves the compression ratio, although with the tradeoff of image quality. With just 4 levels of quantization, we can get upto 93% compression, although with significantly visible deterioration of quality.