summaryrefslogtreecommitdiffstats
path: root/doc
diff options
context:
space:
mode:
authorYann Collet <cyan@fb.com>2018-02-26 21:31:18 (GMT)
committerYann Collet <cyan@fb.com>2018-02-26 21:31:18 (GMT)
commitba115386fa69c148cd1b27790a8b95cd817ff172 (patch)
tree4cf6677f225a4d060734223b5b02f59dd87036f0 /doc
parent1882b10e4192b993dd40361d4df1ef391c168911 (diff)
downloadlz4-ba115386fa69c148cd1b27790a8b95cd817ff172.zip
lz4-ba115386fa69c148cd1b27790a8b95cd817ff172.tar.gz
lz4-ba115386fa69c148cd1b27790a8b95cd817ff172.tar.bz2
update code comment on LZ4 streaming interface
notably regarding LZ4_saveDict() speed advantage, answering #477.
Diffstat (limited to 'doc')
-rw-r--r--doc/lz4_manual.html21
1 files changed, 11 insertions, 10 deletions
diff --git a/doc/lz4_manual.html b/doc/lz4_manual.html
index b5a4042..43107c6 100644
--- a/doc/lz4_manual.html
+++ b/doc/lz4_manual.html
@@ -172,28 +172,29 @@ int LZ4_freeStream (LZ4_stream_t* streamPtr);
</p></pre><BR>
<pre><b>int LZ4_compress_fast_continue (LZ4_stream_t* streamPtr, const char* src, char* dst, int srcSize, int dstCapacity, int acceleration);
-</b><p> Compress content into 'src' using data from previously compressed blocks, improving compression ratio.
+</b><p> Compress 'src' content using data from previously compressed blocks, for better compression ratio.
'dst' buffer must be already allocated.
If dstCapacity >= LZ4_compressBound(srcSize), compression is guaranteed to succeed, and runs faster.
- Important : The previous 64KB of compressed data is assumed to remain preset and unmodified in memory!
- If less than 64KB has been compressed all the data must be present.
+ Important : The previous 64KB of compressed data is assumed to remain present and unmodified in memory!
+
Special 1 : When input is a double-buffer, they can have any size, including < 64 KB.
Make sure that buffers are separated by at least one byte.
- This way, rule becomes simple : each block depends on previous block only.
+ This way, each block only depends on previous block.
Special 2 : If input buffer is a ring-buffer, it can have any size, including < 64 KB.
@return : size of compressed block
- or 0 if there is an error (typically, compressed data cannot fit into 'dst')
+ or 0 if there is an error (typically, cannot fit into 'dst').
After an error, the stream status is invalid, it can only be reset or freed.
</p></pre><BR>
-<pre><b>int LZ4_saveDict (LZ4_stream_t* streamPtr, char* safeBuffer, int dictSize);
-</b><p> If previously compressed data block is not guaranteed to remain available at its current memory location,
+<pre><b>int LZ4_saveDict (LZ4_stream_t* streamPtr, char* safeBuffer, int maxDictSize);
+</b><p> If last 64KB data cannot be guaranteed to remain available at its current memory location,
save it into a safer place (char* safeBuffer).
- Note : it's not necessary to call LZ4_loadDict() after LZ4_saveDict(), dictionary is immediately usable.
- @return : saved dictionary size in bytes (necessarily <= dictSize), or 0 if error.
+ This is schematically equivalent to a memcpy() followed by LZ4_loadDict(),
+ but is much faster, because LZ4_saveDict() doesn't need to rebuild tables.
+ @return : saved dictionary size in bytes (necessarily <= maxDictSize), or 0 if error.
</p></pre><BR>
@@ -209,7 +210,7 @@ int LZ4_freeStreamDecode (LZ4_streamDecode_t* LZ4_stream);
<pre><b>int LZ4_setStreamDecode (LZ4_streamDecode_t* LZ4_streamDecode, const char* dictionary, int dictSize);
</b><p> An LZ4_streamDecode_t structure can be allocated once and re-used multiple times.
Use this function to start decompression of a new stream of blocks.
- A dictionary can optionnally be set. Use NULL or size 0 for a simple reset order.
+ A dictionary can optionnally be set. Use NULL or size 0 for a reset order.
@return : 1 if OK, 0 if error
</p></pre><BR>