home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
World of A1200
/
World_Of_A1200.iso
/
programs
/
compress
/
misc
/
xpk
/
libs
/
compressors
/
fast.doc
next >
Wrap
Text File
|
1995-02-27
|
9KB
|
195 lines
FAST
A fast LZRW based compression algorithm
Version 1.00
Copyright 1993 Christian von Roques
Legal issues
------------
xpkFAST is (C) Copyright 1993 by Christian von Roques.
This package may be freely distributed, as long as it is kept in its
original, complete, and unmodified form. It may not be distributed by
itself or in a commercial package of any kind without my permission.
xpkFAST is distributed in the hope that it will be useful, but WITHOUT
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
FITNESS FOR A PARTICULAR PURPOSE.
Installation
------------
Make sure the directory libs:compressors does exist and then just copy
xpkFAST.library to libs:compressors . You also need to have the XPK
package installed, it is available from several sources including Fish
disks.
Description
-----------
xpkFAST is an XPK compression sublibrary whose main purpose is to be
fast. The most interesting part of FAST is its speedy compressor, which
makes it predestined for applications which compress about as often as they
decompress. Good examples are: backup systems which make use of XPK to
support compressed backups or compressing filesystems. An introductory
text to the concept of the XPK compression system can be found in the
OVERVIEW document supplied by the standard XPK distribution.
FAST consists of three parts, two compressors and a common
decompressor. You can choose between the two compressors by using FAST.0
up to FAST.89 for the ``speedy'' compressor and FAST.90 up to FAST.100 for
the ``crawling'' compressor, which is still faster than NUKE. The default
mode is FAST.50 which selects the ``speedy'' compressor.
Following is a table briefly listing some comparative statistics for
most of the xpk compression sublibraries. These were generated by xBench
on the standard XPK benchmark system (A3000/25 with SCRAM, using the
AmigaVision executable as data). Note that memory needs don't include
xpkmaster.library's buffers.
Method Mode Packing Unpacking Packing Unpacking Compression
Memory Memory Speed Speed Ratio
------ ------- ------- --------- ------- --------- -----------
FAST 0..89 96K 0K 426 K/s 1048 K/s 32.7%
FAST 90..100 96K 0K 52 K/s 1082 K/s 39.3%
RDCN 0..100 ??? ??? 217 K/s 800 K/s 33.2%
BLZW 0..14 3K 2K 159 K/s 303 K/s 24.4%
BLZW 15..28 7K 4K 141 K/s 328 K/s 29.4%
BLZW 29..42 15K 8K 135 K/s 343 K/s 31.7%
BLZW 43..57 30K 16K 134 K/s 356 K/s 32.4%
BLZW 58..71 60K 32K 139 K/s 364 K/s 32.9%
BLZW 72..85 120K 64K 143 K/s 374 K/s 33.1%
BLZW 86..100 240K 128K 157 K/s 381 K/s 33.7%
NUKE 0..100 192K 0K 35 K/s 613 K/s 45.2%
IMPL 0..10 300K 0K 29 K/s 360 K/s 34.8%
IMPL 11..30 350K 0K 27 K/s 332 K/s 39.8%
IMPL 31..50 400K 0K 20 K/s 314 K/s 43.3%
IMPL 51..75 425K 0K 14 K/s 300 K/s 44.0%
IMPL 76..98 450K 0K 8 K/s 292 K/s 44.2%
IMPL 99..100 450K 0K 6 K/s 291 K/s 44.3%
RLEN 0..100 0K 0K 140 K/s 1043 K/s 4.5%
CBR0 0..100 0K 0K 388 K/s 1833 K/s 3.1%
Some Comments to the above table: Always remember that these comments
are just an interpretation of above table. There probably are data files
giving totally different results!
* RDCN is FAST's direct competitor, it gives a bit more compression,
but is significantly slower.
* If you need a very fast decompression use FAST.
* For symmetric applications use either FAST or BLZW.
[BLZW is always two to three times slower than FAST, but gives a
little better compression on text files.]
* Don't use IMPL, NUKE is faster and gives better compression.
* Don't expect too much compression from run length (RLEN, CBR0).
If you want to use a runlength encoder use CBR0, it's much faster.
Algorithm
---------
FAST is a member of the LZ77 family of datacompressors. Other popular
members of the LZ77 family are: xpkNUKE, PowerPacker, Imploder (xpkIMPL)
and some parts of lha, gzip, zip, zoo, freeze...
The common thing about all LZ77 compressors is that they store the data
as sequences of <copy>- and <quote>-items. FAST uses one `control-bit' to
distinguish between a <copy>- and a <quote>-item. A <quote>-item simply
consists of one byte which has to be placed into the outputstream
uninterpreted. Each <copy>-item consists of 12 bit <distance>- and 4 bit
<length>-information. <distance> encodes where to copy _from_. The 4095
useful possibilities are 1..4095(*) bytes back in the outputstream.
<length> encodes _how_many_ bytes to copy. The used range is: 3..18 .
Which is encoded as 18-<length>.
The input: aaaaadadada compresses to: Q(a) C(4,1) Q(d) C(5,2). Where
Q(char) means write the character char to the output and C(len,dist) means
copy len bytes which can be found dist bytes back in the output to the
output.
FAST uses two datastreams. That is, the compressed data consists of two
parts, the wordstream and the bytestream. The first compressor which uses
this technique was xpkNUKE. The bytestream starts at the beginning of the
compressed data and the wordstream is stored in reverse order beginning at
the end of the compressed data. Thus the compressed data does look like
this: literalsSSDDRROOWW where small characters denote literal bytes and
two capital characters are a word from the wordstream.
If you want to discover more of the internal workings of xpkFAST just:
``Use the force! Read the source!'' The best place to start your tour
through the source is the decompressor in decompress.s since the
decompressor is much simpler than the compressor.
(*) I could have been using distances of 1..4096, but doing so would
have added one instruction to the short and thus fast decompressor.
History
-------
In April 1991, Ross Williams published his LZRW1 algorithm by
presenting it at the data compression conference.
The LZRW1-A algorithm is a direct descendant of the LZRW1 algorithm,
improving it a little in both speed and compression.
FAST started as a ``port'' of Ross Williams' LZRW1-A C-Implementation
and his 68000-version of the decompressor to the Amiga as xpksub-library.
While porting I made some small changes improving the decompression speed.
I removed the feature of handling the case of noncompressable input,
because the xpkmaster.library takes care of that. After that, I found some
cute changes which dramatically improved the speed of the decompressor.
These were in detail:
* split the compressed data into a word- and a bytestream, removing many
double byte accesses with a shift in between.
* changed the copy loop from a move-dbra loop to 18 moves in a row.
* changed the used range from 1..4096 to 0..4095 eliminating one
instruction in the decompression loop.
* removed all bra.s from the inner decompression loop.
* totally rewrote the compressor in 68000 assembler.
+ changed the hashfunction to NOT use mul or div.
+ produces the ``new'' format needed by the new decompressor.
+ removed nearly all of the loop control tests by having
a fast and a save loop.
+ small code fits into the instructioncache of a 68030.
Urban Dominik Müller helped me to improve the speed of the compressor
even further, contributing several ideas and some code. For details refer
to the source.
Contact Addresses
-----------------
Ross Williams
ross@spam.ua.oz.au
Christian von Roques Christian von Roques
Forststrasse 71 or Kastanienweg 4
D-76131 Karlsruhe D-78713 Schramberg
GERMANY GERMANY
roques@karlsruhe.gmd.de (preferred) IRCnick: Nescum
roques@juliet.ka.sub.org
Urban Dominik Müller
Schulhausstrasse 83
CH-6312 Steinhausen
SCHWEIZ
umueller@amiga.physik.unizh.ch IRCnick: Zop