ImageResize - a simple image resizer program with multithreaded capabilities
Features:
- The program actually serves as a study to the task-based parallel programming. It simply resizes (magnifies) images
without any interpolation.
- As the image loading and saving doesn't count to the real parallel processing (and it is not parallelizable and threfore has a negative effect on the performance measurments, see Amdahl's law),
the program measures the time needed only for the image processing (in [msec]) and writes it after the file names.
- The parallelization of the algorithm is relatively easy: the generation of each destination line can be independently calculated and this implies a straightforward structure where the
independent tasks (each processing one line) can be parallely executed. This is very similar to the ImageMagick parallel execution.
- This mode of the task dispatcher is the most widely used, in cases where there is a program section that can split up the job into independent tasks.
- The application is a good demonstration for that the SDPP and TTaskdispatcher libraries are easy to be used statically in applications.
Usage:
MTImageResize {infilename} -m {magn} -l {lines} -j {threads} {outfilename}
- magn: magnification
- lines: the number of lines in one task
- threads: the number of the execution threads
Performance results with the testimage, with different threads (more about the test here):
Threads | magn: 2 | magn: 5 | magn: 10
|
1 | 265 | 1622 | 6318
|
2 | 140 | 795 | 3120
|
3 | 93 | 531 | 2091
|
4 | 78 | 421 | 1623
|
As we can clearly see, the the algorithm scales linearly with the number of processors.
Download the program.