[Kde-imaging] Lossless image compression

Christoph Feck christoph at maxiom.de
Wed Feb 8 15:42:55 UTC 2012


On Tuesday 07 February 2012 15:43:19 Dmitry Kazakov wrote:
> Probably, I'm a bit outdated.
> 
> I've just run the test on my new machine.
> The results are the following:
> 
> Compression LZF w/o  linearization: 247 memcpy's. Ratio: 0.938
> Compression LZF with linearization: 213 memcpy's. Ratio: 0.769
> 
> Decompression LZF w/o  linearization:  78 memcpy's.
> Decompression LZF with linearization: 112 memcpy's.
> 

I am interested what exactly you are measuring. Either your memcpy is 
blazingly fast, or mine is very slow.

I get the following CPU timings (i.e. only "user" part of "time" 
output). I tried several times, and listed is the smallest value I 
got. Machine is 1.2 GHz ULV Centrino, 32 bit, only one core used. Test 
files from http://www.imagecompression.info/test_images/

First test: 7216x5412 "big_building.ppm", RGB 8-bit photo (112 MB)

memcpy: 0.126 s
bytecopy: 0.218 s

compression:
IZ p3: 2.947 s, ratio 0.494
IZ p2: 1.625 s, ratio 0.509
IZ p1: 1.488 s, ratio 0.546
LZF: 1.826 s, ratio 0.989

decompression:
IZ p3: 3.216 s
IZ p2: 1.779 s
IZ p1: 1.670 s
LZF: 0.544 s

Second test: 3072x2048 "artificial.ppm", RGB 8 bit raytraced (18 MB)

memcpy: 0.017 s
bytecopy: 0.035 s

compression:
IZ p3: 0.452 s, ratio 0.119
IZ p2: 0.235 s, ratio 0.139
IZ p1: 0.215 s, ratio 0.122
LZF: 0.114 s, ratio 0.189

decompression:
IZ p3: 0.491 s
IZ p2: 0.264 s
IZ p1: 0.217 s
LZF: 0.073 s

"memcpy" is what gnu libc 2.14.1 + gcc 4.6.2 combo provides in -O2 
mode.

"bytecopy" is:
	while (p != pend) {
	    *dest++ = *p++;
	}
where dest and p are byte pointers.

"IZ p3" is IZ with (default) 3-pixel predictor. "IZ p2" and "IZ p1" 
are IZ with 2-pixel and 1-pixel predictors, which trade some 
compression rate for speed (preferred for swap compression).

"LZF" is lzf code copied verbatim from krita master (no linearization, 
just to compare speed, not size).


More information about the kimageshop mailing list