lz4hc.h
Go to the documentation of this file.
00001 /*
00002    LZ4 HC - High Compression Mode of LZ4
00003    Header File
00004    Copyright (C) 2011-2015, Yann Collet.
00005    BSD 2-Clause License (http://www.opensource.org/licenses/bsd-license.php)
00006 
00007    Redistribution and use in source and binary forms, with or without
00008    modification, are permitted provided that the following conditions are
00009    met:
00010 
00011        * Redistributions of source code must retain the above copyright
00012    notice, this list of conditions and the following disclaimer.
00013        * Redistributions in binary form must reproduce the above
00014    copyright notice, this list of conditions and the following disclaimer
00015    in the documentation and/or other materials provided with the
00016    distribution.
00017 
00018    THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
00019    "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
00020    LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
00021    A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
00022    OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
00023    SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
00024    LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
00025    DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
00026    THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
00027    (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
00028    OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
00029 
00030    You can contact the author at :
00031    - LZ4 source repository : https://github.com/Cyan4973/lz4
00032    - LZ4 public forum : https://groups.google.com/forum/#!forum/lz4c
00033 */
00034 #pragma once
00035 
00036 
00037 #if defined (__cplusplus)
00038 extern "C" {
00039 #endif
00040 
00041 /*****************************
00042 *  Includes
00043 *****************************/
00044 #include <stddef.h>   /* size_t */
00045 
00046 
00047 /**************************************
00048 *  Block Compression
00049 **************************************/
00050 int LZ4_compress_HC (const char* src, char* dst, int srcSize, int maxDstSize, int compressionLevel);
00051 /*
00052 LZ4_compress_HC :
00053     Destination buffer 'dst' must be already allocated.
00054     Compression completion is guaranteed if 'dst' buffer is sized to handle worst circumstances (data not compressible)
00055     Worst size evaluation is provided by function LZ4_compressBound() (see "lz4.h")
00056       srcSize  : Max supported value is LZ4_MAX_INPUT_SIZE (see "lz4.h")
00057       compressionLevel : Recommended values are between 4 and 9, although any value between 0 and 16 will work.
00058                          0 means "use default value" (see lz4hc.c).
00059                          Values >16 behave the same as 16.
00060       return : the number of bytes written into buffer 'dst'
00061             or 0 if compression fails.
00062 */
00063 
00064 
00065 /* Note :
00066    Decompression functions are provided within LZ4 source code (see "lz4.h") (BSD license)
00067 */
00068 
00069 
00070 int LZ4_sizeofStateHC(void);
00071 int LZ4_compress_HC_extStateHC(void* state, const char* src, char* dst, int srcSize, int maxDstSize, int compressionLevel);
00072 /*
00073 LZ4_compress_HC_extStateHC() :
00074    Use this function if you prefer to manually allocate memory for compression tables.
00075    To know how much memory must be allocated for the compression tables, use :
00076       int LZ4_sizeofStateHC();
00077 
00078    Allocated memory must be aligned on 8-bytes boundaries (which a normal malloc() will do properly).
00079 
00080    The allocated memory can then be provided to the compression functions using 'void* state' parameter.
00081    LZ4_compress_HC_extStateHC() is equivalent to previously described function.
00082    It just uses externally allocated memory for stateHC.
00083 */
00084 
00085 
00086 /**************************************
00087 *  Streaming Compression
00088 **************************************/
00089 #define LZ4_STREAMHCSIZE        262192
00090 #define LZ4_STREAMHCSIZE_SIZET (LZ4_STREAMHCSIZE / sizeof(size_t))
00091 typedef struct { size_t table[LZ4_STREAMHCSIZE_SIZET]; } LZ4_streamHC_t;
00092 /*
00093   LZ4_streamHC_t
00094   This structure allows static allocation of LZ4 HC streaming state.
00095   State must then be initialized using LZ4_resetStreamHC() before first use.
00096 
00097   Static allocation should only be used in combination with static linking.
00098   If you want to use LZ4 as a DLL, please use construction functions below, which are future-proof.
00099 */
00100 
00101 
00102 LZ4_streamHC_t* LZ4_createStreamHC(void);
00103 int             LZ4_freeStreamHC (LZ4_streamHC_t* streamHCPtr);
00104 /*
00105   These functions create and release memory for LZ4 HC streaming state.
00106   Newly created states are already initialized.
00107   Existing state space can be re-used anytime using LZ4_resetStreamHC().
00108   If you use LZ4 as a DLL, use these functions instead of static structure allocation,
00109   to avoid size mismatch between different versions.
00110 */
00111 
00112 void LZ4_resetStreamHC (LZ4_streamHC_t* streamHCPtr, int compressionLevel);
00113 int  LZ4_loadDictHC (LZ4_streamHC_t* streamHCPtr, const char* dictionary, int dictSize);
00114 
00115 int LZ4_compress_HC_continue (LZ4_streamHC_t* streamHCPtr, const char* src, char* dst, int srcSize, int maxDstSize);
00116 
00117 int LZ4_saveDictHC (LZ4_streamHC_t* streamHCPtr, char* safeBuffer, int maxDictSize);
00118 
00119 /*
00120   These functions compress data in successive blocks of any size, using previous blocks as dictionary.
00121   One key assumption is that previous blocks (up to 64 KB) remain read-accessible while compressing next blocks.
00122   There is an exception for ring buffers, which can be smaller 64 KB.
00123   Such case is automatically detected and correctly handled by LZ4_compress_HC_continue().
00124 
00125   Before starting compression, state must be properly initialized, using LZ4_resetStreamHC().
00126   A first "fictional block" can then be designated as initial dictionary, using LZ4_loadDictHC() (Optional).
00127 
00128   Then, use LZ4_compress_HC_continue() to compress each successive block.
00129   It works like LZ4_compress_HC(), but use previous memory blocks as dictionary to improve compression.
00130   Previous memory blocks (including initial dictionary when present) must remain accessible and unmodified during compression.
00131   As a reminder, size 'dst' buffer to handle worst cases, using LZ4_compressBound(), to ensure success of compression operation.
00132 
00133   If, for any reason, previous data blocks can't be preserved unmodified in memory during next compression block,
00134   you must save it to a safer memory space, using LZ4_saveDictHC().
00135   Return value of LZ4_saveDictHC() is the size of dictionary effectively saved into 'safeBuffer'.
00136 */
00137 
00138 
00139 
00140 /**************************************
00141 *  Deprecated Functions
00142 **************************************/
00143 /* Deprecate Warnings */
00144 /* Should these warnings messages be a problem,
00145    it is generally possible to disable them,
00146    with -Wno-deprecated-declarations for gcc
00147    or _CRT_SECURE_NO_WARNINGS in Visual for example.
00148    You can also define LZ4_DEPRECATE_WARNING_DEFBLOCK. */
00149 #ifndef LZ4_DEPRECATE_WARNING_DEFBLOCK
00150 #  define LZ4_DEPRECATE_WARNING_DEFBLOCK
00151 #  define LZ4_GCC_VERSION (__GNUC__ * 100 + __GNUC_MINOR__)
00152 #  if (LZ4_GCC_VERSION >= 405) || defined(__clang__)
00153 #    define LZ4_DEPRECATED(message) __attribute__((deprecated(message)))
00154 #  elif (LZ4_GCC_VERSION >= 301)
00155 #    define LZ4_DEPRECATED(message) __attribute__((deprecated))
00156 #  elif defined(_MSC_VER)
00157 #    define LZ4_DEPRECATED(message) __declspec(deprecated(message))
00158 #  else
00159 #    pragma message("WARNING: You need to implement LZ4_DEPRECATED for this compiler")
00160 #    define LZ4_DEPRECATED(message)
00161 #  endif
00162 #endif // LZ4_DEPRECATE_WARNING_DEFBLOCK
00163 
00164 /* compression functions */
00165 /* these functions are planned to trigger warning messages by r131 approximately */
00166 int LZ4_compressHC                (const char* source, char* dest, int inputSize);
00167 int LZ4_compressHC_limitedOutput  (const char* source, char* dest, int inputSize, int maxOutputSize);
00168 int LZ4_compressHC2               (const char* source, char* dest, int inputSize, int compressionLevel);
00169 int LZ4_compressHC2_limitedOutput (const char* source, char* dest, int inputSize, int maxOutputSize, int compressionLevel);
00170 int LZ4_compressHC_withStateHC               (void* state, const char* source, char* dest, int inputSize);
00171 int LZ4_compressHC_limitedOutput_withStateHC (void* state, const char* source, char* dest, int inputSize, int maxOutputSize);
00172 int LZ4_compressHC2_withStateHC              (void* state, const char* source, char* dest, int inputSize, int compressionLevel);
00173 int LZ4_compressHC2_limitedOutput_withStateHC(void* state, const char* source, char* dest, int inputSize, int maxOutputSize, int compressionLevel);
00174 int LZ4_compressHC_continue               (LZ4_streamHC_t* LZ4_streamHCPtr, const char* source, char* dest, int inputSize);
00175 int LZ4_compressHC_limitedOutput_continue (LZ4_streamHC_t* LZ4_streamHCPtr, const char* source, char* dest, int inputSize, int maxOutputSize);
00176 
00177 /* Streaming functions following the older model; should no longer be used */
00178 LZ4_DEPRECATED("use LZ4_createStreamHC() instead") void* LZ4_createHC (char* inputBuffer);
00179 LZ4_DEPRECATED("use LZ4_saveDictHC() instead")     char* LZ4_slideInputBufferHC (void* LZ4HC_Data);
00180 LZ4_DEPRECATED("use LZ4_freeStreamHC() instead")   int   LZ4_freeHC (void* LZ4HC_Data);
00181 LZ4_DEPRECATED("use LZ4_compress_HC_continue() instead") int   LZ4_compressHC2_continue (void* LZ4HC_Data, const char* source, char* dest, int inputSize, int compressionLevel);
00182 LZ4_DEPRECATED("use LZ4_compress_HC_continue() instead") int   LZ4_compressHC2_limitedOutput_continue (void* LZ4HC_Data, const char* source, char* dest, int inputSize, int maxOutputSize, int compressionLevel);
00183 LZ4_DEPRECATED("use LZ4_createStreamHC() instead") int   LZ4_sizeofStreamStateHC(void);
00184 LZ4_DEPRECATED("use LZ4_resetStreamHC() instead")  int   LZ4_resetStreamStateHC(void* state, char* inputBuffer);
00185 
00186 
00187 #if defined (__cplusplus)
00188 }
00189 #endif


rtabmap
Author(s): Mathieu Labbe
autogenerated on Sat Jul 23 2016 11:44:16