]> git.ipfire.org Git - thirdparty/zlib-ng.git/commitdiff
Remove toofar checks now that we always hash 4 bytes, and the minimum
authorHans Kristian Rosbach <hk-git@circlestorm.org>
Mon, 25 May 2020 15:17:45 +0000 (17:17 +0200)
committerHans Kristian Rosbach <hk-github@circlestorm.org>
Sat, 30 May 2020 19:31:38 +0000 (21:31 +0200)
match length is thus also 4. (MIN_MATCH is still 3 for other reasons)

deflate_medium.c
deflate_slow.c

index 21dcbe447a32e88c86048d7b65e11d321536d271..d0d8ed6ca4e7f8e15549db185a75fcaabc395096 100644 (file)
@@ -261,11 +261,6 @@ ZLIB_INTERNAL block_state deflate_medium(deflate_state *s, int flush) {
                 else
                     fizzle_matches(s, &current_match, &next_match);
             }
-
-            /* 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;
 
         } else {
index b012176228ee0ab5f4646d5a263e7996c66ee1bc..4f9a39a40cd69e6b94fb9b82dfced7cbd401ad28 100644 (file)
@@ -9,15 +9,6 @@
 #include "deflate_p.h"
 #include "functable.h"
 
-/* ===========================================================================
- * Local data
- */
-
-#ifndef TOO_FAR
-#  define TOO_FAR 4096
-#endif
-/* Matches of length 3 are discarded if their distance exceeds TOO_FAR */
-
 /* ===========================================================================
  * Same as deflate_medium, but achieves better compression. We use a lazy
  * evaluation for matches: a match is finally adopted only if there is
@@ -64,12 +55,7 @@ ZLIB_INTERNAL block_state deflate_slow(deflate_state *s, int flush) {
             s->match_length = functable.longest_match(s, hash_head);
             /* longest_match() sets match_start */
 
-            if (s->match_length <= 5 && (s->strategy == Z_FILTERED
-#if TOO_FAR <= 32767
-                || (s->match_length == MIN_MATCH && s->strstart - s->match_start > TOO_FAR)
-#endif
-                )) {
-
+            if (s->match_length <= 5 && (s->strategy == Z_FILTERED)) {
                 /* If prev_match is also MIN_MATCH, match_start is garbage
                  * but we will ignore the current match anyway.
                  */