updated documentation for ZSTD_estimate*()
make it clearer that tighter memory estimation can be provided using advanced functions on the condition of a defined input size bound.
This commit is contained in:
+20
-15
@@ -1268,23 +1268,28 @@ ZSTDLIB_API size_t ZSTD_getSequences(ZSTD_CCtx* zc, ZSTD_Sequence* outSeqs,
|
|||||||
***************************************/
|
***************************************/
|
||||||
|
|
||||||
/*! ZSTD_estimate*() :
|
/*! ZSTD_estimate*() :
|
||||||
* These functions make it possible to estimate memory usage of a future
|
* These functions make it possible to estimate memory usage
|
||||||
* {D,C}Ctx, before its creation.
|
* of a future {D,C}Ctx, before its creation.
|
||||||
*
|
*
|
||||||
* ZSTD_estimateCCtxSize() will provide a budget large enough for any
|
* ZSTD_estimateCCtxSize() will provide a memory budget large enough
|
||||||
* compression level up to selected one. Unlike ZSTD_estimateCStreamSize*(),
|
* for any compression level up to selected one.
|
||||||
* this estimate does not include space for a window buffer, so this estimate
|
* Note : Unlike ZSTD_estimateCStreamSize*(), this estimate
|
||||||
* is guaranteed to be enough for single-shot compressions, but not streaming
|
* does not include space for a window buffer.
|
||||||
* compressions. It will however assume the input may be arbitrarily large,
|
* Therefore, the estimation is only guaranteed for single-shot compressions, not streaming.
|
||||||
* which is the worst case. If srcSize is known to always be small,
|
* The estimate will assume the input may be arbitrarily large,
|
||||||
* ZSTD_estimateCCtxSize_usingCParams() can provide a tighter estimation.
|
* which is the worst case.
|
||||||
* ZSTD_estimateCCtxSize_usingCParams() can be used in tandem with
|
|
||||||
* ZSTD_getCParams() to create cParams from compressionLevel.
|
|
||||||
* ZSTD_estimateCCtxSize_usingCCtxParams() can be used in tandem with
|
|
||||||
* ZSTD_CCtxParams_setParameter().
|
|
||||||
*
|
*
|
||||||
* Note: only single-threaded compression is supported. This function will
|
* When srcSize can be bound by a known and rather "small" value,
|
||||||
* return an error code if ZSTD_c_nbWorkers is >= 1. */
|
* this fact can be used to provide a tighter estimation
|
||||||
|
* because the CCtx compression context will need less memory.
|
||||||
|
* This tighter estimation can be provided by more advanced functions
|
||||||
|
* ZSTD_estimateCCtxSize_usingCParams(), which can be used in tandem with ZSTD_getCParams(),
|
||||||
|
* and ZSTD_estimateCCtxSize_usingCCtxParams(), which can be used in tandem with ZSTD_CCtxParams_setParameter().
|
||||||
|
* Both can be used to estimate memory using custom compression parameters and arbitrary srcSize limits.
|
||||||
|
*
|
||||||
|
* Note 2 : only single-threaded compression is supported.
|
||||||
|
* ZSTD_estimateCCtxSize_usingCCtxParams() will return an error code if ZSTD_c_nbWorkers is >= 1.
|
||||||
|
*/
|
||||||
ZSTDLIB_API size_t ZSTD_estimateCCtxSize(int compressionLevel);
|
ZSTDLIB_API size_t ZSTD_estimateCCtxSize(int compressionLevel);
|
||||||
ZSTDLIB_API size_t ZSTD_estimateCCtxSize_usingCParams(ZSTD_compressionParameters cParams);
|
ZSTDLIB_API size_t ZSTD_estimateCCtxSize_usingCParams(ZSTD_compressionParameters cParams);
|
||||||
ZSTDLIB_API size_t ZSTD_estimateCCtxSize_usingCCtxParams(const ZSTD_CCtx_params* params);
|
ZSTDLIB_API size_t ZSTD_estimateCCtxSize_usingCCtxParams(const ZSTD_CCtx_params* params);
|
||||||
|
|||||||
Reference in New Issue
Block a user