This repository contains an implementation of a decoder for the JPEG image format, written entirely in C without any dependency, following its official specification. It supports JFIF files in the sequential format, or progressive format without upsampling. It uses an implementation of the Loeffler algoritm for fast DCT computation.
You may compile using make after positioning in the root folder:
cd ./jpegdecoder/
make
Run the executable as follows:
./bin/jpeg2ppm img.jpeg -opt
Where opt
can be either:
-v
to have the verbose mode which displays the header of the image-b
to have the blabla mode which does not export in ppm but displays the results of each - step for each MCU-p
to save all intermediate images when decompressing a progressive image
Our decoder supports images compressed according to the JFIF-APP0 sequential or progressive format. Corrupted images or non-compliant images will cause an appropriate error message. Images with progressive upsampling are currently unsupported. The supported subsampling modes are the 4 most common ones:
- vertical subsampling
- horizontal subsampling
- vertical and horizontal subsampling
The autotest
folder contains an automatized test to compare uncompressed images to image rasters in the ppm
format.
source ./autotest/autotest.sh
This decoder was written from scratch by Habib Slim, Nathan Boulanger and Lucas Druart.