summaryrefslogtreecommitdiffstats
path: root/doc/lz4_Block_format.md
diff options
context:
space:
mode:
authorYann Collet <cyan@fb.com>2018-01-14 05:09:02 (GMT)
committerYann Collet <cyan@fb.com>2018-01-14 05:09:02 (GMT)
commit151a50e16e558b9619b979ef1c0a525acc13ed92 (patch)
treede2eace172cbef23f0f12392487104aafeee5960 /doc/lz4_Block_format.md
parent7628d9d15a399404d3ee4c0c07fcf0f6a2f39ede (diff)
parente0e29cf09e12aa8e98275a736e98fba7eed93b3f (diff)
downloadlz4-151a50e16e558b9619b979ef1c0a525acc13ed92.zip
lz4-151a50e16e558b9619b979ef1c0a525acc13ed92.tar.gz
lz4-151a50e16e558b9619b979ef1c0a525acc13ed92.tar.bz2
Merge branch 'master' into coverity_scan
Diffstat (limited to 'doc/lz4_Block_format.md')
-rw-r--r--doc/lz4_Block_format.md16
1 files changed, 12 insertions, 4 deletions
diff --git a/doc/lz4_Block_format.md b/doc/lz4_Block_format.md
index 0f6a5ba..4e39b41 100644
--- a/doc/lz4_Block_format.md
+++ b/doc/lz4_Block_format.md
@@ -90,10 +90,18 @@ A 255 value means there is another byte to read and add.
There is no limit to the number of optional bytes that can be output this way.
(This points towards a maximum achievable compression ratio of about 250).
-With the offset and the matchlength,
-the decoder can now proceed to copy the data from the already decoded buffer.
-On decoding the matchlength, we reach the end of the compressed sequence,
-and therefore start another one.
+Decoding the matchlength reaches the end of current sequence.
+Next byte will be the start of another sequence.
+But before moving to next sequence,
+it's time to use the decoded match position and length.
+The decoder copies matchlength bytes from match position to current position.
+
+In some cases, matchlength is larger than offset.
+Therefore, match pos + match length > current pos,
+which means that later bytes to copy are not yet decoded.
+This is called an "overlap match", and must be handled with special care.
+The most common case is an offset of 1,
+meaning the last byte is repeated matchlength times.
Parsing restrictions