• Main Page
  • Related Pages
  • Namespaces
  • Data Structures
  • Files
  • File List
  • Globals

fastlz.h

Go to the documentation of this file.
00001 /*
00002   FastLZ - lightning-fast lossless compression library
00003 
00004   Copyright (C) 2007 Ariya Hidayat (ariya@kde.org)
00005   Copyright (C) 2006 Ariya Hidayat (ariya@kde.org)
00006   Copyright (C) 2005 Ariya Hidayat (ariya@kde.org)
00007 
00008   Permission is hereby granted, free of charge, to any person obtaining a copy
00009   of this software and associated documentation files (the "Software"), to deal
00010   in the Software without restriction, including without limitation the rights
00011   to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
00012   copies of the Software, and to permit persons to whom the Software is
00013   furnished to do so, subject to the following conditions:
00014 
00015   The above copyright notice and this permission notice shall be included in
00016   all copies or substantial portions of the Software.
00017 
00018   THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
00019   IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
00020   FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
00021   AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
00022   LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
00023   OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
00024   THE SOFTWARE.
00025 */
00026 
00027 #ifndef FASTLZ_H
00028 #define FASTLZ_H
00029 
00030 #define FASTLZ_VERSION 0x000100
00031 
00032 #define FASTLZ_VERSION_MAJOR     0
00033 #define FASTLZ_VERSION_MINOR     0
00034 #define FASTLZ_VERSION_REVISION  0
00035 
00036 #define FASTLZ_VERSION_STRING "0.1.0"
00037 
00038 #if defined (__cplusplus)
00039 extern "C" {
00040 #endif
00041 
00042 /**
00043   Compress a block of data in the input buffer and returns the size of
00044   compressed block. The size of input buffer is specified by length. The
00045   minimum input buffer size is 16.
00046 
00047   The output buffer must be at least 5% larger than the input buffer
00048   and can not be smaller than 66 bytes.
00049 
00050   If the input is not compressible, the return value might be larger than
00051   length (input buffer size).
00052 
00053   The input buffer and the output buffer can not overlap.
00054 */
00055 
00056 int fastlz_compress(const void* input, int length, void* output);
00057 
00058 /**
00059   Decompress a block of compressed data and returns the size of the
00060   decompressed block. If error occurs, e.g. the compressed data is
00061   corrupted or the output buffer is not large enough, then 0 (zero)
00062   will be returned instead.
00063 
00064   The input buffer and the output buffer can not overlap.
00065 
00066   Decompression is memory safe and guaranteed not to write the output buffer
00067   more than what is specified in maxout.
00068  */
00069 
00070 int fastlz_decompress(const void* input, int length, void* output, int maxout);
00071 
00072 /**
00073   Compress a block of data in the input buffer and returns the size of
00074   compressed block. The size of input buffer is specified by length. The
00075   minimum input buffer size is 16.
00076 
00077   The output buffer must be at least 5% larger than the input buffer
00078   and can not be smaller than 66 bytes.
00079 
00080   If the input is not compressible, the return value might be larger than
00081   length (input buffer size).
00082 
00083   The input buffer and the output buffer can not overlap.
00084 
00085   Compression level can be specified in parameter level. At the moment,
00086   only level 1 and level 2 are supported.
00087   Level 1 is the fastest compression and generally useful for short data.
00088   Level 2 is slightly slower but it gives better compression ratio.
00089 
00090   Note that the compressed data, regardless of the level, can always be
00091   decompressed using the function fastlz_decompress above.
00092 */
00093 
00094 int fastlz_compress_level(int level, const void* input, int length, void* output);
00095 
00096 #if defined (__cplusplus)
00097 }
00098 #endif
00099 
00100 #endif /* FASTLZ_H */

Generated by  doxygen 1.7.1