Skip to content

This project focuses on building an image compressor executable that implements multithreading to leverage the system's resources, and was implemented in Linux using C. This is done in a thread-safe and data-safe manner by the use of appropriate mutexes. The user enters the total number of threads the system must use, the compression factor (a v…

Notifications You must be signed in to change notification settings

nehemgr/Multithreaded-Image-Compression-Using-DFT

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

9 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Multithreaded-Image-Compression-Using-DFT

This project focuses on building an image compressor executable that implements multithreading to leverage the system's resources, and was implemented in Linux using C. This is done in a thread-safe and data-safe manner by the use of appropriate mutexes. The user enters the total number of threads the system must use, the compression factor (a value between 1 to 10) and the source and destination image file names. A separate file is included that performs exactly the same, but sequentially and the comparisons are provided. The focus here is only to multithread the calculation of the DFTs of smaller 16x16 sub-images, and hence the DFT calculations were implemented using the existing FFTW libraries.

Running the Project

Make sure you are running the code in Linux. In the terminal run the executable using the syntax:

./img_prj <number_of_threads> <compression_factor [1-10]> <input_img.jpg> <output_img.jpg>
  • The number of threads can be any positive integer. Do note that giving this parameter as 1, does not mean that this implements sequential code. This is because, always N+1 threads will be used (where N is the entered parameter). The implicit thread will be used for copying the pixels from the source to the destination image.
  • The compression factor must be any integer between 1 and 10, where 1 implies that the image is not compressed at all and 10 means that it is compressed at maximum.
  • The input and output filetypes must be either jpg or jpeg.

Project Demo

alt text

alt text Original File - mountains.jpg, 1920x1080, 288.8 KB

alt text New File - mountains_new.jpg, 1920x1080, Compression Factor 5, 123.5 KB

Results

The testing of the times were done on a freshly booted system, with no other applications open, to ensure that the program would have complete access to all the 4 processor cores of the machine. These are summarized in the graph below. The point corresponding to threads as zero, is the code without multithreading.

alt text

The degree of compression in the file size is tabulated below for the aforementioned image mountains.jpg.

alt text

About

This project focuses on building an image compressor executable that implements multithreading to leverage the system's resources, and was implemented in Linux using C. This is done in a thread-safe and data-safe manner by the use of appropriate mutexes. The user enters the total number of threads the system must use, the compression factor (a v…

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages