This project is a JPEG encoder that provides two versions: a full CPU implementation and a hybrid CPU/GPU implementation using CUDA.
The JPEG Encoder is designed to efficiently compress images into the JPEG format. It supports two modes:
-
Full CPU Version: This version utilizes the CPU for all encoding processes. It is suitable for systems without a compatible GPU or for users who prefer a CPU-only implementation.
-
CPU/GPU Version with CUDA: This version leverages CUDA, a parallel computing platform and application programming interface model created by Nvidia, to offload certain processing tasks to the GPU. This can significantly enhance the encoding performance on systems with CUDA-compatible GPUs.
- Full support for the JPEG compression standard.
- Two encoding modes: CPU-only and CPU/GPU with CUDA.
- Efficient parallel processing using CUDA for improved performance.
- Easy-to-use command-line interface for encoding images.
- CUDA-enabled GPU: Required for the CPU/GPU version. Ensure you have a compatible GPU and the necessary CUDA toolkit installed.
-
Clone the repository:
git clone [email protected]:iMaTzzz/gpu_project.git
-
Build the Project: Navigate to the project directory and build the encoder:
mkdir dist cd dist cmake .. make
-
Run the Encoder: After building the project, you can run the JPEG encoder on the provided images. Please note that when executing the GPU version on a single image, we refrain from including any warm-up procedure. Consequently, the observed runtime may appear slower compared to the results obtained from benchmark tests. Here are three examples (Code is provided below):
- If you want to run the CPU version on an image located in the images directory (First example)
- If you want to run the GPU version on an image located in the images directory (Second example)
- If you want to run both versions on all the images located in the images directory (Third example)
./ppm2jpeg ../images/<image> ./ppm2jpeg --gpu ../images/<image> ./ppm2jpeg --test:../images
- C/C++ compiler
- CUDA-enabled GPU (for the CPU/GPU version)
- Input images in supported formats (e.g., PGM, PPM) (Some images are already included in the images directory)
Contributions to this project are welcome! If you encounter any issues, have ideas for improvements, or would like to contribute new features, feel free to submit a pull request or open an issue.