diff --git a/programs/fileio.c b/programs/fileio.c index 8803fff0f..b29936191 100644 --- a/programs/fileio.c +++ b/programs/fileio.c @@ -71,6 +71,7 @@ #define MB *(1<<20) #define GB *(1U<<30) +#define ADAPT_WINDOWLOG_DEFAULT 23 /* 8 MB */ #define DICTSIZE_MAX (32 MB) /* protection against large input (attack scenario) */ #define FNSPACE 30 @@ -427,6 +428,9 @@ static cRess_t FIO_createCResources(const char* dictFileName, int cLevel, if (dictFileName && (dictBuffer==NULL)) EXM_THROW(32, "allocation error : can't create dictBuffer"); + if (g_adaptiveMode && !g_ldmFlag && !comprParams.windowLog) + comprParams.windowLog = ADAPT_WINDOWLOG_DEFAULT; + CHECK( ZSTD_CCtx_setParameter(ress.cctx, ZSTD_p_contentSizeFlag, 1) ); /* always enable content size when available (note: supposed to be default) */ CHECK( ZSTD_CCtx_setParameter(ress.cctx, ZSTD_p_dictIDFlag, g_dictIDFlag) ); CHECK( ZSTD_CCtx_setParameter(ress.cctx, ZSTD_p_checksumFlag, g_checksumFlag) ); diff --git a/programs/zstd.1.md b/programs/zstd.1.md index 5f3701864..b662758ac 100644 --- a/programs/zstd.1.md +++ b/programs/zstd.1.md @@ -136,10 +136,11 @@ the last one takes effect. Final compressed result is slightly different from `-T1`. * `--adapt` : `zstd` will dynamically adapt compression level to perceived I/O conditions. - The current compression level can be observed live by using command `-v`. + Compression level adaptation can be observed live by using command `-v`. Works with multi-threading and `--long` mode. - Does not work with `--single-thread`. + When not specified otherwise, uses a window size of 8 MB. Due to the chaotic nature of dynamic adaptation, compressed result is not reproducible. + Adaptation does not work with `--single-thread`. * `-D file`: use `file` as Dictionary to compress or decompress FILE(s) * `--no-dictID`: