This is a CUDA-accelerated image processing library that applies filters to P6 PPM files.
The program also produce timing report on average time for:
- Host to Device Copy
- Kernel Execution
- Device to Host Copy
Verification mode compares the output of the GPU version against an CPU computed version for verification and reports the number of mismatched pixels, if any.
Included in this program is a make file.
To compile run
~$ makerunning make will compile the programs object files into the folder /build and the executable imgtool will be in /bin
To clean run
~$ make cleanIt is recommended that you run this program from the root of this repository
~$ ./bin/imgtool ./tests/input.ppm output.ppm --filter <name> [options]Note: If running from the root it is recommended to store images in the test folder.
Filters
drop_reddrop_greendrop_bluesharpenblursobel_xsobel_y
Options
--runs {int}- runs takes an int as an options and specifies how many to run the filter for performance reporting
--radius {int}- This is an option for the blur filter that specifies the radius of the blur
--verify- This runs a verification mode the check the GPU output against a CPU version of the filter and reports any mismatched pixels
~$ ./bin/imgtool ./tests/input.ppm output.ppm --filter blur --radius 4 --verify~$ ./bin/imgtool ./tests/input.ppm output.ppm --filter sobel_x --runs 20The boundary strategy used is mirroring on the edges. If we are on a pixel on row0 and getting its neighbor row-1 this is an invalid pixel so instead both of those pixels will access row0.
int curRow = min(height-1, max(0, row + blurRow));
int curCol = min(width-1, max(0, col + blurCol)); The outputs are then clamped
outImage[trueRGBOffset] = (unsigned char)(min(255, max(0, greyscaleVal)));
outImage[trueRGBOffset + 1] = (unsigned char)(min(255, max(0, greyscaleVal)));
outImage[trueRGBOffset + 2] = (unsigned char)(min(255, max(0, greyscaleVal)));The Program access pixels as a 1D array and then gets the RGB channels
This is AoS, Array of Structures as it is an array of Pixels(a structure)
This program does not use shared memory and opts to use manual memory copy to allow for timing memory copies.
There are two test images supplied in this repository lenna.ppm and DJ.ppm
Both are portraits suited to testing of the filters