[libzstd] Allow compression parameters to be set with a cdict
The order you set parameters in the advanced API is not supposed to matter. However, once you call `ZSTD_CCtx_refCDict()` the compression parameters cannot be changed. Remove that restriction, and document what parameters are used when using a CDict. If the CCtx is in dictionary mode, then the CDict's parameters are used. If the CCtx is not in dictionary mode, then its requested parameters are used.
This commit is contained in:
1 parent
ea3b81f02c
commit
787b76904a
3 files changed
+22
-18
No files matched your search
@@ -1294,6 +1294,17 @@ static int basicUnitTests(U32 seed, double compressibility)
|
||||
}
|
||||
DISPLAYLEVEL(3, "OK \n");
|
||||
|
||||
DISPLAYLEVEL(3, "test%3i : ZSTD_CCtx_refCDict() then set parameters : ", testNb++);
|
||||
{ ZSTD_CDict* const cdict = ZSTD_createCDict(CNBuffer, dictSize, 1);
|
||||
CHECK_Z( ZSTD_CCtx_setParameter(cctx, ZSTD_c_compressionLevel, 1) );
|
||||
CHECK_Z( ZSTD_CCtx_setParameter(cctx, ZSTD_c_hashLog, 12 ));
|
||||
CHECK_Z( ZSTD_CCtx_refCDict(cctx, cdict) );
|
||||
CHECK_Z( ZSTD_CCtx_setParameter(cctx, ZSTD_c_compressionLevel, 1) );
|
||||
CHECK_Z( ZSTD_CCtx_setParameter(cctx, ZSTD_c_hashLog, 12 ));
|
||||
ZSTD_freeCDict(cdict);
|
||||
}
|
||||
DISPLAYLEVEL(3, "OK \n");
|
||||
|
||||
DISPLAYLEVEL(3, "test%3i : Dictionary with non-default repcodes : ", testNb++);
|
||||
{ U32 u; for (u=0; u<nbSamples; u++) samplesSizes[u] = sampleUnitSize; }
|
||||
dictSize = ZDICT_trainFromBuffer(dictBuffer, dictSize,
|
||||
|
||||
Reference in new issue
Block a user