Open main menu

CDOT Wiki β

Changes

AAA Adrina Arsa Andriy

3,475 bytes added, 10:04, 3 October 2014
no edit summary
Because the data would be split into smaller pieces by the explode function, this could be paralleled. Since this takes almost 55% of the time of the program, it would be worth speeding up.
 
====Andriy Guzenko’s Findings====
 
I found a jpeg-compressor of a relatively small size written in C++. The core compression algorithm is about 900 lines plus the header file. You can find the code online here: [ https://code.google.com/p/jpeg-compressor/ ]
 
It is a console application which requires three command line arguments for successful execution. The first is the source ‘jpg’ file with appropriate ‘read’ permissions. The second is the destination file in any format. The third argument is the quality factor which is a number between 0 and 100. The 0 quality factor will produce a better quality compressed image.
 
The application also contains the decompression module which allows to decompress files back into ‘jpg’ format.
 
Finally, the application provides a number of options for compression and decompression such as:
 
‘-o’ – enables optimized Huffman tables and makes compression slower but produces smaller files
 
‘-x’ – exhaustive compression test
 
Profiling of this application revealed a number of hotspots in both compression and decompression algorithms.
 
The compression profile for 3.3 Mb ‘Jpg’ image which produced 0.7 Mb compressed file:
 
<pre>
> a.out img.jpg result 50
 
Each sample counts as 0.01 seconds.
 
% cumulative self self total
 
time seconds seconds calls s/call s/call name
 
12.18 1.66 1.66 image_compare(image_compare_results&, int, int, unsigned char const*, int, unsigned char const*, int, bool)
 
8.90 2.87 1.21 YCbCr_to_RGB_row(unsigned char*, unsigned char const*, unsigned char const*, unsigned char const*, int, int)
 
8.61 4.04 1.17 jpge::DCT2D(int*)
 
8.46 5.18 1.15 jpge::RGB_to_YCC(unsigned char*, unsigned char const*, int)
 
8.02 6.28 1.09 idct_block(unsigned char*, int, short*, unsigned char*)
 
6.48 7.16 0.88 3456 0.00 0.00 jpgd::jpeg_decoder::expanded_convert()
 
5.30 7.88 0.72 4214032 0.00 0.00 jpgd::Col<4>::idct(unsigned char*, int const*)
 
4.12 8.44 0.56 373248 0.00 0.00 jpge::jpeg_encoder::load_quantized_coefficients(int)
 
4.01 8.98 0.55 get_pixel(int*, unsigned char const*, bool, int)
 
3.16 9.41 0.43 resample_row_h_2(unsigned char*, unsigned char*, unsigned char*, int, int)
 
2.58 9.76 0.35 2140439 0.00 0.00 jpgd::Row<4>::idct(int*, short const*)
 
2.43 10.09 0.33 373248 0.00 0.00 jpge::jpeg_encoder::code_coefficients_pass_two(int)
 
2.02 10.37 0.28 decode_block(jpeg*, short*, huffman*, huffman*, int)
</pre>
 
And produced the output :
 
<pre>
jpge/jpgd example app
 
Source file: "img.JPG", image resolution: 4608x3456, actual comps: 3
 
Writing JPEG image to file: comp
 
Compressed file size: 799619, bits/pixel: 0.402
 
Compression time: 4609.175ms, Decompression time: 6812.550ms
 
Error Max: 71.000000, Mean: 5.951586, Mean^2: 20.892606, RMSE: 4.570843, PSNR: 3
 
4.930877
 
Success.
</pre>
 
According to the profiling data such methods as “jpge::DCT2D(int*)” and “jpge::RGB_to_YCC” can be parallelized to improve the application performance which will be particularly useful for compressing large ‘jpg’ files at a better quality factor.
=== Assignment 2 ===
=== Assignment 3 ===