• Home
  • Raw
  • Download

Lines Matching refs:cctx

111 	ZSTD_CCtx *cctx;  in ZSTD_createCCtx_advanced()  local
114 cctx = (ZSTD_CCtx *)ZSTD_malloc(sizeof(ZSTD_CCtx), customMem); in ZSTD_createCCtx_advanced()
115 if (!cctx) in ZSTD_createCCtx_advanced()
117 memset(cctx, 0, sizeof(ZSTD_CCtx)); in ZSTD_createCCtx_advanced()
118 cctx->customMem = customMem; in ZSTD_createCCtx_advanced()
119 return cctx; in ZSTD_createCCtx_advanced()
125 ZSTD_CCtx *cctx = ZSTD_createCCtx_advanced(stackMem); in ZSTD_initCCtx() local
126 if (cctx) { in ZSTD_initCCtx()
127 cctx->workSpace = ZSTD_stackAllocAll(cctx->customMem.opaque, &cctx->workSpaceSize); in ZSTD_initCCtx()
129 return cctx; in ZSTD_initCCtx()
132 size_t ZSTD_freeCCtx(ZSTD_CCtx *cctx) in ZSTD_freeCCtx() argument
134 if (cctx == NULL) in ZSTD_freeCCtx()
136 ZSTD_free(cctx->workSpace, cctx->customMem); in ZSTD_freeCCtx()
137 ZSTD_free(cctx, cctx->customMem); in ZSTD_freeCCtx()
143 static ZSTD_parameters ZSTD_getParamsFromCCtx(const ZSTD_CCtx *cctx) { return cctx->params; } in ZSTD_getParamsFromCCtx() argument
217 static size_t ZSTD_continueCCtx(ZSTD_CCtx *cctx, ZSTD_parameters params, U64 frameContentSize) in ZSTD_continueCCtx() argument
219 U32 const end = (U32)(cctx->nextSrc - cctx->base); in ZSTD_continueCCtx()
220 cctx->params = params; in ZSTD_continueCCtx()
221 cctx->frameContentSize = frameContentSize; in ZSTD_continueCCtx()
222 cctx->lowLimit = end; in ZSTD_continueCCtx()
223 cctx->dictLimit = end; in ZSTD_continueCCtx()
224 cctx->nextToUpdate = end + 1; in ZSTD_continueCCtx()
225 cctx->stage = ZSTDcs_init; in ZSTD_continueCCtx()
226 cctx->dictID = 0; in ZSTD_continueCCtx()
227 cctx->loadedDictEnd = 0; in ZSTD_continueCCtx()
231 cctx->rep[i] = repStartValue[i]; in ZSTD_continueCCtx()
233 cctx->seqStore.litLengthSum = 0; /* force reset of btopt stats */ in ZSTD_continueCCtx()
234 xxh64_reset(&cctx->xxhState, 0); in ZSTD_continueCCtx()
337 void ZSTD_invalidateRepCodes(ZSTD_CCtx *cctx) in ZSTD_invalidateRepCodes() argument
341 cctx->rep[i] = 0; in ZSTD_invalidateRepCodes()
1008 void ZSTD_compressBlock_fast_generic(ZSTD_CCtx *cctx, const void *src, size_t srcSize, const U32 ml… in ZSTD_compressBlock_fast_generic() argument
1010 U32 *const hashTable = cctx->hashTable; in ZSTD_compressBlock_fast_generic()
1011 U32 const hBits = cctx->params.cParams.hashLog; in ZSTD_compressBlock_fast_generic()
1012 seqStore_t *seqStorePtr = &(cctx->seqStore); in ZSTD_compressBlock_fast_generic()
1013 const BYTE *const base = cctx->base; in ZSTD_compressBlock_fast_generic()
1017 const U32 lowestIndex = cctx->dictLimit; in ZSTD_compressBlock_fast_generic()
1021 U32 offset_1 = cctx->rep[0], offset_2 = cctx->rep[1]; in ZSTD_compressBlock_fast_generic()
1093 cctx->repToConfirm[0] = offset_1 ? offset_1 : offsetSaved; in ZSTD_compressBlock_fast_generic()
1094 cctx->repToConfirm[1] = offset_2 ? offset_2 : offsetSaved; in ZSTD_compressBlock_fast_generic()
1235 static void ZSTD_fillDoubleHashTable(ZSTD_CCtx *cctx, const void *end, const U32 mls) in ZSTD_fillDoubleHashTable() argument
1237 U32 *const hashLarge = cctx->hashTable; in ZSTD_fillDoubleHashTable()
1238 U32 const hBitsL = cctx->params.cParams.hashLog; in ZSTD_fillDoubleHashTable()
1239 U32 *const hashSmall = cctx->chainTable; in ZSTD_fillDoubleHashTable()
1240 U32 const hBitsS = cctx->params.cParams.chainLog; in ZSTD_fillDoubleHashTable()
1241 const BYTE *const base = cctx->base; in ZSTD_fillDoubleHashTable()
1242 const BYTE *ip = base + cctx->nextToUpdate; in ZSTD_fillDoubleHashTable()
1254 void ZSTD_compressBlock_doubleFast_generic(ZSTD_CCtx *cctx, const void *src, size_t srcSize, const … in ZSTD_compressBlock_doubleFast_generic() argument
1256 U32 *const hashLong = cctx->hashTable; in ZSTD_compressBlock_doubleFast_generic()
1257 const U32 hBitsL = cctx->params.cParams.hashLog; in ZSTD_compressBlock_doubleFast_generic()
1258 U32 *const hashSmall = cctx->chainTable; in ZSTD_compressBlock_doubleFast_generic()
1259 const U32 hBitsS = cctx->params.cParams.chainLog; in ZSTD_compressBlock_doubleFast_generic()
1260 seqStore_t *seqStorePtr = &(cctx->seqStore); in ZSTD_compressBlock_doubleFast_generic()
1261 const BYTE *const base = cctx->base; in ZSTD_compressBlock_doubleFast_generic()
1265 const U32 lowestIndex = cctx->dictLimit; in ZSTD_compressBlock_doubleFast_generic()
1269 U32 offset_1 = cctx->rep[0], offset_2 = cctx->rep[1]; in ZSTD_compressBlock_doubleFast_generic()
1372 cctx->repToConfirm[0] = offset_1 ? offset_1 : offsetSaved; in ZSTD_compressBlock_doubleFast_generic()
1373 cctx->repToConfirm[1] = offset_2 ? offset_2 : offsetSaved; in ZSTD_compressBlock_doubleFast_generic()
2355 static size_t ZSTD_compress_generic(ZSTD_CCtx *cctx, void *dst, size_t dstCapacity, const void *src… in ZSTD_compress_generic() argument
2357 size_t blockSize = cctx->blockSize; in ZSTD_compress_generic()
2362 U32 const maxDist = 1 << cctx->params.cParams.windowLog; in ZSTD_compress_generic()
2364 if (cctx->params.fParams.checksumFlag && srcSize) in ZSTD_compress_generic()
2365 xxh64_update(&cctx->xxhState, src, srcSize); in ZSTD_compress_generic()
2377 if (cctx->lowLimit > (3U << 29)) { in ZSTD_compress_generic()
2378 …U32 const cycleMask = (1 << ZSTD_cycleLog(cctx->params.cParams.hashLog, cctx->params.cParams.strat… in ZSTD_compress_generic()
2379 U32 const curr = (U32)(ip - cctx->base); in ZSTD_compress_generic()
2380 U32 const newCurr = (curr & cycleMask) + (1 << cctx->params.cParams.windowLog); in ZSTD_compress_generic()
2383 ZSTD_reduceIndex(cctx, correction); in ZSTD_compress_generic()
2384 cctx->base += correction; in ZSTD_compress_generic()
2385 cctx->dictBase += correction; in ZSTD_compress_generic()
2386 cctx->lowLimit -= correction; in ZSTD_compress_generic()
2387 cctx->dictLimit -= correction; in ZSTD_compress_generic()
2388 if (cctx->nextToUpdate < correction) in ZSTD_compress_generic()
2389 cctx->nextToUpdate = 0; in ZSTD_compress_generic()
2391 cctx->nextToUpdate -= correction; in ZSTD_compress_generic()
2394 if ((U32)(ip + blockSize - cctx->base) > cctx->loadedDictEnd + maxDist) { in ZSTD_compress_generic()
2396 U32 const newLowLimit = (U32)(ip + blockSize - cctx->base) - maxDist; in ZSTD_compress_generic()
2397 if (cctx->lowLimit < newLowLimit) in ZSTD_compress_generic()
2398 cctx->lowLimit = newLowLimit; in ZSTD_compress_generic()
2399 if (cctx->dictLimit < cctx->lowLimit) in ZSTD_compress_generic()
2400 cctx->dictLimit = cctx->lowLimit; in ZSTD_compress_generic()
2403 …cSize = ZSTD_compressBlock_internal(cctx, op + ZSTD_blockHeaderSize, dstCapacity - ZSTD_blockHeade… in ZSTD_compress_generic()
2427 cctx->stage = ZSTDcs_ending; in ZSTD_compress_generic()
2490 static size_t ZSTD_compressContinue_internal(ZSTD_CCtx *cctx, void *dst, size_t dstCapacity, const … in ZSTD_compressContinue_internal() argument
2495 if (cctx->stage == ZSTDcs_created) in ZSTD_compressContinue_internal()
2498 if (frame && (cctx->stage == ZSTDcs_init)) { in ZSTD_compressContinue_internal()
2499 …fhSize = ZSTD_writeFrameHeader(dst, dstCapacity, cctx->params, cctx->frameContentSize, cctx->dictI… in ZSTD_compressContinue_internal()
2504 cctx->stage = ZSTDcs_ongoing; in ZSTD_compressContinue_internal()
2508 if (src != cctx->nextSrc) { in ZSTD_compressContinue_internal()
2510 ptrdiff_t const delta = cctx->nextSrc - ip; in ZSTD_compressContinue_internal()
2511 cctx->lowLimit = cctx->dictLimit; in ZSTD_compressContinue_internal()
2512 cctx->dictLimit = (U32)(cctx->nextSrc - cctx->base); in ZSTD_compressContinue_internal()
2513 cctx->dictBase = cctx->base; in ZSTD_compressContinue_internal()
2514 cctx->base -= delta; in ZSTD_compressContinue_internal()
2515 cctx->nextToUpdate = cctx->dictLimit; in ZSTD_compressContinue_internal()
2516 if (cctx->dictLimit - cctx->lowLimit < HASH_READ_SIZE) in ZSTD_compressContinue_internal()
2517 cctx->lowLimit = cctx->dictLimit; /* too small extDict */ in ZSTD_compressContinue_internal()
2521 if ((ip + srcSize > cctx->dictBase + cctx->lowLimit) & (ip < cctx->dictBase + cctx->dictLimit)) { in ZSTD_compressContinue_internal()
2522 ptrdiff_t const highInputIdx = (ip + srcSize) - cctx->dictBase; in ZSTD_compressContinue_internal()
2523 …U32 const lowLimitMax = (highInputIdx > (ptrdiff_t)cctx->dictLimit) ? cctx->dictLimit : (U32)highI… in ZSTD_compressContinue_internal()
2524 cctx->lowLimit = lowLimitMax; in ZSTD_compressContinue_internal()
2527 cctx->nextSrc = ip + srcSize; in ZSTD_compressContinue_internal()
2530 …size_t const cSize = frame ? ZSTD_compress_generic(cctx, dst, dstCapacity, src, srcSize, lastFrame… in ZSTD_compressContinue_internal()
2531 : ZSTD_compressBlock_internal(cctx, dst, dstCapacity, src, srcSize); in ZSTD_compressContinue_internal()
2539 size_t ZSTD_compressContinue(ZSTD_CCtx *cctx, void *dst, size_t dstCapacity, const void *src, size_… in ZSTD_compressContinue() argument
2541 return ZSTD_compressContinue_internal(cctx, dst, dstCapacity, src, srcSize, 1, 0); in ZSTD_compressContinue()
2544 size_t ZSTD_getBlockSizeMax(ZSTD_CCtx *cctx) { return MIN(ZSTD_BLOCKSIZE_ABSOLUTEMAX, 1 << cctx->pa… in ZSTD_getBlockSizeMax() argument
2546 size_t ZSTD_compressBlock(ZSTD_CCtx *cctx, void *dst, size_t dstCapacity, const void *src, size_t s… in ZSTD_compressBlock() argument
2548 size_t const blockSizeMax = ZSTD_getBlockSizeMax(cctx); in ZSTD_compressBlock()
2551 return ZSTD_compressContinue_internal(cctx, dst, dstCapacity, src, srcSize, 0, 0); in ZSTD_compressBlock()
2626 static size_t ZSTD_loadZstdDictionary(ZSTD_CCtx *cctx, const void *dict, size_t dictSize) in ZSTD_loadZstdDictionary() argument
2634 cctx->dictID = cctx->params.fParams.noDictIDFlag ? 0 : ZSTD_readLE32(dictPtr); in ZSTD_loadZstdDictionary()
2638 … hufHeaderSize = HUF_readCTable_wksp(cctx->hufTable, 255, dictPtr, dictEnd - dictPtr, cctx->tmpCou… in ZSTD_loadZstdDictionary()
2652 …CHECK_E(FSE_buildCTable_wksp(cctx->offcodeCTable, offcodeNCount, offcodeMaxValue, offcodeLog, cctx in ZSTD_loadZstdDictionary()
2668 …FSE_buildCTable_wksp(cctx->matchlengthCTable, matchlengthNCount, matchlengthMaxValue, matchlengthL… in ZSTD_loadZstdDictionary()
2683 …K_E(FSE_buildCTable_wksp(cctx->litlengthCTable, litlengthNCount, litlengthMaxValue, litlengthLog, in ZSTD_loadZstdDictionary()
2690 cctx->rep[0] = ZSTD_readLE32(dictPtr + 0); in ZSTD_loadZstdDictionary()
2691 cctx->rep[1] = ZSTD_readLE32(dictPtr + 4); in ZSTD_loadZstdDictionary()
2692 cctx->rep[2] = ZSTD_readLE32(dictPtr + 8); in ZSTD_loadZstdDictionary()
2708 if (cctx->rep[u] == 0) in ZSTD_loadZstdDictionary()
2710 if (cctx->rep[u] > dictContentSize) in ZSTD_loadZstdDictionary()
2715 cctx->flagStaticTables = 1; in ZSTD_loadZstdDictionary()
2716 cctx->flagStaticHufTable = HUF_repeat_valid; in ZSTD_loadZstdDictionary()
2717 return ZSTD_loadDictionaryContent(cctx, dictPtr, dictContentSize); in ZSTD_loadZstdDictionary()
2723 static size_t ZSTD_compress_insertDictionary(ZSTD_CCtx *cctx, const void *dict, size_t dictSize) in ZSTD_compress_insertDictionary() argument
2729 if ((ZSTD_readLE32(dict) != ZSTD_DICT_MAGIC) || (cctx->forceRawDict)) in ZSTD_compress_insertDictionary()
2730 return ZSTD_loadDictionaryContent(cctx, dict, dictSize); in ZSTD_compress_insertDictionary()
2733 return ZSTD_loadZstdDictionary(cctx, dict, dictSize); in ZSTD_compress_insertDictionary()
2738 static size_t ZSTD_compressBegin_internal(ZSTD_CCtx *cctx, const void *dict, size_t dictSize, ZSTD_… in ZSTD_compressBegin_internal() argument
2741 CHECK_F(ZSTD_resetCCtx_advanced(cctx, params, pledgedSrcSize, crp)); in ZSTD_compressBegin_internal()
2742 return ZSTD_compress_insertDictionary(cctx, dict, dictSize); in ZSTD_compressBegin_internal()
2747 size_t ZSTD_compressBegin_advanced(ZSTD_CCtx *cctx, const void *dict, size_t dictSize, ZSTD_paramet… in ZSTD_compressBegin_advanced() argument
2751 return ZSTD_compressBegin_internal(cctx, dict, dictSize, params, pledgedSrcSize); in ZSTD_compressBegin_advanced()
2754 size_t ZSTD_compressBegin_usingDict(ZSTD_CCtx *cctx, const void *dict, size_t dictSize, int compres… in ZSTD_compressBegin_usingDict() argument
2757 return ZSTD_compressBegin_internal(cctx, dict, dictSize, params, 0); in ZSTD_compressBegin_usingDict()
2760 size_t ZSTD_compressBegin(ZSTD_CCtx *cctx, int compressionLevel) { return ZSTD_compressBegin_usingD… in ZSTD_compressBegin() argument
2765 static size_t ZSTD_writeEpilogue(ZSTD_CCtx *cctx, void *dst, size_t dstCapacity) in ZSTD_writeEpilogue() argument
2771 if (cctx->stage == ZSTDcs_created) in ZSTD_writeEpilogue()
2775 if (cctx->stage == ZSTDcs_init) { in ZSTD_writeEpilogue()
2776 fhSize = ZSTD_writeFrameHeader(dst, dstCapacity, cctx->params, 0, 0); in ZSTD_writeEpilogue()
2781 cctx->stage = ZSTDcs_ongoing; in ZSTD_writeEpilogue()
2784 if (cctx->stage != ZSTDcs_ending) { in ZSTD_writeEpilogue()
2794 if (cctx->params.fParams.checksumFlag) { in ZSTD_writeEpilogue()
2795 U32 const checksum = (U32)xxh64_digest(&cctx->xxhState); in ZSTD_writeEpilogue()
2802 cctx->stage = ZSTDcs_created; /* return to "created but no init" status */ in ZSTD_writeEpilogue()
2806 size_t ZSTD_compressEnd(ZSTD_CCtx *cctx, void *dst, size_t dstCapacity, const void *src, size_t src… in ZSTD_compressEnd() argument
2809 size_t const cSize = ZSTD_compressContinue_internal(cctx, dst, dstCapacity, src, srcSize, 1, 1); in ZSTD_compressEnd()
2812 endResult = ZSTD_writeEpilogue(cctx, (char *)dst + cSize, dstCapacity - cSize); in ZSTD_compressEnd()
2818 static size_t ZSTD_compress_internal(ZSTD_CCtx *cctx, void *dst, size_t dstCapacity, const void *sr… in ZSTD_compress_internal() argument
2821 CHECK_F(ZSTD_compressBegin_internal(cctx, dict, dictSize, params, srcSize)); in ZSTD_compress_internal()
2822 return ZSTD_compressEnd(cctx, dst, dstCapacity, src, srcSize); in ZSTD_compress_internal()
2854 ZSTD_CCtx *const cctx = ZSTD_createCCtx_advanced(customMem); in ZSTD_createCDict_advanced() local
2856 if (!cdict || !cctx) { in ZSTD_createCDict_advanced()
2858 ZSTD_freeCCtx(cctx); in ZSTD_createCDict_advanced()
2868 ZSTD_free(cctx, customMem); in ZSTD_createCDict_advanced()
2878 …size_t const errorCode = ZSTD_compressBegin_advanced(cctx, cdict->dictContent, dictSize, params, 0… in ZSTD_createCDict_advanced()
2882 ZSTD_freeCCtx(cctx); in ZSTD_createCDict_advanced()
2887 cdict->refContext = cctx; in ZSTD_createCDict_advanced()
2914 size_t ZSTD_compressBegin_usingCDict(ZSTD_CCtx *cctx, const ZSTD_CDict *cdict, unsigned long long p… in ZSTD_compressBegin_usingCDict() argument
2917 CHECK_F(ZSTD_copyCCtx(cctx, cdict->refContext, pledgedSrcSize)) in ZSTD_compressBegin_usingCDict()
2921 CHECK_F(ZSTD_compressBegin_advanced(cctx, NULL, 0, params, pledgedSrcSize)); in ZSTD_compressBegin_usingCDict()
2930 size_t ZSTD_compress_usingCDict(ZSTD_CCtx *cctx, void *dst, size_t dstCapacity, const void *src, si… in ZSTD_compress_usingCDict() argument
2932 CHECK_F(ZSTD_compressBegin_usingCDict(cctx, cdict, srcSize)); in ZSTD_compress_usingCDict()
2935 cctx->params.fParams.contentSizeFlag = 1; in ZSTD_compress_usingCDict()
2936 cctx->frameContentSize = srcSize; in ZSTD_compress_usingCDict()
2938 cctx->params.fParams.contentSizeFlag = 0; in ZSTD_compress_usingCDict()
2941 return ZSTD_compressEnd(cctx, dst, dstCapacity, src, srcSize); in ZSTD_compress_usingCDict()
2951 ZSTD_CCtx *cctx; member
2994 zcs->cctx = ZSTD_createCCtx_advanced(customMem); in ZSTD_createCStream_advanced()
2995 if (zcs->cctx == NULL) { in ZSTD_createCStream_advanced()
3008 ZSTD_freeCCtx(zcs->cctx); in ZSTD_freeCStream()
3009 zcs->cctx = NULL; in ZSTD_freeCStream()
3032 CHECK_F(ZSTD_compressBegin_usingCDict(zcs->cctx, zcs->cdict, pledgedSrcSize)) in ZSTD_resetCStream_internal()
3034 CHECK_F(ZSTD_compressBegin_advanced(zcs->cctx, NULL, 0, zcs->params, pledgedSrcSize)); in ZSTD_resetCStream_internal()
3166 …cSize = (flush == zsf_end) ? ZSTD_compressEnd(zcs->cctx, cDst, oSize, zcs->inBuff + zcs->inToCompr… in ZSTD_compressStream_generic()
3167 : ZSTD_compressContinue(zcs->cctx, cDst, oSize, zcs->inBuff + zcs->inToCompress, iSize); in ZSTD_compressStream_generic()
3274 …zcs->outBuffContentSize = !notEnded ? 0 : ZSTD_compressEnd(zcs->cctx, zcs->outBuff, zcs->outBuffSi… in ZSTD_endStream()