|
enum | ZSTD_strategy {
ZSTD_fast =1
, ZSTD_dfast =2
, ZSTD_greedy =3
, ZSTD_lazy =4
,
ZSTD_lazy2 =5
, ZSTD_btlazy2 =6
, ZSTD_btopt =7
, ZSTD_btultra =8
,
ZSTD_btultra2 =9
} |
|
enum | ZSTD_cParameter {
ZSTD_c_compressionLevel =100
, ZSTD_c_windowLog =101
, ZSTD_c_hashLog =102
, ZSTD_c_chainLog =103
,
ZSTD_c_searchLog =104
, ZSTD_c_minMatch =105
, ZSTD_c_targetLength =106
, ZSTD_c_strategy =107
,
ZSTD_c_enableLongDistanceMatching =160
, ZSTD_c_ldmHashLog =161
, ZSTD_c_ldmMinMatch =162
, ZSTD_c_ldmBucketSizeLog =163
,
ZSTD_c_ldmHashRateLog =164
, ZSTD_c_contentSizeFlag =200
, ZSTD_c_checksumFlag =201
, ZSTD_c_dictIDFlag =202
,
ZSTD_c_nbWorkers =400
, ZSTD_c_jobSize =401
, ZSTD_c_overlapLog =402
, ZSTD_c_experimentalParam1 =500
,
ZSTD_c_experimentalParam2 =10
, ZSTD_c_experimentalParam3 =1000
, ZSTD_c_experimentalParam4 =1001
, ZSTD_c_experimentalParam5 =1002
,
ZSTD_c_experimentalParam6 =1003
, ZSTD_c_experimentalParam7 =1004
, ZSTD_c_experimentalParam8 =1005
, ZSTD_c_experimentalParam9 =1006
,
ZSTD_c_experimentalParam10 =1007
, ZSTD_c_experimentalParam11 =1008
, ZSTD_c_experimentalParam12 =1009
, ZSTD_c_experimentalParam13 =1010
,
ZSTD_c_experimentalParam14 =1011
, ZSTD_c_experimentalParam15 =1012
, ZSTD_c_experimentalParam16 =1013
, ZSTD_c_experimentalParam17 =1014
,
ZSTD_c_experimentalParam18 =1015
, ZSTD_c_experimentalParam19 =1016
} |
|
enum | ZSTD_ResetDirective { ZSTD_reset_session_only = 1
, ZSTD_reset_parameters = 2
, ZSTD_reset_session_and_parameters = 3
} |
|
enum | ZSTD_dParameter {
ZSTD_d_windowLogMax =100
, ZSTD_d_experimentalParam1 =1000
, ZSTD_d_experimentalParam2 =1001
, ZSTD_d_experimentalParam3 =1002
,
ZSTD_d_experimentalParam4 =1003
, ZSTD_d_experimentalParam5 =1004
} |
|
enum | ZSTD_EndDirective { ZSTD_e_continue =0
, ZSTD_e_flush =1
, ZSTD_e_end =2
} |
|
|
ZSTDLIB_API unsigned | ZSTD_versionNumber (void) |
|
ZSTDLIB_API const char * | ZSTD_versionString (void) |
|
ZSTDLIB_API size_t | ZSTD_compress (void *dst, size_t dstCapacity, const void *src, size_t srcSize, int compressionLevel) |
|
ZSTDLIB_API size_t | ZSTD_decompress (void *dst, size_t dstCapacity, const void *src, size_t compressedSize) |
|
ZSTDLIB_API unsigned long long | ZSTD_getFrameContentSize (const void *src, size_t srcSize) |
|
ZSTDLIB_API unsigned long long | ZSTD_getDecompressedSize (const void *src, size_t srcSize) |
|
ZSTDLIB_API size_t | ZSTD_findFrameCompressedSize (const void *src, size_t srcSize) |
|
ZSTDLIB_API size_t | ZSTD_compressBound (size_t srcSize) |
|
ZSTDLIB_API unsigned | ZSTD_isError (size_t code) |
|
ZSTDLIB_API const char * | ZSTD_getErrorName (size_t code) |
|
ZSTDLIB_API int | ZSTD_minCLevel (void) |
|
ZSTDLIB_API int | ZSTD_maxCLevel (void) |
|
ZSTDLIB_API int | ZSTD_defaultCLevel (void) |
|
ZSTDLIB_API ZSTD_CCtx * | ZSTD_createCCtx (void) |
|
ZSTDLIB_API size_t | ZSTD_freeCCtx (ZSTD_CCtx *cctx) |
|
ZSTDLIB_API size_t | ZSTD_compressCCtx (ZSTD_CCtx *cctx, void *dst, size_t dstCapacity, const void *src, size_t srcSize, int compressionLevel) |
|
ZSTDLIB_API ZSTD_DCtx * | ZSTD_createDCtx (void) |
|
ZSTDLIB_API size_t | ZSTD_freeDCtx (ZSTD_DCtx *dctx) |
|
ZSTDLIB_API size_t | ZSTD_decompressDCtx (ZSTD_DCtx *dctx, void *dst, size_t dstCapacity, const void *src, size_t srcSize) |
|
ZSTDLIB_API ZSTD_bounds | ZSTD_cParam_getBounds (ZSTD_cParameter cParam) |
|
ZSTDLIB_API size_t | ZSTD_CCtx_setParameter (ZSTD_CCtx *cctx, ZSTD_cParameter param, int value) |
|
ZSTDLIB_API size_t | ZSTD_CCtx_setPledgedSrcSize (ZSTD_CCtx *cctx, unsigned long long pledgedSrcSize) |
|
ZSTDLIB_API size_t | ZSTD_CCtx_reset (ZSTD_CCtx *cctx, ZSTD_ResetDirective reset) |
|
ZSTDLIB_API size_t | ZSTD_compress2 (ZSTD_CCtx *cctx, void *dst, size_t dstCapacity, const void *src, size_t srcSize) |
|
ZSTDLIB_API ZSTD_bounds | ZSTD_dParam_getBounds (ZSTD_dParameter dParam) |
|
ZSTDLIB_API size_t | ZSTD_DCtx_setParameter (ZSTD_DCtx *dctx, ZSTD_dParameter param, int value) |
|
ZSTDLIB_API size_t | ZSTD_DCtx_reset (ZSTD_DCtx *dctx, ZSTD_ResetDirective reset) |
|
ZSTDLIB_API ZSTD_CStream * | ZSTD_createCStream (void) |
|
ZSTDLIB_API size_t | ZSTD_freeCStream (ZSTD_CStream *zcs) |
|
ZSTDLIB_API size_t | ZSTD_compressStream2 (ZSTD_CCtx *cctx, ZSTD_outBuffer *output, ZSTD_inBuffer *input, ZSTD_EndDirective endOp) |
|
ZSTDLIB_API size_t | ZSTD_CStreamInSize (void) |
|
ZSTDLIB_API size_t | ZSTD_CStreamOutSize (void) |
|
ZSTDLIB_API size_t | ZSTD_initCStream (ZSTD_CStream *zcs, int compressionLevel) |
|
ZSTDLIB_API size_t | ZSTD_compressStream (ZSTD_CStream *zcs, ZSTD_outBuffer *output, ZSTD_inBuffer *input) |
|
ZSTDLIB_API size_t | ZSTD_flushStream (ZSTD_CStream *zcs, ZSTD_outBuffer *output) |
|
ZSTDLIB_API size_t | ZSTD_endStream (ZSTD_CStream *zcs, ZSTD_outBuffer *output) |
|
ZSTDLIB_API ZSTD_DStream * | ZSTD_createDStream (void) |
|
ZSTDLIB_API size_t | ZSTD_freeDStream (ZSTD_DStream *zds) |
|
ZSTDLIB_API size_t | ZSTD_initDStream (ZSTD_DStream *zds) |
|
ZSTDLIB_API size_t | ZSTD_decompressStream (ZSTD_DStream *zds, ZSTD_outBuffer *output, ZSTD_inBuffer *input) |
|
ZSTDLIB_API size_t | ZSTD_DStreamInSize (void) |
|
ZSTDLIB_API size_t | ZSTD_DStreamOutSize (void) |
|
ZSTDLIB_API size_t | ZSTD_compress_usingDict (ZSTD_CCtx *ctx, void *dst, size_t dstCapacity, const void *src, size_t srcSize, const void *dict, size_t dictSize, int compressionLevel) |
|
ZSTDLIB_API size_t | ZSTD_decompress_usingDict (ZSTD_DCtx *dctx, void *dst, size_t dstCapacity, const void *src, size_t srcSize, const void *dict, size_t dictSize) |
|
ZSTDLIB_API ZSTD_CDict * | ZSTD_createCDict (const void *dictBuffer, size_t dictSize, int compressionLevel) |
|
ZSTDLIB_API size_t | ZSTD_freeCDict (ZSTD_CDict *CDict) |
|
ZSTDLIB_API size_t | ZSTD_compress_usingCDict (ZSTD_CCtx *cctx, void *dst, size_t dstCapacity, const void *src, size_t srcSize, const ZSTD_CDict *cdict) |
|
ZSTDLIB_API ZSTD_DDict * | ZSTD_createDDict (const void *dictBuffer, size_t dictSize) |
|
ZSTDLIB_API size_t | ZSTD_freeDDict (ZSTD_DDict *ddict) |
|
ZSTDLIB_API size_t | ZSTD_decompress_usingDDict (ZSTD_DCtx *dctx, void *dst, size_t dstCapacity, const void *src, size_t srcSize, const ZSTD_DDict *ddict) |
|
ZSTDLIB_API unsigned | ZSTD_getDictID_fromDict (const void *dict, size_t dictSize) |
|
ZSTDLIB_API unsigned | ZSTD_getDictID_fromCDict (const ZSTD_CDict *cdict) |
|
ZSTDLIB_API unsigned | ZSTD_getDictID_fromDDict (const ZSTD_DDict *ddict) |
|
ZSTDLIB_API unsigned | ZSTD_getDictID_fromFrame (const void *src, size_t srcSize) |
|
ZSTDLIB_API size_t | ZSTD_CCtx_loadDictionary (ZSTD_CCtx *cctx, const void *dict, size_t dictSize) |
|
ZSTDLIB_API size_t | ZSTD_CCtx_refCDict (ZSTD_CCtx *cctx, const ZSTD_CDict *cdict) |
|
ZSTDLIB_API size_t | ZSTD_CCtx_refPrefix (ZSTD_CCtx *cctx, const void *prefix, size_t prefixSize) |
|
ZSTDLIB_API size_t | ZSTD_DCtx_loadDictionary (ZSTD_DCtx *dctx, const void *dict, size_t dictSize) |
|
ZSTDLIB_API size_t | ZSTD_DCtx_refDDict (ZSTD_DCtx *dctx, const ZSTD_DDict *ddict) |
|
ZSTDLIB_API size_t | ZSTD_DCtx_refPrefix (ZSTD_DCtx *dctx, const void *prefix, size_t prefixSize) |
|
ZSTDLIB_API size_t | ZSTD_sizeof_CCtx (const ZSTD_CCtx *cctx) |
|
ZSTDLIB_API size_t | ZSTD_sizeof_DCtx (const ZSTD_DCtx *dctx) |
|
ZSTDLIB_API size_t | ZSTD_sizeof_CStream (const ZSTD_CStream *zcs) |
|
ZSTDLIB_API size_t | ZSTD_sizeof_DStream (const ZSTD_DStream *zds) |
|
ZSTDLIB_API size_t | ZSTD_sizeof_CDict (const ZSTD_CDict *cdict) |
|
ZSTDLIB_API size_t | ZSTD_sizeof_DDict (const ZSTD_DDict *ddict) |
|
ZSTD_CCtx_refCDict() : Requires v1.4.0+ Reference a prepared dictionary, to be used for all future compressed frames. Note that compression parameters are enforced from within CDict, and supersede any compression parameter previously set within CCtx. The parameters ignored are labelled as "superseded-by-cdict" in the ZSTD_cParameter enum docs. The ignored parameters will be used again if the CCtx is returned to no-dictionary mode. The dictionary will remain valid for future compressed frames using same CCtx.
- Returns
- : 0, or an error code (which can be tested with ZSTD_isError()). Special : Referencing a NULL CDict means "return to no-dictionary mode". Note 1 : Currently, only one dictionary can be managed. Referencing a new dictionary effectively "discards" any previous one. Note 2 : CDict is just referenced, its lifetime must outlive its usage within CCtx.
ZSTD_CCtx_refCDict() : Requires v1.4.0+ Reference a prepared dictionary, to be used for all next compressed frames. Note that compression parameters are enforced from within CDict, and supersede any compression parameter previously set within CCtx. The parameters ignored are labelled as "superseded-by-cdict" in the ZSTD_cParameter enum docs. The ignored parameters will be used again if the CCtx is returned to no-dictionary mode. The dictionary will remain valid for future compressed frames using same CCtx.
- Returns
- : 0, or an error code (which can be tested with ZSTD_isError()). Special : Referencing a NULL CDict means "return to no-dictionary mode". Note 1 : Currently, only one dictionary can be managed. Referencing a new dictionary effectively "discards" any previous one. Note 2 : CDict is just referenced, its lifetime must outlive its usage within CCtx.
ZSTD_CCtx_refPrefix() : Requires v1.4.0+ Reference a prefix (single-usage dictionary) for next compressed frame. A prefix is only used once. Tables are discarded at end of frame (ZSTD_e_end). Decompression will need same prefix to properly regenerate data. Compressing with a prefix is similar in outcome as performing a diff and compressing it, but performs much faster, especially during decompression (compression speed is tunable with compression level). This method is compatible with LDM (long distance mode).
- Returns
- : 0, or an error code (which can be tested with ZSTD_isError()). Special: Adding any prefix (including NULL) invalidates any previous prefix or dictionary Note 1 : Prefix buffer is referenced. It must outlive 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, ensure that the window size is large enough to contain the entire source. See ZSTD_c_windowLog. 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. If there is a need to use the same prefix multiple times, consider loadDictionary instead. Note 4 : By default, the prefix is interpreted as raw content (ZSTD_dct_rawContent). Use experimental ZSTD_CCtx_refPrefix_advanced() to alter dictionary interpretation.
ZSTD_CCtx_refPrefix() : Requires v1.4.0+ Reference a prefix (single-usage dictionary) for next compressed frame. A prefix is only used once. Tables are discarded at end of frame (ZSTD_e_end). Decompression will need same prefix to properly regenerate data. Compressing with a prefix is similar in outcome as performing a diff and compressing it, but performs much faster, especially during decompression (compression speed is tunable with compression level).
- Returns
- : 0, or an error code (which can be tested with ZSTD_isError()). Special: Adding any prefix (including NULL) invalidates any previous prefix or dictionary Note 1 : Prefix buffer is referenced. It must outlive 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, ensure that the window size is large enough to contain the entire source. See ZSTD_c_windowLog. 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. If there is a need to use the same prefix multiple times, consider loadDictionary instead. Note 4 : By default, the prefix is interpreted as raw content (ZSTD_dct_rawContent). Use experimental ZSTD_CCtx_refPrefix_advanced() to alter dictionary interpretation.
ZSTD_CCtx_setParameter() : Set one compression parameter, selected by enum ZSTD_cParameter. All parameters have valid bounds. Bounds can be queried using ZSTD_cParam_getBounds(). Providing a value beyond bound will either clamp it, or trigger an error (depending on parameter). Setting a parameter is generally only possible during frame initialization (before starting compression). Exception : when using multi-threading mode (nbWorkers >= 1), the following parameters can be updated during compression (within same frame): => compressionLevel, hashLog, chainLog, searchLog, minMatch, targetLength and strategy. new parameters will be active for next job only (after a flush()).
- Returns
- : an error code (which can be tested using ZSTD_isError()).
ZSTD_DCtx_loadDictionary() : Requires v1.4.0+ Create an internal DDict from dict buffer, to be used to decompress all future frames. The dictionary remains valid for all future frames, until explicitly invalidated, or a new dictionary is loaded.
- Returns
- : 0, or an error code (which can be tested with ZSTD_isError()). Special : Adding a NULL (or 0-size) dictionary invalidates any previous dictionary, meaning "return to no-dictionary mode". Note 1 : Loading a dictionary involves building tables, which has a non-negligible impact on CPU usage and latency. It's recommended to "load once, use many times", to amortize the cost Note 2 :
dict
content will be copied internally, so dict
can be released after loading. Use ZSTD_DCtx_loadDictionary_byReference() to reference dictionary content instead. Note 3 : Use ZSTD_DCtx_loadDictionary_advanced() to take control of how dictionary content is loaded and interpreted.
ZSTD_DCtx_loadDictionary() : Requires v1.4.0+ Create an internal DDict from dict buffer, to be used to decompress next frames. The dictionary remains valid for all future frames, until explicitly invalidated.
- Returns
- : 0, or an error code (which can be tested with ZSTD_isError()). Special : Adding a NULL (or 0-size) dictionary invalidates any previous dictionary, meaning "return to no-dictionary mode". Note 1 : Loading a dictionary involves building tables, which has a non-negligible impact on CPU usage and latency. It's recommended to "load once, use many times", to amortize the cost Note 2 :
dict
content will be copied internally, so dict
can be released after loading. Use ZSTD_DCtx_loadDictionary_byReference() to reference dictionary content instead. Note 3 : Use ZSTD_DCtx_loadDictionary_advanced() to take control of how dictionary content is loaded and interpreted.
ZSTD_DCtx_refDDict() : Requires v1.4.0+ Reference a prepared dictionary, to be used to decompress next frames. The dictionary remains active for decompression of future frames using same DCtx.
If called with ZSTD_d_refMultipleDDicts enabled, repeated calls of this function will store the DDict references in a table, and the DDict used for decompression will be determined at decompression time, as per the dict ID in the frame. The memory for the table is allocated on the first call to refDDict, and can be freed with ZSTD_freeDCtx().
If called with ZSTD_d_refMultipleDDicts disabled (the default), only one dictionary will be managed, and referencing a dictionary effectively "discards" any previous one.
- Returns
- : 0, or an error code (which can be tested with ZSTD_isError()). Special: referencing a NULL DDict means "return to no-dictionary mode". Note 2 : DDict is just referenced, its lifetime must outlive its usage from DCtx.
ZSTD_DCtx_refDDict() : Requires v1.4.0+ Reference a prepared dictionary, to be used to decompress next frames. The dictionary remains active for decompression of future frames using same DCtx.
If called with ZSTD_d_refMultipleDDicts enabled, repeated calls of this function will store the DDict references in a table, and the DDict used for decompression will be determined at decompression time, as per the dict ID in the frame. The memory for the table is allocated on the first call to refDDict, and can be freed with ZSTD_freeDCtx().
- Returns
- : 0, or an error code (which can be tested with ZSTD_isError()). Note 1 : Currently, only one dictionary can be managed. Referencing a new dictionary effectively "discards" any previous one. Special: referencing a NULL DDict means "return to no-dictionary mode". Note 2 : DDict is just referenced, its lifetime must outlive its usage from DCtx.
ZSTDLIB_API size_t ZSTD_decompress |
( |
void * | dst, |
|
|
size_t | dstCapacity, |
|
|
const void * | src, |
|
|
size_t | srcSize ) |
ZSTD_decompress() : compressedSize
: must be the exact size of some number of compressed and/or skippable frames. dstCapacity
is an upper bound of originalSize to regenerate. If user cannot imply a maximum upper bound, it's better to use streaming mode to decompress data.
- Returns
- : the number of bytes decompressed into
dst
(<= dstCapacity
), or an errorCode if it fails (which can be tested using ZSTD_isError()).
For the case where the decompression library hasn't been included we add a dummy function to fake the process and stop the buffers being optimised out.
Zstandard decompression functions. dst
must point to a space at least as large as the reconstructed output.
For the case where the decompression library hasn't been included we add a dummy function to fake the process and stop the buffers being optimised out.
Equivalent to:
ZSTD_CCtx_reset(zcs, ZSTD_reset_session_only);
ZSTD_CCtx_refCDict(zcs, NULL); // clear the dictionary (if any)
ZSTD_CCtx_setParameter(zcs, ZSTD_c_compressionLevel, compressionLevel);
Note that ZSTD_initCStream() clears any previously set dictionary. Use the new API to compress with a dictionary.
Equivalent to:
ZSTD_CCtx_reset(zcs, ZSTD_reset_session_only);
ZSTD_CCtx_refCDict(zcs, NULL); // clear the dictionary (if any)
ZSTD_CCtx_setParameter(zcs, ZSTD_c_compressionLevel, compressionLevel);