Add parameter to control multiple DDicts
This commit is contained in:
parent
f933668d3f
commit
fd5b608f1c
@ -1530,6 +1530,9 @@ ZSTD_bounds ZSTD_dParam_getBounds(ZSTD_dParameter dParam)
|
|||||||
bounds.lowerBound = (int)ZSTD_d_validateChecksum;
|
bounds.lowerBound = (int)ZSTD_d_validateChecksum;
|
||||||
bounds.upperBound = (int)ZSTD_d_ignoreChecksum;
|
bounds.upperBound = (int)ZSTD_d_ignoreChecksum;
|
||||||
return bounds;
|
return bounds;
|
||||||
|
case ZSTD_d_refMultipleDDicts:
|
||||||
|
bounds.lowerBound = (int)ZSTD_d_refSingleDict;
|
||||||
|
bounds.upperBound = (int)ZSTD_d_refMultipleDicts;
|
||||||
default:;
|
default:;
|
||||||
}
|
}
|
||||||
bounds.error = ERROR(parameter_unsupported);
|
bounds.error = ERROR(parameter_unsupported);
|
||||||
@ -1567,6 +1570,9 @@ size_t ZSTD_DCtx_getParameter(ZSTD_DCtx* dctx, ZSTD_dParameter param, int* value
|
|||||||
case ZSTD_d_forceIgnoreChecksum:
|
case ZSTD_d_forceIgnoreChecksum:
|
||||||
*value = (int)dctx->forceIgnoreChecksum;
|
*value = (int)dctx->forceIgnoreChecksum;
|
||||||
return 0;
|
return 0;
|
||||||
|
case ZSTD_d_refMultipleDDicts:
|
||||||
|
*value = (int)dctx->refMultipleDDicts;
|
||||||
|
return 0;
|
||||||
default:;
|
default:;
|
||||||
}
|
}
|
||||||
RETURN_ERROR(parameter_unsupported, "");
|
RETURN_ERROR(parameter_unsupported, "");
|
||||||
@ -1593,6 +1599,9 @@ size_t ZSTD_DCtx_setParameter(ZSTD_DCtx* dctx, ZSTD_dParameter dParam, int value
|
|||||||
CHECK_DBOUNDS(ZSTD_d_forceIgnoreChecksum, value);
|
CHECK_DBOUNDS(ZSTD_d_forceIgnoreChecksum, value);
|
||||||
dctx->forceIgnoreChecksum = (ZSTD_forceIgnoreChecksum_e)value;
|
dctx->forceIgnoreChecksum = (ZSTD_forceIgnoreChecksum_e)value;
|
||||||
return 0;
|
return 0;
|
||||||
|
case ZSTD_d_refMultipleDDicts:
|
||||||
|
CHECK_DBOUNDS(ZSTD_d_refMultipleDDicts, value);
|
||||||
|
dctx->refMultipleDDicts = (ZSTD_refMultipleDDicts_e)value;
|
||||||
default:;
|
default:;
|
||||||
}
|
}
|
||||||
RETURN_ERROR(parameter_unsupported, "");
|
RETURN_ERROR(parameter_unsupported, "");
|
||||||
|
@ -136,6 +136,7 @@ struct ZSTD_DCtx_s
|
|||||||
U32 dictID;
|
U32 dictID;
|
||||||
int ddictIsCold; /* if == 1 : dictionary is "new" for working context, and presumed "cold" (not in cpu cache) */
|
int ddictIsCold; /* if == 1 : dictionary is "new" for working context, and presumed "cold" (not in cpu cache) */
|
||||||
ZSTD_dictUses_e dictUses;
|
ZSTD_dictUses_e dictUses;
|
||||||
|
ZSTD_refMultipleDDicts_e refMultipleDDicts; /* User specified: if == 1, will allow references to multiple DDicts. Default == 0 (disabled) */
|
||||||
|
|
||||||
/* streaming */
|
/* streaming */
|
||||||
ZSTD_dStreamStage streamStage;
|
ZSTD_dStreamStage streamStage;
|
||||||
|
23
lib/zstd.h
23
lib/zstd.h
@ -546,12 +546,14 @@ typedef enum {
|
|||||||
* ZSTD_d_format
|
* ZSTD_d_format
|
||||||
* ZSTD_d_stableOutBuffer
|
* ZSTD_d_stableOutBuffer
|
||||||
* ZSTD_d_forceIgnoreChecksum
|
* ZSTD_d_forceIgnoreChecksum
|
||||||
|
* ZSTD_d_refMultipleDDicts
|
||||||
* 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_d_experimentalParam1=1000,
|
ZSTD_d_experimentalParam1=1000,
|
||||||
ZSTD_d_experimentalParam2=1001,
|
ZSTD_d_experimentalParam2=1001,
|
||||||
ZSTD_d_experimentalParam3=1002
|
ZSTD_d_experimentalParam3=1002,
|
||||||
|
ZSTD_d_experimentalParam4=1003
|
||||||
|
|
||||||
} ZSTD_dParameter;
|
} ZSTD_dParameter;
|
||||||
|
|
||||||
@ -1205,6 +1207,12 @@ typedef enum {
|
|||||||
ZSTD_d_ignoreChecksum = 1
|
ZSTD_d_ignoreChecksum = 1
|
||||||
} ZSTD_forceIgnoreChecksum_e;
|
} ZSTD_forceIgnoreChecksum_e;
|
||||||
|
|
||||||
|
typedef enum {
|
||||||
|
/* Note: this enum controls ZSTD_d_refMultipleDDicts */
|
||||||
|
ZSTD_d_refSingleDict = 0,
|
||||||
|
ZSTD_d_refMultipleDicts = 1,
|
||||||
|
} ZSTD_refMultipleDDicts_e;
|
||||||
|
|
||||||
typedef enum {
|
typedef enum {
|
||||||
/* Note: this enum and the behavior it controls are effectively internal
|
/* Note: this enum and the behavior it controls are effectively internal
|
||||||
* implementation details of the compressor. They are expected to continue
|
* implementation details of the compressor. They are expected to continue
|
||||||
@ -2000,6 +2008,19 @@ ZSTDLIB_API size_t ZSTD_DCtx_getParameter(ZSTD_DCtx* dctx, ZSTD_dParameter param
|
|||||||
*/
|
*/
|
||||||
#define ZSTD_d_forceIgnoreChecksum ZSTD_d_experimentalParam3
|
#define ZSTD_d_forceIgnoreChecksum ZSTD_d_experimentalParam3
|
||||||
|
|
||||||
|
/* ZSTD_d_refMultipleDDicts
|
||||||
|
* Experimental parameter.
|
||||||
|
* Default is 0 == disabled. Set to 1 to enable
|
||||||
|
*
|
||||||
|
* If enabled and dctx is allocated on the heap, then additional memory will be allocated
|
||||||
|
* to store references to multiple ZSTD_DDict. That is, multiple calls of ZSTD_refDDict()
|
||||||
|
* using a given ZSTD_DCtx, rather than overwriting the previous DCtx referenced, will
|
||||||
|
* store all references, and at decompression time, the appropriate dictID is selected
|
||||||
|
* from the set of DDicts based on the dictID in the frame.
|
||||||
|
*/
|
||||||
|
#define ZSTD_d_refMultipleDDicts ZSTD_d_experimentalParam4
|
||||||
|
|
||||||
|
|
||||||
/*! ZSTD_DCtx_setFormat() :
|
/*! ZSTD_DCtx_setFormat() :
|
||||||
* Instruct the decoder context about what kind of data to decode next.
|
* Instruct the decoder context about what kind of data to decode next.
|
||||||
* This instruction is mandatory to decode data without a fully-formed header,
|
* This instruction is mandatory to decode data without a fully-formed header,
|
||||||
|
Loading…
x
Reference in New Issue
Block a user