Added support for forcing new CDict behavior and updated enum
parent
9294f4826b
commit
e4de8b098a
|
@ -2908,7 +2908,8 @@ static size_t ZSTD_compressBegin_internal(ZSTD_CCtx* cctx,
|
|||
assert(!((dict) && (cdict))); /* either dict or cdict, not both */
|
||||
if ( (cdict)
|
||||
&& (cdict->dictContentSize > 0)
|
||||
&& (pledgedSrcSize < ZSTD_USE_CDICT_PARAMS_CUTOFF || cdict->compressionLevel == 0) ) {
|
||||
&& (pledgedSrcSize < ZSTD_USE_CDICT_PARAMS_CUTOFF || cdict->compressionLevel == 0)
|
||||
&& (params->attachDictPref != ZSTD_dictForceInputParams) ) {
|
||||
return ZSTD_resetCCtx_usingCDict(cctx, cdict, params, pledgedSrcSize, zbuff);
|
||||
}
|
||||
|
||||
|
|
|
@ -1149,7 +1149,7 @@ typedef enum {
|
|||
* to evolve and should be considered only in the context of extremely
|
||||
* advanced performance tuning.
|
||||
*
|
||||
* Zstd currently supports the use of a CDict in two ways:
|
||||
* Zstd currently supports the use of a CDict in three ways:
|
||||
*
|
||||
* - The contents of the CDict can be copied into the working context. This
|
||||
* means that the compression can search both the dictionary and input
|
||||
|
@ -1165,6 +1165,10 @@ typedef enum {
|
|||
* working context's tables can be reused). For small inputs, this can be
|
||||
* faster than copying the CDict's tables.
|
||||
*
|
||||
* - The CDict's tables are not used at all, and instead we use the working
|
||||
* context alone to determine how our tables are initialized. This method
|
||||
* should be used when using a small dictionary to compress a large input.
|
||||
*
|
||||
* Zstd has a simple internal heuristic that selects which strategy to use
|
||||
* at the beginning of a compression. However, if experimentation shows that
|
||||
* Zstd is making poor choices, it is possible to override that choice with
|
||||
|
@ -1173,6 +1177,7 @@ typedef enum {
|
|||
ZSTD_dictDefaultAttach = 0, /* Use the default heuristic. */
|
||||
ZSTD_dictForceAttach = 1, /* Never copy the dictionary. */
|
||||
ZSTD_dictForceCopy = 2, /* Always copy the dictionary. */
|
||||
ZSTD_dictForceInputParams = 3, /* Always use input to determine tables */
|
||||
} ZSTD_dictAttachPref_e;
|
||||
|
||||
typedef enum {
|
||||
|
|
Loading…
Reference in New Issue