DESCRIPTION
-----------
This archive contains simple and readable ANSI C implementations of
run length encoding and decoding (RLE).  It includes two implementations, a
conventional implementation and a variant of the packbits method.  These
implementations are not intended to be the best, fastest, smallest, or any
other performance related adjective.

The conventional version of encoding provides a run length for runs of two
or more symbols.  If the encoded file contains a run of two or more symbols,
the run will be encoded as two identical symbols followed by a byte with the
length of the rest of the run.  This method incurs a one byte penalty for
every two byte run.

The packbit variant will encode data as blocks of symbols.  Each block starts
with a one byte count.  If the count is non-negative, count + 1 symbols are
copied verbatim.  If the count is negative, the symbol that follows occurs
in a run 2 - count long.  This method incurs a one byte penalty for every
block of up symbols that is not a run.

More information on run length encoding may be found at:
http://michael.dipperstein.com/rle
http://www.datacompression.info/RLE.shtml

FILES
-----
COPYING         - Rules for copying and distributing LGPL software
getopt.c        - LGPL version of getopt source from GNU project
getopt.h        - LGPL version of getopt headers from GNU project
LICENSE         - GNU Lesser General Public License
Makefile        - makefile for this project (assumes gcc compiler and GNU make)
README          - this file
rle.c           - Library of run length encoding and decoding routines.
rle.h           - Header containing prototypes for library functions.
sample.c        - Demonstration of how to use run length encoding library
                  functions
vpackbits.c     - Implementation of a variant of the packbits encoding and
                  decoding algorithm

BUILDING
--------
To build these files with GNU make and gcc, simply enter "make" from the
command line.  The executable will be named sample (or sample.exe).

USAGE
-----
Usage: sample <options>

options:
  -c : Encode input file to output file.
  -d : Decode input file to output file.
  -v : Use variant of packbits algorithm.
  -i <filename> : Name of input file.
  -o <filename> : Name of output file.
  -h | ?  : Print out command line options.

-c      Compress the specified input file (see -i) then using run length
        encoding, writing the encoded results to the specified output file
        (see -o).

-d      Decompresses the specified input file (see -i) writing the results to
        the specified output file (see -o).  Only files compressed by this
        program may be decompressed.

-v      Compress/Decompress using a packbit variant.  Yields better compression
        in some instances.

-i <filename>   The name of the input file.  There is no valid usage of this
                program without a specified input file.

-o <filename>   The name of the output file.  If no file is specified, stdout
                will be used.  NOTE: Sending compressed output to stdout may
                produce undesirable results.

HISTORY
-------
04/30/04  - Initial Release
09/08/06  - Added packbits variant

TODO
----
- Add an option to very the size of the symbol being encoded.

AUTHOR
------
Michael Dipperstein (mdipper@alumni.engr.ucsb.edu)
http://michael.dipperstein.com
