[A83] Re: ZPic83 compression


[Prev][Next][Index][Thread]

[A83] Re: ZPic83 compression






Nat Allan wrote:

> Yeah, i was thinking of giving a RLE compressor a shot after i finish my
> current project, but ive got a bad feeling it would end up in my 'Failed'
> directory along with the rest of em...
> 
> How efficient is ZPic83 compression?  Is it better than plain RLE?


ZPic83 uses LZSS, which in almost all cases is far superior to RLE. The 
best case for RLE compression is a stream of data consisting entirely of 
the same byte value (ie: all zero's). The PCX implementation of RLE 
compresses this to 128 bytes. ZPic83 reduces it to 10.

The PCX implementation could be improved somewhat, however. PCX requires 
a decoding 'break' at the end of each scanline, so the largest run 
length stored in a 96x64 image is 12 (96 / 8). If you ignored that part 
of the spec, and did a few other tweaks, you could reduce it to 24 bytes 
for RLE.

It would be foolish to say that LZSS will *always* perform better than 
RLE, since it is largely implementation dependant, but I would say that 
99% of the time LZSS will win.

The one advantage of RLE is pure speed. It is much faster than most 
other algorithms and a Z80 implementation would hands down over LZSS, so 
it depends on what your objective is - size or speed.

There are also some compression utilities which use RLE in the first 
pass, and LZSS in a second pass - the main objective being to reduce the 
LZSS compression time, since a 'lazy' LZ algorithm will get really 
bogged down by large sequences of the same value.




References: