Data Compression
Data Types
None which are public.
Functions
These functions reside in the file compand.c.
-
boolean compandAlgAvail(byte alg);
-
This returns TRUE if the identified compression/expansion algorithm is
implemented.
-
DataFileP compress(DataFileP input, byte
algorithm);
-
Compress a stream of data represented by theinput data file according
to the specified algorithm; prefixing the result with the appropriate PGP-style
compressed packet header.
-
boolean decompress(DataFileP in, DataFileP
out, byte algorithm);
-
Attempt to expand the data in to out according to the specified
algorithm, returning the success or failure of the attempt.
Dependencies
No systematic interface has been defined for individual compression methods;
beyond requiring that they support methods amenable to the interface for
the whole module.
The compression algorithms
The Deflate method is spread over many files taken from GnuZIP 1.2.4, a
standard public domain implementation, with only minor interface tweaks
to operate with the CTC DataFile type; to use standard data types, and
to silence compiler noise.
The splay-tree method in splay.c is implemented from
Applications
of Splay Trees to Data Compression, D.W. Jones, Comm of ACM, Aug 1988,
pp 996-1007. This latter method has the advantage mainly of simplicity
of implementation, in providing an example of how to extend CTC's repertoire.
The number of independent state trees (128) is chosen to optimize performance
for text while minimizing heap storage requirements. The algorithm improves
if the number of byte values mapping to any single tree is minimized, with
the exception of a strange degradation in compression if 256 states are
used. It has the interesting property, due to its Markov process internals,
of degrading gracefully on single bit errors.
webmaster@bifroest.demon.co.uk