]> mj.ucw.cz Git - libucw.git/blob - lib/lizard.h
25ba4bcee29fc946a6b41e9c265b4b02770e0d46
[libucw.git] / lib / lizard.h
1 /*
2  *      LiZzaRd -- Fast compression method based on Lempel-Ziv 77
3  *
4  *      (c) 2004, Robert Spalek <robert@ucw.cz>
5  *
6  *      The file format is based on LZO1X and 
7  *      the compression method is based on zlib.
8  */
9
10 #define LIZZARD_NEEDS_CHARS     8
11   /* The compression routine needs input buffer 8 characters longer, because it
12    * does not check the input bounds all the time.  */
13 #define LIZZARD_MAX_MULTIPLY    65LL/64
14 #define LIZZARD_MAX_ADD         4
15   /* In the worst case, the compressed file will not be longer than its
16    * original length * 65/64 + 4.
17    *
18    * The additive constant is for EOF and the header of the file.
19    *
20    * The multiplicative constant 129/128 comes from an incompressible string of
21    * length 256 that requires a 2-byte header.  However, if longer strings get
22    * interrupted by a sequence of length 3 compressed into 2 characters, the
23    * overlap is sligtly bigger.
24    * TODO: check */
25
26 int lizzard_compress(byte *in, uns in_len, byte *out);
27 int lizzard_decompress(byte *in, byte *out);