home *** CD-ROM | disk | FTP | other *** search
/ Magazyn Amiga Shareware Floppies / ma54.dms / ma54.adf / xpkFAST_V1_03 / FAST.doc < prev    next >
Text File  |  1993-12-06  |  11KB  |  259 lines

  1.                     FAST
  2.            A fast LZRW based compression algorithm
  3.                 Version 1.03
  4.              Copyright 1993 Christian von Roques
  5.  
  6.  
  7.  
  8.                 Legal issues
  9.                 ------------
  10.  
  11.     xpkFAST is (C) Copyright 1993 by Christian von Roques.
  12.  
  13.     This package may  be freely distributed,  as long as it  is kept in its
  14. original, complete, and   unmodified form.  It    may not  be distributed  by
  15. itself or in a commercial package of any kind without my written permission.
  16.  
  17.     xpkFAST is distributed in the hope that  it will be useful, but WITHOUT
  18. ANY WARRANTY;  without even  the   implied warranty of    MERCHANTABILITY  or
  19. FITNESS FOR A PARTICULAR PURPOSE.
  20.  
  21.  
  22.                 Installation
  23.                 ------------
  24.  
  25.     Make sure the directory libs:compressors  does exist and then just copy
  26. xpkFAST.library  to libs:compressors   .  You  also  need to  have  the XPK
  27. package  installed, it    is  available from  several  sources including Fish
  28. disks.
  29.  
  30.  
  31.                  Description
  32.                  -----------
  33.  
  34.     xpkFAST is an  XPK compression sublibrary  whose main purpose is  to be
  35. fast.  The most  interesting part of FAST  is its speedy  compressor, which
  36. makes it predestined for applications which compress about as often as they
  37. decompress.  Good examples  are: backup systems  which make  use  of XPK to
  38. support  compressed backups  or  compressing filesystems.  An  introductory
  39. text  to the concept   of the XPK compression  system  can be  found in the
  40. OVERVIEW document supplied by the standard XPK distribution.
  41.  
  42.     FAST consists  of      three  parts,  two  compressors  and     a   common
  43. decompressor.  You  can choose between    the two compressors by using FAST.0
  44. up to FAST.89 for the ``speedy'' compressor  and FAST.90 up to FAST.100 for
  45. the ``crawling'' compressor, which is  still faster than NUKE.  The default
  46. mode is FAST.50 which selects the ``speedy'' compressor.
  47.  
  48.     Following is  a table briefly listing   some comparative statistics for
  49. most of the xpk compression sublibraries.  These are the results of the XPK
  50. standard benchmark  xBench on the  standard  XPK benchmark system  A3000/25
  51. with  SCRAM, using the  AmigaVision executable  as  data.  Note that memory
  52. requirements don't include xpkmaster.library's buffers.  You can get at the
  53. results for other libraries with the help of xQuery.
  54.  
  55. Method    Mode     Packing   Unpacking   Packing     Unpacking   Compression
  56.          Memory     Memory    Speed       Speed    Ratio
  57. ------ -------     -------   ---------   -------     ---------   -----------
  58. FAST    0..79       64K          0K      428 K/s     1055 K/s    32.7%
  59. FAST   80..100      272K          0K       70 K/s     1096 K/s    39.3%
  60.  
  61. RDCN    0..100       16K          0K      217 K/s      800 K/s    33.2% *
  62.  
  63. BLZW    0..14        3K          2K      159 K/s      303 K/s    24.4%
  64. BLZW   15..28        7K          4K      141 K/s      328 K/s    29.4%
  65. BLZW   29..42       15K          8K      135 K/s      343 K/s    31.7%
  66. BLZW   43..57       30K         16K      134 K/s      356 K/s    32.4%
  67. BLZW   58..71       60K         32K      139 K/s      364 K/s    32.9%
  68. BLZW   72..85      120K         64K      143 K/s      374 K/s    33.1%
  69. BLZW   86..100      240K        128K      157 K/s      381 K/s    33.7%
  70.  
  71. NUKE    0..100      192K          0K       35 K/s      613 K/s    45.2%
  72.  
  73. IMPL    0..10      300K          0K       29 K/s      360 K/s    34.8%
  74. IMPL   11..30      350K          0K       27 K/s      332 K/s    39.8%
  75. IMPL   31..50      400K          0K       20 K/s      314 K/s    43.3%
  76. IMPL   51..75      425K          0K       14 K/s      300 K/s    44.0%
  77. IMPL   76..98      450K          0K    8 K/s      292 K/s    44.2%
  78. IMPL   99..100      450K          0K    6 K/s      291 K/s    44.3%
  79.  
  80. RLEN    0..100        0K          0K      140 K/s     1043 K/s     4.5%
  81. CBR0    0..100        0K          0K      388 K/s     1833 K/s     3.1% (**)
  82.  
  83. (*) The results  compiled into  xpkRDCN.library  are wrong!  [The author of
  84.     RDCN did not have access to a Amiga3000/25 with SCRM and had to guess.]
  85.     The results presented here  have been newly measured  and represent the
  86.     behaviour of the xpkRDCN.library V2.2.
  87.  
  88. (**)Same as (*) for xpkRDCN.library.
  89.  
  90.     Some Comments to  the above table: Always  remember that these comments
  91. are just an interpretation of the above table. There are probably data files
  92. giving totally different results!
  93.  
  94.  *  RDCN is FAST's direct competitor, it gives a bit more compression,
  95.     but is significantly slower.
  96.  *  If you need a very fast decompression use FAST.
  97.  *  For symmetric applications use either FAST or BLZW.
  98.     [BLZW is always two to three times slower than FAST, but is better
  99.      in compressing text files.]
  100.  *  Do not use IMPL, NUKE is faster and gives better compression.
  101.  *  Don't expect too much compression from run length compressors like
  102.     RLEN or CBR0.  If you want to use a runlength encoder use CBR0,
  103.     it's much faster than RLEN.
  104.  
  105.  
  106.                   Algorithm
  107.                   ---------
  108.  
  109.     FAST is a member of the LZ77 family  of datacompressors.  Other popular
  110. members  of the LZ77 family  are:  xpkNUKE, PowerPacker, Imploder (xpkIMPL)
  111. and some parts of lha, gzip, zip, zoo, freeze...
  112.  
  113.     The common thing about all LZ77 compressors is that they store the data
  114. as sequences of <copy>- and  <quote>-items.  FAST uses one `control-bit' to
  115. distinguish between  a <copy>- and a   <quote>-item.  A <quote>-item simply
  116. consists  of one  byte   which  has  to   be placed  into the  outputstream
  117. uninterpreted.   Each <copy>-item consists of  12 bit <distance>- and 4 bit
  118. <length>-information.   <distance> encodes where to  copy _from_.  The 4095
  119. useful   possibilities  are 1..4095(*)  bytes    back in the  outputstream.
  120. <length> encodes _how_many_ bytes to copy.  Possible <length>s range from 3
  121. to 18, which are encoded as 18-<length>.
  122.  
  123.     The input:    aaaaadadada compresses to: Q(a) C(1,4)  Q(d) C(2,5).  Where
  124. Q(char) is a <quote>-item and means  write a single character 'char' to the
  125. output and the <copy>-item C(dist,len) means copy 'len' bytes, which can be
  126. found 'dist' bytes back in the output, to the output.
  127.  
  128.     FAST uses two datastreams. That is, the compressed data consists of two
  129. parts, the wordstream and the  bytestream.  The first compressor which used
  130. this technique was xpkNUKE.  The bytestream starts  at the beginning of the
  131. compressed data and the wordstream is stored in  reverse order beginning at
  132. the  end of the  compressed data.  Thus the  compressed data does look like
  133. this: literalsSSDDRROOWW where     small characters denote  literal bytes and
  134. two capital characters are a word from the wordstream.
  135.  
  136.     If you want to discover more of the internal  workings of xpkFAST just:
  137. ``Use the  force!  Read the  source!''  The  best place  to start your tour
  138. through  the  source is     the decompressor  in decompress.s    since    the
  139. decompressor is much simpler than the compressor.
  140.  
  141. (*)     I could have been using distances of 1..4096, but doing so would
  142.     have added one instruction to the short and thus fast decompressor.
  143.  
  144.  
  145.                    History
  146.                    -------
  147.  
  148.     In April 1991, Ross Williams published his LZRW1 algorithm by
  149. presenting it at the data compression conference.
  150.  
  151.     The LZRW1-A algorithm is a direct descendant of the LZRW1 algorithm,
  152. improving it a little in both speed and compression.
  153.  
  154.     FAST  started as a ``port''  of Ross Williams' LZRW1-A C-Implementation
  155. and his 68000-version  of the decompressor to  the Amiga as xpksub-library.
  156. While porting I made some  small changes improving the decompression speed.
  157. I  removed  the feature  of handling  the   case of  noncompressable input,
  158. because the xpkmaster.library takes care of that.  After that, I found some
  159. cute changes which   dramatically improved the    speed  of the decompressor.
  160. These were in detail:
  161.  
  162.  *  split the compressed data into a word- and a bytestream, removing many
  163.     double byte accesses with a shift in between.
  164.  *  changed the copy loop from a move-dbra loop to 18 moves in a row.
  165.  *  changed the used range from 1..4096 to 0..4095 eliminating one
  166.     instruction in the decompression loop.
  167.  *  removed all bra.s from the inner decompression loop.
  168.  *  totally rewrote the compressor in 68000 assembler.
  169.     + changed the hashfunction to NOT use mul or div.
  170.     + produces the ``new'' format needed by the new decompressor.
  171.     + removed nearly all of the loop control tests by having
  172.       a fast and a safe loop.
  173.     + small code fits into the instructioncache of a 68030.
  174.  
  175.     Urban Dominik Müller helped me to improve the speed of the compressor
  176. even further, contributing several ideas and  some code.  For details refer
  177. to the source.
  178.  
  179. V1.00:    release date: 29-Aug-1993
  180.  
  181. V1.01:    unreleased.  [testversion with four different compressors.]
  182.  
  183. V1.02:  release date: 12-Sep-1993
  184.   *    quadrupled the HASHSIZE for FAST.80 .. FAST.100 which allowed the
  185.     removal of 2 now unneeded COMPARE_BYTEs to speed up compress_slow.
  186.  
  187. V1.03:    release date: 17-Oct-1993
  188.   *    major code juggling in compress2.s to squeeze some cycles.
  189.   *    removed the need for a ctrlCtr in compress2.s in favour of doing
  190.     addx.w ctrl,ctrl  bcs.s ctrlFull and ctrl initialized to #1
  191.     instead of rol.w #1,ctrl  dbra ctrlCnt,notFull and ctrl initialized
  192.     to #$0000FFFF 
  193.  
  194.  
  195.                            "Thank you"s must go to:
  196.                            ------------------------
  197.  
  198.     Jörg Bublath        <bublath@forwiss.uni-passau.de>
  199.     for never getting tired of assembling and testing new versions.
  200.  
  201.     Urban Dominik Müller    <umueller@amiga.icu.net.ch>
  202.     for providing ideas and code to improve FAST, XPK itself
  203.     and doing various xBenchmarks on his A4000 and A3000.
  204.  
  205.     Ralph Schmidt        <laire@uni-paderborn.de>
  206.     for providing BAsm and BDebug  [In my opinion the best
  207.     development environment for assembler programs on the Amiga.]
  208.     and doing some batch-xBenchmarks on his A4000.
  209.  
  210.     Michael van Elst        <mlelstv@specklec.mpifr-bonn.mpg.de>
  211.     for being so couraged to run one of the first alpha versions
  212.     of the crawling mode on his A3000 during a large filetransfer
  213.     --- and crash.
  214.  
  215.     Markus Illenseer        <markus@TechFak.Uni-Bielefeld.DE>
  216.     for enabling me the remote-use [and once -guru] of his A2000+68030
  217.     and temporarily ripping all the 16Bit FAST RAM out for the sake
  218.     of acurate xBenchmarks.
  219.  
  220.     Tobias Walter        <walter@askdonald.ask.uni-karlsruhe.de>
  221.     for letting me use his A1000 to test 11 totaly different and
  222.     incompatible versions of FAST in one evening.
  223.  
  224.     Matthias Meixner        <meixner@rbg.informatik.th-darmstadt.de>
  225.     for doing some xBenchmarks when Jörg was `unavailable'.
  226.  
  227.     Markus Armbruster        <armbru@juliet.ka.sub.org>
  228.     for assisting me in the two weeks search for the
  229.     _nonexistent_ timing-indeterministency-bug.
  230.  
  231.  
  232.  
  233.                   Contact Addresses
  234.                   -----------------
  235.  
  236.     Ross Williams
  237.     ross@spam.ua.oz.au
  238.  
  239.  
  240.     Christian von Roques            Christian von Roques
  241.     Forststrasse 71        or        Kastanienweg 4
  242.   D-76131 Karlsruhe                  D-78713 Schramberg
  243.     GERMANY                    GERMANY
  244.  
  245.     roques@karlsruhe.gmd.de (till end of 1993)    IRCnick: Nescum
  246.     roques@juliet.ka.sub.org
  247.     roques@ira.uka.de (should be valid in 1994 and later)
  248.  
  249.     If you are mailing me disks, use an MSDOS-filesystem, since I
  250.     DO NOT OWN an Amiga and most unices can read MSDOS-filesystems.
  251.  
  252.  
  253.     Urban Dominik Müller
  254.     Schulhausstrasse 83
  255.  CH-6312 Steinhausen
  256.     SCHWEIZ
  257.  
  258.     umueller@amiga.icu.net.ch            IRCnick: Zop
  259.