fix : ZSTD_compress_generic(,,,ZSTD_e_end) automatically sets pledgedSrcSize
as per documentation, on ZSTD_setPledgedSrcSize() : > If all data is provided and consumed in a single round, > this value (pledgedSrcSize) is overriden by srcSize instead. This wasn't applied before compression level is transformed into compression parameters. As a consequence, small input missed compression parameters adaptation. It seems to work fine now : compression was compared with ZSTD_compress_advanced(), results were the same.
This commit is contained in:
@@ -2814,6 +2814,7 @@ size_t ZSTD_compress_generic (ZSTD_CCtx* cctx,
|
||||
if (cctx->streamStage == zcss_init) {
|
||||
ZSTD_prefixDict const prefixDict = cctx->prefixDict;
|
||||
ZSTD_CCtx_params params = cctx->requestedParams;
|
||||
if (endOp == ZSTD_e_end) cctx->pledgedSrcSizePlusOne = input->size + 1;
|
||||
params.cParams = ZSTD_getCParamsFromCCtxParams(
|
||||
cctx->requestedParams, cctx->pledgedSrcSizePlusOne-1, 0 /*dictSize*/);
|
||||
memset(&cctx->prefixDict, 0, sizeof(cctx->prefixDict)); /* single usage */
|
||||
|
||||
Reference in New Issue
Block a user