summaryrefslogtreecommitdiff
path: root/deflate_medium.c
diff options
context:
space:
mode:
authorHans Kristian Rosbach <hk-git@circlestorm.org>2019-11-01 11:47:50 +0100
committerHans Kristian Rosbach <hk-github@circlestorm.org>2020-03-18 11:04:05 +0100
commit3f21e5071f33bc0ff6e94d5fa0ecf398d6e3fcc3 (patch)
tree9e14eb562162c336ac5afce8067314015e5bc0b1 /deflate_medium.c
parent4c1cf4f10456316ed8d03d990a05721af20b1783 (diff)
Add comment regarding long match distance bit costs.
Diffstat (limited to 'deflate_medium.c')
-rw-r--r--deflate_medium.c1
1 files changed, 1 insertions, 0 deletions
diff --git a/deflate_medium.c b/deflate_medium.c
index 8283a08..07ce71f 100644
--- a/deflate_medium.c
+++ b/deflate_medium.c
@@ -292,6 +292,7 @@ ZLIB_INTERNAL block_state deflate_medium(deflate_state *s, int flush) {
}
/* short matches with a very long distance are rarely a good idea encoding wise */
+ /* distances 8193–16384 take 12 extra bits, distances 16385–32768 take 13 extra bits */
if (next_match.match_length == 3 && (next_match.strstart - next_match.match_start) > 12000)
next_match.match_length = 1;
s->strstart = current_match.strstart;