Lines Matching refs:cdict
155 ZSTD_freeCDict(cctx->localDict.cdict); in ZSTD_clearAllDicts()
158 cctx->cdict = NULL; in ZSTD_clearAllDicts()
164 size_t const cdictSize = ZSTD_sizeof_CDict(dict.cdict); in ZSTD_sizeof_localDict()
1120 RETURN_ERROR_IF(cctx->cdict, stage_wrong, in ZSTD_CCtx_setParametersUsingCCtxParams()
1194 assert(dl->cdict == NULL); in ZSTD_initLocalDict()
1198 if (dl->cdict != NULL) { in ZSTD_initLocalDict()
1200 assert(cctx->cdict == dl->cdict); in ZSTD_initLocalDict()
1204 assert(cctx->cdict == NULL); in ZSTD_initLocalDict()
1207 dl->cdict = ZSTD_createCDict_advanced2( in ZSTD_initLocalDict()
1214 RETURN_ERROR_IF(!dl->cdict, memory_allocation, "ZSTD_createCDict_advanced failed"); in ZSTD_initLocalDict()
1215 cctx->cdict = dl->cdict; in ZSTD_initLocalDict()
1264 size_t ZSTD_CCtx_refCDict(ZSTD_CCtx* cctx, const ZSTD_CDict* cdict) in ZSTD_CCtx_refCDict() argument
1270 cctx->cdict = cdict; in ZSTD_CCtx_refCDict()
2235 static int ZSTD_shouldAttachDict(const ZSTD_CDict* cdict, in ZSTD_shouldAttachDict() argument
2239 size_t cutoff = attachDictSizeCutoffs[cdict->matchState.cParams.strategy]; in ZSTD_shouldAttachDict()
2240 int const dedicatedDictSearch = cdict->matchState.dedicatedDictSearch; in ZSTD_shouldAttachDict()
2252 const ZSTD_CDict* cdict, in ZSTD_resetCCtx_byAttachingCDict() argument
2260 ZSTD_compressionParameters adjusted_cdict_cParams = cdict->matchState.cParams; in ZSTD_resetCCtx_byAttachingCDict()
2267 if (cdict->matchState.dedicatedDictSearch) { in ZSTD_resetCCtx_byAttachingCDict()
2272 cdict->dictContentSize, ZSTD_cpm_attachDict, in ZSTD_resetCCtx_byAttachingCDict()
2275 params.useRowMatchFinder = cdict->useRowMatchFinder; /* cdict overrides */ in ZSTD_resetCCtx_byAttachingCDict()
2282 { const U32 cdictEnd = (U32)( cdict->matchState.window.nextSrc in ZSTD_resetCCtx_byAttachingCDict()
2283 - cdict->matchState.window.base); in ZSTD_resetCCtx_byAttachingCDict()
2284 const U32 cdictLen = cdictEnd - cdict->matchState.window.dictLimit; in ZSTD_resetCCtx_byAttachingCDict()
2290 cctx->blockState.matchState.dictMatchState = &cdict->matchState; in ZSTD_resetCCtx_byAttachingCDict()
2303 cctx->dictID = cdict->dictID; in ZSTD_resetCCtx_byAttachingCDict()
2304 cctx->dictContentSize = cdict->dictContentSize; in ZSTD_resetCCtx_byAttachingCDict()
2307 ZSTD_memcpy(cctx->blockState.prevCBlock, &cdict->cBlockState, sizeof(cdict->cBlockState)); in ZSTD_resetCCtx_byAttachingCDict()
2329 const ZSTD_CDict* cdict, in ZSTD_resetCCtx_byCopyingCDict() argument
2334 const ZSTD_compressionParameters *cdict_cParams = &cdict->matchState.cParams; in ZSTD_resetCCtx_byCopyingCDict()
2336 assert(!cdict->matchState.dedicatedDictSearch); in ZSTD_resetCCtx_byCopyingCDict()
2345 params.useRowMatchFinder = cdict->useRowMatchFinder; in ZSTD_resetCCtx_byCopyingCDict()
2358 …{ size_t const chainSize = ZSTD_allocateChainTable(cdict_cParams->strategy, cdict->useRowMatchFi… in ZSTD_resetCCtx_byCopyingCDict()
2364 cdict->matchState.hashTable, in ZSTD_resetCCtx_byCopyingCDict()
2370 cdict->matchState.chainTable, in ZSTD_resetCCtx_byCopyingCDict()
2374 if (ZSTD_rowMatchFinderUsed(cdict_cParams->strategy, cdict->useRowMatchFinder)) { in ZSTD_resetCCtx_byCopyingCDict()
2377 cdict->matchState.tagTable, in ZSTD_resetCCtx_byCopyingCDict()
2379 cctx->blockState.matchState.hashSalt = cdict->matchState.hashSalt; in ZSTD_resetCCtx_byCopyingCDict()
2387 assert(cdict->matchState.hashLog3 == 0); in ZSTD_resetCCtx_byCopyingCDict()
2394 { ZSTD_MatchState_t const* srcMatchState = &cdict->matchState; in ZSTD_resetCCtx_byCopyingCDict()
2401 cctx->dictID = cdict->dictID; in ZSTD_resetCCtx_byCopyingCDict()
2402 cctx->dictContentSize = cdict->dictContentSize; in ZSTD_resetCCtx_byCopyingCDict()
2405 ZSTD_memcpy(cctx->blockState.prevCBlock, &cdict->cBlockState, sizeof(cdict->cBlockState)); in ZSTD_resetCCtx_byCopyingCDict()
2414 const ZSTD_CDict* cdict, in ZSTD_resetCCtx_usingCDict() argument
2423 if (ZSTD_shouldAttachDict(cdict, params, pledgedSrcSize)) { in ZSTD_resetCCtx_usingCDict()
2425 cctx, cdict, *params, pledgedSrcSize, zbuff); in ZSTD_resetCCtx_usingCDict()
2428 cctx, cdict, *params, pledgedSrcSize, zbuff); in ZSTD_resetCCtx_usingCDict()
5156 const ZSTD_CDict* cdict, in ZSTD_compressBegin_internal() argument
5160 size_t const dictContentSize = cdict ? cdict->dictContentSize : dictSize; in ZSTD_compressBegin_internal()
5164 assert(!((dict) && (cdict))); /* either dict or cdict, not both */ in ZSTD_compressBegin_internal()
5165 if ( (cdict) in ZSTD_compressBegin_internal()
5166 && (cdict->dictContentSize > 0) in ZSTD_compressBegin_internal()
5168 || pledgedSrcSize < cdict->dictContentSize * ZSTD_USE_CDICT_PARAMS_DICTSIZE_MULTIPLIER in ZSTD_compressBegin_internal()
5170 || cdict->compressionLevel == 0) in ZSTD_compressBegin_internal()
5172 return ZSTD_resetCCtx_usingCDict(cctx, cdict, params, pledgedSrcSize, zbuff); in ZSTD_compressBegin_internal()
5178 { size_t const dictID = cdict ? in ZSTD_compressBegin_internal()
5181 &cctx->ldmState, &cctx->workspace, &cctx->appliedParams, cdict->dictContent, in ZSTD_compressBegin_internal()
5182 cdict->dictContentSize, cdict->dictContentType, dtlm, in ZSTD_compressBegin_internal()
5200 const ZSTD_CDict* cdict, in ZSTD_compressBegin_advanced_internal() argument
5209 cdict, in ZSTD_compressBegin_advanced_internal()
5428 size_t ZSTD_sizeof_CDict(const ZSTD_CDict* cdict) in ZSTD_sizeof_CDict() argument
5430 if (cdict==NULL) return 0; /* support sizeof on NULL */ in ZSTD_sizeof_CDict()
5431 DEBUGLOG(5, "sizeof(*cdict) : %u", (unsigned)sizeof(*cdict)); in ZSTD_sizeof_CDict()
5433 return (cdict->workspace.workspace == cdict ? 0 : sizeof(*cdict)) in ZSTD_sizeof_CDict()
5434 + ZSTD_cwksp_sizeof(&cdict->workspace); in ZSTD_sizeof_CDict()
5438 ZSTD_CDict* cdict, in ZSTD_initCDict_internal() argument
5446 cdict->matchState.cParams = params.cParams; in ZSTD_initCDict_internal()
5447 cdict->matchState.dedicatedDictSearch = params.enableDedicatedDictSearch; in ZSTD_initCDict_internal()
5449 cdict->dictContent = dictBuffer; in ZSTD_initCDict_internal()
5451 …void *internalBuffer = ZSTD_cwksp_reserve_object(&cdict->workspace, ZSTD_cwksp_align(dictSize, siz… in ZSTD_initCDict_internal()
5453 cdict->dictContent = internalBuffer; in ZSTD_initCDict_internal()
5456 cdict->dictContentSize = dictSize; in ZSTD_initCDict_internal()
5457 cdict->dictContentType = dictContentType; in ZSTD_initCDict_internal()
5459 … cdict->entropyWorkspace = (U32*)ZSTD_cwksp_reserve_object(&cdict->workspace, HUF_WORKSPACE_SIZE); in ZSTD_initCDict_internal()
5463 ZSTD_reset_compressedBlockState(&cdict->cBlockState); in ZSTD_initCDict_internal()
5465 &cdict->matchState, in ZSTD_initCDict_internal()
5466 &cdict->workspace, in ZSTD_initCDict_internal()
5478 &cdict->cBlockState, &cdict->matchState, NULL, &cdict->workspace, in ZSTD_initCDict_internal()
5479 ¶ms, cdict->dictContent, cdict->dictContentSize, in ZSTD_initCDict_internal()
5480 dictContentType, ZSTD_dtlm_full, ZSTD_tfp_forCDict, cdict->entropyWorkspace); in ZSTD_initCDict_internal()
5483 cdict->dictID = (U32)dictID; in ZSTD_initCDict_internal()
5509 ZSTD_CDict* cdict; in ZSTD_createCDict_advanced_internal() local
5518 cdict = (ZSTD_CDict*)ZSTD_cwksp_reserve_object(&ws, sizeof(ZSTD_CDict)); in ZSTD_createCDict_advanced_internal()
5519 assert(cdict != NULL); in ZSTD_createCDict_advanced_internal()
5520 ZSTD_cwksp_move(&cdict->workspace, &ws); in ZSTD_createCDict_advanced_internal()
5521 cdict->customMem = customMem; in ZSTD_createCDict_advanced_internal()
5522 cdict->compressionLevel = ZSTD_NO_CLEVEL; /* signals advanced API usage */ in ZSTD_createCDict_advanced_internal()
5523 cdict->useRowMatchFinder = useRowMatchFinder; in ZSTD_createCDict_advanced_internal()
5524 return cdict; in ZSTD_createCDict_advanced_internal()
5555 ZSTD_CDict* cdict; in ZSTD_createCDict_advanced2() local
5580 cdict = ZSTD_createCDict_advanced_internal(dictSize, in ZSTD_createCDict_advanced2()
5585 if (!cdict || ZSTD_isError( ZSTD_initCDict_internal(cdict, in ZSTD_createCDict_advanced2()
5589 ZSTD_freeCDict(cdict); in ZSTD_createCDict_advanced2()
5593 return cdict; in ZSTD_createCDict_advanced2()
5599 ZSTD_CDict* const cdict = ZSTD_createCDict_advanced(dict, dictSize, in ZSTD_createCDict() local
5602 if (cdict) in ZSTD_createCDict()
5603 cdict->compressionLevel = (compressionLevel == 0) ? ZSTD_CLEVEL_DEFAULT : compressionLevel; in ZSTD_createCDict()
5604 return cdict; in ZSTD_createCDict()
5610 ZSTD_CDict* const cdict = ZSTD_createCDict_advanced(dict, dictSize, in ZSTD_createCDict_byReference() local
5613 if (cdict) in ZSTD_createCDict_byReference()
5614 cdict->compressionLevel = (compressionLevel == 0) ? ZSTD_CLEVEL_DEFAULT : compressionLevel; in ZSTD_createCDict_byReference()
5615 return cdict; in ZSTD_createCDict_byReference()
5618 size_t ZSTD_freeCDict(ZSTD_CDict* cdict) in ZSTD_freeCDict() argument
5620 if (cdict==NULL) return 0; /* support free on NULL */ in ZSTD_freeCDict()
5621 { ZSTD_customMem const cMem = cdict->customMem; in ZSTD_freeCDict()
5622 int cdictInWorkspace = ZSTD_cwksp_owns_buffer(&cdict->workspace, cdict); in ZSTD_freeCDict()
5623 ZSTD_cwksp_free(&cdict->workspace, cMem); in ZSTD_freeCDict()
5625 ZSTD_customFree(cdict, cMem); in ZSTD_freeCDict()
5659 ZSTD_CDict* cdict; in ZSTD_initStaticCDict() local
5668 cdict = (ZSTD_CDict*)ZSTD_cwksp_reserve_object(&ws, sizeof(ZSTD_CDict)); in ZSTD_initStaticCDict()
5669 if (cdict == NULL) return NULL; in ZSTD_initStaticCDict()
5670 ZSTD_cwksp_move(&cdict->workspace, &ws); in ZSTD_initStaticCDict()
5678 cdict->useRowMatchFinder = useRowMatchFinder; in ZSTD_initStaticCDict()
5679 cdict->compressionLevel = ZSTD_NO_CLEVEL; in ZSTD_initStaticCDict()
5681 if (ZSTD_isError( ZSTD_initCDict_internal(cdict, in ZSTD_initStaticCDict()
5687 return cdict; in ZSTD_initStaticCDict()
5690 ZSTD_compressionParameters ZSTD_getCParamsFromCDict(const ZSTD_CDict* cdict) in ZSTD_getCParamsFromCDict() argument
5692 assert(cdict != NULL); in ZSTD_getCParamsFromCDict()
5693 return cdict->matchState.cParams; in ZSTD_getCParamsFromCDict()
5700 unsigned ZSTD_getDictID_fromCDict(const ZSTD_CDict* cdict) in ZSTD_getDictID_fromCDict() argument
5702 if (cdict==NULL) return 0; in ZSTD_getDictID_fromCDict()
5703 return cdict->dictID; in ZSTD_getDictID_fromCDict()
5710 ZSTD_CCtx* const cctx, const ZSTD_CDict* const cdict, in ZSTD_compressBegin_usingCDict_internal() argument
5715 RETURN_ERROR_IF(cdict==NULL, dictionary_wrong, "NULL pointer!"); in ZSTD_compressBegin_usingCDict_internal()
5721 … || pledgedSrcSize < cdict->dictContentSize * ZSTD_USE_CDICT_PARAMS_DICTSIZE_MULTIPLIER in ZSTD_compressBegin_usingCDict_internal()
5723 || cdict->compressionLevel == 0 ) ? in ZSTD_compressBegin_usingCDict_internal()
5724 ZSTD_getCParamsFromCDict(cdict) in ZSTD_compressBegin_usingCDict_internal()
5725 : ZSTD_getCParams(cdict->compressionLevel, in ZSTD_compressBegin_usingCDict_internal()
5727 cdict->dictContentSize); in ZSTD_compressBegin_usingCDict_internal()
5728 ZSTD_CCtxParams_init_internal(&cctxParams, ¶ms, cdict->compressionLevel); in ZSTD_compressBegin_usingCDict_internal()
5741 cdict, in ZSTD_compressBegin_usingCDict_internal()
5751 ZSTD_CCtx* const cctx, const ZSTD_CDict* const cdict, in ZSTD_compressBegin_usingCDict_advanced() argument
5754 return ZSTD_compressBegin_usingCDict_internal(cctx, cdict, fParams, pledgedSrcSize); in ZSTD_compressBegin_usingCDict_advanced()
5759 size_t ZSTD_compressBegin_usingCDict_deprecated(ZSTD_CCtx* cctx, const ZSTD_CDict* cdict) in ZSTD_compressBegin_usingCDict_deprecated() argument
5762 return ZSTD_compressBegin_usingCDict_internal(cctx, cdict, fParams, ZSTD_CONTENTSIZE_UNKNOWN); in ZSTD_compressBegin_usingCDict_deprecated()
5765 size_t ZSTD_compressBegin_usingCDict(ZSTD_CCtx* cctx, const ZSTD_CDict* cdict) in ZSTD_compressBegin_usingCDict() argument
5767 return ZSTD_compressBegin_usingCDict_deprecated(cctx, cdict); in ZSTD_compressBegin_usingCDict()
5776 const ZSTD_CDict* cdict, ZSTD_frameParameters fParams) in ZSTD_compress_usingCDict_internal() argument
5778 …FORWARD_IF_ERROR(ZSTD_compressBegin_usingCDict_internal(cctx, cdict, fParams, srcSize), ""); /* wi… in ZSTD_compress_usingCDict_internal()
5788 const ZSTD_CDict* cdict, ZSTD_frameParameters fParams) in ZSTD_compress_usingCDict_advanced() argument
5790 return ZSTD_compress_usingCDict_internal(cctx, dst, dstCapacity, src, srcSize, cdict, fParams); in ZSTD_compress_usingCDict_advanced()
5801 const ZSTD_CDict* cdict) in ZSTD_compress_usingCDict() argument
5804 return ZSTD_compress_usingCDict_internal(cctx, dst, dstCapacity, src, srcSize, cdict, fParams); in ZSTD_compress_usingCDict()
5845 static ZSTD_CParamMode_e ZSTD_getCParamMode(ZSTD_CDict const* cdict, ZSTD_CCtx_params const* params… in ZSTD_getCParamMode() argument
5847 if (cdict != NULL && ZSTD_shouldAttachDict(cdict, params, pledgedSrcSize)) in ZSTD_getCParamMode()
5873 const void* dict, size_t dictSize, const ZSTD_CDict* cdict, in ZSTD_initCStream_internal() argument
5882 assert(!((dict) && (cdict))); /* either dict or cdict, not both */ in ZSTD_initCStream_internal()
5887 FORWARD_IF_ERROR( ZSTD_CCtx_refCDict(zcs, cdict) , ""); in ZSTD_initCStream_internal()
5895 const ZSTD_CDict* cdict, in ZSTD_initCStream_usingCDict_advanced() argument
5903 FORWARD_IF_ERROR( ZSTD_CCtx_refCDict(zcs, cdict) , ""); in ZSTD_initCStream_usingCDict_advanced()
5908 size_t ZSTD_initCStream_usingCDict(ZSTD_CStream* zcs, const ZSTD_CDict* cdict) in ZSTD_initCStream_usingCDict() argument
5912 FORWARD_IF_ERROR( ZSTD_CCtx_refCDict(zcs, cdict) , ""); in ZSTD_initCStream_usingCDict()
6237 assert(prefixDict.dict==NULL || cctx->cdict==NULL); /* only one can be set */ in ZSTD_CCtx_init_compressStream2()
6238 if (cctx->cdict && !cctx->localDict.cdict) { in ZSTD_CCtx_init_compressStream2()
6243 params.compressionLevel = cctx->cdict->compressionLevel; in ZSTD_CCtx_init_compressStream2()
6250 : (cctx->cdict ? cctx->cdict->dictContentSize : 0); in ZSTD_CCtx_init_compressStream2()
6251 …ZSTD_CParamMode_e const mode = ZSTD_getCParamMode(cctx->cdict, ¶ms, cctx->pledgedSrcSizePlusOn… in ZSTD_CCtx_init_compressStream2()
6268 cctx->cdict, in ZSTD_CCtx_init_compressStream2()
6451 if (cctx->cdict) { in ZSTD_transferSequences_wBlockDelim()
6452 dictSize = (U32)cctx->cdict->dictContentSize; in ZSTD_transferSequences_wBlockDelim()
6556 if (cctx->cdict) { in ZSTD_transferSequences_noDelim()
6557 dictSize = cctx->cdict->dictContentSize; in ZSTD_transferSequences_noDelim()