mirror of
https://github.com/facebook/zstd.git
synced 2024-11-23 16:56:46 +08:00
change experimental parameter name
from ZSTD_c_useBlockSplitter to ZSTD_c_splitAfterSequences.
This commit is contained in:
parent
4f93206d62
commit
bbaba45589
@ -598,7 +598,7 @@ ZSTD_bounds ZSTD_cParam_getBounds(ZSTD_cParameter param)
|
|||||||
bounds.upperBound = 1;
|
bounds.upperBound = 1;
|
||||||
return bounds;
|
return bounds;
|
||||||
|
|
||||||
case ZSTD_c_useBlockSplitter:
|
case ZSTD_c_splitAfterSequences:
|
||||||
bounds.lowerBound = (int)ZSTD_ps_auto;
|
bounds.lowerBound = (int)ZSTD_ps_auto;
|
||||||
bounds.upperBound = (int)ZSTD_ps_disable;
|
bounds.upperBound = (int)ZSTD_ps_disable;
|
||||||
return bounds;
|
return bounds;
|
||||||
@ -701,7 +701,7 @@ static int ZSTD_isUpdateAuthorized(ZSTD_cParameter param)
|
|||||||
case ZSTD_c_stableOutBuffer:
|
case ZSTD_c_stableOutBuffer:
|
||||||
case ZSTD_c_blockDelimiters:
|
case ZSTD_c_blockDelimiters:
|
||||||
case ZSTD_c_validateSequences:
|
case ZSTD_c_validateSequences:
|
||||||
case ZSTD_c_useBlockSplitter:
|
case ZSTD_c_splitAfterSequences:
|
||||||
case ZSTD_c_useRowMatchFinder:
|
case ZSTD_c_useRowMatchFinder:
|
||||||
case ZSTD_c_deterministicRefPrefix:
|
case ZSTD_c_deterministicRefPrefix:
|
||||||
case ZSTD_c_prefetchCDictTables:
|
case ZSTD_c_prefetchCDictTables:
|
||||||
@ -760,7 +760,7 @@ size_t ZSTD_CCtx_setParameter(ZSTD_CCtx* cctx, ZSTD_cParameter param, int value)
|
|||||||
case ZSTD_c_stableOutBuffer:
|
case ZSTD_c_stableOutBuffer:
|
||||||
case ZSTD_c_blockDelimiters:
|
case ZSTD_c_blockDelimiters:
|
||||||
case ZSTD_c_validateSequences:
|
case ZSTD_c_validateSequences:
|
||||||
case ZSTD_c_useBlockSplitter:
|
case ZSTD_c_splitAfterSequences:
|
||||||
case ZSTD_c_blockSplitterLevel:
|
case ZSTD_c_blockSplitterLevel:
|
||||||
case ZSTD_c_useRowMatchFinder:
|
case ZSTD_c_useRowMatchFinder:
|
||||||
case ZSTD_c_deterministicRefPrefix:
|
case ZSTD_c_deterministicRefPrefix:
|
||||||
@ -982,8 +982,8 @@ size_t ZSTD_CCtxParams_setParameter(ZSTD_CCtx_params* CCtxParams,
|
|||||||
CCtxParams->validateSequences = value;
|
CCtxParams->validateSequences = value;
|
||||||
return (size_t)CCtxParams->validateSequences;
|
return (size_t)CCtxParams->validateSequences;
|
||||||
|
|
||||||
case ZSTD_c_useBlockSplitter:
|
case ZSTD_c_splitAfterSequences:
|
||||||
BOUNDCHECK(ZSTD_c_useBlockSplitter, value);
|
BOUNDCHECK(ZSTD_c_splitAfterSequences, value);
|
||||||
CCtxParams->postBlockSplitter = (ZSTD_paramSwitch_e)value;
|
CCtxParams->postBlockSplitter = (ZSTD_paramSwitch_e)value;
|
||||||
return CCtxParams->postBlockSplitter;
|
return CCtxParams->postBlockSplitter;
|
||||||
|
|
||||||
@ -1147,7 +1147,7 @@ size_t ZSTD_CCtxParams_getParameter(
|
|||||||
case ZSTD_c_validateSequences :
|
case ZSTD_c_validateSequences :
|
||||||
*value = (int)CCtxParams->validateSequences;
|
*value = (int)CCtxParams->validateSequences;
|
||||||
break;
|
break;
|
||||||
case ZSTD_c_useBlockSplitter :
|
case ZSTD_c_splitAfterSequences :
|
||||||
*value = (int)CCtxParams->postBlockSplitter;
|
*value = (int)CCtxParams->postBlockSplitter;
|
||||||
break;
|
break;
|
||||||
case ZSTD_c_blockSplitterLevel :
|
case ZSTD_c_blockSplitterLevel :
|
||||||
|
51
lib/zstd.h
51
lib/zstd.h
@ -491,12 +491,12 @@ typedef enum {
|
|||||||
* ZSTD_c_stableOutBuffer
|
* ZSTD_c_stableOutBuffer
|
||||||
* ZSTD_c_blockDelimiters
|
* ZSTD_c_blockDelimiters
|
||||||
* ZSTD_c_validateSequences
|
* ZSTD_c_validateSequences
|
||||||
* ZSTD_c_useBlockSplitter
|
* ZSTD_c_blockSplitterLevel
|
||||||
|
* ZSTD_c_splitAfterSequences
|
||||||
* ZSTD_c_useRowMatchFinder
|
* ZSTD_c_useRowMatchFinder
|
||||||
* ZSTD_c_prefetchCDictTables
|
* ZSTD_c_prefetchCDictTables
|
||||||
* ZSTD_c_enableSeqProducerFallback
|
* ZSTD_c_enableSeqProducerFallback
|
||||||
* ZSTD_c_maxBlockSize
|
* ZSTD_c_maxBlockSize
|
||||||
* ZSTD_c_blockSplitterLevel
|
|
||||||
* 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;
|
||||||
* also, the enums values themselves are unstable and can still change.
|
* also, the enums values themselves are unstable and can still change.
|
||||||
@ -2150,8 +2150,32 @@ ZSTDLIB_STATIC_API size_t ZSTD_CCtx_refPrefix_advanced(ZSTD_CCtx* cctx, const vo
|
|||||||
*/
|
*/
|
||||||
#define ZSTD_c_validateSequences ZSTD_c_experimentalParam12
|
#define ZSTD_c_validateSequences ZSTD_c_experimentalParam12
|
||||||
|
|
||||||
/* ZSTD_c_useBlockSplitter
|
/* ZSTD_c_blockSplitterLevel
|
||||||
* Controlled with ZSTD_paramSwitch_e enum.
|
* note: this parameter only influences the first splitter stage,
|
||||||
|
* which is active before producing the sequences.
|
||||||
|
* ZSTD_c_splitAfterSequences controls the next splitter stage,
|
||||||
|
* which is active after sequence production.
|
||||||
|
* Note that both can be combined.
|
||||||
|
* Allowed values are between 0 and ZSTD_BLOCKSPLITTER_LEVEL_MAX included.
|
||||||
|
* 0 means "auto", which will select a value depending on current ZSTD_c_strategy.
|
||||||
|
* 1 means no splitting.
|
||||||
|
* Then, values from 2 to 6 are sorted in increasing cpu load order.
|
||||||
|
*
|
||||||
|
* Note that currently the first block is never split,
|
||||||
|
* to ensure expansion guarantees in presence of incompressible data.
|
||||||
|
*/
|
||||||
|
#define ZSTD_BLOCKSPLITTER_LEVEL_MAX 6
|
||||||
|
#define ZSTD_c_blockSplitterLevel ZSTD_c_experimentalParam20
|
||||||
|
|
||||||
|
/* ZSTD_c_splitAfterSequences
|
||||||
|
* This is a stronger splitter algorithm,
|
||||||
|
* based on actual sequences previously produced by the selected parser.
|
||||||
|
* It's also slower, and as a consequence, mostly used for high compression levels.
|
||||||
|
* While the post-splitter does overlap with the pre-splitter,
|
||||||
|
* both can nonetheless be combined,
|
||||||
|
* notably with ZSTD_c_blockSplitterLevel at ZSTD_BLOCKSPLITTER_LEVEL_MAX,
|
||||||
|
* resulting in higher compression ratio than just one of them.
|
||||||
|
*
|
||||||
* Default is ZSTD_ps_auto.
|
* Default is ZSTD_ps_auto.
|
||||||
* Set to ZSTD_ps_disable to never use block splitter.
|
* Set to ZSTD_ps_disable to never use block splitter.
|
||||||
* Set to ZSTD_ps_enable to always use block splitter.
|
* Set to ZSTD_ps_enable to always use block splitter.
|
||||||
@ -2159,7 +2183,7 @@ ZSTDLIB_STATIC_API size_t ZSTD_CCtx_refPrefix_advanced(ZSTD_CCtx* cctx, const vo
|
|||||||
* By default, in ZSTD_ps_auto, the library will decide at runtime whether to use
|
* By default, in ZSTD_ps_auto, the library will decide at runtime whether to use
|
||||||
* block splitting based on the compression parameters.
|
* block splitting based on the compression parameters.
|
||||||
*/
|
*/
|
||||||
#define ZSTD_c_useBlockSplitter ZSTD_c_experimentalParam13
|
#define ZSTD_c_splitAfterSequences ZSTD_c_experimentalParam13
|
||||||
|
|
||||||
/* ZSTD_c_useRowMatchFinder
|
/* ZSTD_c_useRowMatchFinder
|
||||||
* Controlled with ZSTD_paramSwitch_e enum.
|
* Controlled with ZSTD_paramSwitch_e enum.
|
||||||
@ -2265,23 +2289,6 @@ ZSTDLIB_STATIC_API size_t ZSTD_CCtx_refPrefix_advanced(ZSTD_CCtx* cctx, const vo
|
|||||||
*/
|
*/
|
||||||
#define ZSTD_c_searchForExternalRepcodes ZSTD_c_experimentalParam19
|
#define ZSTD_c_searchForExternalRepcodes ZSTD_c_experimentalParam19
|
||||||
|
|
||||||
/* ZSTD_c_blockSplitterLevel
|
|
||||||
* note: this parameter only influences the first splitter stage,
|
|
||||||
* which is active before producing the sequences.
|
|
||||||
* ZSTD_c_useBlockSplitter influence the next splitter stage,
|
|
||||||
* which is active after sequence production,
|
|
||||||
* and is more accurate but also slower.
|
|
||||||
* Both can be combined.
|
|
||||||
* Allowed values are between 0 and 6.
|
|
||||||
* 0 means "auto", which will select a value depending on current ZSTD_c_strategy.
|
|
||||||
* 1 means no splitting.
|
|
||||||
* Then, values from 2 to 6 are sorted in increasing cpu load order.
|
|
||||||
*
|
|
||||||
* Note that currently the first block is never split,
|
|
||||||
* to ensure expansion guarantees in presence of incompressible data.
|
|
||||||
*/
|
|
||||||
#define ZSTD_BLOCKSPLITTER_LEVEL_MAX 6
|
|
||||||
#define ZSTD_c_blockSplitterLevel ZSTD_c_experimentalParam20
|
|
||||||
|
|
||||||
/*! ZSTD_CCtx_getParameter() :
|
/*! ZSTD_CCtx_getParameter() :
|
||||||
* Get the requested compression parameter value, selected by enum ZSTD_cParameter,
|
* Get the requested compression parameter value, selected by enum ZSTD_cParameter,
|
||||||
|
@ -140,7 +140,8 @@ void FUZZ_setRandomParameters(ZSTD_CCtx *cctx, size_t srcSize, FUZZ_dataProducer
|
|||||||
setRand(cctx, ZSTD_c_forceMaxWindow, 0, 1, producer);
|
setRand(cctx, ZSTD_c_forceMaxWindow, 0, 1, producer);
|
||||||
setRand(cctx, ZSTD_c_literalCompressionMode, 0, 2, producer);
|
setRand(cctx, ZSTD_c_literalCompressionMode, 0, 2, producer);
|
||||||
setRand(cctx, ZSTD_c_forceAttachDict, 0, 2, producer);
|
setRand(cctx, ZSTD_c_forceAttachDict, 0, 2, producer);
|
||||||
setRand(cctx, ZSTD_c_useBlockSplitter, 0, 2, producer);
|
setRand(cctx, ZSTD_c_blockSplitterLevel, 0, ZSTD_BLOCKSPLITTER_LEVEL_MAX, producer);
|
||||||
|
setRand(cctx, ZSTD_c_splitAfterSequences, 0, 2, producer);
|
||||||
setRand(cctx, ZSTD_c_deterministicRefPrefix, 0, 1, producer);
|
setRand(cctx, ZSTD_c_deterministicRefPrefix, 0, 1, producer);
|
||||||
setRand(cctx, ZSTD_c_prefetchCDictTables, 0, 2, producer);
|
setRand(cctx, ZSTD_c_prefetchCDictTables, 0, 2, producer);
|
||||||
setRand(cctx, ZSTD_c_maxBlockSize, ZSTD_BLOCKSIZE_MAX_MIN, ZSTD_BLOCKSIZE_MAX, producer);
|
setRand(cctx, ZSTD_c_maxBlockSize, ZSTD_BLOCKSIZE_MAX_MIN, ZSTD_BLOCKSIZE_MAX, producer);
|
||||||
|
@ -1420,7 +1420,7 @@ static int basicUnitTests(U32 const seed, double compressibility)
|
|||||||
|
|
||||||
CHECK_Z(ZSTD_CCtx_setParameter(cctx, ZSTD_c_compressionLevel, 19));
|
CHECK_Z(ZSTD_CCtx_setParameter(cctx, ZSTD_c_compressionLevel, 19));
|
||||||
CHECK_Z(ZSTD_CCtx_setParameter(cctx, ZSTD_c_minMatch, 7));
|
CHECK_Z(ZSTD_CCtx_setParameter(cctx, ZSTD_c_minMatch, 7));
|
||||||
CHECK_Z(ZSTD_CCtx_setParameter(cctx, ZSTD_c_useBlockSplitter, ZSTD_ps_enable));
|
CHECK_Z(ZSTD_CCtx_setParameter(cctx, ZSTD_c_splitAfterSequences, ZSTD_ps_enable));
|
||||||
|
|
||||||
cSize = ZSTD_compress2(cctx, compressedBuffer, compressedBufferSize, data, srcSize);
|
cSize = ZSTD_compress2(cctx, compressedBuffer, compressedBufferSize, data, srcSize);
|
||||||
CHECK_Z(cSize);
|
CHECK_Z(cSize);
|
||||||
@ -1737,8 +1737,8 @@ static int basicUnitTests(U32 const seed, double compressibility)
|
|||||||
{ ZSTD_CCtx* const cctx = ZSTD_createCCtx();
|
{ ZSTD_CCtx* const cctx = ZSTD_createCCtx();
|
||||||
int value;
|
int value;
|
||||||
ZSTD_compressionParameters cparams = ZSTD_getCParams(1, 0, 0);
|
ZSTD_compressionParameters cparams = ZSTD_getCParams(1, 0, 0);
|
||||||
cparams.strategy = -1;
|
cparams.strategy = (ZSTD_strategy)-1; /* set invalid value, on purpose */
|
||||||
/* Set invalid cParams == no change. */
|
/* Set invalid cParams == error out, and no change. */
|
||||||
CHECK(ZSTD_isError(ZSTD_CCtx_setCParams(cctx, cparams)));
|
CHECK(ZSTD_isError(ZSTD_CCtx_setCParams(cctx, cparams)));
|
||||||
|
|
||||||
CHECK_Z(ZSTD_CCtx_getParameter(cctx, ZSTD_c_windowLog, &value));
|
CHECK_Z(ZSTD_CCtx_getParameter(cctx, ZSTD_c_windowLog, &value));
|
||||||
@ -1801,12 +1801,12 @@ static int basicUnitTests(U32 const seed, double compressibility)
|
|||||||
ZSTD_freeCCtx(cctx);
|
ZSTD_freeCCtx(cctx);
|
||||||
}
|
}
|
||||||
|
|
||||||
DISPLAYLEVEL(3, "test%3d : ZSTD_CCtx_setCarams() : ", testNb++);
|
DISPLAYLEVEL(3, "test%3d : ZSTD_CCtx_setParams() : ", testNb++);
|
||||||
{ ZSTD_CCtx* const cctx = ZSTD_createCCtx();
|
{ ZSTD_CCtx* const cctx = ZSTD_createCCtx();
|
||||||
int value;
|
int value;
|
||||||
ZSTD_parameters params = ZSTD_getParams(1, 0, 0);
|
ZSTD_parameters params = ZSTD_getParams(1, 0, 0);
|
||||||
params.cParams.strategy = -1;
|
params.cParams.strategy = (ZSTD_strategy)-1; /* set invalid value, on purpose */
|
||||||
/* Set invalid params == no change. */
|
/* Set invalid params == error out, and no change. */
|
||||||
CHECK(ZSTD_isError(ZSTD_CCtx_setParams(cctx, params)));
|
CHECK(ZSTD_isError(ZSTD_CCtx_setParams(cctx, params)));
|
||||||
|
|
||||||
CHECK_Z(ZSTD_CCtx_getParameter(cctx, ZSTD_c_windowLog, &value));
|
CHECK_Z(ZSTD_CCtx_getParameter(cctx, ZSTD_c_windowLog, &value));
|
||||||
@ -2252,7 +2252,7 @@ static int basicUnitTests(U32 const seed, double compressibility)
|
|||||||
|
|
||||||
DISPLAYLEVEL(3, "test%3i : compress with block splitting : ", testNb++)
|
DISPLAYLEVEL(3, "test%3i : compress with block splitting : ", testNb++)
|
||||||
{ ZSTD_CCtx* cctx = ZSTD_createCCtx();
|
{ ZSTD_CCtx* cctx = ZSTD_createCCtx();
|
||||||
CHECK_Z( ZSTD_CCtx_setParameter(cctx, ZSTD_c_useBlockSplitter, ZSTD_ps_enable) );
|
CHECK_Z( ZSTD_CCtx_setParameter(cctx, ZSTD_c_splitAfterSequences, ZSTD_ps_enable) );
|
||||||
cSize = ZSTD_compress2(cctx, compressedBuffer, compressedBufferSize, CNBuffer, CNBuffSize);
|
cSize = ZSTD_compress2(cctx, compressedBuffer, compressedBufferSize, CNBuffer, CNBuffSize);
|
||||||
CHECK_Z(cSize);
|
CHECK_Z(cSize);
|
||||||
ZSTD_freeCCtx(cctx);
|
ZSTD_freeCCtx(cctx);
|
||||||
|
Loading…
Reference in New Issue
Block a user