diff options
author | Adam Ierymenko <adam.ierymenko@gmail.com> | 2013-11-06 11:01:34 -0500 |
---|---|---|
committer | Adam Ierymenko <adam.ierymenko@gmail.com> | 2013-11-06 11:01:34 -0500 |
commit | 6b8c90bffd4f052cdeb3a09f0c9d44c2767dd0a4 (patch) | |
tree | 483a94332a42f52ed9b55c3bdec3c2f3e9e849db /ext/lz4/lz4hc.h | |
parent | 9455b1cc810eff7517f51f50eee828344af3526a (diff) | |
download | infinitytier-6b8c90bffd4f052cdeb3a09f0c9d44c2767dd0a4.tar.gz infinitytier-6b8c90bffd4f052cdeb3a09f0c9d44c2767dd0a4.zip |
Upgrade LZ4, remove extraneous files, put tap-mac into ext/ to declutter root.
Diffstat (limited to 'ext/lz4/lz4hc.h')
-rw-r--r-- | ext/lz4/lz4hc.h | 67 |
1 files changed, 59 insertions, 8 deletions
diff --git a/ext/lz4/lz4hc.h b/ext/lz4/lz4hc.h index cb74689f..107fd0fc 100644 --- a/ext/lz4/lz4hc.h +++ b/ext/lz4/lz4hc.h @@ -1,7 +1,7 @@ /*
LZ4 HC - High Compression Mode of LZ4
Header File
- Copyright (C) 2011-2012, Yann Collet.
+ Copyright (C) 2011-2013, Yann Collet.
BSD 2-Clause License (http://www.opensource.org/licenses/bsd-license.php)
Redistribution and use in source and binary forms, with or without
@@ -39,19 +39,70 @@ extern "C" { #endif
-int LZ4_compressHC (const char* source, char* dest, int isize);
-
+int LZ4_compressHC (const char* source, char* dest, int inputSize);
/*
LZ4_compressHC :
- return : the number of bytes in compressed buffer dest
- note : destination buffer must be already allocated.
- To avoid any problem, size it to handle worst cases situations (input data not compressible)
- Worst case size evaluation is provided by function LZ4_compressBound() (see "lz4.h")
+ return : the number of bytes in compressed buffer dest
+ or 0 if compression fails.
+ note : destination buffer must be already allocated.
+ To avoid any problem, size it to handle worst cases situations (input data not compressible)
+ Worst case size evaluation is provided by function LZ4_compressBound() (see "lz4.h")
+*/
+
+int LZ4_compressHC_limitedOutput (const char* source, char* dest, int inputSize, int maxOutputSize);
+/*
+LZ4_compress_limitedOutput() :
+ Compress 'inputSize' bytes from 'source' into an output buffer 'dest' of maximum size 'maxOutputSize'.
+ If it cannot achieve it, compression will stop, and result of the function will be zero.
+ This function never writes outside of provided output buffer.
+
+ inputSize : Max supported value is 1 GB
+ maxOutputSize : is maximum allowed size into the destination buffer (which must be already allocated)
+ return : the number of output bytes written in buffer 'dest'
+ or 0 if compression fails.
*/
/* Note :
-Decompression functions are provided within regular LZ4 source code (see "lz4.h") (BSD license)
+Decompression functions are provided within LZ4 source code (see "lz4.h") (BSD license)
+*/
+
+
+/* Advanced Functions */
+
+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);
+char* LZ4_slideInputBufferHC (void* LZ4HC_Data);
+int LZ4_freeHC (void* LZ4HC_Data);
+
+/*
+These functions allow the compression of dependent blocks, where each block benefits from prior 64 KB within preceding blocks.
+In order to achieve this, it is necessary to start creating the LZ4HC Data Structure, thanks to the function :
+
+void* LZ4_createHC (const char* inputBuffer);
+The result of the function is the (void*) pointer on the LZ4HC Data Structure.
+This pointer will be needed in all other functions.
+If the pointer returned is NULL, then the allocation has failed, and compression must be aborted.
+The only parameter 'const char* inputBuffer' must, obviously, point at the beginning of input buffer.
+The input buffer must be already allocated, and size at least 192KB.
+'inputBuffer' will also be the 'const char* source' of the first block.
+
+All blocks are expected to lay next to each other within the input buffer, starting from 'inputBuffer'.
+To compress each block, use either LZ4_compressHC_continue() or LZ4_compressHC_limitedOutput_continue().
+Their behavior are identical to LZ4_compressHC() or LZ4_compressHC_limitedOutput(),
+but require the LZ4HC Data Structure as their first argument, and check that each block starts right after the previous one.
+If next block does not begin immediately after the previous one, the compression will fail (return 0).
+
+When it's no longer possible to lay the next block after the previous one (not enough space left into input buffer), a call to :
+char* LZ4_slideInputBufferHC(void* LZ4HC_Data);
+must be performed. It will typically copy the latest 64KB of input at the beginning of input buffer.
+Note that, for this function to work properly, minimum size of an input buffer must be 192KB.
+==> The memory position where the next input data block must start is provided as the result of the function.
+
+Compression can then resume, using LZ4_compressHC_continue() or LZ4_compressHC_limitedOutput_continue(), as usual.
+
+When compression is completed, a call to LZ4_freeHC() will release the memory used by the LZ4HC Data Structure.
*/
|