]> git.ipfire.org Git - thirdparty/zstd.git/commitdiff
overlap at full windowSize for max compression level
authorYann Collet <cyan@fb.com>
Thu, 30 Mar 2017 23:23:22 +0000 (16:23 -0700)
committerYann Collet <cyan@fb.com>
Thu, 30 Mar 2017 23:23:22 +0000 (16:23 -0700)
as it provides max compression ratio

lib/compress/zstdmt_compress.c

index f9d722b114adeb57863351e292e027e41f35e003..009d04a1fa277c7e43c77464fe09a296b3bdec5b 100644 (file)
@@ -390,7 +390,8 @@ size_t ZSTDMT_compressCCtx(ZSTDMT_CCtx* mtctx,
                            int compressionLevel)
 {
     ZSTD_parameters params = ZSTD_getParams(compressionLevel, srcSize, 0);
-    size_t const overlapSize = (size_t)1 << (params.cParams.windowLog - 3);
+    U32 const overlapLog = (compressionLevel >= ZSTD_maxCLevel()) ? 0 : 3;
+    size_t const overlapSize = (size_t)1 << (params.cParams.windowLog - overlapLog);
     size_t const chunkTargetSize = (size_t)1 << (params.cParams.windowLog + 2);
     unsigned const nbChunksMax = (unsigned)(srcSize / chunkTargetSize) + 1;
     unsigned nbChunks = MIN(nbChunksMax, mtctx->nbThreads);