summaryrefslogtreecommitdiffstats
path: root/lz4hc.h
diff options
context:
space:
mode:
authorYann Collet <yann.collet.73@gmail.com>2014-10-18 10:18:14 (GMT)
committerYann Collet <yann.collet.73@gmail.com>2014-10-18 10:18:14 (GMT)
commitd239a23337e5eba41f557b48eb26f0db81b28f26 (patch)
tree63d7ea0dc4d6224656392c5772053e5bf4fbd3a0 /lz4hc.h
parent460616007c032c7a9a6e0591c97bf025689cc001 (diff)
downloadlz4-d239a23337e5eba41f557b48eb26f0db81b28f26.zip
lz4-d239a23337e5eba41f557b48eb26f0db81b28f26.tar.gz
lz4-d239a23337e5eba41f557b48eb26f0db81b28f26.tar.bz2
updated LZ4HC API
Diffstat (limited to 'lz4hc.h')
-rw-r--r--lz4hc.h58
1 files changed, 54 insertions, 4 deletions
diff --git a/lz4hc.h b/lz4hc.h
index deb2394..29a05f5 100644
--- a/lz4hc.h
+++ b/lz4hc.h
@@ -74,7 +74,7 @@ int LZ4_compressHC2_limitedOutput (const char* source, char* dest, int inputSize
*/
/* Note :
-Decompression functions are provided within LZ4 source code (see "lz4.h") (BSD license)
+ Decompression functions are provided within LZ4 source code (see "lz4.h") (BSD license)
*/
@@ -101,13 +101,63 @@ They just use the externally allocated memory area instead of allocating their o
*/
+
+
+/**************************************
+ Experimental Streaming Functions
+**************************************/
+#define LZ4_STREAMHCSIZE_U32 65546
+#define LZ4_STREAMHCSIZE (LZ4_STREAMHCSIZE_U32 * sizeof(unsigned int))
+typedef struct { unsigned int table[LZ4_STREAMHCSIZE_U32]; } LZ4_streamHC_t;
+
+/*
+This structure allows static allocation of LZ4 HC streaming state.
+State must then be initialized using LZ4_resetStreamHC() before first use.
+
+If you prefer dynamic allocation, please refer to functions below.
+*/
+
+LZ4_streamHC_t* LZ4_createStreamHC(void);
+int LZ4_freeStreamHC (LZ4_streamHC_t* LZ4_streamHCPtr);
+
+/*
+These functions create and release memory for LZ4 HC streaming state.
+Newly created states are already initialized.
+Existing state space can be re-used anytime using LZ4_resetStreamHC().
+*/
+
+void LZ4_resetStreamHC (LZ4_streamHC_t* LZ4_streamHCPtr, int compressionLevel);
+int LZ4_loadDictHC (LZ4_streamHC_t* LZ4_streamHCPtr, const char* dictionary, int dictSize);
+
+int LZ4_compressHC_continue (LZ4_streamHC_t* LZ4_streamHCPtr, const char* source, char* dest, int inputSize);
+int LZ4_compressHC_limitedOutput_continue (LZ4_streamHC_t* LZ4_streamHCPtr, const char* source, char* dest, int inputSize, int maxOutputSize);
+
+int LZ4_saveDictHC (LZ4_streamHC_t* LZ4_streamHCPtr, char* safeBuffer, int maxDictSize);
+
+/*
+These functions compress data in successive blocks of any size, using previous blocks as dictionary.
+
+Before starting compression, state must be properly initialized, using LZ4_resetStreamHC().
+A first "fictional block" can then be designated as initial dictionary, using LZ4_loadDictHC() (Optional).
+
+Then, use LZ4_compressHC_continue() or LZ4_compressHC_limitedOutput_continue() to compress each successive block.
+They work like usual LZ4_compressHC() or LZ4_compressHC_limitedOutput(), but use previous memory blocks to improve compression.
+Previous memory blocks (including initial dictionary when present) must remain accessible and unmodified during compression.
+
+If, for any reason, previous data block can't be preserved in memory for next block compression,
+you can still preserve it by moving it to a safer place,
+using LZ4_saveDictHC().
+*/
+
+
+
/**************************************
- Streaming Functions
+ Deprecated Streaming Functions
**************************************/
/* Note : these streaming functions still follows the older model */
void* LZ4_createHC (const char* inputBuffer);
-int LZ4_compressHC_continue (void* LZ4HC_Data, const char* source, char* dest, int inputSize);
-int LZ4_compressHC_limitedOutput_continue (void* LZ4HC_Data, const char* source, char* dest, int inputSize, int maxOutputSize);
+//int LZ4_compressHC_continue (void* LZ4HC_Data, const char* source, char* dest, int inputSize);
+//int LZ4_compressHC_limitedOutput_continue (void* LZ4HC_Data, const char* source, char* dest, int inputSize, int maxOutputSize);
char* LZ4_slideInputBufferHC (void* LZ4HC_Data);
int LZ4_freeHC (void* LZ4HC_Data);