ViewVC Help
View File | Revision Log | Show Annotations | Download File
/cvs/Compress-LZV1/LZV1.pm
Revision: 1.1
Committed: Thu Sep 27 18:35:26 2001 UTC (22 years, 7 months ago) by root
Branch: MAIN
CVS Tags: HEAD
Log Message:
*** empty log message ***

File Contents

# User Rev Content
1 root 1.1 =head1 NAME
2    
3     Compress::LZV1 - extremely leight-weight Lev-Zimpel-Vogt compression
4    
5     =head1 SYNOPSIS
6    
7     use Compress::LZV1;
8    
9     $probably_compressed = compress $uncompressed_data;
10    
11     $original_data = decompress $probably_compressed;
12    
13     =head1 DESCRIPTION
14    
15     LZV1 is an extremely fast (not that much slower than a pure memcpy)
16     compression algorithm. It is ideal for applications where you want to save
17     I<some> space but not at the cost of speed. It is ideal for repetitive
18     data as well. The module is self-contained and very small (no large
19     library to be pulled in).
20    
21     I have no idea wether any patents in any countries apply to this
22     algorithm, but at the moment it is believed that it is free from any
23     patents.
24    
25     =head1 FUNCTIONS
26    
27     =head2 $compressed = compress $uncompressed
28    
29     Try to compress the given string as quickly and as much as possible. In
30     the worst case, the string can enlarge by at most a single byte. Empty
31     strings yield empty strings. The uncompressed data string must be smaller
32     than 16MB (1<<24).
33    
34     The compressed data is (currently) in one of two forms:
35    
36     * a literal 'U', followed by the original, uncompressed data
37    
38     * a literal 'L', followed by three bytes (big-endian) uncompressed length, followed by the actual LZV1 data
39    
40     This could be improved for small (uncompressible strings) to no overhead
41     on average, but I'm too lazy to do that for just one byte savings ;)
42    
43     =head2 $decompressed = decompress $compressed
44    
45     Uncompress the string (compressed by C<compress>) and return the original
46     data. Decompression errors can result in either broken data (there is no
47     checksum kept) or a runtime error.
48    
49     =head1 SEE ALSO
50    
51     Other Compress::* modules, especially Compress::LZO (for speed) and
52     Compress::Zlib.
53    
54     =head1 AUTHOR
55    
56     This perl extension was written by Marc Lehmann <pcg@goof.com> (See
57     also http://www.goof.com/pcg/marc/). The original lzv1 code was written
58     by Hermann Vogt and put under the GPL. (There is also a i386 assembler
59     version that is not used in this module).
60    
61     The lzv1 code was accompanied by the following comment:
62    
63     =over 4
64    
65     The method presented here is faster and compresses better than lzrw1 and
66     lzrw1-a. I named it lzv for "Lev-Zimpel-Vogt". It uses ideas introduced
67     by Ross Williams in his algorithm lzrw1 [R. N. Williams (1991): "An
68     Extremly Fast ZIV-Lempel Data Compression Algorithm", Proceedings IEEE
69     Data Compression Conference, Snowbird, Utah, 362-371] and by Fiala and
70     Green in their algorithm a1 [E. R. Fiala, D. H. Greene (1989): "Data
71     Compression with Finite Windows", Communications of the ACM, 4, 490-505].
72     Because lzv differs strongly from both, I hope there will be no patent
73     problems. The hashing-method has been stolen from Jean-loup Gailly's
74     (patent free) gzip.
75    
76     =back
77    
78     =cut
79    
80     package Compress::LZV1;
81    
82     require Exporter;
83     require DynaLoader;
84    
85     $VERSION = 0.04;
86     @ISA = qw/Exporter DynaLoader/;
87     @EXPORT = qw(compress decompress);
88     bootstrap Compress::LZV1 $VERSION;
89    
90     1;
91    
92    
93    
94    
95