From: senhuang42 Date: Mon, 19 Oct 2020 14:26:17 +0000 (-0400) Subject: Add ldm enable condition in ZSTD_resetCCtx_internal X-Git-Tag: v1.4.7~44^2~6 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=590f7f55f0ca68bb1a90043efb014f18c4b07cd1;p=thirdparty%2Fzstd.git Add ldm enable condition in ZSTD_resetCCtx_internal --- diff --git a/lib/compress/zstd_compress.c b/lib/compress/zstd_compress.c index b1bb9fa10..434c23000 100644 --- a/lib/compress/zstd_compress.c +++ b/lib/compress/zstd_compress.c @@ -1542,6 +1542,12 @@ static size_t ZSTD_resetCCtx_internal(ZSTD_CCtx* zc, zc->isFirstBlock = 1; + if (params.cParams.strategy >= ZSTD_btopt && params.cParams.windowLog >= 27) { + /* Enable LDM by default for optimal parser and window size >= 128MB */ + DEBUGLOG(4, "LDM enabled by default (window size >= 128MB, strategy >= btopt)"); + params.ldmParams.enableLdm = 1; + } + if (params.ldmParams.enableLdm) { /* Adjust long distance matching parameters */ ZSTD_ldm_adjustParameters(¶ms.ldmParams, ¶ms.cParams);