changed parameter names from ZSTD_p_* to ZSTD_c_*
for naming consistency
This commit is contained in:
@@ -579,7 +579,7 @@ static void* compressionThread(void* arg)
|
|||||||
params.cParams.windowLog = 23;
|
params.cParams.windowLog = 23;
|
||||||
{
|
{
|
||||||
size_t const initError = ZSTD_compressBegin_advanced(ctx->cctx, job->src.start + job->dictSize - useDictSize, useDictSize, params, 0);
|
size_t const initError = ZSTD_compressBegin_advanced(ctx->cctx, job->src.start + job->dictSize - useDictSize, useDictSize, params, 0);
|
||||||
size_t const windowSizeError = ZSTD_CCtx_setParameter(ctx->cctx, ZSTD_p_forceMaxWindow, 1);
|
size_t const windowSizeError = ZSTD_CCtx_setParameter(ctx->cctx, ZSTD_c_forceMaxWindow, 1);
|
||||||
if (ZSTD_isError(initError) || ZSTD_isError(windowSizeError)) {
|
if (ZSTD_isError(initError) || ZSTD_isError(windowSizeError)) {
|
||||||
DISPLAY("Error: something went wrong while starting compression\n");
|
DISPLAY("Error: something went wrong while starting compression\n");
|
||||||
signalErrorToThreads(ctx);
|
signalErrorToThreads(ctx);
|
||||||
|
|||||||
+32
-32
@@ -408,23 +408,23 @@ size_t ZSTD_sizeof_DDict(const ZSTD_DDict* ddict);
|
|||||||
<pre><b>typedef enum {
|
<pre><b>typedef enum {
|
||||||
|
|
||||||
</b>/* compression parameters */<b>
|
</b>/* compression parameters */<b>
|
||||||
ZSTD_p_compressionLevel=100, </b>/* Update all compression parameters according to pre-defined cLevel table<b>
|
ZSTD_c_compressionLevel=100, </b>/* Update all compression parameters according to pre-defined cLevel table<b>
|
||||||
* Default level is ZSTD_CLEVEL_DEFAULT==3.
|
* Default level is ZSTD_CLEVEL_DEFAULT==3.
|
||||||
* Special: value 0 means default, which is controlled by ZSTD_CLEVEL_DEFAULT.
|
* Special: value 0 means default, which is controlled by ZSTD_CLEVEL_DEFAULT.
|
||||||
* Note 1 : it's possible to pass a negative compression level.
|
* Note 1 : it's possible to pass a negative compression level.
|
||||||
* Note 2 : setting a level sets all default values of other compression parameters */
|
* Note 2 : setting a level sets all default values of other compression parameters */
|
||||||
ZSTD_p_windowLog=101, </b>/* Maximum allowed back-reference distance, expressed as power of 2.<b>
|
ZSTD_c_windowLog=101, </b>/* Maximum allowed back-reference distance, expressed as power of 2.<b>
|
||||||
* Must be clamped between ZSTD_WINDOWLOG_MIN and ZSTD_WINDOWLOG_MAX.
|
* Must be clamped between ZSTD_WINDOWLOG_MIN and ZSTD_WINDOWLOG_MAX.
|
||||||
* Special: value 0 means "use default windowLog".
|
* Special: value 0 means "use default windowLog".
|
||||||
* Note: Using a window size greater than 1<<ZSTD_WINDOWLOG_LIMIT_DEFAULT
|
* Note: Using a window size greater than 1<<ZSTD_WINDOWLOG_LIMIT_DEFAULT
|
||||||
* requires explicitly allowing such window size during decompression stage if using streaming. */
|
* requires explicitly allowing such window size during decompression stage if using streaming. */
|
||||||
ZSTD_p_hashLog=102, </b>/* Size of the initial probe table, as a power of 2.<b>
|
ZSTD_c_hashLog=102, </b>/* Size of the initial probe table, as a power of 2.<b>
|
||||||
* Resulting memory usage is (1 << (hashLog+2)).
|
* Resulting memory usage is (1 << (hashLog+2)).
|
||||||
* Must be clamped between ZSTD_HASHLOG_MIN and ZSTD_HASHLOG_MAX.
|
* Must be clamped between ZSTD_HASHLOG_MIN and ZSTD_HASHLOG_MAX.
|
||||||
* Larger tables improve compression ratio of strategies <= dFast,
|
* Larger tables improve compression ratio of strategies <= dFast,
|
||||||
* and improve speed of strategies > dFast.
|
* and improve speed of strategies > dFast.
|
||||||
* Special: value 0 means "use default hashLog". */
|
* Special: value 0 means "use default hashLog". */
|
||||||
ZSTD_p_chainLog=103, </b>/* Size of the multi-probe search table, as a power of 2.<b>
|
ZSTD_c_chainLog=103, </b>/* Size of the multi-probe search table, as a power of 2.<b>
|
||||||
* Resulting memory usage is (1 << (chainLog+2)).
|
* Resulting memory usage is (1 << (chainLog+2)).
|
||||||
* Must be clamped between ZSTD_CHAINLOG_MIN and ZSTD_CHAINLOG_MAX.
|
* Must be clamped between ZSTD_CHAINLOG_MIN and ZSTD_CHAINLOG_MAX.
|
||||||
* Larger tables result in better and slower compression.
|
* Larger tables result in better and slower compression.
|
||||||
@@ -432,11 +432,11 @@ size_t ZSTD_sizeof_DDict(const ZSTD_DDict* ddict);
|
|||||||
* It's still useful when using "dfast" strategy,
|
* It's still useful when using "dfast" strategy,
|
||||||
* in which case it defines a secondary probe table.
|
* in which case it defines a secondary probe table.
|
||||||
* Special: value 0 means "use default chainLog". */
|
* Special: value 0 means "use default chainLog". */
|
||||||
ZSTD_p_searchLog=104, </b>/* Number of search attempts, as a power of 2.<b>
|
ZSTD_c_searchLog=104, </b>/* Number of search attempts, as a power of 2.<b>
|
||||||
* More attempts result in better and slower compression.
|
* More attempts result in better and slower compression.
|
||||||
* This parameter is useless when using "fast" and "dFast" strategies.
|
* This parameter is useless when using "fast" and "dFast" strategies.
|
||||||
* Special: value 0 means "use default searchLog". */
|
* Special: value 0 means "use default searchLog". */
|
||||||
ZSTD_p_minMatch=105, </b>/* Minimum size of searched matches.<b>
|
ZSTD_c_minMatch=105, </b>/* Minimum size of searched matches.<b>
|
||||||
* Note that Zstandard can still find matches of smaller size,
|
* Note that Zstandard can still find matches of smaller size,
|
||||||
* it just tweaks its search algorithm to look for this size and larger.
|
* it just tweaks its search algorithm to look for this size and larger.
|
||||||
* Larger values increase compression and decompression speed, but decrease ratio.
|
* Larger values increase compression and decompression speed, but decrease ratio.
|
||||||
@@ -444,7 +444,7 @@ size_t ZSTD_sizeof_DDict(const ZSTD_DDict* ddict);
|
|||||||
* Note that currently, for all strategies < btopt, effective minimum is 4.
|
* Note that currently, for all strategies < btopt, effective minimum is 4.
|
||||||
* , for all strategies > fast, effective maximum is 6.
|
* , for all strategies > fast, effective maximum is 6.
|
||||||
* Special: value 0 means "use default minMatchLength". */
|
* Special: value 0 means "use default minMatchLength". */
|
||||||
ZSTD_p_targetLength=106, </b>/* Impact of this field depends on strategy.<b>
|
ZSTD_c_targetLength=106, </b>/* Impact of this field depends on strategy.<b>
|
||||||
* For strategies btopt & btultra:
|
* For strategies btopt & btultra:
|
||||||
* Length of Match considered "good enough" to stop search.
|
* Length of Match considered "good enough" to stop search.
|
||||||
* Larger values make compression stronger, and slower.
|
* Larger values make compression stronger, and slower.
|
||||||
@@ -452,33 +452,33 @@ size_t ZSTD_sizeof_DDict(const ZSTD_DDict* ddict);
|
|||||||
* Distance between match sampling.
|
* Distance between match sampling.
|
||||||
* Larger values make compression faster, and weaker.
|
* Larger values make compression faster, and weaker.
|
||||||
* Special: value 0 means "use default targetLength". */
|
* Special: value 0 means "use default targetLength". */
|
||||||
ZSTD_p_compressionStrategy=107, </b>/* See ZSTD_strategy enum definition.<b>
|
ZSTD_c_compressionStrategy=107, </b>/* See ZSTD_strategy enum definition.<b>
|
||||||
* The higher the value of selected strategy, the more complex it is,
|
* The higher the value of selected strategy, the more complex it is,
|
||||||
* resulting in stronger and slower compression.
|
* resulting in stronger and slower compression.
|
||||||
* Special: value 0 means "use default strategy". */
|
* Special: value 0 means "use default strategy". */
|
||||||
|
|
||||||
</b>/* LDM mode parameters */<b>
|
</b>/* LDM mode parameters */<b>
|
||||||
ZSTD_p_enableLongDistanceMatching=160, </b>/* Enable long distance matching.<b>
|
ZSTD_c_enableLongDistanceMatching=160, </b>/* Enable long distance matching.<b>
|
||||||
* This parameter is designed to improve compression ratio
|
* This parameter is designed to improve compression ratio
|
||||||
* for large inputs, by finding large matches at long distance.
|
* for large inputs, by finding large matches at long distance.
|
||||||
* It increases memory usage and window size.
|
* It increases memory usage and window size.
|
||||||
* Note: enabling this parameter increases default ZSTD_p_windowLog to 128 MB
|
* Note: enabling this parameter increases default ZSTD_c_windowLog to 128 MB
|
||||||
* except when expressly set to a different value. */
|
* except when expressly set to a different value. */
|
||||||
ZSTD_p_ldmHashLog=161, </b>/* Size of the table for long distance matching, as a power of 2.<b>
|
ZSTD_c_ldmHashLog=161, </b>/* Size of the table for long distance matching, as a power of 2.<b>
|
||||||
* Larger values increase memory usage and compression ratio,
|
* Larger values increase memory usage and compression ratio,
|
||||||
* but decrease compression speed.
|
* but decrease compression speed.
|
||||||
* Must be clamped between ZSTD_HASHLOG_MIN and ZSTD_HASHLOG_MAX
|
* Must be clamped between ZSTD_HASHLOG_MIN and ZSTD_HASHLOG_MAX
|
||||||
* default: windowlog - 7.
|
* default: windowlog - 7.
|
||||||
* Special: value 0 means "automatically determine hashlog". */
|
* Special: value 0 means "automatically determine hashlog". */
|
||||||
ZSTD_p_ldmMinMatch=162, </b>/* Minimum match size for long distance matcher.<b>
|
ZSTD_c_ldmMinMatch=162, </b>/* Minimum match size for long distance matcher.<b>
|
||||||
* Larger/too small values usually decrease compression ratio.
|
* Larger/too small values usually decrease compression ratio.
|
||||||
* Must be clamped between ZSTD_LDM_MINMATCH_MIN and ZSTD_LDM_MINMATCH_MAX.
|
* Must be clamped between ZSTD_LDM_MINMATCH_MIN and ZSTD_LDM_MINMATCH_MAX.
|
||||||
* Special: value 0 means "use default value" (default: 64). */
|
* Special: value 0 means "use default value" (default: 64). */
|
||||||
ZSTD_p_ldmBucketSizeLog=163, </b>/* Log size of each bucket in the LDM hash table for collision resolution.<b>
|
ZSTD_c_ldmBucketSizeLog=163, </b>/* Log size of each bucket in the LDM hash table for collision resolution.<b>
|
||||||
* Larger values improve collision resolution but decrease compression speed.
|
* Larger values improve collision resolution but decrease compression speed.
|
||||||
* The maximum value is ZSTD_LDM_BUCKETSIZELOG_MAX.
|
* The maximum value is ZSTD_LDM_BUCKETSIZELOG_MAX.
|
||||||
* Special: value 0 means "use default value" (default: 3). */
|
* Special: value 0 means "use default value" (default: 3). */
|
||||||
ZSTD_p_ldmHashRateLog=164, </b>/* Frequency of inserting/looking up entries into the LDM hash table.<b>
|
ZSTD_c_ldmHashRateLog=164, </b>/* Frequency of inserting/looking up entries into the LDM hash table.<b>
|
||||||
* Must be clamped between 0 and (ZSTD_WINDOWLOG_MAX - ZSTD_HASHLOG_MIN).
|
* Must be clamped between 0 and (ZSTD_WINDOWLOG_MAX - ZSTD_HASHLOG_MIN).
|
||||||
* Default is MAX(0, (windowLog - ldmHashLog)), optimizing hash table usage.
|
* Default is MAX(0, (windowLog - ldmHashLog)), optimizing hash table usage.
|
||||||
* Larger values improve compression speed.
|
* Larger values improve compression speed.
|
||||||
@@ -486,16 +486,16 @@ size_t ZSTD_sizeof_DDict(const ZSTD_DDict* ddict);
|
|||||||
* Special: value 0 means "automatically determine hashRateLog". */
|
* Special: value 0 means "automatically determine hashRateLog". */
|
||||||
|
|
||||||
</b>/* frame parameters */<b>
|
</b>/* frame parameters */<b>
|
||||||
ZSTD_p_contentSizeFlag=200, </b>/* Content size will be written into frame header _whenever known_ (default:1)<b>
|
ZSTD_c_contentSizeFlag=200, </b>/* Content size will be written into frame header _whenever known_ (default:1)<b>
|
||||||
* Content size must be known at the beginning of compression,
|
* Content size must be known at the beginning of compression,
|
||||||
* it is provided using ZSTD_CCtx_setPledgedSrcSize() */
|
* it is provided using ZSTD_CCtx_setPledgedSrcSize() */
|
||||||
ZSTD_p_checksumFlag=201, </b>/* A 32-bits checksum of content is written at end of frame (default:0) */<b>
|
ZSTD_c_checksumFlag=201, </b>/* A 32-bits checksum of content is written at end of frame (default:0) */<b>
|
||||||
ZSTD_p_dictIDFlag=202, </b>/* When applicable, dictionary's ID is written into frame header (default:1) */<b>
|
ZSTD_c_dictIDFlag=202, </b>/* When applicable, dictionary's ID is written into frame header (default:1) */<b>
|
||||||
|
|
||||||
</b>/* multi-threading parameters */<b>
|
</b>/* multi-threading parameters */<b>
|
||||||
</b>/* These parameters are only useful if multi-threading is enabled (compiled with build macro ZSTD_MULTITHREAD).<b>
|
</b>/* These parameters are only useful if multi-threading is enabled (compiled with build macro ZSTD_MULTITHREAD).<b>
|
||||||
* They return an error otherwise. */
|
* They return an error otherwise. */
|
||||||
ZSTD_p_nbWorkers=400, </b>/* Select how many threads will be spawned to compress in parallel.<b>
|
ZSTD_c_nbWorkers=400, </b>/* Select how many threads will be spawned to compress in parallel.<b>
|
||||||
* When nbWorkers >= 1, triggers asynchronous mode when used with ZSTD_compressStream*() :
|
* When nbWorkers >= 1, triggers asynchronous mode when used with ZSTD_compressStream*() :
|
||||||
* ZSTD_compressStream*() consumes input and flush output if possible, but immediately gives back control to caller,
|
* ZSTD_compressStream*() consumes input and flush output if possible, but immediately gives back control to caller,
|
||||||
* while compression work is performed in parallel, within worker threads.
|
* while compression work is performed in parallel, within worker threads.
|
||||||
@@ -503,12 +503,12 @@ size_t ZSTD_sizeof_DDict(const ZSTD_DDict* ddict);
|
|||||||
* in which case, ZSTD_compressStream2() delegates to ZSTD_compress2(), which is always a blocking call).
|
* in which case, ZSTD_compressStream2() delegates to ZSTD_compress2(), which is always a blocking call).
|
||||||
* More workers improve speed, but also increase memory usage.
|
* More workers improve speed, but also increase memory usage.
|
||||||
* Default value is `0`, aka "single-threaded mode" : no worker is spawned, compression is performed inside Caller's thread, all invocations are blocking */
|
* Default value is `0`, aka "single-threaded mode" : no worker is spawned, compression is performed inside Caller's thread, all invocations are blocking */
|
||||||
ZSTD_p_jobSize=401, </b>/* Size of a compression job. This value is enforced only when nbWorkers >= 1.<b>
|
ZSTD_c_jobSize=401, </b>/* Size of a compression job. This value is enforced only when nbWorkers >= 1.<b>
|
||||||
* Each compression job is completed in parallel, so this value can indirectly impact the nb of active threads.
|
* Each compression job is completed in parallel, so this value can indirectly impact the nb of active threads.
|
||||||
* 0 means default, which is dynamically determined based on compression parameters.
|
* 0 means default, which is dynamically determined based on compression parameters.
|
||||||
* Job size must be a minimum of overlapSize, or 1 MB, whichever is largest.
|
* Job size must be a minimum of overlapSize, or 1 MB, whichever is largest.
|
||||||
* The minimum size is automatically and transparently enforced */
|
* The minimum size is automatically and transparently enforced */
|
||||||
ZSTD_p_overlapSizeLog=402, </b>/* Size of previous job reloaded at the beginning of each job, as a fraction of window size.<b>
|
ZSTD_c_overlapSizeLog=402, </b>/* Size of previous job reloaded at the beginning of each job, as a fraction of window size.<b>
|
||||||
* This value is enforced only when nbWorkers >= 1.
|
* This value is enforced only when nbWorkers >= 1.
|
||||||
* Larger values increase compression ratio, but decrease speed.
|
* Larger values increase compression ratio, but decrease speed.
|
||||||
* Values range from 0 (no overlap) to 9 (overlap a full windowSize).
|
* Values range from 0 (no overlap) to 9 (overlap a full windowSize).
|
||||||
@@ -519,17 +519,17 @@ size_t ZSTD_sizeof_DDict(const ZSTD_DDict* ddict);
|
|||||||
</b>/* note : additional experimental parameters are also available<b>
|
</b>/* note : additional experimental parameters are also available<b>
|
||||||
* within the experimental section of the API.
|
* within the experimental section of the API.
|
||||||
* At the time of this writing, they include :
|
* At the time of this writing, they include :
|
||||||
* ZSTD_p_rsyncable
|
* ZSTD_c_rsyncable
|
||||||
* ZSTD_p_format
|
* ZSTD_c_format
|
||||||
* ZSTD_p_forceMaxWindow
|
* ZSTD_c_forceMaxWindow
|
||||||
* ZSTD_p_forceAttachDict
|
* ZSTD_c_forceAttachDict
|
||||||
* Because they are not stable, it's necessary to define ZSTD_STATIC_LINKING_ONLY to access them.
|
* Because they are not stable, it's necessary to define ZSTD_STATIC_LINKING_ONLY to access them.
|
||||||
* note : never ever use experimentalParam? names directly
|
* note : never ever use experimentalParam? names directly
|
||||||
*/
|
*/
|
||||||
ZSTD_p_experimentalParam1=500,
|
ZSTD_c_experimentalParam1=500,
|
||||||
ZSTD_p_experimentalParam2=10,
|
ZSTD_c_experimentalParam2=10,
|
||||||
ZSTD_p_experimentalParam3=1000,
|
ZSTD_c_experimentalParam3=1000,
|
||||||
ZSTD_p_experimentalParam4
|
ZSTD_c_experimentalParam4
|
||||||
} ZSTD_cParameter;
|
} ZSTD_cParameter;
|
||||||
</b></pre><BR>
|
</b></pre><BR>
|
||||||
<pre><b>typedef struct {
|
<pre><b>typedef struct {
|
||||||
@@ -618,7 +618,7 @@ size_t ZSTD_sizeof_DDict(const ZSTD_DDict* ddict);
|
|||||||
Its content must remain unmodified during compression.
|
Its content must remain unmodified during compression.
|
||||||
Note 2 : If the intention is to diff some large src data blob with some prior version of itself,
|
Note 2 : If the intention is to diff some large src data blob with some prior version of itself,
|
||||||
ensure that the window size is large enough to contain the entire source.
|
ensure that the window size is large enough to contain the entire source.
|
||||||
See ZSTD_p_windowLog.
|
See ZSTD_c_windowLog.
|
||||||
Note 3 : Referencing a prefix involves building tables, which are dependent on compression parameters.
|
Note 3 : Referencing a prefix involves building tables, which are dependent on compression parameters.
|
||||||
It's a CPU consuming operation, with non-negligible impact on latency.
|
It's a CPU consuming operation, with non-negligible impact on latency.
|
||||||
If there is a need to use the same prefix multiple times, consider loadDictionary instead.
|
If there is a need to use the same prefix multiple times, consider loadDictionary instead.
|
||||||
@@ -708,7 +708,7 @@ size_t ZSTD_sizeof_DDict(const ZSTD_DDict* ddict);
|
|||||||
</b>/* note : additional experimental parameters are also available<b>
|
</b>/* note : additional experimental parameters are also available<b>
|
||||||
* within the experimental section of the API.
|
* within the experimental section of the API.
|
||||||
* At the time of this writing, they include :
|
* At the time of this writing, they include :
|
||||||
* ZSTD_p_format
|
* ZSTD_c_format
|
||||||
* Because they are not stable, it's necessary to define ZSTD_STATIC_LINKING_ONLY to access them.
|
* Because they are not stable, it's necessary to define ZSTD_STATIC_LINKING_ONLY to access them.
|
||||||
* note : never ever use experimentalParam? names directly
|
* note : never ever use experimentalParam? names directly
|
||||||
*/
|
*/
|
||||||
@@ -921,7 +921,7 @@ size_t ZSTD_estimateDCtxSize(void);
|
|||||||
It will also consider src size to be arbitrarily "large", which is worst case.
|
It will also consider src size to be arbitrarily "large", which is worst case.
|
||||||
If srcSize is known to always be small, ZSTD_estimateCCtxSize_usingCParams() can provide a tighter estimation.
|
If srcSize is known to always be small, ZSTD_estimateCCtxSize_usingCParams() can provide a tighter estimation.
|
||||||
ZSTD_estimateCCtxSize_usingCParams() can be used in tandem with ZSTD_getCParams() to create cParams from compressionLevel.
|
ZSTD_estimateCCtxSize_usingCParams() can be used in tandem with ZSTD_getCParams() to create cParams from compressionLevel.
|
||||||
ZSTD_estimateCCtxSize_usingCCtxParams() can be used in tandem with ZSTD_CCtxParam_setParameter(). Only single-threaded compression is supported. This function will return an error code if ZSTD_p_nbWorkers is >= 1.
|
ZSTD_estimateCCtxSize_usingCCtxParams() can be used in tandem with ZSTD_CCtxParam_setParameter(). Only single-threaded compression is supported. This function will return an error code if ZSTD_c_nbWorkers is >= 1.
|
||||||
Note : CCtx size estimation is only correct for single-threaded compression.
|
Note : CCtx size estimation is only correct for single-threaded compression.
|
||||||
</p></pre><BR>
|
</p></pre><BR>
|
||||||
|
|
||||||
@@ -934,7 +934,7 @@ size_t ZSTD_estimateDStreamSize_fromFrame(const void* src, size_t srcSize);
|
|||||||
It will also consider src size to be arbitrarily "large", which is worst case.
|
It will also consider src size to be arbitrarily "large", which is worst case.
|
||||||
If srcSize is known to always be small, ZSTD_estimateCStreamSize_usingCParams() can provide a tighter estimation.
|
If srcSize is known to always be small, ZSTD_estimateCStreamSize_usingCParams() can provide a tighter estimation.
|
||||||
ZSTD_estimateCStreamSize_usingCParams() can be used in tandem with ZSTD_getCParams() to create cParams from compressionLevel.
|
ZSTD_estimateCStreamSize_usingCParams() can be used in tandem with ZSTD_getCParams() to create cParams from compressionLevel.
|
||||||
ZSTD_estimateCStreamSize_usingCCtxParams() can be used in tandem with ZSTD_CCtxParam_setParameter(). Only single-threaded compression is supported. This function will return an error code if ZSTD_p_nbWorkers is >= 1.
|
ZSTD_estimateCStreamSize_usingCCtxParams() can be used in tandem with ZSTD_CCtxParam_setParameter(). Only single-threaded compression is supported. This function will return an error code if ZSTD_c_nbWorkers is >= 1.
|
||||||
Note : CStream size estimation is only correct for single-threaded compression.
|
Note : CStream size estimation is only correct for single-threaded compression.
|
||||||
ZSTD_DStream memory budget depends on window Size.
|
ZSTD_DStream memory budget depends on window Size.
|
||||||
This information can be passed manually, using ZSTD_estimateDStreamSize,
|
This information can be passed manually, using ZSTD_estimateDStreamSize,
|
||||||
|
|||||||
+115
-115
@@ -232,62 +232,62 @@ ZSTD_bounds ZSTD_cParam_getBounds(ZSTD_cParameter param)
|
|||||||
|
|
||||||
switch(param)
|
switch(param)
|
||||||
{
|
{
|
||||||
case ZSTD_p_compressionLevel:
|
case ZSTD_c_compressionLevel:
|
||||||
bounds.lowerBound = ZSTD_minCLevel();
|
bounds.lowerBound = ZSTD_minCLevel();
|
||||||
bounds.upperBound = ZSTD_maxCLevel();
|
bounds.upperBound = ZSTD_maxCLevel();
|
||||||
return bounds;
|
return bounds;
|
||||||
|
|
||||||
case ZSTD_p_windowLog:
|
case ZSTD_c_windowLog:
|
||||||
bounds.lowerBound = ZSTD_WINDOWLOG_MIN;
|
bounds.lowerBound = ZSTD_WINDOWLOG_MIN;
|
||||||
bounds.upperBound = ZSTD_WINDOWLOG_MAX;
|
bounds.upperBound = ZSTD_WINDOWLOG_MAX;
|
||||||
return bounds;
|
return bounds;
|
||||||
|
|
||||||
case ZSTD_p_hashLog:
|
case ZSTD_c_hashLog:
|
||||||
bounds.lowerBound = ZSTD_HASHLOG_MIN;
|
bounds.lowerBound = ZSTD_HASHLOG_MIN;
|
||||||
bounds.upperBound = ZSTD_HASHLOG_MAX;
|
bounds.upperBound = ZSTD_HASHLOG_MAX;
|
||||||
return bounds;
|
return bounds;
|
||||||
|
|
||||||
case ZSTD_p_chainLog:
|
case ZSTD_c_chainLog:
|
||||||
bounds.lowerBound = ZSTD_CHAINLOG_MIN;
|
bounds.lowerBound = ZSTD_CHAINLOG_MIN;
|
||||||
bounds.upperBound = ZSTD_CHAINLOG_MAX;
|
bounds.upperBound = ZSTD_CHAINLOG_MAX;
|
||||||
return bounds;
|
return bounds;
|
||||||
|
|
||||||
case ZSTD_p_searchLog:
|
case ZSTD_c_searchLog:
|
||||||
bounds.lowerBound = ZSTD_SEARCHLOG_MIN;
|
bounds.lowerBound = ZSTD_SEARCHLOG_MIN;
|
||||||
bounds.upperBound = ZSTD_SEARCHLOG_MAX;
|
bounds.upperBound = ZSTD_SEARCHLOG_MAX;
|
||||||
return bounds;
|
return bounds;
|
||||||
|
|
||||||
case ZSTD_p_minMatch:
|
case ZSTD_c_minMatch:
|
||||||
bounds.lowerBound = ZSTD_MINMATCH_MIN;
|
bounds.lowerBound = ZSTD_MINMATCH_MIN;
|
||||||
bounds.upperBound = ZSTD_MINMATCH_MAX;
|
bounds.upperBound = ZSTD_MINMATCH_MAX;
|
||||||
return bounds;
|
return bounds;
|
||||||
|
|
||||||
case ZSTD_p_targetLength:
|
case ZSTD_c_targetLength:
|
||||||
bounds.lowerBound = ZSTD_TARGETLENGTH_MIN;
|
bounds.lowerBound = ZSTD_TARGETLENGTH_MIN;
|
||||||
bounds.upperBound = ZSTD_TARGETLENGTH_MAX;
|
bounds.upperBound = ZSTD_TARGETLENGTH_MAX;
|
||||||
return bounds;
|
return bounds;
|
||||||
|
|
||||||
case ZSTD_p_compressionStrategy:
|
case ZSTD_c_compressionStrategy:
|
||||||
bounds.lowerBound = (int)ZSTD_fast;
|
bounds.lowerBound = (int)ZSTD_fast;
|
||||||
bounds.upperBound = (int)ZSTD_btultra; /* note : how to ensure at compile time that this is the highest value strategy ? */
|
bounds.upperBound = (int)ZSTD_btultra; /* note : how to ensure at compile time that this is the highest value strategy ? */
|
||||||
return bounds;
|
return bounds;
|
||||||
|
|
||||||
case ZSTD_p_contentSizeFlag:
|
case ZSTD_c_contentSizeFlag:
|
||||||
bounds.lowerBound = 0;
|
bounds.lowerBound = 0;
|
||||||
bounds.upperBound = 1;
|
bounds.upperBound = 1;
|
||||||
return bounds;
|
return bounds;
|
||||||
|
|
||||||
case ZSTD_p_checksumFlag:
|
case ZSTD_c_checksumFlag:
|
||||||
bounds.lowerBound = 0;
|
bounds.lowerBound = 0;
|
||||||
bounds.upperBound = 1;
|
bounds.upperBound = 1;
|
||||||
return bounds;
|
return bounds;
|
||||||
|
|
||||||
case ZSTD_p_dictIDFlag:
|
case ZSTD_c_dictIDFlag:
|
||||||
bounds.lowerBound = 0;
|
bounds.lowerBound = 0;
|
||||||
bounds.upperBound = 1;
|
bounds.upperBound = 1;
|
||||||
return bounds;
|
return bounds;
|
||||||
|
|
||||||
case ZSTD_p_nbWorkers:
|
case ZSTD_c_nbWorkers:
|
||||||
bounds.lowerBound = 0;
|
bounds.lowerBound = 0;
|
||||||
#ifdef ZSTD_MULTITHREAD
|
#ifdef ZSTD_MULTITHREAD
|
||||||
bounds.upperBound = ZSTDMT_NBWORKERS_MAX;
|
bounds.upperBound = ZSTDMT_NBWORKERS_MAX;
|
||||||
@@ -296,7 +296,7 @@ ZSTD_bounds ZSTD_cParam_getBounds(ZSTD_cParameter param)
|
|||||||
#endif
|
#endif
|
||||||
return bounds;
|
return bounds;
|
||||||
|
|
||||||
case ZSTD_p_jobSize:
|
case ZSTD_c_jobSize:
|
||||||
bounds.lowerBound = 0;
|
bounds.lowerBound = 0;
|
||||||
#ifdef ZSTD_MULTITHREAD
|
#ifdef ZSTD_MULTITHREAD
|
||||||
bounds.upperBound = ZSTDMT_JOBSIZE_MAX;
|
bounds.upperBound = ZSTDMT_JOBSIZE_MAX;
|
||||||
@@ -305,54 +305,54 @@ ZSTD_bounds ZSTD_cParam_getBounds(ZSTD_cParameter param)
|
|||||||
#endif
|
#endif
|
||||||
return bounds;
|
return bounds;
|
||||||
|
|
||||||
case ZSTD_p_overlapSizeLog:
|
case ZSTD_c_overlapSizeLog:
|
||||||
bounds.lowerBound = ZSTD_OVERLAPLOG_MIN;
|
bounds.lowerBound = ZSTD_OVERLAPLOG_MIN;
|
||||||
bounds.upperBound = ZSTD_OVERLAPLOG_MAX;
|
bounds.upperBound = ZSTD_OVERLAPLOG_MAX;
|
||||||
return bounds;
|
return bounds;
|
||||||
|
|
||||||
case ZSTD_p_enableLongDistanceMatching:
|
case ZSTD_c_enableLongDistanceMatching:
|
||||||
bounds.lowerBound = 0;
|
bounds.lowerBound = 0;
|
||||||
bounds.upperBound = 1;
|
bounds.upperBound = 1;
|
||||||
return bounds;
|
return bounds;
|
||||||
|
|
||||||
case ZSTD_p_ldmHashLog:
|
case ZSTD_c_ldmHashLog:
|
||||||
bounds.lowerBound = ZSTD_LDM_HASHLOG_MIN;
|
bounds.lowerBound = ZSTD_LDM_HASHLOG_MIN;
|
||||||
bounds.upperBound = ZSTD_LDM_HASHLOG_MAX;
|
bounds.upperBound = ZSTD_LDM_HASHLOG_MAX;
|
||||||
return bounds;
|
return bounds;
|
||||||
|
|
||||||
case ZSTD_p_ldmMinMatch:
|
case ZSTD_c_ldmMinMatch:
|
||||||
bounds.lowerBound = ZSTD_LDM_MINMATCH_MIN;
|
bounds.lowerBound = ZSTD_LDM_MINMATCH_MIN;
|
||||||
bounds.upperBound = ZSTD_LDM_MINMATCH_MAX;
|
bounds.upperBound = ZSTD_LDM_MINMATCH_MAX;
|
||||||
return bounds;
|
return bounds;
|
||||||
|
|
||||||
case ZSTD_p_ldmBucketSizeLog:
|
case ZSTD_c_ldmBucketSizeLog:
|
||||||
bounds.lowerBound = ZSTD_LDM_BUCKETSIZELOG_MIN;
|
bounds.lowerBound = ZSTD_LDM_BUCKETSIZELOG_MIN;
|
||||||
bounds.upperBound = ZSTD_LDM_BUCKETSIZELOG_MAX;
|
bounds.upperBound = ZSTD_LDM_BUCKETSIZELOG_MAX;
|
||||||
return bounds;
|
return bounds;
|
||||||
|
|
||||||
case ZSTD_p_ldmHashRateLog:
|
case ZSTD_c_ldmHashRateLog:
|
||||||
bounds.lowerBound = ZSTD_LDM_HASHRATELOG_MIN;
|
bounds.lowerBound = ZSTD_LDM_HASHRATELOG_MIN;
|
||||||
bounds.upperBound = ZSTD_LDM_HASHRATELOG_MAX;
|
bounds.upperBound = ZSTD_LDM_HASHRATELOG_MAX;
|
||||||
return bounds;
|
return bounds;
|
||||||
|
|
||||||
/* experimental parameters */
|
/* experimental parameters */
|
||||||
case ZSTD_p_rsyncable:
|
case ZSTD_c_rsyncable:
|
||||||
bounds.lowerBound = 0;
|
bounds.lowerBound = 0;
|
||||||
bounds.upperBound = 1;
|
bounds.upperBound = 1;
|
||||||
return bounds;
|
return bounds;
|
||||||
|
|
||||||
case ZSTD_p_forceMaxWindow :
|
case ZSTD_c_forceMaxWindow :
|
||||||
bounds.lowerBound = 0;
|
bounds.lowerBound = 0;
|
||||||
bounds.upperBound = 1;
|
bounds.upperBound = 1;
|
||||||
return bounds;
|
return bounds;
|
||||||
|
|
||||||
case ZSTD_p_format:
|
case ZSTD_c_format:
|
||||||
ZSTD_STATIC_ASSERT((int)ZSTD_f_zstd1 < (int)ZSTD_f_zstd1_magicless);
|
ZSTD_STATIC_ASSERT((int)ZSTD_f_zstd1 < (int)ZSTD_f_zstd1_magicless);
|
||||||
bounds.lowerBound = (int)ZSTD_f_zstd1;
|
bounds.lowerBound = (int)ZSTD_f_zstd1;
|
||||||
bounds.upperBound = (int)ZSTD_f_zstd1_magicless;
|
bounds.upperBound = (int)ZSTD_f_zstd1_magicless;
|
||||||
return bounds;
|
return bounds;
|
||||||
|
|
||||||
case ZSTD_p_forceAttachDict:
|
case ZSTD_c_forceAttachDict:
|
||||||
bounds.lowerBound = 0;
|
bounds.lowerBound = 0;
|
||||||
bounds.upperBound = 1;
|
bounds.upperBound = 1;
|
||||||
return bounds;
|
return bounds;
|
||||||
@@ -374,31 +374,31 @@ static int ZSTD_isUpdateAuthorized(ZSTD_cParameter param)
|
|||||||
{
|
{
|
||||||
switch(param)
|
switch(param)
|
||||||
{
|
{
|
||||||
case ZSTD_p_compressionLevel:
|
case ZSTD_c_compressionLevel:
|
||||||
case ZSTD_p_hashLog:
|
case ZSTD_c_hashLog:
|
||||||
case ZSTD_p_chainLog:
|
case ZSTD_c_chainLog:
|
||||||
case ZSTD_p_searchLog:
|
case ZSTD_c_searchLog:
|
||||||
case ZSTD_p_minMatch:
|
case ZSTD_c_minMatch:
|
||||||
case ZSTD_p_targetLength:
|
case ZSTD_c_targetLength:
|
||||||
case ZSTD_p_compressionStrategy:
|
case ZSTD_c_compressionStrategy:
|
||||||
return 1;
|
return 1;
|
||||||
|
|
||||||
case ZSTD_p_format:
|
case ZSTD_c_format:
|
||||||
case ZSTD_p_windowLog:
|
case ZSTD_c_windowLog:
|
||||||
case ZSTD_p_contentSizeFlag:
|
case ZSTD_c_contentSizeFlag:
|
||||||
case ZSTD_p_checksumFlag:
|
case ZSTD_c_checksumFlag:
|
||||||
case ZSTD_p_dictIDFlag:
|
case ZSTD_c_dictIDFlag:
|
||||||
case ZSTD_p_forceMaxWindow :
|
case ZSTD_c_forceMaxWindow :
|
||||||
case ZSTD_p_nbWorkers:
|
case ZSTD_c_nbWorkers:
|
||||||
case ZSTD_p_jobSize:
|
case ZSTD_c_jobSize:
|
||||||
case ZSTD_p_overlapSizeLog:
|
case ZSTD_c_overlapSizeLog:
|
||||||
case ZSTD_p_rsyncable:
|
case ZSTD_c_rsyncable:
|
||||||
case ZSTD_p_enableLongDistanceMatching:
|
case ZSTD_c_enableLongDistanceMatching:
|
||||||
case ZSTD_p_ldmHashLog:
|
case ZSTD_c_ldmHashLog:
|
||||||
case ZSTD_p_ldmMinMatch:
|
case ZSTD_c_ldmMinMatch:
|
||||||
case ZSTD_p_ldmBucketSizeLog:
|
case ZSTD_c_ldmBucketSizeLog:
|
||||||
case ZSTD_p_ldmHashRateLog:
|
case ZSTD_c_ldmHashRateLog:
|
||||||
case ZSTD_p_forceAttachDict:
|
case ZSTD_c_forceAttachDict:
|
||||||
default:
|
default:
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
@@ -416,52 +416,52 @@ size_t ZSTD_CCtx_setParameter(ZSTD_CCtx* cctx, ZSTD_cParameter param, int value)
|
|||||||
|
|
||||||
switch(param)
|
switch(param)
|
||||||
{
|
{
|
||||||
case ZSTD_p_format :
|
case ZSTD_c_format :
|
||||||
return ZSTD_CCtxParam_setParameter(&cctx->requestedParams, param, value);
|
return ZSTD_CCtxParam_setParameter(&cctx->requestedParams, param, value);
|
||||||
|
|
||||||
case ZSTD_p_compressionLevel:
|
case ZSTD_c_compressionLevel:
|
||||||
if (cctx->cdict) return ERROR(stage_wrong);
|
if (cctx->cdict) return ERROR(stage_wrong);
|
||||||
return ZSTD_CCtxParam_setParameter(&cctx->requestedParams, param, value);
|
return ZSTD_CCtxParam_setParameter(&cctx->requestedParams, param, value);
|
||||||
|
|
||||||
case ZSTD_p_windowLog:
|
case ZSTD_c_windowLog:
|
||||||
case ZSTD_p_hashLog:
|
case ZSTD_c_hashLog:
|
||||||
case ZSTD_p_chainLog:
|
case ZSTD_c_chainLog:
|
||||||
case ZSTD_p_searchLog:
|
case ZSTD_c_searchLog:
|
||||||
case ZSTD_p_minMatch:
|
case ZSTD_c_minMatch:
|
||||||
case ZSTD_p_targetLength:
|
case ZSTD_c_targetLength:
|
||||||
case ZSTD_p_compressionStrategy:
|
case ZSTD_c_compressionStrategy:
|
||||||
if (cctx->cdict) return ERROR(stage_wrong);
|
if (cctx->cdict) return ERROR(stage_wrong);
|
||||||
return ZSTD_CCtxParam_setParameter(&cctx->requestedParams, param, value);
|
return ZSTD_CCtxParam_setParameter(&cctx->requestedParams, param, value);
|
||||||
|
|
||||||
case ZSTD_p_contentSizeFlag:
|
case ZSTD_c_contentSizeFlag:
|
||||||
case ZSTD_p_checksumFlag:
|
case ZSTD_c_checksumFlag:
|
||||||
case ZSTD_p_dictIDFlag:
|
case ZSTD_c_dictIDFlag:
|
||||||
return ZSTD_CCtxParam_setParameter(&cctx->requestedParams, param, value);
|
return ZSTD_CCtxParam_setParameter(&cctx->requestedParams, param, value);
|
||||||
|
|
||||||
case ZSTD_p_forceMaxWindow : /* Force back-references to remain < windowSize,
|
case ZSTD_c_forceMaxWindow : /* Force back-references to remain < windowSize,
|
||||||
* even when referencing into Dictionary content.
|
* even when referencing into Dictionary content.
|
||||||
* default : 0 when using a CDict, 1 when using a Prefix */
|
* default : 0 when using a CDict, 1 when using a Prefix */
|
||||||
return ZSTD_CCtxParam_setParameter(&cctx->requestedParams, param, value);
|
return ZSTD_CCtxParam_setParameter(&cctx->requestedParams, param, value);
|
||||||
|
|
||||||
case ZSTD_p_forceAttachDict:
|
case ZSTD_c_forceAttachDict:
|
||||||
return ZSTD_CCtxParam_setParameter(&cctx->requestedParams, param, value);
|
return ZSTD_CCtxParam_setParameter(&cctx->requestedParams, param, value);
|
||||||
|
|
||||||
case ZSTD_p_nbWorkers:
|
case ZSTD_c_nbWorkers:
|
||||||
if ((value!=0) && cctx->staticSize) {
|
if ((value!=0) && cctx->staticSize) {
|
||||||
return ERROR(parameter_unsupported); /* MT not compatible with static alloc */
|
return ERROR(parameter_unsupported); /* MT not compatible with static alloc */
|
||||||
}
|
}
|
||||||
return ZSTD_CCtxParam_setParameter(&cctx->requestedParams, param, value);
|
return ZSTD_CCtxParam_setParameter(&cctx->requestedParams, param, value);
|
||||||
|
|
||||||
case ZSTD_p_jobSize:
|
case ZSTD_c_jobSize:
|
||||||
case ZSTD_p_overlapSizeLog:
|
case ZSTD_c_overlapSizeLog:
|
||||||
case ZSTD_p_rsyncable:
|
case ZSTD_c_rsyncable:
|
||||||
return ZSTD_CCtxParam_setParameter(&cctx->requestedParams, param, value);
|
return ZSTD_CCtxParam_setParameter(&cctx->requestedParams, param, value);
|
||||||
|
|
||||||
case ZSTD_p_enableLongDistanceMatching:
|
case ZSTD_c_enableLongDistanceMatching:
|
||||||
case ZSTD_p_ldmHashLog:
|
case ZSTD_c_ldmHashLog:
|
||||||
case ZSTD_p_ldmMinMatch:
|
case ZSTD_c_ldmMinMatch:
|
||||||
case ZSTD_p_ldmBucketSizeLog:
|
case ZSTD_c_ldmBucketSizeLog:
|
||||||
case ZSTD_p_ldmHashRateLog:
|
case ZSTD_c_ldmHashRateLog:
|
||||||
if (cctx->cdict) return ERROR(stage_wrong);
|
if (cctx->cdict) return ERROR(stage_wrong);
|
||||||
return ZSTD_CCtxParam_setParameter(&cctx->requestedParams, param, value);
|
return ZSTD_CCtxParam_setParameter(&cctx->requestedParams, param, value);
|
||||||
|
|
||||||
@@ -475,13 +475,13 @@ size_t ZSTD_CCtxParam_setParameter(ZSTD_CCtx_params* CCtxParams,
|
|||||||
DEBUGLOG(4, "ZSTD_CCtxParam_setParameter (%i, %i)", (int)param, value);
|
DEBUGLOG(4, "ZSTD_CCtxParam_setParameter (%i, %i)", (int)param, value);
|
||||||
switch(param)
|
switch(param)
|
||||||
{
|
{
|
||||||
case ZSTD_p_format :
|
case ZSTD_c_format :
|
||||||
if (value > (int)ZSTD_f_zstd1_magicless)
|
if (value > (int)ZSTD_f_zstd1_magicless)
|
||||||
return ERROR(parameter_unsupported);
|
return ERROR(parameter_unsupported);
|
||||||
CCtxParams->format = (ZSTD_format_e)value;
|
CCtxParams->format = (ZSTD_format_e)value;
|
||||||
return (size_t)CCtxParams->format;
|
return (size_t)CCtxParams->format;
|
||||||
|
|
||||||
case ZSTD_p_compressionLevel : {
|
case ZSTD_c_compressionLevel : {
|
||||||
int cLevel = value;
|
int cLevel = value;
|
||||||
if (cLevel > ZSTD_maxCLevel()) cLevel = ZSTD_maxCLevel();
|
if (cLevel > ZSTD_maxCLevel()) cLevel = ZSTD_maxCLevel();
|
||||||
if (cLevel) { /* 0 : does not change current level */
|
if (cLevel) { /* 0 : does not change current level */
|
||||||
@@ -491,75 +491,75 @@ size_t ZSTD_CCtxParam_setParameter(ZSTD_CCtx_params* CCtxParams,
|
|||||||
return 0; /* return type (size_t) cannot represent negative values */
|
return 0; /* return type (size_t) cannot represent negative values */
|
||||||
}
|
}
|
||||||
|
|
||||||
case ZSTD_p_windowLog :
|
case ZSTD_c_windowLog :
|
||||||
if (value!=0) /* 0 => use default */
|
if (value!=0) /* 0 => use default */
|
||||||
CLAMPCHECK(value, ZSTD_WINDOWLOG_MIN, ZSTD_WINDOWLOG_MAX);
|
CLAMPCHECK(value, ZSTD_WINDOWLOG_MIN, ZSTD_WINDOWLOG_MAX);
|
||||||
CCtxParams->cParams.windowLog = value;
|
CCtxParams->cParams.windowLog = value;
|
||||||
return CCtxParams->cParams.windowLog;
|
return CCtxParams->cParams.windowLog;
|
||||||
|
|
||||||
case ZSTD_p_hashLog :
|
case ZSTD_c_hashLog :
|
||||||
if (value!=0) /* 0 => use default */
|
if (value!=0) /* 0 => use default */
|
||||||
CLAMPCHECK(value, ZSTD_HASHLOG_MIN, ZSTD_HASHLOG_MAX);
|
CLAMPCHECK(value, ZSTD_HASHLOG_MIN, ZSTD_HASHLOG_MAX);
|
||||||
CCtxParams->cParams.hashLog = value;
|
CCtxParams->cParams.hashLog = value;
|
||||||
return CCtxParams->cParams.hashLog;
|
return CCtxParams->cParams.hashLog;
|
||||||
|
|
||||||
case ZSTD_p_chainLog :
|
case ZSTD_c_chainLog :
|
||||||
if (value!=0) /* 0 => use default */
|
if (value!=0) /* 0 => use default */
|
||||||
CLAMPCHECK(value, ZSTD_CHAINLOG_MIN, ZSTD_CHAINLOG_MAX);
|
CLAMPCHECK(value, ZSTD_CHAINLOG_MIN, ZSTD_CHAINLOG_MAX);
|
||||||
CCtxParams->cParams.chainLog = value;
|
CCtxParams->cParams.chainLog = value;
|
||||||
return CCtxParams->cParams.chainLog;
|
return CCtxParams->cParams.chainLog;
|
||||||
|
|
||||||
case ZSTD_p_searchLog :
|
case ZSTD_c_searchLog :
|
||||||
if (value!=0) /* 0 => use default */
|
if (value!=0) /* 0 => use default */
|
||||||
CLAMPCHECK(value, ZSTD_SEARCHLOG_MIN, ZSTD_SEARCHLOG_MAX);
|
CLAMPCHECK(value, ZSTD_SEARCHLOG_MIN, ZSTD_SEARCHLOG_MAX);
|
||||||
CCtxParams->cParams.searchLog = value;
|
CCtxParams->cParams.searchLog = value;
|
||||||
return value;
|
return value;
|
||||||
|
|
||||||
case ZSTD_p_minMatch :
|
case ZSTD_c_minMatch :
|
||||||
if (value!=0) /* 0 => use default */
|
if (value!=0) /* 0 => use default */
|
||||||
CLAMPCHECK(value, ZSTD_MINMATCH_MIN, ZSTD_MINMATCH_MAX);
|
CLAMPCHECK(value, ZSTD_MINMATCH_MIN, ZSTD_MINMATCH_MAX);
|
||||||
CCtxParams->cParams.minMatch = value;
|
CCtxParams->cParams.minMatch = value;
|
||||||
return CCtxParams->cParams.minMatch;
|
return CCtxParams->cParams.minMatch;
|
||||||
|
|
||||||
case ZSTD_p_targetLength :
|
case ZSTD_c_targetLength :
|
||||||
/* all values are valid. 0 => use default */
|
/* all values are valid. 0 => use default */
|
||||||
CCtxParams->cParams.targetLength = value;
|
CCtxParams->cParams.targetLength = value;
|
||||||
return CCtxParams->cParams.targetLength;
|
return CCtxParams->cParams.targetLength;
|
||||||
|
|
||||||
case ZSTD_p_compressionStrategy :
|
case ZSTD_c_compressionStrategy :
|
||||||
if (value!=0) /* 0 => use default */
|
if (value!=0) /* 0 => use default */
|
||||||
CLAMPCHECK(value, (int)ZSTD_fast, (int)ZSTD_btultra);
|
CLAMPCHECK(value, (int)ZSTD_fast, (int)ZSTD_btultra);
|
||||||
CCtxParams->cParams.strategy = (ZSTD_strategy)value;
|
CCtxParams->cParams.strategy = (ZSTD_strategy)value;
|
||||||
return (size_t)CCtxParams->cParams.strategy;
|
return (size_t)CCtxParams->cParams.strategy;
|
||||||
|
|
||||||
case ZSTD_p_contentSizeFlag :
|
case ZSTD_c_contentSizeFlag :
|
||||||
/* Content size written in frame header _when known_ (default:1) */
|
/* Content size written in frame header _when known_ (default:1) */
|
||||||
DEBUGLOG(4, "set content size flag = %u", (value!=0));
|
DEBUGLOG(4, "set content size flag = %u", (value!=0));
|
||||||
CCtxParams->fParams.contentSizeFlag = value != 0;
|
CCtxParams->fParams.contentSizeFlag = value != 0;
|
||||||
return CCtxParams->fParams.contentSizeFlag;
|
return CCtxParams->fParams.contentSizeFlag;
|
||||||
|
|
||||||
case ZSTD_p_checksumFlag :
|
case ZSTD_c_checksumFlag :
|
||||||
/* A 32-bits content checksum will be calculated and written at end of frame (default:0) */
|
/* A 32-bits content checksum will be calculated and written at end of frame (default:0) */
|
||||||
CCtxParams->fParams.checksumFlag = value != 0;
|
CCtxParams->fParams.checksumFlag = value != 0;
|
||||||
return CCtxParams->fParams.checksumFlag;
|
return CCtxParams->fParams.checksumFlag;
|
||||||
|
|
||||||
case ZSTD_p_dictIDFlag : /* When applicable, dictionary's dictID is provided in frame header (default:1) */
|
case ZSTD_c_dictIDFlag : /* When applicable, dictionary's dictID is provided in frame header (default:1) */
|
||||||
DEBUGLOG(4, "set dictIDFlag = %u", (value!=0));
|
DEBUGLOG(4, "set dictIDFlag = %u", (value!=0));
|
||||||
CCtxParams->fParams.noDictIDFlag = !value;
|
CCtxParams->fParams.noDictIDFlag = !value;
|
||||||
return !CCtxParams->fParams.noDictIDFlag;
|
return !CCtxParams->fParams.noDictIDFlag;
|
||||||
|
|
||||||
case ZSTD_p_forceMaxWindow :
|
case ZSTD_c_forceMaxWindow :
|
||||||
CCtxParams->forceWindow = (value != 0);
|
CCtxParams->forceWindow = (value != 0);
|
||||||
return CCtxParams->forceWindow;
|
return CCtxParams->forceWindow;
|
||||||
|
|
||||||
case ZSTD_p_forceAttachDict : {
|
case ZSTD_c_forceAttachDict : {
|
||||||
const ZSTD_dictAttachPref_e pref = (ZSTD_dictAttachPref_e)value;
|
const ZSTD_dictAttachPref_e pref = (ZSTD_dictAttachPref_e)value;
|
||||||
CLAMPCHECK(pref, ZSTD_dictDefaultAttach, ZSTD_dictForceCopy);
|
CLAMPCHECK(pref, ZSTD_dictDefaultAttach, ZSTD_dictForceCopy);
|
||||||
CCtxParams->attachDictPref = pref;
|
CCtxParams->attachDictPref = pref;
|
||||||
return CCtxParams->attachDictPref;
|
return CCtxParams->attachDictPref;
|
||||||
}
|
}
|
||||||
|
|
||||||
case ZSTD_p_nbWorkers :
|
case ZSTD_c_nbWorkers :
|
||||||
#ifndef ZSTD_MULTITHREAD
|
#ifndef ZSTD_MULTITHREAD
|
||||||
if (value!=0) return ERROR(parameter_unsupported);
|
if (value!=0) return ERROR(parameter_unsupported);
|
||||||
return 0;
|
return 0;
|
||||||
@@ -567,50 +567,50 @@ size_t ZSTD_CCtxParam_setParameter(ZSTD_CCtx_params* CCtxParams,
|
|||||||
return ZSTDMT_CCtxParam_setNbWorkers(CCtxParams, value);
|
return ZSTDMT_CCtxParam_setNbWorkers(CCtxParams, value);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
case ZSTD_p_jobSize :
|
case ZSTD_c_jobSize :
|
||||||
#ifndef ZSTD_MULTITHREAD
|
#ifndef ZSTD_MULTITHREAD
|
||||||
return ERROR(parameter_unsupported);
|
return ERROR(parameter_unsupported);
|
||||||
#else
|
#else
|
||||||
return ZSTDMT_CCtxParam_setMTCtxParameter(CCtxParams, ZSTDMT_p_jobSize, value);
|
return ZSTDMT_CCtxParam_setMTCtxParameter(CCtxParams, ZSTDMT_p_jobSize, value);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
case ZSTD_p_overlapSizeLog :
|
case ZSTD_c_overlapSizeLog :
|
||||||
#ifndef ZSTD_MULTITHREAD
|
#ifndef ZSTD_MULTITHREAD
|
||||||
return ERROR(parameter_unsupported);
|
return ERROR(parameter_unsupported);
|
||||||
#else
|
#else
|
||||||
return ZSTDMT_CCtxParam_setMTCtxParameter(CCtxParams, ZSTDMT_p_overlapSectionLog, value);
|
return ZSTDMT_CCtxParam_setMTCtxParameter(CCtxParams, ZSTDMT_p_overlapSectionLog, value);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
case ZSTD_p_rsyncable :
|
case ZSTD_c_rsyncable :
|
||||||
#ifndef ZSTD_MULTITHREAD
|
#ifndef ZSTD_MULTITHREAD
|
||||||
return ERROR(parameter_unsupported);
|
return ERROR(parameter_unsupported);
|
||||||
#else
|
#else
|
||||||
return ZSTDMT_CCtxParam_setMTCtxParameter(CCtxParams, ZSTDMT_p_rsyncable, value);
|
return ZSTDMT_CCtxParam_setMTCtxParameter(CCtxParams, ZSTDMT_p_rsyncable, value);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
case ZSTD_p_enableLongDistanceMatching :
|
case ZSTD_c_enableLongDistanceMatching :
|
||||||
CCtxParams->ldmParams.enableLdm = (value!=0);
|
CCtxParams->ldmParams.enableLdm = (value!=0);
|
||||||
return CCtxParams->ldmParams.enableLdm;
|
return CCtxParams->ldmParams.enableLdm;
|
||||||
|
|
||||||
case ZSTD_p_ldmHashLog :
|
case ZSTD_c_ldmHashLog :
|
||||||
if (value!=0) /* 0 ==> auto */
|
if (value!=0) /* 0 ==> auto */
|
||||||
CLAMPCHECK(value, ZSTD_HASHLOG_MIN, ZSTD_HASHLOG_MAX);
|
CLAMPCHECK(value, ZSTD_HASHLOG_MIN, ZSTD_HASHLOG_MAX);
|
||||||
CCtxParams->ldmParams.hashLog = value;
|
CCtxParams->ldmParams.hashLog = value;
|
||||||
return CCtxParams->ldmParams.hashLog;
|
return CCtxParams->ldmParams.hashLog;
|
||||||
|
|
||||||
case ZSTD_p_ldmMinMatch :
|
case ZSTD_c_ldmMinMatch :
|
||||||
if (value!=0) /* 0 ==> default */
|
if (value!=0) /* 0 ==> default */
|
||||||
CLAMPCHECK(value, ZSTD_LDM_MINMATCH_MIN, ZSTD_LDM_MINMATCH_MAX);
|
CLAMPCHECK(value, ZSTD_LDM_MINMATCH_MIN, ZSTD_LDM_MINMATCH_MAX);
|
||||||
CCtxParams->ldmParams.minMatchLength = value;
|
CCtxParams->ldmParams.minMatchLength = value;
|
||||||
return CCtxParams->ldmParams.minMatchLength;
|
return CCtxParams->ldmParams.minMatchLength;
|
||||||
|
|
||||||
case ZSTD_p_ldmBucketSizeLog :
|
case ZSTD_c_ldmBucketSizeLog :
|
||||||
if (value!=0) /* 0 ==> default */
|
if (value!=0) /* 0 ==> default */
|
||||||
CLAMPCHECK(value, ZSTD_LDM_BUCKETSIZELOG_MIN, ZSTD_LDM_BUCKETSIZELOG_MAX);
|
CLAMPCHECK(value, ZSTD_LDM_BUCKETSIZELOG_MIN, ZSTD_LDM_BUCKETSIZELOG_MAX);
|
||||||
CCtxParams->ldmParams.bucketSizeLog = value;
|
CCtxParams->ldmParams.bucketSizeLog = value;
|
||||||
return CCtxParams->ldmParams.bucketSizeLog;
|
return CCtxParams->ldmParams.bucketSizeLog;
|
||||||
|
|
||||||
case ZSTD_p_ldmHashRateLog :
|
case ZSTD_c_ldmHashRateLog :
|
||||||
if (value > ZSTD_WINDOWLOG_MAX - ZSTD_HASHLOG_MIN)
|
if (value > ZSTD_WINDOWLOG_MAX - ZSTD_HASHLOG_MIN)
|
||||||
return ERROR(parameter_outOfBound);
|
return ERROR(parameter_outOfBound);
|
||||||
CCtxParams->ldmParams.hashRateLog = value;
|
CCtxParams->ldmParams.hashRateLog = value;
|
||||||
@@ -630,88 +630,88 @@ size_t ZSTD_CCtxParam_getParameter(
|
|||||||
{
|
{
|
||||||
switch(param)
|
switch(param)
|
||||||
{
|
{
|
||||||
case ZSTD_p_format :
|
case ZSTD_c_format :
|
||||||
*value = CCtxParams->format;
|
*value = CCtxParams->format;
|
||||||
break;
|
break;
|
||||||
case ZSTD_p_compressionLevel :
|
case ZSTD_c_compressionLevel :
|
||||||
*value = CCtxParams->compressionLevel;
|
*value = CCtxParams->compressionLevel;
|
||||||
break;
|
break;
|
||||||
case ZSTD_p_windowLog :
|
case ZSTD_c_windowLog :
|
||||||
*value = CCtxParams->cParams.windowLog;
|
*value = CCtxParams->cParams.windowLog;
|
||||||
break;
|
break;
|
||||||
case ZSTD_p_hashLog :
|
case ZSTD_c_hashLog :
|
||||||
*value = CCtxParams->cParams.hashLog;
|
*value = CCtxParams->cParams.hashLog;
|
||||||
break;
|
break;
|
||||||
case ZSTD_p_chainLog :
|
case ZSTD_c_chainLog :
|
||||||
*value = CCtxParams->cParams.chainLog;
|
*value = CCtxParams->cParams.chainLog;
|
||||||
break;
|
break;
|
||||||
case ZSTD_p_searchLog :
|
case ZSTD_c_searchLog :
|
||||||
*value = CCtxParams->cParams.searchLog;
|
*value = CCtxParams->cParams.searchLog;
|
||||||
break;
|
break;
|
||||||
case ZSTD_p_minMatch :
|
case ZSTD_c_minMatch :
|
||||||
*value = CCtxParams->cParams.minMatch;
|
*value = CCtxParams->cParams.minMatch;
|
||||||
break;
|
break;
|
||||||
case ZSTD_p_targetLength :
|
case ZSTD_c_targetLength :
|
||||||
*value = CCtxParams->cParams.targetLength;
|
*value = CCtxParams->cParams.targetLength;
|
||||||
break;
|
break;
|
||||||
case ZSTD_p_compressionStrategy :
|
case ZSTD_c_compressionStrategy :
|
||||||
*value = (unsigned)CCtxParams->cParams.strategy;
|
*value = (unsigned)CCtxParams->cParams.strategy;
|
||||||
break;
|
break;
|
||||||
case ZSTD_p_contentSizeFlag :
|
case ZSTD_c_contentSizeFlag :
|
||||||
*value = CCtxParams->fParams.contentSizeFlag;
|
*value = CCtxParams->fParams.contentSizeFlag;
|
||||||
break;
|
break;
|
||||||
case ZSTD_p_checksumFlag :
|
case ZSTD_c_checksumFlag :
|
||||||
*value = CCtxParams->fParams.checksumFlag;
|
*value = CCtxParams->fParams.checksumFlag;
|
||||||
break;
|
break;
|
||||||
case ZSTD_p_dictIDFlag :
|
case ZSTD_c_dictIDFlag :
|
||||||
*value = !CCtxParams->fParams.noDictIDFlag;
|
*value = !CCtxParams->fParams.noDictIDFlag;
|
||||||
break;
|
break;
|
||||||
case ZSTD_p_forceMaxWindow :
|
case ZSTD_c_forceMaxWindow :
|
||||||
*value = CCtxParams->forceWindow;
|
*value = CCtxParams->forceWindow;
|
||||||
break;
|
break;
|
||||||
case ZSTD_p_forceAttachDict :
|
case ZSTD_c_forceAttachDict :
|
||||||
*value = CCtxParams->attachDictPref;
|
*value = CCtxParams->attachDictPref;
|
||||||
break;
|
break;
|
||||||
case ZSTD_p_nbWorkers :
|
case ZSTD_c_nbWorkers :
|
||||||
#ifndef ZSTD_MULTITHREAD
|
#ifndef ZSTD_MULTITHREAD
|
||||||
assert(CCtxParams->nbWorkers == 0);
|
assert(CCtxParams->nbWorkers == 0);
|
||||||
#endif
|
#endif
|
||||||
*value = CCtxParams->nbWorkers;
|
*value = CCtxParams->nbWorkers;
|
||||||
break;
|
break;
|
||||||
case ZSTD_p_jobSize :
|
case ZSTD_c_jobSize :
|
||||||
#ifndef ZSTD_MULTITHREAD
|
#ifndef ZSTD_MULTITHREAD
|
||||||
return ERROR(parameter_unsupported);
|
return ERROR(parameter_unsupported);
|
||||||
#else
|
#else
|
||||||
*value = CCtxParams->jobSize;
|
*value = CCtxParams->jobSize;
|
||||||
break;
|
break;
|
||||||
#endif
|
#endif
|
||||||
case ZSTD_p_overlapSizeLog :
|
case ZSTD_c_overlapSizeLog :
|
||||||
#ifndef ZSTD_MULTITHREAD
|
#ifndef ZSTD_MULTITHREAD
|
||||||
return ERROR(parameter_unsupported);
|
return ERROR(parameter_unsupported);
|
||||||
#else
|
#else
|
||||||
*value = CCtxParams->overlapSizeLog;
|
*value = CCtxParams->overlapSizeLog;
|
||||||
break;
|
break;
|
||||||
#endif
|
#endif
|
||||||
case ZSTD_p_rsyncable :
|
case ZSTD_c_rsyncable :
|
||||||
#ifndef ZSTD_MULTITHREAD
|
#ifndef ZSTD_MULTITHREAD
|
||||||
return ERROR(parameter_unsupported);
|
return ERROR(parameter_unsupported);
|
||||||
#else
|
#else
|
||||||
*value = CCtxParams->rsyncable;
|
*value = CCtxParams->rsyncable;
|
||||||
break;
|
break;
|
||||||
#endif
|
#endif
|
||||||
case ZSTD_p_enableLongDistanceMatching :
|
case ZSTD_c_enableLongDistanceMatching :
|
||||||
*value = CCtxParams->ldmParams.enableLdm;
|
*value = CCtxParams->ldmParams.enableLdm;
|
||||||
break;
|
break;
|
||||||
case ZSTD_p_ldmHashLog :
|
case ZSTD_c_ldmHashLog :
|
||||||
*value = CCtxParams->ldmParams.hashLog;
|
*value = CCtxParams->ldmParams.hashLog;
|
||||||
break;
|
break;
|
||||||
case ZSTD_p_ldmMinMatch :
|
case ZSTD_c_ldmMinMatch :
|
||||||
*value = CCtxParams->ldmParams.minMatchLength;
|
*value = CCtxParams->ldmParams.minMatchLength;
|
||||||
break;
|
break;
|
||||||
case ZSTD_p_ldmBucketSizeLog :
|
case ZSTD_c_ldmBucketSizeLog :
|
||||||
*value = CCtxParams->ldmParams.bucketSizeLog;
|
*value = CCtxParams->ldmParams.bucketSizeLog;
|
||||||
break;
|
break;
|
||||||
case ZSTD_p_ldmHashRateLog :
|
case ZSTD_c_ldmHashRateLog :
|
||||||
*value = CCtxParams->ldmParams.hashRateLog;
|
*value = CCtxParams->ldmParams.hashRateLog;
|
||||||
break;
|
break;
|
||||||
default: return ERROR(parameter_unsupported);
|
default: return ERROR(parameter_unsupported);
|
||||||
|
|||||||
@@ -672,7 +672,7 @@ static void ZSTDMT_compressionJob(void* jobDescription)
|
|||||||
if (ZSTD_isError(initError)) JOB_ERROR(initError);
|
if (ZSTD_isError(initError)) JOB_ERROR(initError);
|
||||||
} else { /* srcStart points at reloaded section */
|
} else { /* srcStart points at reloaded section */
|
||||||
U64 const pledgedSrcSize = job->firstJob ? job->fullFrameSize : job->src.size;
|
U64 const pledgedSrcSize = job->firstJob ? job->fullFrameSize : job->src.size;
|
||||||
{ size_t const forceWindowError = ZSTD_CCtxParam_setParameter(&jobParams, ZSTD_p_forceMaxWindow, !job->firstJob);
|
{ size_t const forceWindowError = ZSTD_CCtxParam_setParameter(&jobParams, ZSTD_c_forceMaxWindow, !job->firstJob);
|
||||||
if (ZSTD_isError(forceWindowError)) JOB_ERROR(forceWindowError);
|
if (ZSTD_isError(forceWindowError)) JOB_ERROR(forceWindowError);
|
||||||
}
|
}
|
||||||
{ size_t const initError = ZSTD_compressBegin_advanced_internal(cctx,
|
{ size_t const initError = ZSTD_compressBegin_advanced_internal(cctx,
|
||||||
|
|||||||
+37
-37
@@ -510,23 +510,23 @@ typedef enum { ZSTD_fast=1,
|
|||||||
typedef enum {
|
typedef enum {
|
||||||
|
|
||||||
/* compression parameters */
|
/* compression parameters */
|
||||||
ZSTD_p_compressionLevel=100, /* Update all compression parameters according to pre-defined cLevel table
|
ZSTD_c_compressionLevel=100, /* Update all compression parameters according to pre-defined cLevel table
|
||||||
* Default level is ZSTD_CLEVEL_DEFAULT==3.
|
* Default level is ZSTD_CLEVEL_DEFAULT==3.
|
||||||
* Special: value 0 means default, which is controlled by ZSTD_CLEVEL_DEFAULT.
|
* Special: value 0 means default, which is controlled by ZSTD_CLEVEL_DEFAULT.
|
||||||
* Note 1 : it's possible to pass a negative compression level.
|
* Note 1 : it's possible to pass a negative compression level.
|
||||||
* Note 2 : setting a level sets all default values of other compression parameters */
|
* Note 2 : setting a level sets all default values of other compression parameters */
|
||||||
ZSTD_p_windowLog=101, /* Maximum allowed back-reference distance, expressed as power of 2.
|
ZSTD_c_windowLog=101, /* Maximum allowed back-reference distance, expressed as power of 2.
|
||||||
* Must be clamped between ZSTD_WINDOWLOG_MIN and ZSTD_WINDOWLOG_MAX.
|
* Must be clamped between ZSTD_WINDOWLOG_MIN and ZSTD_WINDOWLOG_MAX.
|
||||||
* Special: value 0 means "use default windowLog".
|
* Special: value 0 means "use default windowLog".
|
||||||
* Note: Using a window size greater than 1<<ZSTD_WINDOWLOG_LIMIT_DEFAULT
|
* Note: Using a window size greater than 1<<ZSTD_WINDOWLOG_LIMIT_DEFAULT
|
||||||
* requires explicitly allowing such window size during decompression stage if using streaming. */
|
* requires explicitly allowing such window size during decompression stage if using streaming. */
|
||||||
ZSTD_p_hashLog=102, /* Size of the initial probe table, as a power of 2.
|
ZSTD_c_hashLog=102, /* Size of the initial probe table, as a power of 2.
|
||||||
* Resulting memory usage is (1 << (hashLog+2)).
|
* Resulting memory usage is (1 << (hashLog+2)).
|
||||||
* Must be clamped between ZSTD_HASHLOG_MIN and ZSTD_HASHLOG_MAX.
|
* Must be clamped between ZSTD_HASHLOG_MIN and ZSTD_HASHLOG_MAX.
|
||||||
* Larger tables improve compression ratio of strategies <= dFast,
|
* Larger tables improve compression ratio of strategies <= dFast,
|
||||||
* and improve speed of strategies > dFast.
|
* and improve speed of strategies > dFast.
|
||||||
* Special: value 0 means "use default hashLog". */
|
* Special: value 0 means "use default hashLog". */
|
||||||
ZSTD_p_chainLog=103, /* Size of the multi-probe search table, as a power of 2.
|
ZSTD_c_chainLog=103, /* Size of the multi-probe search table, as a power of 2.
|
||||||
* Resulting memory usage is (1 << (chainLog+2)).
|
* Resulting memory usage is (1 << (chainLog+2)).
|
||||||
* Must be clamped between ZSTD_CHAINLOG_MIN and ZSTD_CHAINLOG_MAX.
|
* Must be clamped between ZSTD_CHAINLOG_MIN and ZSTD_CHAINLOG_MAX.
|
||||||
* Larger tables result in better and slower compression.
|
* Larger tables result in better and slower compression.
|
||||||
@@ -534,11 +534,11 @@ typedef enum {
|
|||||||
* It's still useful when using "dfast" strategy,
|
* It's still useful when using "dfast" strategy,
|
||||||
* in which case it defines a secondary probe table.
|
* in which case it defines a secondary probe table.
|
||||||
* Special: value 0 means "use default chainLog". */
|
* Special: value 0 means "use default chainLog". */
|
||||||
ZSTD_p_searchLog=104, /* Number of search attempts, as a power of 2.
|
ZSTD_c_searchLog=104, /* Number of search attempts, as a power of 2.
|
||||||
* More attempts result in better and slower compression.
|
* More attempts result in better and slower compression.
|
||||||
* This parameter is useless when using "fast" and "dFast" strategies.
|
* This parameter is useless when using "fast" and "dFast" strategies.
|
||||||
* Special: value 0 means "use default searchLog". */
|
* Special: value 0 means "use default searchLog". */
|
||||||
ZSTD_p_minMatch=105, /* Minimum size of searched matches.
|
ZSTD_c_minMatch=105, /* Minimum size of searched matches.
|
||||||
* Note that Zstandard can still find matches of smaller size,
|
* Note that Zstandard can still find matches of smaller size,
|
||||||
* it just tweaks its search algorithm to look for this size and larger.
|
* it just tweaks its search algorithm to look for this size and larger.
|
||||||
* Larger values increase compression and decompression speed, but decrease ratio.
|
* Larger values increase compression and decompression speed, but decrease ratio.
|
||||||
@@ -546,7 +546,7 @@ typedef enum {
|
|||||||
* Note that currently, for all strategies < btopt, effective minimum is 4.
|
* Note that currently, for all strategies < btopt, effective minimum is 4.
|
||||||
* , for all strategies > fast, effective maximum is 6.
|
* , for all strategies > fast, effective maximum is 6.
|
||||||
* Special: value 0 means "use default minMatchLength". */
|
* Special: value 0 means "use default minMatchLength". */
|
||||||
ZSTD_p_targetLength=106, /* Impact of this field depends on strategy.
|
ZSTD_c_targetLength=106, /* Impact of this field depends on strategy.
|
||||||
* For strategies btopt & btultra:
|
* For strategies btopt & btultra:
|
||||||
* Length of Match considered "good enough" to stop search.
|
* Length of Match considered "good enough" to stop search.
|
||||||
* Larger values make compression stronger, and slower.
|
* Larger values make compression stronger, and slower.
|
||||||
@@ -554,33 +554,33 @@ typedef enum {
|
|||||||
* Distance between match sampling.
|
* Distance between match sampling.
|
||||||
* Larger values make compression faster, and weaker.
|
* Larger values make compression faster, and weaker.
|
||||||
* Special: value 0 means "use default targetLength". */
|
* Special: value 0 means "use default targetLength". */
|
||||||
ZSTD_p_compressionStrategy=107, /* See ZSTD_strategy enum definition.
|
ZSTD_c_compressionStrategy=107, /* See ZSTD_strategy enum definition.
|
||||||
* The higher the value of selected strategy, the more complex it is,
|
* The higher the value of selected strategy, the more complex it is,
|
||||||
* resulting in stronger and slower compression.
|
* resulting in stronger and slower compression.
|
||||||
* Special: value 0 means "use default strategy". */
|
* Special: value 0 means "use default strategy". */
|
||||||
|
|
||||||
/* LDM mode parameters */
|
/* LDM mode parameters */
|
||||||
ZSTD_p_enableLongDistanceMatching=160, /* Enable long distance matching.
|
ZSTD_c_enableLongDistanceMatching=160, /* Enable long distance matching.
|
||||||
* This parameter is designed to improve compression ratio
|
* This parameter is designed to improve compression ratio
|
||||||
* for large inputs, by finding large matches at long distance.
|
* for large inputs, by finding large matches at long distance.
|
||||||
* It increases memory usage and window size.
|
* It increases memory usage and window size.
|
||||||
* Note: enabling this parameter increases default ZSTD_p_windowLog to 128 MB
|
* Note: enabling this parameter increases default ZSTD_c_windowLog to 128 MB
|
||||||
* except when expressly set to a different value. */
|
* except when expressly set to a different value. */
|
||||||
ZSTD_p_ldmHashLog=161, /* Size of the table for long distance matching, as a power of 2.
|
ZSTD_c_ldmHashLog=161, /* Size of the table for long distance matching, as a power of 2.
|
||||||
* Larger values increase memory usage and compression ratio,
|
* Larger values increase memory usage and compression ratio,
|
||||||
* but decrease compression speed.
|
* but decrease compression speed.
|
||||||
* Must be clamped between ZSTD_HASHLOG_MIN and ZSTD_HASHLOG_MAX
|
* Must be clamped between ZSTD_HASHLOG_MIN and ZSTD_HASHLOG_MAX
|
||||||
* default: windowlog - 7.
|
* default: windowlog - 7.
|
||||||
* Special: value 0 means "automatically determine hashlog". */
|
* Special: value 0 means "automatically determine hashlog". */
|
||||||
ZSTD_p_ldmMinMatch=162, /* Minimum match size for long distance matcher.
|
ZSTD_c_ldmMinMatch=162, /* Minimum match size for long distance matcher.
|
||||||
* Larger/too small values usually decrease compression ratio.
|
* Larger/too small values usually decrease compression ratio.
|
||||||
* Must be clamped between ZSTD_LDM_MINMATCH_MIN and ZSTD_LDM_MINMATCH_MAX.
|
* Must be clamped between ZSTD_LDM_MINMATCH_MIN and ZSTD_LDM_MINMATCH_MAX.
|
||||||
* Special: value 0 means "use default value" (default: 64). */
|
* Special: value 0 means "use default value" (default: 64). */
|
||||||
ZSTD_p_ldmBucketSizeLog=163, /* Log size of each bucket in the LDM hash table for collision resolution.
|
ZSTD_c_ldmBucketSizeLog=163, /* Log size of each bucket in the LDM hash table for collision resolution.
|
||||||
* Larger values improve collision resolution but decrease compression speed.
|
* Larger values improve collision resolution but decrease compression speed.
|
||||||
* The maximum value is ZSTD_LDM_BUCKETSIZELOG_MAX.
|
* The maximum value is ZSTD_LDM_BUCKETSIZELOG_MAX.
|
||||||
* Special: value 0 means "use default value" (default: 3). */
|
* Special: value 0 means "use default value" (default: 3). */
|
||||||
ZSTD_p_ldmHashRateLog=164, /* Frequency of inserting/looking up entries into the LDM hash table.
|
ZSTD_c_ldmHashRateLog=164, /* Frequency of inserting/looking up entries into the LDM hash table.
|
||||||
* Must be clamped between 0 and (ZSTD_WINDOWLOG_MAX - ZSTD_HASHLOG_MIN).
|
* Must be clamped between 0 and (ZSTD_WINDOWLOG_MAX - ZSTD_HASHLOG_MIN).
|
||||||
* Default is MAX(0, (windowLog - ldmHashLog)), optimizing hash table usage.
|
* Default is MAX(0, (windowLog - ldmHashLog)), optimizing hash table usage.
|
||||||
* Larger values improve compression speed.
|
* Larger values improve compression speed.
|
||||||
@@ -588,16 +588,16 @@ typedef enum {
|
|||||||
* Special: value 0 means "automatically determine hashRateLog". */
|
* Special: value 0 means "automatically determine hashRateLog". */
|
||||||
|
|
||||||
/* frame parameters */
|
/* frame parameters */
|
||||||
ZSTD_p_contentSizeFlag=200, /* Content size will be written into frame header _whenever known_ (default:1)
|
ZSTD_c_contentSizeFlag=200, /* Content size will be written into frame header _whenever known_ (default:1)
|
||||||
* Content size must be known at the beginning of compression,
|
* Content size must be known at the beginning of compression,
|
||||||
* it is provided using ZSTD_CCtx_setPledgedSrcSize() */
|
* it is provided using ZSTD_CCtx_setPledgedSrcSize() */
|
||||||
ZSTD_p_checksumFlag=201, /* A 32-bits checksum of content is written at end of frame (default:0) */
|
ZSTD_c_checksumFlag=201, /* A 32-bits checksum of content is written at end of frame (default:0) */
|
||||||
ZSTD_p_dictIDFlag=202, /* When applicable, dictionary's ID is written into frame header (default:1) */
|
ZSTD_c_dictIDFlag=202, /* When applicable, dictionary's ID is written into frame header (default:1) */
|
||||||
|
|
||||||
/* multi-threading parameters */
|
/* multi-threading parameters */
|
||||||
/* These parameters are only useful if multi-threading is enabled (compiled with build macro ZSTD_MULTITHREAD).
|
/* These parameters are only useful if multi-threading is enabled (compiled with build macro ZSTD_MULTITHREAD).
|
||||||
* They return an error otherwise. */
|
* They return an error otherwise. */
|
||||||
ZSTD_p_nbWorkers=400, /* Select how many threads will be spawned to compress in parallel.
|
ZSTD_c_nbWorkers=400, /* Select how many threads will be spawned to compress in parallel.
|
||||||
* When nbWorkers >= 1, triggers asynchronous mode when used with ZSTD_compressStream*() :
|
* When nbWorkers >= 1, triggers asynchronous mode when used with ZSTD_compressStream*() :
|
||||||
* ZSTD_compressStream*() consumes input and flush output if possible, but immediately gives back control to caller,
|
* ZSTD_compressStream*() consumes input and flush output if possible, but immediately gives back control to caller,
|
||||||
* while compression work is performed in parallel, within worker threads.
|
* while compression work is performed in parallel, within worker threads.
|
||||||
@@ -605,12 +605,12 @@ typedef enum {
|
|||||||
* in which case, ZSTD_compressStream2() delegates to ZSTD_compress2(), which is always a blocking call).
|
* in which case, ZSTD_compressStream2() delegates to ZSTD_compress2(), which is always a blocking call).
|
||||||
* More workers improve speed, but also increase memory usage.
|
* More workers improve speed, but also increase memory usage.
|
||||||
* Default value is `0`, aka "single-threaded mode" : no worker is spawned, compression is performed inside Caller's thread, all invocations are blocking */
|
* Default value is `0`, aka "single-threaded mode" : no worker is spawned, compression is performed inside Caller's thread, all invocations are blocking */
|
||||||
ZSTD_p_jobSize=401, /* Size of a compression job. This value is enforced only when nbWorkers >= 1.
|
ZSTD_c_jobSize=401, /* Size of a compression job. This value is enforced only when nbWorkers >= 1.
|
||||||
* Each compression job is completed in parallel, so this value can indirectly impact the nb of active threads.
|
* Each compression job is completed in parallel, so this value can indirectly impact the nb of active threads.
|
||||||
* 0 means default, which is dynamically determined based on compression parameters.
|
* 0 means default, which is dynamically determined based on compression parameters.
|
||||||
* Job size must be a minimum of overlapSize, or 1 MB, whichever is largest.
|
* Job size must be a minimum of overlapSize, or 1 MB, whichever is largest.
|
||||||
* The minimum size is automatically and transparently enforced */
|
* The minimum size is automatically and transparently enforced */
|
||||||
ZSTD_p_overlapSizeLog=402, /* Size of previous job reloaded at the beginning of each job, as a fraction of window size.
|
ZSTD_c_overlapSizeLog=402, /* Size of previous job reloaded at the beginning of each job, as a fraction of window size.
|
||||||
* This value is enforced only when nbWorkers >= 1.
|
* This value is enforced only when nbWorkers >= 1.
|
||||||
* Larger values increase compression ratio, but decrease speed.
|
* Larger values increase compression ratio, but decrease speed.
|
||||||
* Values range from 0 (no overlap) to 9 (overlap a full windowSize).
|
* Values range from 0 (no overlap) to 9 (overlap a full windowSize).
|
||||||
@@ -621,17 +621,17 @@ typedef enum {
|
|||||||
/* note : additional experimental parameters are also available
|
/* note : additional experimental parameters are also available
|
||||||
* within the experimental section of the API.
|
* within the experimental section of the API.
|
||||||
* At the time of this writing, they include :
|
* At the time of this writing, they include :
|
||||||
* ZSTD_p_rsyncable
|
* ZSTD_c_rsyncable
|
||||||
* ZSTD_p_format
|
* ZSTD_c_format
|
||||||
* ZSTD_p_forceMaxWindow
|
* ZSTD_c_forceMaxWindow
|
||||||
* ZSTD_p_forceAttachDict
|
* ZSTD_c_forceAttachDict
|
||||||
* Because they are not stable, it's necessary to define ZSTD_STATIC_LINKING_ONLY to access them.
|
* Because they are not stable, it's necessary to define ZSTD_STATIC_LINKING_ONLY to access them.
|
||||||
* note : never ever use experimentalParam? names directly
|
* note : never ever use experimentalParam? names directly
|
||||||
*/
|
*/
|
||||||
ZSTD_p_experimentalParam1=500,
|
ZSTD_c_experimentalParam1=500,
|
||||||
ZSTD_p_experimentalParam2=10,
|
ZSTD_c_experimentalParam2=10,
|
||||||
ZSTD_p_experimentalParam3=1000,
|
ZSTD_c_experimentalParam3=1000,
|
||||||
ZSTD_p_experimentalParam4
|
ZSTD_c_experimentalParam4
|
||||||
} ZSTD_cParameter;
|
} ZSTD_cParameter;
|
||||||
|
|
||||||
|
|
||||||
@@ -720,7 +720,7 @@ ZSTDLIB_API size_t ZSTD_CCtx_refCDict(ZSTD_CCtx* cctx, const ZSTD_CDict* cdict);
|
|||||||
* Its content must remain unmodified during compression.
|
* Its content must remain unmodified during compression.
|
||||||
* Note 2 : If the intention is to diff some large src data blob with some prior version of itself,
|
* Note 2 : If the intention is to diff some large src data blob with some prior version of itself,
|
||||||
* ensure that the window size is large enough to contain the entire source.
|
* ensure that the window size is large enough to contain the entire source.
|
||||||
* See ZSTD_p_windowLog.
|
* See ZSTD_c_windowLog.
|
||||||
* Note 3 : Referencing a prefix involves building tables, which are dependent on compression parameters.
|
* Note 3 : Referencing a prefix involves building tables, which are dependent on compression parameters.
|
||||||
* It's a CPU consuming operation, with non-negligible impact on latency.
|
* It's a CPU consuming operation, with non-negligible impact on latency.
|
||||||
* If there is a need to use the same prefix multiple times, consider loadDictionary instead.
|
* If there is a need to use the same prefix multiple times, consider loadDictionary instead.
|
||||||
@@ -829,7 +829,7 @@ typedef enum {
|
|||||||
/* note : additional experimental parameters are also available
|
/* note : additional experimental parameters are also available
|
||||||
* within the experimental section of the API.
|
* within the experimental section of the API.
|
||||||
* At the time of this writing, they include :
|
* At the time of this writing, they include :
|
||||||
* ZSTD_p_format
|
* ZSTD_c_format
|
||||||
* Because they are not stable, it's necessary to define ZSTD_STATIC_LINKING_ONLY to access them.
|
* Because they are not stable, it's necessary to define ZSTD_STATIC_LINKING_ONLY to access them.
|
||||||
* note : never ever use experimentalParam? names directly
|
* note : never ever use experimentalParam? names directly
|
||||||
*/
|
*/
|
||||||
@@ -1095,7 +1095,7 @@ ZSTDLIB_API size_t ZSTD_frameHeaderSize(const void* src, size_t srcSize);
|
|||||||
* It will also consider src size to be arbitrarily "large", which is worst case.
|
* It will also consider src size to be arbitrarily "large", which is worst case.
|
||||||
* If srcSize is known to always be small, ZSTD_estimateCCtxSize_usingCParams() can provide a tighter estimation.
|
* If srcSize is known to always be small, ZSTD_estimateCCtxSize_usingCParams() can provide a tighter estimation.
|
||||||
* ZSTD_estimateCCtxSize_usingCParams() can be used in tandem with ZSTD_getCParams() to create cParams from compressionLevel.
|
* ZSTD_estimateCCtxSize_usingCParams() can be used in tandem with ZSTD_getCParams() to create cParams from compressionLevel.
|
||||||
* ZSTD_estimateCCtxSize_usingCCtxParams() can be used in tandem with ZSTD_CCtxParam_setParameter(). Only single-threaded compression is supported. This function will return an error code if ZSTD_p_nbWorkers is >= 1.
|
* ZSTD_estimateCCtxSize_usingCCtxParams() can be used in tandem with ZSTD_CCtxParam_setParameter(). Only single-threaded compression is supported. This function will return an error code if ZSTD_c_nbWorkers is >= 1.
|
||||||
* Note : CCtx size estimation is only correct for single-threaded compression. */
|
* Note : CCtx size estimation is only correct for single-threaded compression. */
|
||||||
ZSTDLIB_API size_t ZSTD_estimateCCtxSize(int compressionLevel);
|
ZSTDLIB_API size_t ZSTD_estimateCCtxSize(int compressionLevel);
|
||||||
ZSTDLIB_API size_t ZSTD_estimateCCtxSize_usingCParams(ZSTD_compressionParameters cParams);
|
ZSTDLIB_API size_t ZSTD_estimateCCtxSize_usingCParams(ZSTD_compressionParameters cParams);
|
||||||
@@ -1107,7 +1107,7 @@ ZSTDLIB_API size_t ZSTD_estimateDCtxSize(void);
|
|||||||
* It will also consider src size to be arbitrarily "large", which is worst case.
|
* It will also consider src size to be arbitrarily "large", which is worst case.
|
||||||
* If srcSize is known to always be small, ZSTD_estimateCStreamSize_usingCParams() can provide a tighter estimation.
|
* If srcSize is known to always be small, ZSTD_estimateCStreamSize_usingCParams() can provide a tighter estimation.
|
||||||
* ZSTD_estimateCStreamSize_usingCParams() can be used in tandem with ZSTD_getCParams() to create cParams from compressionLevel.
|
* ZSTD_estimateCStreamSize_usingCParams() can be used in tandem with ZSTD_getCParams() to create cParams from compressionLevel.
|
||||||
* ZSTD_estimateCStreamSize_usingCCtxParams() can be used in tandem with ZSTD_CCtxParam_setParameter(). Only single-threaded compression is supported. This function will return an error code if ZSTD_p_nbWorkers is >= 1.
|
* ZSTD_estimateCStreamSize_usingCCtxParams() can be used in tandem with ZSTD_CCtxParam_setParameter(). Only single-threaded compression is supported. This function will return an error code if ZSTD_c_nbWorkers is >= 1.
|
||||||
* Note : CStream size estimation is only correct for single-threaded compression.
|
* Note : CStream size estimation is only correct for single-threaded compression.
|
||||||
* ZSTD_DStream memory budget depends on window Size.
|
* ZSTD_DStream memory budget depends on window Size.
|
||||||
* This information can be passed manually, using ZSTD_estimateDStreamSize,
|
* This information can be passed manually, using ZSTD_estimateDStreamSize,
|
||||||
@@ -1269,7 +1269,7 @@ ZSTDLIB_API size_t ZSTD_CCtx_refPrefix_advanced(ZSTD_CCtx* cctx, const void* pre
|
|||||||
/* Enables rsyncable mode,
|
/* Enables rsyncable mode,
|
||||||
* which makes compressed files more rsync friendly
|
* which makes compressed files more rsync friendly
|
||||||
* by adding periodic synchronization points to the compressed data.
|
* by adding periodic synchronization points to the compressed data.
|
||||||
* The target average block size is ZSTD_p_jobSize / 2.
|
* The target average block size is ZSTD_c_jobSize / 2.
|
||||||
* It's possible to modify the job size to increase or decrease
|
* It's possible to modify the job size to increase or decrease
|
||||||
* the granularity of the synchronization point.
|
* the granularity of the synchronization point.
|
||||||
* Once the jobSize is smaller than the window size,
|
* Once the jobSize is smaller than the window size,
|
||||||
@@ -1282,22 +1282,22 @@ ZSTDLIB_API size_t ZSTD_CCtx_refPrefix_advanced(ZSTD_CCtx* cctx, const void* pre
|
|||||||
* If the selected compression level is already running significantly slower,
|
* If the selected compression level is already running significantly slower,
|
||||||
* the overall speed won't be significantly impacted.
|
* the overall speed won't be significantly impacted.
|
||||||
*/
|
*/
|
||||||
#define ZSTD_p_rsyncable ZSTD_p_experimentalParam1
|
#define ZSTD_c_rsyncable ZSTD_c_experimentalParam1
|
||||||
|
|
||||||
/* Select a compression format.
|
/* Select a compression format.
|
||||||
* The value must be of type ZSTD_format_e.
|
* The value must be of type ZSTD_format_e.
|
||||||
* See ZSTD_format_e enum definition for details */
|
* See ZSTD_format_e enum definition for details */
|
||||||
#define ZSTD_p_format ZSTD_p_experimentalParam2
|
#define ZSTD_c_format ZSTD_c_experimentalParam2
|
||||||
|
|
||||||
/* Force back-reference distances to remain < windowSize,
|
/* Force back-reference distances to remain < windowSize,
|
||||||
* even when referencing into Dictionary content (default:0) */
|
* even when referencing into Dictionary content (default:0) */
|
||||||
#define ZSTD_p_forceMaxWindow ZSTD_p_experimentalParam3
|
#define ZSTD_c_forceMaxWindow ZSTD_c_experimentalParam3
|
||||||
|
|
||||||
/* Controls whether the contents of a CDict
|
/* Controls whether the contents of a CDict
|
||||||
* are used in place, or copied into the working context.
|
* are used in place, or copied into the working context.
|
||||||
* Accepts values from the ZSTD_dictAttachPref_e enum.
|
* Accepts values from the ZSTD_dictAttachPref_e enum.
|
||||||
* See the comments on that enum for an explanation of the feature. */
|
* See the comments on that enum for an explanation of the feature. */
|
||||||
#define ZSTD_p_forceAttachDict ZSTD_p_experimentalParam4
|
#define ZSTD_c_forceAttachDict ZSTD_c_experimentalParam4
|
||||||
|
|
||||||
/*! ZSTD_CCtx_getParameter() :
|
/*! ZSTD_CCtx_getParameter() :
|
||||||
* Get the requested value of one compression parameter, selected by enum ZSTD_cParameter.
|
* Get the requested value of one compression parameter, selected by enum ZSTD_cParameter.
|
||||||
|
|||||||
+15
-15
@@ -162,23 +162,23 @@ static void BMK_initCCtx(ZSTD_CCtx* ctx,
|
|||||||
const ZSTD_compressionParameters* comprParams, const BMK_advancedParams_t* adv) {
|
const ZSTD_compressionParameters* comprParams, const BMK_advancedParams_t* adv) {
|
||||||
ZSTD_CCtx_reset(ctx, ZSTD_reset_session_and_parameters);
|
ZSTD_CCtx_reset(ctx, ZSTD_reset_session_and_parameters);
|
||||||
if (adv->nbWorkers==1) {
|
if (adv->nbWorkers==1) {
|
||||||
ZSTD_CCtx_setParameter(ctx, ZSTD_p_nbWorkers, 0);
|
ZSTD_CCtx_setParameter(ctx, ZSTD_c_nbWorkers, 0);
|
||||||
} else {
|
} else {
|
||||||
ZSTD_CCtx_setParameter(ctx, ZSTD_p_nbWorkers, adv->nbWorkers);
|
ZSTD_CCtx_setParameter(ctx, ZSTD_c_nbWorkers, adv->nbWorkers);
|
||||||
}
|
}
|
||||||
ZSTD_CCtx_setParameter(ctx, ZSTD_p_compressionLevel, cLevel);
|
ZSTD_CCtx_setParameter(ctx, ZSTD_c_compressionLevel, cLevel);
|
||||||
ZSTD_CCtx_setParameter(ctx, ZSTD_p_enableLongDistanceMatching, adv->ldmFlag);
|
ZSTD_CCtx_setParameter(ctx, ZSTD_c_enableLongDistanceMatching, adv->ldmFlag);
|
||||||
ZSTD_CCtx_setParameter(ctx, ZSTD_p_ldmMinMatch, adv->ldmMinMatch);
|
ZSTD_CCtx_setParameter(ctx, ZSTD_c_ldmMinMatch, adv->ldmMinMatch);
|
||||||
ZSTD_CCtx_setParameter(ctx, ZSTD_p_ldmHashLog, adv->ldmHashLog);
|
ZSTD_CCtx_setParameter(ctx, ZSTD_c_ldmHashLog, adv->ldmHashLog);
|
||||||
ZSTD_CCtx_setParameter(ctx, ZSTD_p_ldmBucketSizeLog, adv->ldmBucketSizeLog);
|
ZSTD_CCtx_setParameter(ctx, ZSTD_c_ldmBucketSizeLog, adv->ldmBucketSizeLog);
|
||||||
ZSTD_CCtx_setParameter(ctx, ZSTD_p_ldmHashRateLog, adv->ldmHashRateLog);
|
ZSTD_CCtx_setParameter(ctx, ZSTD_c_ldmHashRateLog, adv->ldmHashRateLog);
|
||||||
ZSTD_CCtx_setParameter(ctx, ZSTD_p_windowLog, comprParams->windowLog);
|
ZSTD_CCtx_setParameter(ctx, ZSTD_c_windowLog, comprParams->windowLog);
|
||||||
ZSTD_CCtx_setParameter(ctx, ZSTD_p_hashLog, comprParams->hashLog);
|
ZSTD_CCtx_setParameter(ctx, ZSTD_c_hashLog, comprParams->hashLog);
|
||||||
ZSTD_CCtx_setParameter(ctx, ZSTD_p_chainLog, comprParams->chainLog);
|
ZSTD_CCtx_setParameter(ctx, ZSTD_c_chainLog, comprParams->chainLog);
|
||||||
ZSTD_CCtx_setParameter(ctx, ZSTD_p_searchLog, comprParams->searchLog);
|
ZSTD_CCtx_setParameter(ctx, ZSTD_c_searchLog, comprParams->searchLog);
|
||||||
ZSTD_CCtx_setParameter(ctx, ZSTD_p_minMatch, comprParams->minMatch);
|
ZSTD_CCtx_setParameter(ctx, ZSTD_c_minMatch, comprParams->minMatch);
|
||||||
ZSTD_CCtx_setParameter(ctx, ZSTD_p_targetLength, comprParams->targetLength);
|
ZSTD_CCtx_setParameter(ctx, ZSTD_c_targetLength, comprParams->targetLength);
|
||||||
ZSTD_CCtx_setParameter(ctx, ZSTD_p_compressionStrategy, comprParams->strategy);
|
ZSTD_CCtx_setParameter(ctx, ZSTD_c_compressionStrategy, comprParams->strategy);
|
||||||
ZSTD_CCtx_loadDictionary(ctx, dictBuffer, dictBufferSize);
|
ZSTD_CCtx_loadDictionary(ctx, dictBuffer, dictBufferSize);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
+22
-22
@@ -529,42 +529,42 @@ static cRess_t FIO_createCResources(const char* dictFileName, int cLevel,
|
|||||||
if (g_adaptiveMode && !g_ldmFlag && !comprParams.windowLog)
|
if (g_adaptiveMode && !g_ldmFlag && !comprParams.windowLog)
|
||||||
comprParams.windowLog = ADAPT_WINDOWLOG_DEFAULT;
|
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_c_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_c_dictIDFlag, g_dictIDFlag) );
|
||||||
CHECK( ZSTD_CCtx_setParameter(ress.cctx, ZSTD_p_checksumFlag, g_checksumFlag) );
|
CHECK( ZSTD_CCtx_setParameter(ress.cctx, ZSTD_c_checksumFlag, g_checksumFlag) );
|
||||||
/* compression level */
|
/* compression level */
|
||||||
CHECK( ZSTD_CCtx_setParameter(ress.cctx, ZSTD_p_compressionLevel, cLevel) );
|
CHECK( ZSTD_CCtx_setParameter(ress.cctx, ZSTD_c_compressionLevel, cLevel) );
|
||||||
/* long distance matching */
|
/* long distance matching */
|
||||||
CHECK( ZSTD_CCtx_setParameter(ress.cctx, ZSTD_p_enableLongDistanceMatching, g_ldmFlag) );
|
CHECK( ZSTD_CCtx_setParameter(ress.cctx, ZSTD_c_enableLongDistanceMatching, g_ldmFlag) );
|
||||||
CHECK( ZSTD_CCtx_setParameter(ress.cctx, ZSTD_p_ldmHashLog, g_ldmHashLog) );
|
CHECK( ZSTD_CCtx_setParameter(ress.cctx, ZSTD_c_ldmHashLog, g_ldmHashLog) );
|
||||||
CHECK( ZSTD_CCtx_setParameter(ress.cctx, ZSTD_p_ldmMinMatch, g_ldmMinMatch) );
|
CHECK( ZSTD_CCtx_setParameter(ress.cctx, ZSTD_c_ldmMinMatch, g_ldmMinMatch) );
|
||||||
if (g_ldmBucketSizeLog != FIO_LDM_PARAM_NOTSET) {
|
if (g_ldmBucketSizeLog != FIO_LDM_PARAM_NOTSET) {
|
||||||
CHECK( ZSTD_CCtx_setParameter(ress.cctx, ZSTD_p_ldmBucketSizeLog, g_ldmBucketSizeLog) );
|
CHECK( ZSTD_CCtx_setParameter(ress.cctx, ZSTD_c_ldmBucketSizeLog, g_ldmBucketSizeLog) );
|
||||||
}
|
}
|
||||||
if (g_ldmHashRateLog != FIO_LDM_PARAM_NOTSET) {
|
if (g_ldmHashRateLog != FIO_LDM_PARAM_NOTSET) {
|
||||||
CHECK( ZSTD_CCtx_setParameter(ress.cctx, ZSTD_p_ldmHashRateLog, g_ldmHashRateLog) );
|
CHECK( ZSTD_CCtx_setParameter(ress.cctx, ZSTD_c_ldmHashRateLog, g_ldmHashRateLog) );
|
||||||
}
|
}
|
||||||
/* compression parameters */
|
/* compression parameters */
|
||||||
CHECK( ZSTD_CCtx_setParameter(ress.cctx, ZSTD_p_windowLog, comprParams.windowLog) );
|
CHECK( ZSTD_CCtx_setParameter(ress.cctx, ZSTD_c_windowLog, comprParams.windowLog) );
|
||||||
CHECK( ZSTD_CCtx_setParameter(ress.cctx, ZSTD_p_chainLog, comprParams.chainLog) );
|
CHECK( ZSTD_CCtx_setParameter(ress.cctx, ZSTD_c_chainLog, comprParams.chainLog) );
|
||||||
CHECK( ZSTD_CCtx_setParameter(ress.cctx, ZSTD_p_hashLog, comprParams.hashLog) );
|
CHECK( ZSTD_CCtx_setParameter(ress.cctx, ZSTD_c_hashLog, comprParams.hashLog) );
|
||||||
CHECK( ZSTD_CCtx_setParameter(ress.cctx, ZSTD_p_searchLog, comprParams.searchLog) );
|
CHECK( ZSTD_CCtx_setParameter(ress.cctx, ZSTD_c_searchLog, comprParams.searchLog) );
|
||||||
CHECK( ZSTD_CCtx_setParameter(ress.cctx, ZSTD_p_minMatch, comprParams.minMatch) );
|
CHECK( ZSTD_CCtx_setParameter(ress.cctx, ZSTD_c_minMatch, comprParams.minMatch) );
|
||||||
CHECK( ZSTD_CCtx_setParameter(ress.cctx, ZSTD_p_targetLength, comprParams.targetLength) );
|
CHECK( ZSTD_CCtx_setParameter(ress.cctx, ZSTD_c_targetLength, comprParams.targetLength) );
|
||||||
CHECK( ZSTD_CCtx_setParameter(ress.cctx, ZSTD_p_compressionStrategy, comprParams.strategy) );
|
CHECK( ZSTD_CCtx_setParameter(ress.cctx, ZSTD_c_compressionStrategy, comprParams.strategy) );
|
||||||
/* multi-threading */
|
/* multi-threading */
|
||||||
#ifdef ZSTD_MULTITHREAD
|
#ifdef ZSTD_MULTITHREAD
|
||||||
DISPLAYLEVEL(5,"set nb workers = %u \n", g_nbWorkers);
|
DISPLAYLEVEL(5,"set nb workers = %u \n", g_nbWorkers);
|
||||||
CHECK( ZSTD_CCtx_setParameter(ress.cctx, ZSTD_p_nbWorkers, g_nbWorkers) );
|
CHECK( ZSTD_CCtx_setParameter(ress.cctx, ZSTD_c_nbWorkers, g_nbWorkers) );
|
||||||
CHECK( ZSTD_CCtx_setParameter(ress.cctx, ZSTD_p_jobSize, g_blockSize) );
|
CHECK( ZSTD_CCtx_setParameter(ress.cctx, ZSTD_c_jobSize, g_blockSize) );
|
||||||
if ( (g_overlapLog == FIO_OVERLAP_LOG_NOTSET)
|
if ( (g_overlapLog == FIO_OVERLAP_LOG_NOTSET)
|
||||||
&& (cLevel == ZSTD_maxCLevel()) )
|
&& (cLevel == ZSTD_maxCLevel()) )
|
||||||
g_overlapLog = 9; /* full overlap */
|
g_overlapLog = 9; /* full overlap */
|
||||||
if (g_overlapLog != FIO_OVERLAP_LOG_NOTSET) {
|
if (g_overlapLog != FIO_OVERLAP_LOG_NOTSET) {
|
||||||
DISPLAYLEVEL(3,"set overlapLog = %u \n", g_overlapLog);
|
DISPLAYLEVEL(3,"set overlapLog = %u \n", g_overlapLog);
|
||||||
CHECK( ZSTD_CCtx_setParameter(ress.cctx, ZSTD_p_overlapSizeLog, g_overlapLog) );
|
CHECK( ZSTD_CCtx_setParameter(ress.cctx, ZSTD_c_overlapSizeLog, g_overlapLog) );
|
||||||
}
|
}
|
||||||
CHECK( ZSTD_CCtx_setParameter(ress.cctx, ZSTD_p_rsyncable, g_rsyncable) );
|
CHECK( ZSTD_CCtx_setParameter(ress.cctx, ZSTD_c_rsyncable, g_rsyncable) );
|
||||||
#endif
|
#endif
|
||||||
/* dictionary */
|
/* dictionary */
|
||||||
CHECK( ZSTD_CCtx_setPledgedSrcSize(ress.cctx, srcSize) ); /* set the value temporarily for dictionary loading, to adapt compression parameters */
|
CHECK( ZSTD_CCtx_setPledgedSrcSize(ress.cctx, srcSize) ); /* set the value temporarily for dictionary loading, to adapt compression parameters */
|
||||||
@@ -994,14 +994,14 @@ FIO_compressZstdFrame(const cRess_t* ressPtr,
|
|||||||
if (compressionLevel > ZSTD_maxCLevel()) compressionLevel = ZSTD_maxCLevel();
|
if (compressionLevel > ZSTD_maxCLevel()) compressionLevel = ZSTD_maxCLevel();
|
||||||
if (compressionLevel > g_maxAdaptLevel) compressionLevel = g_maxAdaptLevel;
|
if (compressionLevel > g_maxAdaptLevel) compressionLevel = g_maxAdaptLevel;
|
||||||
compressionLevel += (compressionLevel == 0); /* skip 0 */
|
compressionLevel += (compressionLevel == 0); /* skip 0 */
|
||||||
ZSTD_CCtx_setParameter(ress.cctx, ZSTD_p_compressionLevel, compressionLevel);
|
ZSTD_CCtx_setParameter(ress.cctx, ZSTD_c_compressionLevel, compressionLevel);
|
||||||
}
|
}
|
||||||
if (speedChange == faster) {
|
if (speedChange == faster) {
|
||||||
DISPLAYLEVEL(6, "faster speed , lighter compression \n")
|
DISPLAYLEVEL(6, "faster speed , lighter compression \n")
|
||||||
compressionLevel --;
|
compressionLevel --;
|
||||||
if (compressionLevel < g_minAdaptLevel) compressionLevel = g_minAdaptLevel;
|
if (compressionLevel < g_minAdaptLevel) compressionLevel = g_minAdaptLevel;
|
||||||
compressionLevel -= (compressionLevel == 0); /* skip 0 */
|
compressionLevel -= (compressionLevel == 0); /* skip 0 */
|
||||||
ZSTD_CCtx_setParameter(ress.cctx, ZSTD_p_compressionLevel, compressionLevel);
|
ZSTD_CCtx_setParameter(ress.cctx, ZSTD_c_compressionLevel, compressionLevel);
|
||||||
}
|
}
|
||||||
speedChange = noChange;
|
speedChange = noChange;
|
||||||
|
|
||||||
|
|||||||
+18
-18
@@ -200,7 +200,7 @@ local_ZSTD_compress_generic_T2_end(const void* src, size_t srcSize,
|
|||||||
void* buff2)
|
void* buff2)
|
||||||
{
|
{
|
||||||
(void)buff2;
|
(void)buff2;
|
||||||
ZSTD_CCtx_setParameter(g_cstream, ZSTD_p_nbWorkers, 2);
|
ZSTD_CCtx_setParameter(g_cstream, ZSTD_c_nbWorkers, 2);
|
||||||
return ZSTD_compress2(g_cstream, dst, dstCapacity, src, srcSize);
|
return ZSTD_compress2(g_cstream, dst, dstCapacity, src, srcSize);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -212,7 +212,7 @@ local_ZSTD_compress_generic_T2_continue(const void* src, size_t srcSize,
|
|||||||
ZSTD_outBuffer buffOut;
|
ZSTD_outBuffer buffOut;
|
||||||
ZSTD_inBuffer buffIn;
|
ZSTD_inBuffer buffIn;
|
||||||
(void)buff2;
|
(void)buff2;
|
||||||
ZSTD_CCtx_setParameter(g_cstream, ZSTD_p_nbWorkers, 2);
|
ZSTD_CCtx_setParameter(g_cstream, ZSTD_c_nbWorkers, 2);
|
||||||
buffOut.dst = dst;
|
buffOut.dst = dst;
|
||||||
buffOut.size = dstCapacity;
|
buffOut.size = dstCapacity;
|
||||||
buffOut.pos = 0;
|
buffOut.pos = 0;
|
||||||
@@ -394,24 +394,24 @@ static size_t benchMem(U32 benchNb,
|
|||||||
cLevel, cparams->windowLog, cparams->hashLog, cparams->chainLog, cparams->searchLog,
|
cLevel, cparams->windowLog, cparams->hashLog, cparams->chainLog, cparams->searchLog,
|
||||||
cparams->minMatch, cparams->targetLength, cparams->strategy); */
|
cparams->minMatch, cparams->targetLength, cparams->strategy); */
|
||||||
|
|
||||||
ZSTD_CCtx_setParameter(g_zcc, ZSTD_p_compressionLevel, cLevel);
|
ZSTD_CCtx_setParameter(g_zcc, ZSTD_c_compressionLevel, cLevel);
|
||||||
ZSTD_CCtx_setParameter(g_zcc, ZSTD_p_windowLog, cparams.windowLog);
|
ZSTD_CCtx_setParameter(g_zcc, ZSTD_c_windowLog, cparams.windowLog);
|
||||||
ZSTD_CCtx_setParameter(g_zcc, ZSTD_p_hashLog, cparams.hashLog);
|
ZSTD_CCtx_setParameter(g_zcc, ZSTD_c_hashLog, cparams.hashLog);
|
||||||
ZSTD_CCtx_setParameter(g_zcc, ZSTD_p_chainLog, cparams.chainLog);
|
ZSTD_CCtx_setParameter(g_zcc, ZSTD_c_chainLog, cparams.chainLog);
|
||||||
ZSTD_CCtx_setParameter(g_zcc, ZSTD_p_searchLog, cparams.searchLog);
|
ZSTD_CCtx_setParameter(g_zcc, ZSTD_c_searchLog, cparams.searchLog);
|
||||||
ZSTD_CCtx_setParameter(g_zcc, ZSTD_p_minMatch, cparams.minMatch);
|
ZSTD_CCtx_setParameter(g_zcc, ZSTD_c_minMatch, cparams.minMatch);
|
||||||
ZSTD_CCtx_setParameter(g_zcc, ZSTD_p_targetLength, cparams.targetLength);
|
ZSTD_CCtx_setParameter(g_zcc, ZSTD_c_targetLength, cparams.targetLength);
|
||||||
ZSTD_CCtx_setParameter(g_zcc, ZSTD_p_compressionStrategy, cparams.strategy);
|
ZSTD_CCtx_setParameter(g_zcc, ZSTD_c_compressionStrategy, cparams.strategy);
|
||||||
|
|
||||||
|
|
||||||
ZSTD_CCtx_setParameter(g_cstream, ZSTD_p_compressionLevel, cLevel);
|
ZSTD_CCtx_setParameter(g_cstream, ZSTD_c_compressionLevel, cLevel);
|
||||||
ZSTD_CCtx_setParameter(g_cstream, ZSTD_p_windowLog, cparams.windowLog);
|
ZSTD_CCtx_setParameter(g_cstream, ZSTD_c_windowLog, cparams.windowLog);
|
||||||
ZSTD_CCtx_setParameter(g_cstream, ZSTD_p_hashLog, cparams.hashLog);
|
ZSTD_CCtx_setParameter(g_cstream, ZSTD_c_hashLog, cparams.hashLog);
|
||||||
ZSTD_CCtx_setParameter(g_cstream, ZSTD_p_chainLog, cparams.chainLog);
|
ZSTD_CCtx_setParameter(g_cstream, ZSTD_c_chainLog, cparams.chainLog);
|
||||||
ZSTD_CCtx_setParameter(g_cstream, ZSTD_p_searchLog, cparams.searchLog);
|
ZSTD_CCtx_setParameter(g_cstream, ZSTD_c_searchLog, cparams.searchLog);
|
||||||
ZSTD_CCtx_setParameter(g_cstream, ZSTD_p_minMatch, cparams.minMatch);
|
ZSTD_CCtx_setParameter(g_cstream, ZSTD_c_minMatch, cparams.minMatch);
|
||||||
ZSTD_CCtx_setParameter(g_cstream, ZSTD_p_targetLength, cparams.targetLength);
|
ZSTD_CCtx_setParameter(g_cstream, ZSTD_c_targetLength, cparams.targetLength);
|
||||||
ZSTD_CCtx_setParameter(g_cstream, ZSTD_p_compressionStrategy, cparams.strategy);
|
ZSTD_CCtx_setParameter(g_cstream, ZSTD_c_compressionStrategy, cparams.strategy);
|
||||||
|
|
||||||
/* Preparation */
|
/* Preparation */
|
||||||
switch(benchNb)
|
switch(benchNb)
|
||||||
|
|||||||
+16
-16
@@ -60,25 +60,25 @@ ZSTD_parameters FUZZ_randomParams(size_t srcSize, uint32_t *state)
|
|||||||
void FUZZ_setRandomParameters(ZSTD_CCtx *cctx, size_t srcSize, uint32_t *state)
|
void FUZZ_setRandomParameters(ZSTD_CCtx *cctx, size_t srcSize, uint32_t *state)
|
||||||
{
|
{
|
||||||
ZSTD_compressionParameters cParams = FUZZ_randomCParams(srcSize, state);
|
ZSTD_compressionParameters cParams = FUZZ_randomCParams(srcSize, state);
|
||||||
set(cctx, ZSTD_p_windowLog, cParams.windowLog);
|
set(cctx, ZSTD_c_windowLog, cParams.windowLog);
|
||||||
set(cctx, ZSTD_p_hashLog, cParams.hashLog);
|
set(cctx, ZSTD_c_hashLog, cParams.hashLog);
|
||||||
set(cctx, ZSTD_p_chainLog, cParams.chainLog);
|
set(cctx, ZSTD_c_chainLog, cParams.chainLog);
|
||||||
set(cctx, ZSTD_p_searchLog, cParams.searchLog);
|
set(cctx, ZSTD_c_searchLog, cParams.searchLog);
|
||||||
set(cctx, ZSTD_p_minMatch, cParams.minMatch);
|
set(cctx, ZSTD_c_minMatch, cParams.minMatch);
|
||||||
set(cctx, ZSTD_p_targetLength, cParams.targetLength);
|
set(cctx, ZSTD_c_targetLength, cParams.targetLength);
|
||||||
set(cctx, ZSTD_p_compressionStrategy, cParams.strategy);
|
set(cctx, ZSTD_c_compressionStrategy, cParams.strategy);
|
||||||
/* Select frame parameters */
|
/* Select frame parameters */
|
||||||
setRand(cctx, ZSTD_p_contentSizeFlag, 0, 1, state);
|
setRand(cctx, ZSTD_c_contentSizeFlag, 0, 1, state);
|
||||||
setRand(cctx, ZSTD_p_checksumFlag, 0, 1, state);
|
setRand(cctx, ZSTD_c_checksumFlag, 0, 1, state);
|
||||||
setRand(cctx, ZSTD_p_dictIDFlag, 0, 1, state);
|
setRand(cctx, ZSTD_c_dictIDFlag, 0, 1, state);
|
||||||
setRand(cctx, ZSTD_p_forceAttachDict, 0, 2, state);
|
setRand(cctx, ZSTD_c_forceAttachDict, 0, 2, state);
|
||||||
/* Select long distance matchig parameters */
|
/* Select long distance matchig parameters */
|
||||||
setRand(cctx, ZSTD_p_enableLongDistanceMatching, 0, 1, state);
|
setRand(cctx, ZSTD_c_enableLongDistanceMatching, 0, 1, state);
|
||||||
setRand(cctx, ZSTD_p_ldmHashLog, ZSTD_HASHLOG_MIN, 16, state);
|
setRand(cctx, ZSTD_c_ldmHashLog, ZSTD_HASHLOG_MIN, 16, state);
|
||||||
setRand(cctx, ZSTD_p_ldmMinMatch, ZSTD_LDM_MINMATCH_MIN,
|
setRand(cctx, ZSTD_c_ldmMinMatch, ZSTD_LDM_MINMATCH_MIN,
|
||||||
ZSTD_LDM_MINMATCH_MAX, state);
|
ZSTD_LDM_MINMATCH_MAX, state);
|
||||||
setRand(cctx, ZSTD_p_ldmBucketSizeLog, 0, ZSTD_LDM_BUCKETSIZELOG_MAX,
|
setRand(cctx, ZSTD_c_ldmBucketSizeLog, 0, ZSTD_LDM_BUCKETSIZELOG_MAX,
|
||||||
state);
|
state);
|
||||||
setRand(cctx, ZSTD_p_ldmHashRateLog, ZSTD_LDM_HASHRATELOG_MIN,
|
setRand(cctx, ZSTD_c_ldmHashRateLog, ZSTD_LDM_HASHRATELOG_MIN,
|
||||||
ZSTD_LDM_HASHRATELOG_MAX, state);
|
ZSTD_LDM_HASHRATELOG_MAX, state);
|
||||||
}
|
}
|
||||||
|
|||||||
+26
-26
@@ -233,8 +233,8 @@ static int FUZ_mallocTests_internal(unsigned seed, double compressibility, unsig
|
|||||||
mallocCounter_t malcount = INIT_MALLOC_COUNTER;
|
mallocCounter_t malcount = INIT_MALLOC_COUNTER;
|
||||||
ZSTD_customMem const cMem = { FUZ_mallocDebug, FUZ_freeDebug, &malcount };
|
ZSTD_customMem const cMem = { FUZ_mallocDebug, FUZ_freeDebug, &malcount };
|
||||||
ZSTD_CCtx* const cctx = ZSTD_createCCtx_advanced(cMem);
|
ZSTD_CCtx* const cctx = ZSTD_createCCtx_advanced(cMem);
|
||||||
CHECK_Z( ZSTD_CCtx_setParameter(cctx, ZSTD_p_compressionLevel, compressionLevel) );
|
CHECK_Z( ZSTD_CCtx_setParameter(cctx, ZSTD_c_compressionLevel, compressionLevel) );
|
||||||
CHECK_Z( ZSTD_CCtx_setParameter(cctx, ZSTD_p_nbWorkers, nbThreads) );
|
CHECK_Z( ZSTD_CCtx_setParameter(cctx, ZSTD_c_nbWorkers, nbThreads) );
|
||||||
CHECK_Z( ZSTD_compress2(cctx, outBuffer, outSize, inBuffer, inSize) );
|
CHECK_Z( ZSTD_compress2(cctx, outBuffer, outSize, inBuffer, inSize) );
|
||||||
ZSTD_freeCCtx(cctx);
|
ZSTD_freeCCtx(cctx);
|
||||||
DISPLAYLEVEL(3, "compress_generic,-T%u,end level %i : ",
|
DISPLAYLEVEL(3, "compress_generic,-T%u,end level %i : ",
|
||||||
@@ -253,8 +253,8 @@ static int FUZ_mallocTests_internal(unsigned seed, double compressibility, unsig
|
|||||||
ZSTD_CCtx* const cctx = ZSTD_createCCtx_advanced(cMem);
|
ZSTD_CCtx* const cctx = ZSTD_createCCtx_advanced(cMem);
|
||||||
ZSTD_outBuffer out = { outBuffer, outSize, 0 };
|
ZSTD_outBuffer out = { outBuffer, outSize, 0 };
|
||||||
ZSTD_inBuffer in = { inBuffer, inSize, 0 };
|
ZSTD_inBuffer in = { inBuffer, inSize, 0 };
|
||||||
CHECK_Z( ZSTD_CCtx_setParameter(cctx, ZSTD_p_compressionLevel, compressionLevel) );
|
CHECK_Z( ZSTD_CCtx_setParameter(cctx, ZSTD_c_compressionLevel, compressionLevel) );
|
||||||
CHECK_Z( ZSTD_CCtx_setParameter(cctx, ZSTD_p_nbWorkers, nbThreads) );
|
CHECK_Z( ZSTD_CCtx_setParameter(cctx, ZSTD_c_nbWorkers, nbThreads) );
|
||||||
CHECK_Z( ZSTD_compressStream2(cctx, &out, &in, ZSTD_e_continue) );
|
CHECK_Z( ZSTD_compressStream2(cctx, &out, &in, ZSTD_e_continue) );
|
||||||
while ( ZSTD_compressStream2(cctx, &out, &in, ZSTD_e_end) ) {}
|
while ( ZSTD_compressStream2(cctx, &out, &in, ZSTD_e_end) ) {}
|
||||||
ZSTD_freeCCtx(cctx);
|
ZSTD_freeCCtx(cctx);
|
||||||
@@ -517,37 +517,37 @@ static int basicUnitTests(U32 seed, double compressibility)
|
|||||||
ZSTD_inBuffer in = {NULL, 0, 0};
|
ZSTD_inBuffer in = {NULL, 0, 0};
|
||||||
int value;
|
int value;
|
||||||
|
|
||||||
CHECK_Z(ZSTD_CCtx_getParameter(cctx, ZSTD_p_compressionLevel, &value));
|
CHECK_Z(ZSTD_CCtx_getParameter(cctx, ZSTD_c_compressionLevel, &value));
|
||||||
CHECK_EQ(value, 3);
|
CHECK_EQ(value, 3);
|
||||||
CHECK_Z(ZSTD_CCtx_getParameter(cctx, ZSTD_p_hashLog, &value));
|
CHECK_Z(ZSTD_CCtx_getParameter(cctx, ZSTD_c_hashLog, &value));
|
||||||
CHECK_EQ(value, 0);
|
CHECK_EQ(value, 0);
|
||||||
CHECK_Z(ZSTD_CCtx_setParameter(cctx, ZSTD_p_hashLog, ZSTD_HASHLOG_MIN));
|
CHECK_Z(ZSTD_CCtx_setParameter(cctx, ZSTD_c_hashLog, ZSTD_HASHLOG_MIN));
|
||||||
CHECK_Z(ZSTD_CCtx_getParameter(cctx, ZSTD_p_compressionLevel, &value));
|
CHECK_Z(ZSTD_CCtx_getParameter(cctx, ZSTD_c_compressionLevel, &value));
|
||||||
CHECK_EQ(value, 3);
|
CHECK_EQ(value, 3);
|
||||||
CHECK_Z(ZSTD_CCtx_getParameter(cctx, ZSTD_p_hashLog, &value));
|
CHECK_Z(ZSTD_CCtx_getParameter(cctx, ZSTD_c_hashLog, &value));
|
||||||
CHECK_EQ(value, ZSTD_HASHLOG_MIN);
|
CHECK_EQ(value, ZSTD_HASHLOG_MIN);
|
||||||
CHECK_Z(ZSTD_CCtx_setParameter(cctx, ZSTD_p_compressionLevel, 7));
|
CHECK_Z(ZSTD_CCtx_setParameter(cctx, ZSTD_c_compressionLevel, 7));
|
||||||
CHECK_Z(ZSTD_CCtx_getParameter(cctx, ZSTD_p_compressionLevel, &value));
|
CHECK_Z(ZSTD_CCtx_getParameter(cctx, ZSTD_c_compressionLevel, &value));
|
||||||
CHECK_EQ(value, 7);
|
CHECK_EQ(value, 7);
|
||||||
CHECK_Z(ZSTD_CCtx_getParameter(cctx, ZSTD_p_hashLog, &value));
|
CHECK_Z(ZSTD_CCtx_getParameter(cctx, ZSTD_c_hashLog, &value));
|
||||||
CHECK_EQ(value, ZSTD_HASHLOG_MIN);
|
CHECK_EQ(value, ZSTD_HASHLOG_MIN);
|
||||||
/* Start a compression job */
|
/* Start a compression job */
|
||||||
ZSTD_compressStream2(cctx, &out, &in, ZSTD_e_continue);
|
ZSTD_compressStream2(cctx, &out, &in, ZSTD_e_continue);
|
||||||
CHECK_Z(ZSTD_CCtx_getParameter(cctx, ZSTD_p_compressionLevel, &value));
|
CHECK_Z(ZSTD_CCtx_getParameter(cctx, ZSTD_c_compressionLevel, &value));
|
||||||
CHECK_EQ(value, 7);
|
CHECK_EQ(value, 7);
|
||||||
CHECK_Z(ZSTD_CCtx_getParameter(cctx, ZSTD_p_hashLog, &value));
|
CHECK_Z(ZSTD_CCtx_getParameter(cctx, ZSTD_c_hashLog, &value));
|
||||||
CHECK_EQ(value, ZSTD_HASHLOG_MIN);
|
CHECK_EQ(value, ZSTD_HASHLOG_MIN);
|
||||||
/* Reset the CCtx */
|
/* Reset the CCtx */
|
||||||
ZSTD_CCtx_reset(cctx, ZSTD_reset_session_only);
|
ZSTD_CCtx_reset(cctx, ZSTD_reset_session_only);
|
||||||
CHECK_Z(ZSTD_CCtx_getParameter(cctx, ZSTD_p_compressionLevel, &value));
|
CHECK_Z(ZSTD_CCtx_getParameter(cctx, ZSTD_c_compressionLevel, &value));
|
||||||
CHECK_EQ(value, 7);
|
CHECK_EQ(value, 7);
|
||||||
CHECK_Z(ZSTD_CCtx_getParameter(cctx, ZSTD_p_hashLog, &value));
|
CHECK_Z(ZSTD_CCtx_getParameter(cctx, ZSTD_c_hashLog, &value));
|
||||||
CHECK_EQ(value, ZSTD_HASHLOG_MIN);
|
CHECK_EQ(value, ZSTD_HASHLOG_MIN);
|
||||||
/* Reset the parameters */
|
/* Reset the parameters */
|
||||||
ZSTD_CCtx_reset(cctx, ZSTD_reset_parameters);
|
ZSTD_CCtx_reset(cctx, ZSTD_reset_parameters);
|
||||||
CHECK_Z(ZSTD_CCtx_getParameter(cctx, ZSTD_p_compressionLevel, &value));
|
CHECK_Z(ZSTD_CCtx_getParameter(cctx, ZSTD_c_compressionLevel, &value));
|
||||||
CHECK_EQ(value, 3);
|
CHECK_EQ(value, 3);
|
||||||
CHECK_Z(ZSTD_CCtx_getParameter(cctx, ZSTD_p_hashLog, &value));
|
CHECK_Z(ZSTD_CCtx_getParameter(cctx, ZSTD_c_hashLog, &value));
|
||||||
CHECK_EQ(value, 0);
|
CHECK_EQ(value, 0);
|
||||||
|
|
||||||
ZSTD_freeCCtx(cctx);
|
ZSTD_freeCCtx(cctx);
|
||||||
@@ -1285,7 +1285,7 @@ static int basicUnitTests(U32 seed, double compressibility)
|
|||||||
params);
|
params);
|
||||||
if (ZSTD_isError(cSize_1pass)) goto _output_error;
|
if (ZSTD_isError(cSize_1pass)) goto _output_error;
|
||||||
|
|
||||||
CHECK( ZSTD_CCtx_setParameter(cctx, ZSTD_p_compressionLevel, compressionLevel) );
|
CHECK( ZSTD_CCtx_setParameter(cctx, ZSTD_c_compressionLevel, compressionLevel) );
|
||||||
{ size_t const compressionResult = ZSTD_compress2(cctx,
|
{ size_t const compressionResult = ZSTD_compress2(cctx,
|
||||||
compressedBuffer, compressedBufferSize,
|
compressedBuffer, compressedBufferSize,
|
||||||
CNBuffer, srcSize);
|
CNBuffer, srcSize);
|
||||||
@@ -1304,9 +1304,9 @@ static int basicUnitTests(U32 seed, double compressibility)
|
|||||||
{ ZSTD_CCtx* const cctx = ZSTD_createCCtx();
|
{ ZSTD_CCtx* const cctx = ZSTD_createCCtx();
|
||||||
DISPLAYLEVEL(3, "test%3i : parameters in order : ", testNb++);
|
DISPLAYLEVEL(3, "test%3i : parameters in order : ", testNb++);
|
||||||
assert(cctx != NULL);
|
assert(cctx != NULL);
|
||||||
CHECK( ZSTD_CCtx_setParameter(cctx, ZSTD_p_compressionLevel, 2) );
|
CHECK( ZSTD_CCtx_setParameter(cctx, ZSTD_c_compressionLevel, 2) );
|
||||||
CHECK( ZSTD_CCtx_setParameter(cctx, ZSTD_p_enableLongDistanceMatching, 1) );
|
CHECK( ZSTD_CCtx_setParameter(cctx, ZSTD_c_enableLongDistanceMatching, 1) );
|
||||||
CHECK( ZSTD_CCtx_setParameter(cctx, ZSTD_p_windowLog, 18) );
|
CHECK( ZSTD_CCtx_setParameter(cctx, ZSTD_c_windowLog, 18) );
|
||||||
{ size_t const compressedSize = ZSTD_compress2(cctx,
|
{ size_t const compressedSize = ZSTD_compress2(cctx,
|
||||||
compressedBuffer, ZSTD_compressBound(inputSize),
|
compressedBuffer, ZSTD_compressBound(inputSize),
|
||||||
CNBuffer, inputSize);
|
CNBuffer, inputSize);
|
||||||
@@ -1320,9 +1320,9 @@ static int basicUnitTests(U32 seed, double compressibility)
|
|||||||
|
|
||||||
{ ZSTD_CCtx* cctx = ZSTD_createCCtx();
|
{ ZSTD_CCtx* cctx = ZSTD_createCCtx();
|
||||||
DISPLAYLEVEL(3, "test%3i : parameters disordered : ", testNb++);
|
DISPLAYLEVEL(3, "test%3i : parameters disordered : ", testNb++);
|
||||||
CHECK( ZSTD_CCtx_setParameter(cctx, ZSTD_p_windowLog, 18) );
|
CHECK( ZSTD_CCtx_setParameter(cctx, ZSTD_c_windowLog, 18) );
|
||||||
CHECK( ZSTD_CCtx_setParameter(cctx, ZSTD_p_enableLongDistanceMatching, 1) );
|
CHECK( ZSTD_CCtx_setParameter(cctx, ZSTD_c_enableLongDistanceMatching, 1) );
|
||||||
CHECK( ZSTD_CCtx_setParameter(cctx, ZSTD_p_compressionLevel, 2) );
|
CHECK( ZSTD_CCtx_setParameter(cctx, ZSTD_c_compressionLevel, 2) );
|
||||||
{ size_t const result = ZSTD_compress2(cctx,
|
{ size_t const result = ZSTD_compress2(cctx,
|
||||||
compressedBuffer, ZSTD_compressBound(inputSize),
|
compressedBuffer, ZSTD_compressBound(inputSize),
|
||||||
CNBuffer, inputSize);
|
CNBuffer, inputSize);
|
||||||
@@ -1375,7 +1375,7 @@ static int basicUnitTests(U32 seed, double compressibility)
|
|||||||
|
|
||||||
/* basic block compression */
|
/* basic block compression */
|
||||||
DISPLAYLEVEL(3, "test%3i : magic-less format test : ", testNb++);
|
DISPLAYLEVEL(3, "test%3i : magic-less format test : ", testNb++);
|
||||||
CHECK( ZSTD_CCtx_setParameter(cctx, ZSTD_p_format, ZSTD_f_zstd1_magicless) );
|
CHECK( ZSTD_CCtx_setParameter(cctx, ZSTD_c_format, ZSTD_f_zstd1_magicless) );
|
||||||
{ ZSTD_inBuffer in = { CNBuffer, inputSize, 0 };
|
{ ZSTD_inBuffer in = { CNBuffer, inputSize, 0 };
|
||||||
ZSTD_outBuffer out = { compressedBuffer, ZSTD_compressBound(inputSize), 0 };
|
ZSTD_outBuffer out = { compressedBuffer, ZSTD_compressBound(inputSize), 0 };
|
||||||
size_t const result = ZSTD_compressStream2(cctx, &out, &in, ZSTD_e_end);
|
size_t const result = ZSTD_compressStream2(cctx, &out, &in, ZSTD_e_end);
|
||||||
|
|||||||
+2
-2
@@ -128,7 +128,7 @@ static const U32 rangetable[NUM_PARAMS] =
|
|||||||
|
|
||||||
/* ZSTD_cctxSetParameter() index to set */
|
/* ZSTD_cctxSetParameter() index to set */
|
||||||
static const ZSTD_cParameter cctxSetParamTable[NUM_PARAMS] =
|
static const ZSTD_cParameter cctxSetParamTable[NUM_PARAMS] =
|
||||||
{ ZSTD_p_windowLog, ZSTD_p_chainLog, ZSTD_p_hashLog, ZSTD_p_searchLog, ZSTD_p_minMatch, ZSTD_p_targetLength, ZSTD_p_compressionStrategy, ZSTD_p_forceAttachDict };
|
{ ZSTD_c_windowLog, ZSTD_c_chainLog, ZSTD_c_hashLog, ZSTD_c_searchLog, ZSTD_c_minMatch, ZSTD_c_targetLength, ZSTD_c_compressionStrategy, ZSTD_c_forceAttachDict };
|
||||||
|
|
||||||
/* names of parameters */
|
/* names of parameters */
|
||||||
static const char* g_paramNames[NUM_PARAMS] =
|
static const char* g_paramNames[NUM_PARAMS] =
|
||||||
@@ -894,7 +894,7 @@ static size_t local_initCCtx(void* payload) {
|
|||||||
const BMK_initCCtxArgs* ag = (const BMK_initCCtxArgs*)payload;
|
const BMK_initCCtxArgs* ag = (const BMK_initCCtxArgs*)payload;
|
||||||
varInds_t i;
|
varInds_t i;
|
||||||
ZSTD_CCtx_reset(ag->cctx, ZSTD_reset_session_and_parameters);
|
ZSTD_CCtx_reset(ag->cctx, ZSTD_reset_session_and_parameters);
|
||||||
ZSTD_CCtx_setParameter(ag->cctx, ZSTD_p_compressionLevel, ag->cLevel);
|
ZSTD_CCtx_setParameter(ag->cctx, ZSTD_c_compressionLevel, ag->cLevel);
|
||||||
|
|
||||||
for(i = 0; i < NUM_PARAMS; i++) {
|
for(i = 0; i < NUM_PARAMS; i++) {
|
||||||
if(ag->comprParams->vals[i] != PARAM_UNSET)
|
if(ag->comprParams->vals[i] != PARAM_UNSET)
|
||||||
|
|||||||
@@ -93,9 +93,9 @@ static size_t cctxParamRoundTripTest(void* resultBuff, size_t resultBuffCapacity
|
|||||||
int const cLevel = h32 % maxClevel;
|
int const cLevel = h32 % maxClevel;
|
||||||
|
|
||||||
/* Set parameters */
|
/* Set parameters */
|
||||||
CHECK_Z( ZSTD_CCtxParam_setParameter(cctxParams, ZSTD_p_compressionLevel, cLevel) );
|
CHECK_Z( ZSTD_CCtxParam_setParameter(cctxParams, ZSTD_c_compressionLevel, cLevel) );
|
||||||
CHECK_Z( ZSTD_CCtxParam_setParameter(cctxParams, ZSTD_p_nbWorkers, 2) );
|
CHECK_Z( ZSTD_CCtxParam_setParameter(cctxParams, ZSTD_c_nbWorkers, 2) );
|
||||||
CHECK_Z( ZSTD_CCtxParam_setParameter(cctxParams, ZSTD_p_overlapSizeLog, 5) );
|
CHECK_Z( ZSTD_CCtxParam_setParameter(cctxParams, ZSTD_c_overlapSizeLog, 5) );
|
||||||
|
|
||||||
|
|
||||||
/* Apply parameters */
|
/* Apply parameters */
|
||||||
|
|||||||
+37
-37
@@ -224,18 +224,18 @@ static size_t SEQ_generateRoundTrip(ZSTD_CCtx* cctx, ZSTD_DCtx* dctx,
|
|||||||
static size_t getCCtxParams(ZSTD_CCtx* zc, ZSTD_parameters* savedParams)
|
static size_t getCCtxParams(ZSTD_CCtx* zc, ZSTD_parameters* savedParams)
|
||||||
{
|
{
|
||||||
int value;
|
int value;
|
||||||
CHECK_RET_Z(ZSTD_CCtx_getParameter(zc, ZSTD_p_windowLog, (int*)&savedParams->cParams.windowLog));
|
CHECK_RET_Z(ZSTD_CCtx_getParameter(zc, ZSTD_c_windowLog, (int*)&savedParams->cParams.windowLog));
|
||||||
CHECK_RET_Z(ZSTD_CCtx_getParameter(zc, ZSTD_p_hashLog, (int*)&savedParams->cParams.hashLog));
|
CHECK_RET_Z(ZSTD_CCtx_getParameter(zc, ZSTD_c_hashLog, (int*)&savedParams->cParams.hashLog));
|
||||||
CHECK_RET_Z(ZSTD_CCtx_getParameter(zc, ZSTD_p_chainLog, (int*)&savedParams->cParams.chainLog));
|
CHECK_RET_Z(ZSTD_CCtx_getParameter(zc, ZSTD_c_chainLog, (int*)&savedParams->cParams.chainLog));
|
||||||
CHECK_RET_Z(ZSTD_CCtx_getParameter(zc, ZSTD_p_searchLog, (int*)&savedParams->cParams.searchLog));
|
CHECK_RET_Z(ZSTD_CCtx_getParameter(zc, ZSTD_c_searchLog, (int*)&savedParams->cParams.searchLog));
|
||||||
CHECK_RET_Z(ZSTD_CCtx_getParameter(zc, ZSTD_p_minMatch, (int*)&savedParams->cParams.minMatch));
|
CHECK_RET_Z(ZSTD_CCtx_getParameter(zc, ZSTD_c_minMatch, (int*)&savedParams->cParams.minMatch));
|
||||||
CHECK_RET_Z(ZSTD_CCtx_getParameter(zc, ZSTD_p_targetLength, (int*)&savedParams->cParams.targetLength));
|
CHECK_RET_Z(ZSTD_CCtx_getParameter(zc, ZSTD_c_targetLength, (int*)&savedParams->cParams.targetLength));
|
||||||
CHECK_RET_Z(ZSTD_CCtx_getParameter(zc, ZSTD_p_compressionStrategy, &value));
|
CHECK_RET_Z(ZSTD_CCtx_getParameter(zc, ZSTD_c_compressionStrategy, &value));
|
||||||
savedParams->cParams.strategy = value;
|
savedParams->cParams.strategy = value;
|
||||||
|
|
||||||
CHECK_RET_Z(ZSTD_CCtx_getParameter(zc, ZSTD_p_checksumFlag, &savedParams->fParams.checksumFlag));
|
CHECK_RET_Z(ZSTD_CCtx_getParameter(zc, ZSTD_c_checksumFlag, &savedParams->fParams.checksumFlag));
|
||||||
CHECK_RET_Z(ZSTD_CCtx_getParameter(zc, ZSTD_p_contentSizeFlag, &savedParams->fParams.contentSizeFlag));
|
CHECK_RET_Z(ZSTD_CCtx_getParameter(zc, ZSTD_c_contentSizeFlag, &savedParams->fParams.contentSizeFlag));
|
||||||
CHECK_RET_Z(ZSTD_CCtx_getParameter(zc, ZSTD_p_dictIDFlag, &value));
|
CHECK_RET_Z(ZSTD_CCtx_getParameter(zc, ZSTD_c_dictIDFlag, &value));
|
||||||
savedParams->fParams.noDictIDFlag = !value;
|
savedParams->fParams.noDictIDFlag = !value;
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
@@ -868,9 +868,9 @@ static int basicUnitTests(U32 seed, double compressibility)
|
|||||||
const BYTE* const srcToCopy = (const BYTE*)CNBuffer + start;
|
const BYTE* const srcToCopy = (const BYTE*)CNBuffer + start;
|
||||||
BYTE* const dst = (BYTE*)CNBuffer + start - offset;
|
BYTE* const dst = (BYTE*)CNBuffer + start - offset;
|
||||||
DISPLAYLEVEL(3, "test%3i : compress %u bytes with multiple threads + dictionary : ", testNb++, (U32)srcSize);
|
DISPLAYLEVEL(3, "test%3i : compress %u bytes with multiple threads + dictionary : ", testNb++, (U32)srcSize);
|
||||||
CHECK_Z( ZSTD_CCtx_setParameter(zc, ZSTD_p_compressionLevel, 3) );
|
CHECK_Z( ZSTD_CCtx_setParameter(zc, ZSTD_c_compressionLevel, 3) );
|
||||||
CHECK_Z( ZSTD_CCtx_setParameter(zc, ZSTD_p_nbWorkers, nbWorkers) );
|
CHECK_Z( ZSTD_CCtx_setParameter(zc, ZSTD_c_nbWorkers, nbWorkers) );
|
||||||
CHECK_Z( ZSTD_CCtx_setParameter(zc, ZSTD_p_jobSize, jobSize) );
|
CHECK_Z( ZSTD_CCtx_setParameter(zc, ZSTD_c_jobSize, jobSize) );
|
||||||
assert(start > offset);
|
assert(start > offset);
|
||||||
assert(start + segLength < COMPRESSIBLE_NOISE_LENGTH);
|
assert(start + segLength < COMPRESSIBLE_NOISE_LENGTH);
|
||||||
memcpy(dst, srcToCopy, segLength); /* create a long repetition at long distance for job 2 */
|
memcpy(dst, srcToCopy, segLength); /* create a long repetition at long distance for job 2 */
|
||||||
@@ -964,10 +964,10 @@ static int basicUnitTests(U32 seed, double compressibility)
|
|||||||
DISPLAYLEVEL(3, "test%3i : ZSTD_initCStream_srcSize sets requestedParams : ", testNb++);
|
DISPLAYLEVEL(3, "test%3i : ZSTD_initCStream_srcSize sets requestedParams : ", testNb++);
|
||||||
{ int level;
|
{ int level;
|
||||||
CHECK_Z(ZSTD_initCStream_srcSize(zc, 11, ZSTD_CONTENTSIZE_UNKNOWN));
|
CHECK_Z(ZSTD_initCStream_srcSize(zc, 11, ZSTD_CONTENTSIZE_UNKNOWN));
|
||||||
CHECK_Z(ZSTD_CCtx_getParameter(zc, ZSTD_p_compressionLevel, &level));
|
CHECK_Z(ZSTD_CCtx_getParameter(zc, ZSTD_c_compressionLevel, &level));
|
||||||
CHECK(level != 11, "Compression level does not match");
|
CHECK(level != 11, "Compression level does not match");
|
||||||
ZSTD_resetCStream(zc, ZSTD_CONTENTSIZE_UNKNOWN);
|
ZSTD_resetCStream(zc, ZSTD_CONTENTSIZE_UNKNOWN);
|
||||||
CHECK_Z(ZSTD_CCtx_getParameter(zc, ZSTD_p_compressionLevel, &level));
|
CHECK_Z(ZSTD_CCtx_getParameter(zc, ZSTD_c_compressionLevel, &level));
|
||||||
CHECK(level != 11, "Compression level does not match");
|
CHECK(level != 11, "Compression level does not match");
|
||||||
}
|
}
|
||||||
DISPLAYLEVEL(3, "OK \n");
|
DISPLAYLEVEL(3, "OK \n");
|
||||||
@@ -1079,7 +1079,7 @@ static int basicUnitTests(U32 seed, double compressibility)
|
|||||||
|
|
||||||
CHECK_Z(ZSTD_CCtx_reset(zc, ZSTD_reset_session_and_parameters));
|
CHECK_Z(ZSTD_CCtx_reset(zc, ZSTD_reset_session_and_parameters));
|
||||||
CHECK_Z(ZSTD_CCtx_refCDict(zc, cdict));
|
CHECK_Z(ZSTD_CCtx_refCDict(zc, cdict));
|
||||||
CHECK_Z(ZSTD_CCtx_setParameter(zc, ZSTD_p_checksumFlag, 1));
|
CHECK_Z(ZSTD_CCtx_setParameter(zc, ZSTD_c_checksumFlag, 1));
|
||||||
/* Write a bunch of 6 byte blocks */
|
/* Write a bunch of 6 byte blocks */
|
||||||
while (remainingInput > 0) {
|
while (remainingInput > 0) {
|
||||||
char testBuffer[6] = "\xAA\xAA\xAA\xAA\xAA\xAA";
|
char testBuffer[6] = "\xAA\xAA\xAA\xAA\xAA\xAA";
|
||||||
@@ -1817,7 +1817,7 @@ static int fuzzerTests_newAPI(U32 seed, U32 nbTests, unsigned startTest,
|
|||||||
if (maxTestSize >= srcBufferSize) maxTestSize = srcBufferSize-1;
|
if (maxTestSize >= srcBufferSize) maxTestSize = srcBufferSize-1;
|
||||||
{ int const compressionLevel = (FUZ_rand(&lseed) % 5) + 1;
|
{ int const compressionLevel = (FUZ_rand(&lseed) % 5) + 1;
|
||||||
DISPLAYLEVEL(5, "t%u : compression level : %i \n", testNb, compressionLevel);
|
DISPLAYLEVEL(5, "t%u : compression level : %i \n", testNb, compressionLevel);
|
||||||
CHECK_Z (setCCtxParameter(zc, cctxParams, ZSTD_p_compressionLevel, compressionLevel, opaqueAPI) );
|
CHECK_Z (setCCtxParameter(zc, cctxParams, ZSTD_c_compressionLevel, compressionLevel, opaqueAPI) );
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
U32 const testLog = FUZ_rand(&lseed) % maxSrcLog;
|
U32 const testLog = FUZ_rand(&lseed) % maxSrcLog;
|
||||||
@@ -1857,39 +1857,39 @@ static int fuzzerTests_newAPI(U32 seed, U32 nbTests, unsigned startTest,
|
|||||||
|
|
||||||
if (FUZ_rand(&lseed) & 1) {
|
if (FUZ_rand(&lseed) & 1) {
|
||||||
DISPLAYLEVEL(5, "t%u: windowLog : %u \n", testNb, cParams.windowLog);
|
DISPLAYLEVEL(5, "t%u: windowLog : %u \n", testNb, cParams.windowLog);
|
||||||
CHECK_Z( setCCtxParameter(zc, cctxParams, ZSTD_p_windowLog, cParams.windowLog, opaqueAPI) );
|
CHECK_Z( setCCtxParameter(zc, cctxParams, ZSTD_c_windowLog, cParams.windowLog, opaqueAPI) );
|
||||||
assert(cParams.windowLog >= ZSTD_WINDOWLOG_MIN); /* guaranteed by ZSTD_adjustCParams() */
|
assert(cParams.windowLog >= ZSTD_WINDOWLOG_MIN); /* guaranteed by ZSTD_adjustCParams() */
|
||||||
windowLogMalus = (cParams.windowLog - ZSTD_WINDOWLOG_MIN) / 5;
|
windowLogMalus = (cParams.windowLog - ZSTD_WINDOWLOG_MIN) / 5;
|
||||||
}
|
}
|
||||||
if (FUZ_rand(&lseed) & 1) {
|
if (FUZ_rand(&lseed) & 1) {
|
||||||
DISPLAYLEVEL(5, "t%u: hashLog : %u \n", testNb, cParams.hashLog);
|
DISPLAYLEVEL(5, "t%u: hashLog : %u \n", testNb, cParams.hashLog);
|
||||||
CHECK_Z( setCCtxParameter(zc, cctxParams, ZSTD_p_hashLog, cParams.hashLog, opaqueAPI) );
|
CHECK_Z( setCCtxParameter(zc, cctxParams, ZSTD_c_hashLog, cParams.hashLog, opaqueAPI) );
|
||||||
}
|
}
|
||||||
if (FUZ_rand(&lseed) & 1) {
|
if (FUZ_rand(&lseed) & 1) {
|
||||||
DISPLAYLEVEL(5, "t%u: chainLog : %u \n", testNb, cParams.chainLog);
|
DISPLAYLEVEL(5, "t%u: chainLog : %u \n", testNb, cParams.chainLog);
|
||||||
CHECK_Z( setCCtxParameter(zc, cctxParams, ZSTD_p_chainLog, cParams.chainLog, opaqueAPI) );
|
CHECK_Z( setCCtxParameter(zc, cctxParams, ZSTD_c_chainLog, cParams.chainLog, opaqueAPI) );
|
||||||
}
|
}
|
||||||
if (FUZ_rand(&lseed) & 1) CHECK_Z( setCCtxParameter(zc, cctxParams, ZSTD_p_searchLog, cParams.searchLog, opaqueAPI) );
|
if (FUZ_rand(&lseed) & 1) CHECK_Z( setCCtxParameter(zc, cctxParams, ZSTD_c_searchLog, cParams.searchLog, opaqueAPI) );
|
||||||
if (FUZ_rand(&lseed) & 1) CHECK_Z( setCCtxParameter(zc, cctxParams, ZSTD_p_minMatch, cParams.minMatch, opaqueAPI) );
|
if (FUZ_rand(&lseed) & 1) CHECK_Z( setCCtxParameter(zc, cctxParams, ZSTD_c_minMatch, cParams.minMatch, opaqueAPI) );
|
||||||
if (FUZ_rand(&lseed) & 1) CHECK_Z( setCCtxParameter(zc, cctxParams, ZSTD_p_targetLength, cParams.targetLength, opaqueAPI) );
|
if (FUZ_rand(&lseed) & 1) CHECK_Z( setCCtxParameter(zc, cctxParams, ZSTD_c_targetLength, cParams.targetLength, opaqueAPI) );
|
||||||
|
|
||||||
/* mess with long distance matching parameters */
|
/* mess with long distance matching parameters */
|
||||||
if (bigTests) {
|
if (bigTests) {
|
||||||
if (FUZ_rand(&lseed) & 1) CHECK_Z( setCCtxParameter(zc, cctxParams, ZSTD_p_enableLongDistanceMatching, FUZ_rand(&lseed) & 63, opaqueAPI) );
|
if (FUZ_rand(&lseed) & 1) CHECK_Z( setCCtxParameter(zc, cctxParams, ZSTD_c_enableLongDistanceMatching, FUZ_rand(&lseed) & 63, opaqueAPI) );
|
||||||
if (FUZ_rand(&lseed) & 3) CHECK_Z( setCCtxParameter(zc, cctxParams, ZSTD_p_ldmHashLog, FUZ_randomClampedLength(&lseed, ZSTD_HASHLOG_MIN, 23), opaqueAPI) );
|
if (FUZ_rand(&lseed) & 3) CHECK_Z( setCCtxParameter(zc, cctxParams, ZSTD_c_ldmHashLog, FUZ_randomClampedLength(&lseed, ZSTD_HASHLOG_MIN, 23), opaqueAPI) );
|
||||||
if (FUZ_rand(&lseed) & 3) CHECK_Z( setCCtxParameter(zc, cctxParams, ZSTD_p_ldmMinMatch, FUZ_randomClampedLength(&lseed, ZSTD_LDM_MINMATCH_MIN, ZSTD_LDM_MINMATCH_MAX), opaqueAPI) );
|
if (FUZ_rand(&lseed) & 3) CHECK_Z( setCCtxParameter(zc, cctxParams, ZSTD_c_ldmMinMatch, FUZ_randomClampedLength(&lseed, ZSTD_LDM_MINMATCH_MIN, ZSTD_LDM_MINMATCH_MAX), opaqueAPI) );
|
||||||
if (FUZ_rand(&lseed) & 3) CHECK_Z( setCCtxParameter(zc, cctxParams, ZSTD_p_ldmBucketSizeLog, FUZ_randomClampedLength(&lseed, ZSTD_LDM_BUCKETSIZELOG_MIN, ZSTD_LDM_BUCKETSIZELOG_MAX), opaqueAPI) );
|
if (FUZ_rand(&lseed) & 3) CHECK_Z( setCCtxParameter(zc, cctxParams, ZSTD_c_ldmBucketSizeLog, FUZ_randomClampedLength(&lseed, ZSTD_LDM_BUCKETSIZELOG_MIN, ZSTD_LDM_BUCKETSIZELOG_MAX), opaqueAPI) );
|
||||||
if (FUZ_rand(&lseed) & 3) CHECK_Z( setCCtxParameter(zc, cctxParams, ZSTD_p_ldmHashRateLog, FUZ_randomClampedLength(&lseed, ZSTD_LDM_HASHRATELOG_MIN, ZSTD_LDM_HASHRATELOG_MAX), opaqueAPI) );
|
if (FUZ_rand(&lseed) & 3) CHECK_Z( setCCtxParameter(zc, cctxParams, ZSTD_c_ldmHashRateLog, FUZ_randomClampedLength(&lseed, ZSTD_LDM_HASHRATELOG_MIN, ZSTD_LDM_HASHRATELOG_MAX), opaqueAPI) );
|
||||||
}
|
}
|
||||||
|
|
||||||
/* mess with frame parameters */
|
/* mess with frame parameters */
|
||||||
if (FUZ_rand(&lseed) & 1) {
|
if (FUZ_rand(&lseed) & 1) {
|
||||||
U32 const checksumFlag = FUZ_rand(&lseed) & 1;
|
U32 const checksumFlag = FUZ_rand(&lseed) & 1;
|
||||||
DISPLAYLEVEL(5, "t%u: frame checksum : %u \n", testNb, checksumFlag);
|
DISPLAYLEVEL(5, "t%u: frame checksum : %u \n", testNb, checksumFlag);
|
||||||
CHECK_Z( setCCtxParameter(zc, cctxParams, ZSTD_p_checksumFlag, checksumFlag, opaqueAPI) );
|
CHECK_Z( setCCtxParameter(zc, cctxParams, ZSTD_c_checksumFlag, checksumFlag, opaqueAPI) );
|
||||||
}
|
}
|
||||||
if (FUZ_rand(&lseed) & 1) CHECK_Z( setCCtxParameter(zc, cctxParams, ZSTD_p_dictIDFlag, FUZ_rand(&lseed) & 1, opaqueAPI) );
|
if (FUZ_rand(&lseed) & 1) CHECK_Z( setCCtxParameter(zc, cctxParams, ZSTD_c_dictIDFlag, FUZ_rand(&lseed) & 1, opaqueAPI) );
|
||||||
if (FUZ_rand(&lseed) & 1) CHECK_Z( setCCtxParameter(zc, cctxParams, ZSTD_p_contentSizeFlag, FUZ_rand(&lseed) & 1, opaqueAPI) );
|
if (FUZ_rand(&lseed) & 1) CHECK_Z( setCCtxParameter(zc, cctxParams, ZSTD_c_contentSizeFlag, FUZ_rand(&lseed) & 1, opaqueAPI) );
|
||||||
if (FUZ_rand(&lseed) & 1) {
|
if (FUZ_rand(&lseed) & 1) {
|
||||||
DISPLAYLEVEL(5, "t%u: pledgedSrcSize : %u \n", testNb, (U32)pledgedSrcSize);
|
DISPLAYLEVEL(5, "t%u: pledgedSrcSize : %u \n", testNb, (U32)pledgedSrcSize);
|
||||||
CHECK_Z( ZSTD_CCtx_setPledgedSrcSize(zc, pledgedSrcSize) );
|
CHECK_Z( ZSTD_CCtx_setPledgedSrcSize(zc, pledgedSrcSize) );
|
||||||
@@ -1901,17 +1901,17 @@ static int fuzzerTests_newAPI(U32 seed, U32 nbTests, unsigned startTest,
|
|||||||
U32 const nbThreadsAdjusted = (windowLogMalus < nbThreadsCandidate) ? nbThreadsCandidate - windowLogMalus : 1;
|
U32 const nbThreadsAdjusted = (windowLogMalus < nbThreadsCandidate) ? nbThreadsCandidate - windowLogMalus : 1;
|
||||||
U32 const nbThreads = MIN(nbThreadsAdjusted, nbThreadsMax);
|
U32 const nbThreads = MIN(nbThreadsAdjusted, nbThreadsMax);
|
||||||
DISPLAYLEVEL(5, "t%u: nbThreads : %u \n", testNb, nbThreads);
|
DISPLAYLEVEL(5, "t%u: nbThreads : %u \n", testNb, nbThreads);
|
||||||
CHECK_Z( setCCtxParameter(zc, cctxParams, ZSTD_p_nbWorkers, nbThreads, opaqueAPI) );
|
CHECK_Z( setCCtxParameter(zc, cctxParams, ZSTD_c_nbWorkers, nbThreads, opaqueAPI) );
|
||||||
if (nbThreads > 1) {
|
if (nbThreads > 1) {
|
||||||
U32 const jobLog = FUZ_rand(&lseed) % (testLog+1);
|
U32 const jobLog = FUZ_rand(&lseed) % (testLog+1);
|
||||||
CHECK_Z( setCCtxParameter(zc, cctxParams, ZSTD_p_overlapSizeLog, FUZ_rand(&lseed) % 10, opaqueAPI) );
|
CHECK_Z( setCCtxParameter(zc, cctxParams, ZSTD_c_overlapSizeLog, FUZ_rand(&lseed) % 10, opaqueAPI) );
|
||||||
CHECK_Z( setCCtxParameter(zc, cctxParams, ZSTD_p_jobSize, (U32)FUZ_rLogLength(&lseed, jobLog), opaqueAPI) );
|
CHECK_Z( setCCtxParameter(zc, cctxParams, ZSTD_c_jobSize, (U32)FUZ_rLogLength(&lseed, jobLog), opaqueAPI) );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
/* Enable rsyncable mode 1 in 4 times. */
|
/* Enable rsyncable mode 1 in 4 times. */
|
||||||
setCCtxParameter(zc, cctxParams, ZSTD_p_rsyncable, (FUZ_rand(&lseed) % 4 == 0), opaqueAPI);
|
setCCtxParameter(zc, cctxParams, ZSTD_c_rsyncable, (FUZ_rand(&lseed) % 4 == 0), opaqueAPI);
|
||||||
|
|
||||||
if (FUZ_rand(&lseed) & 1) CHECK_Z( setCCtxParameter(zc, cctxParams, ZSTD_p_forceMaxWindow, FUZ_rand(&lseed) & 1, opaqueAPI) );
|
if (FUZ_rand(&lseed) & 1) CHECK_Z( setCCtxParameter(zc, cctxParams, ZSTD_c_forceMaxWindow, FUZ_rand(&lseed) & 1, opaqueAPI) );
|
||||||
|
|
||||||
/* Apply parameters */
|
/* Apply parameters */
|
||||||
if (opaqueAPI) {
|
if (opaqueAPI) {
|
||||||
@@ -1931,7 +1931,7 @@ static int fuzzerTests_newAPI(U32 seed, U32 nbTests, unsigned startTest,
|
|||||||
size_t const setError = ZSTD_CCtx_setParametersUsingCCtxParams(zc, cctxParams);
|
size_t const setError = ZSTD_CCtx_setParametersUsingCCtxParams(zc, cctxParams);
|
||||||
CHECK(!ZSTD_isError(setError), "ZSTD_CCtx_setParametersUsingCCtxParams should have failed");
|
CHECK(!ZSTD_isError(setError), "ZSTD_CCtx_setParametersUsingCCtxParams should have failed");
|
||||||
} else {
|
} else {
|
||||||
size_t const setError = ZSTD_CCtx_setParameter(zc, ZSTD_p_windowLog, cParams.windowLog-1);
|
size_t const setError = ZSTD_CCtx_setParameter(zc, ZSTD_c_windowLog, cParams.windowLog-1);
|
||||||
CHECK(!ZSTD_isError(setError), "ZSTD_CCtx_setParameter should have failed");
|
CHECK(!ZSTD_isError(setError), "ZSTD_CCtx_setParameter should have failed");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user