Lines Matching refs:zc
242 static size_t ZSTD_resetCCtx_advanced(ZSTD_CCtx *zc, ZSTD_parameters params, U64 frameContentSize, … in ZSTD_resetCCtx_advanced() argument
245 if (ZSTD_equivalentParams(params, zc->params)) { in ZSTD_resetCCtx_advanced()
246 zc->flagStaticTables = 0; in ZSTD_resetCCtx_advanced()
247 zc->flagStaticHufTable = HUF_repeat_none; in ZSTD_resetCCtx_advanced()
248 return ZSTD_continueCCtx(zc, params, frameContentSize); in ZSTD_resetCCtx_advanced()
269 if (zc->workSpaceSize < neededSpace) { in ZSTD_resetCCtx_advanced()
270 ZSTD_free(zc->workSpace, zc->customMem); in ZSTD_resetCCtx_advanced()
271 zc->workSpace = ZSTD_malloc(neededSpace, zc->customMem); in ZSTD_resetCCtx_advanced()
272 if (zc->workSpace == NULL) in ZSTD_resetCCtx_advanced()
274 zc->workSpaceSize = neededSpace; in ZSTD_resetCCtx_advanced()
279 memset(zc->workSpace, 0, tableSpace); /* reset tables only */ in ZSTD_resetCCtx_advanced()
280 xxh64_reset(&zc->xxhState, 0); in ZSTD_resetCCtx_advanced()
281 zc->hashLog3 = hashLog3; in ZSTD_resetCCtx_advanced()
282 zc->hashTable = (U32 *)(zc->workSpace); in ZSTD_resetCCtx_advanced()
283 zc->chainTable = zc->hashTable + hSize; in ZSTD_resetCCtx_advanced()
284 zc->hashTable3 = zc->chainTable + chainSize; in ZSTD_resetCCtx_advanced()
285 ptr = zc->hashTable3 + h3Size; in ZSTD_resetCCtx_advanced()
286 zc->hufTable = (HUF_CElt *)ptr; in ZSTD_resetCCtx_advanced()
287 zc->flagStaticTables = 0; in ZSTD_resetCCtx_advanced()
288 zc->flagStaticHufTable = HUF_repeat_none; in ZSTD_resetCCtx_advanced()
291 zc->nextToUpdate = 1; in ZSTD_resetCCtx_advanced()
292 zc->nextSrc = NULL; in ZSTD_resetCCtx_advanced()
293 zc->base = NULL; in ZSTD_resetCCtx_advanced()
294 zc->dictBase = NULL; in ZSTD_resetCCtx_advanced()
295 zc->dictLimit = 0; in ZSTD_resetCCtx_advanced()
296 zc->lowLimit = 0; in ZSTD_resetCCtx_advanced()
297 zc->params = params; in ZSTD_resetCCtx_advanced()
298 zc->blockSize = blockSize; in ZSTD_resetCCtx_advanced()
299 zc->frameContentSize = frameContentSize; in ZSTD_resetCCtx_advanced()
303 zc->rep[i] = repStartValue[i]; in ZSTD_resetCCtx_advanced()
307 zc->seqStore.litFreq = (U32 *)ptr; in ZSTD_resetCCtx_advanced()
308 zc->seqStore.litLengthFreq = zc->seqStore.litFreq + (1 << Litbits); in ZSTD_resetCCtx_advanced()
309 zc->seqStore.matchLengthFreq = zc->seqStore.litLengthFreq + (MaxLL + 1); in ZSTD_resetCCtx_advanced()
310 zc->seqStore.offCodeFreq = zc->seqStore.matchLengthFreq + (MaxML + 1); in ZSTD_resetCCtx_advanced()
311 ptr = zc->seqStore.offCodeFreq + (MaxOff + 1); in ZSTD_resetCCtx_advanced()
312 zc->seqStore.matchTable = (ZSTD_match_t *)ptr; in ZSTD_resetCCtx_advanced()
313 ptr = zc->seqStore.matchTable + ZSTD_OPT_NUM + 1; in ZSTD_resetCCtx_advanced()
314 zc->seqStore.priceTable = (ZSTD_optimal_t *)ptr; in ZSTD_resetCCtx_advanced()
315 ptr = zc->seqStore.priceTable + ZSTD_OPT_NUM + 1; in ZSTD_resetCCtx_advanced()
316 zc->seqStore.litLengthSum = 0; in ZSTD_resetCCtx_advanced()
318 zc->seqStore.sequencesStart = (seqDef *)ptr; in ZSTD_resetCCtx_advanced()
319 ptr = zc->seqStore.sequencesStart + maxNbSeq; in ZSTD_resetCCtx_advanced()
320 zc->seqStore.llCode = (BYTE *)ptr; in ZSTD_resetCCtx_advanced()
321 zc->seqStore.mlCode = zc->seqStore.llCode + maxNbSeq; in ZSTD_resetCCtx_advanced()
322 zc->seqStore.ofCode = zc->seqStore.mlCode + maxNbSeq; in ZSTD_resetCCtx_advanced()
323 zc->seqStore.litStart = zc->seqStore.ofCode + maxNbSeq; in ZSTD_resetCCtx_advanced()
325 zc->stage = ZSTDcs_init; in ZSTD_resetCCtx_advanced()
326 zc->dictID = 0; in ZSTD_resetCCtx_advanced()
327 zc->loadedDictEnd = 0; in ZSTD_resetCCtx_advanced()
410 static void ZSTD_reduceIndex(ZSTD_CCtx *zc, const U32 reducerValue) in ZSTD_reduceIndex() argument
413 U32 const hSize = 1 << zc->params.cParams.hashLog; in ZSTD_reduceIndex()
414 ZSTD_reduceTable(zc->hashTable, hSize, reducerValue); in ZSTD_reduceIndex()
418 …U32 const chainSize = (zc->params.cParams.strategy == ZSTD_fast) ? 0 : (1 << zc->params.cParams.ch… in ZSTD_reduceIndex()
419 ZSTD_reduceTable(zc->chainTable, chainSize, reducerValue); in ZSTD_reduceIndex()
423 U32 const h3Size = (zc->hashLog3) ? 1 << zc->hashLog3 : 0; in ZSTD_reduceIndex()
424 ZSTD_reduceTable(zc->hashTable3, h3Size, reducerValue); in ZSTD_reduceIndex()
482 static size_t ZSTD_compressLiterals(ZSTD_CCtx *zc, void *dst, size_t dstCapacity, const void *src, … in ZSTD_compressLiterals() argument
494 size_t const minLitSize = zc->flagStaticHufTable == HUF_repeat_valid ? 6 : LITERAL_NOENTROPY; in ZSTD_compressLiterals()
502 HUF_repeat repeat = zc->flagStaticHufTable; in ZSTD_compressLiterals()
503 int const preferRepeat = zc->params.cParams.strategy < ZSTD_lazy ? srcSize <= 1024 : 0; in ZSTD_compressLiterals()
506 …UF_compress1X_repeat(ostart + lhSize, dstCapacity - lhSize, src, srcSize, 255, 11, zc->tmpCounters, in ZSTD_compressLiterals()
507 sizeof(zc->tmpCounters), zc->hufTable, &repeat, preferRepeat) in ZSTD_compressLiterals()
508 …: HUF_compress4X_repeat(ostart + lhSize, dstCapacity - lhSize, src, srcSize, 255, 11, zc->tmpCount… in ZSTD_compressLiterals()
509 sizeof(zc->tmpCounters), zc->hufTable, &repeat, preferRepeat); in ZSTD_compressLiterals()
514 zc->flagStaticHufTable = HUF_repeat_check; in ZSTD_compressLiterals()
519 zc->flagStaticHufTable = HUF_repeat_none; in ZSTD_compressLiterals()
523 zc->flagStaticHufTable = HUF_repeat_none; in ZSTD_compressLiterals()
586 ZSTD_STATIC size_t ZSTD_compressSequences_internal(ZSTD_CCtx *zc, void *dst, size_t dstCapacity) in ZSTD_compressSequences_internal() argument
588 const int longOffsets = zc->params.cParams.windowLog > STREAM_ACCUMULATOR_MIN; in ZSTD_compressSequences_internal()
589 const seqStore_t *seqStorePtr = &(zc->seqStore); in ZSTD_compressSequences_internal()
590 FSE_CTable *CTable_LitLength = zc->litlengthCTable; in ZSTD_compressSequences_internal()
591 FSE_CTable *CTable_OffsetBits = zc->offcodeCTable; in ZSTD_compressSequences_internal()
592 FSE_CTable *CTable_MatchLength = zc->matchlengthCTable; in ZSTD_compressSequences_internal()
607 size_t workspaceSize = sizeof(zc->tmpCounters); in ZSTD_compressSequences_internal()
610 count = (U32 *)zc->tmpCounters + spaceUsed32; in ZSTD_compressSequences_internal()
612 norm = (S16 *)((U32 *)zc->tmpCounters + spaceUsed32); in ZSTD_compressSequences_internal()
615 workspace = (U32 *)zc->tmpCounters + spaceUsed32; in ZSTD_compressSequences_internal()
623 size_t const cSize = ZSTD_compressLiterals(zc, op, dstCapacity, literals, litSize); in ZSTD_compressSequences_internal()
658 } else if ((zc->flagStaticTables) && (nbSeq < MAX_SEQ_FOR_STATIC_FSE)) { in ZSTD_compressSequences_internal()
690 } else if ((zc->flagStaticTables) && (nbSeq < MAX_SEQ_FOR_STATIC_FSE)) { in ZSTD_compressSequences_internal()
722 } else if ((zc->flagStaticTables) && (nbSeq < MAX_SEQ_FOR_STATIC_FSE)) { in ZSTD_compressSequences_internal()
747 zc->flagStaticTables = 0; in ZSTD_compressSequences_internal()
832 ZSTD_STATIC size_t ZSTD_compressSequences(ZSTD_CCtx *zc, void *dst, size_t dstCapacity, size_t srcS… in ZSTD_compressSequences() argument
834 size_t const cSize = ZSTD_compressSequences_internal(zc, dst, dstCapacity); in ZSTD_compressSequences()
847 zc->flagStaticHufTable = HUF_repeat_none; in ZSTD_compressSequences()
852 zc->rep[i] = zc->repToConfirm[i]; in ZSTD_compressSequences()
992 static void ZSTD_fillHashTable(ZSTD_CCtx *zc, const void *end, const U32 mls) in ZSTD_fillHashTable() argument
994 U32 *const hashTable = zc->hashTable; in ZSTD_fillHashTable()
995 U32 const hBits = zc->params.cParams.hashLog; in ZSTD_fillHashTable()
996 const BYTE *const base = zc->base; in ZSTD_fillHashTable()
997 const BYTE *ip = base + zc->nextToUpdate; in ZSTD_fillHashTable()
1561 static U32 ZSTD_insertBt1(ZSTD_CCtx *zc, const BYTE *const ip, const U32 mls, const BYTE *const ien… in ZSTD_insertBt1() argument
1563 U32 *const hashTable = zc->hashTable; in ZSTD_insertBt1()
1564 U32 const hashLog = zc->params.cParams.hashLog; in ZSTD_insertBt1()
1566 U32 *const bt = zc->chainTable; in ZSTD_insertBt1()
1567 U32 const btLog = zc->params.cParams.chainLog - 1; in ZSTD_insertBt1()
1571 const BYTE *const base = zc->base; in ZSTD_insertBt1()
1572 const BYTE *const dictBase = zc->dictBase; in ZSTD_insertBt1()
1573 const U32 dictLimit = zc->dictLimit; in ZSTD_insertBt1()
1582 U32 const windowLow = zc->lowLimit; in ZSTD_insertBt1()
1643 static size_t ZSTD_insertBtAndFindBestMatch(ZSTD_CCtx *zc, const BYTE *const ip, const BYTE *const … in ZSTD_insertBtAndFindBestMatch() argument
1646 U32 *const hashTable = zc->hashTable; in ZSTD_insertBtAndFindBestMatch()
1647 U32 const hashLog = zc->params.cParams.hashLog; in ZSTD_insertBtAndFindBestMatch()
1649 U32 *const bt = zc->chainTable; in ZSTD_insertBtAndFindBestMatch()
1650 U32 const btLog = zc->params.cParams.chainLog - 1; in ZSTD_insertBtAndFindBestMatch()
1654 const BYTE *const base = zc->base; in ZSTD_insertBtAndFindBestMatch()
1655 const BYTE *const dictBase = zc->dictBase; in ZSTD_insertBtAndFindBestMatch()
1656 const U32 dictLimit = zc->dictLimit; in ZSTD_insertBtAndFindBestMatch()
1661 const U32 windowLow = zc->lowLimit; in ZSTD_insertBtAndFindBestMatch()
1720 zc->nextToUpdate = (matchEndIdx > curr + 8) ? matchEndIdx - 8 : curr + 1; in ZSTD_insertBtAndFindBestMatch()
1724 static void ZSTD_updateTree(ZSTD_CCtx *zc, const BYTE *const ip, const BYTE *const iend, const U32 … in ZSTD_updateTree() argument
1726 const BYTE *const base = zc->base; in ZSTD_updateTree()
1728 U32 idx = zc->nextToUpdate; in ZSTD_updateTree()
1731 idx += ZSTD_insertBt1(zc, base + idx, mls, iend, nbCompares, 0); in ZSTD_updateTree()
1735 static size_t ZSTD_BtFindBestMatch(ZSTD_CCtx *zc, const BYTE *const ip, const BYTE *const iLimit, s… in ZSTD_BtFindBestMatch() argument
1737 if (ip < zc->base + zc->nextToUpdate) in ZSTD_BtFindBestMatch()
1739 ZSTD_updateTree(zc, ip, iLimit, maxNbAttempts, mls); in ZSTD_BtFindBestMatch()
1740 return ZSTD_insertBtAndFindBestMatch(zc, ip, iLimit, offsetPtr, maxNbAttempts, mls, 0); in ZSTD_BtFindBestMatch()
1743 static size_t ZSTD_BtFindBestMatch_selectMLS(ZSTD_CCtx *zc, /* Index table will be updated */ in ZSTD_BtFindBestMatch_selectMLS() argument
1748 case 4: return ZSTD_BtFindBestMatch(zc, ip, iLimit, offsetPtr, maxNbAttempts, 4); in ZSTD_BtFindBestMatch_selectMLS()
1749 case 5: return ZSTD_BtFindBestMatch(zc, ip, iLimit, offsetPtr, maxNbAttempts, 5); in ZSTD_BtFindBestMatch_selectMLS()
1751 case 6: return ZSTD_BtFindBestMatch(zc, ip, iLimit, offsetPtr, maxNbAttempts, 6); in ZSTD_BtFindBestMatch_selectMLS()
1755 static void ZSTD_updateTree_extDict(ZSTD_CCtx *zc, const BYTE *const ip, const BYTE *const iend, co… in ZSTD_updateTree_extDict() argument
1757 const BYTE *const base = zc->base; in ZSTD_updateTree_extDict()
1759 U32 idx = zc->nextToUpdate; in ZSTD_updateTree_extDict()
1762 idx += ZSTD_insertBt1(zc, base + idx, mls, iend, nbCompares, 1); in ZSTD_updateTree_extDict()
1766 static size_t ZSTD_BtFindBestMatch_extDict(ZSTD_CCtx *zc, const BYTE *const ip, const BYTE *const i… in ZSTD_BtFindBestMatch_extDict() argument
1769 if (ip < zc->base + zc->nextToUpdate) in ZSTD_BtFindBestMatch_extDict()
1771 ZSTD_updateTree_extDict(zc, ip, iLimit, maxNbAttempts, mls); in ZSTD_BtFindBestMatch_extDict()
1772 return ZSTD_insertBtAndFindBestMatch(zc, ip, iLimit, offsetPtr, maxNbAttempts, mls, 1); in ZSTD_BtFindBestMatch_extDict()
1775 static size_t ZSTD_BtFindBestMatch_selectMLS_extDict(ZSTD_CCtx *zc, /* Index table will be updated … in ZSTD_BtFindBestMatch_selectMLS_extDict() argument
1781 case 4: return ZSTD_BtFindBestMatch_extDict(zc, ip, iLimit, offsetPtr, maxNbAttempts, 4); in ZSTD_BtFindBestMatch_selectMLS_extDict()
1782 case 5: return ZSTD_BtFindBestMatch_extDict(zc, ip, iLimit, offsetPtr, maxNbAttempts, 5); in ZSTD_BtFindBestMatch_selectMLS_extDict()
1784 case 6: return ZSTD_BtFindBestMatch_extDict(zc, ip, iLimit, offsetPtr, maxNbAttempts, 6); in ZSTD_BtFindBestMatch_selectMLS_extDict()
1796 U32 ZSTD_insertAndFindFirstIndex(ZSTD_CCtx *zc, const BYTE *ip, U32 mls) in ZSTD_insertAndFindFirstIndex() argument
1798 U32 *const hashTable = zc->hashTable; in ZSTD_insertAndFindFirstIndex()
1799 const U32 hashLog = zc->params.cParams.hashLog; in ZSTD_insertAndFindFirstIndex()
1800 U32 *const chainTable = zc->chainTable; in ZSTD_insertAndFindFirstIndex()
1801 const U32 chainMask = (1 << zc->params.cParams.chainLog) - 1; in ZSTD_insertAndFindFirstIndex()
1802 const BYTE *const base = zc->base; in ZSTD_insertAndFindFirstIndex()
1804 U32 idx = zc->nextToUpdate; in ZSTD_insertAndFindFirstIndex()
1813 zc->nextToUpdate = target; in ZSTD_insertAndFindFirstIndex()
1819 size_t ZSTD_HcFindBestMatch_generic(ZSTD_CCtx *zc, /* Index table will be updated */ in ZSTD_HcFindBestMatch_generic() argument
1823 U32 *const chainTable = zc->chainTable; in ZSTD_HcFindBestMatch_generic()
1824 const U32 chainSize = (1 << zc->params.cParams.chainLog); in ZSTD_HcFindBestMatch_generic()
1826 const BYTE *const base = zc->base; in ZSTD_HcFindBestMatch_generic()
1827 const BYTE *const dictBase = zc->dictBase; in ZSTD_HcFindBestMatch_generic()
1828 const U32 dictLimit = zc->dictLimit; in ZSTD_HcFindBestMatch_generic()
1831 const U32 lowLimit = zc->lowLimit; in ZSTD_HcFindBestMatch_generic()
1838 U32 matchIndex = ZSTD_insertAndFindFirstIndex(zc, ip, mls); in ZSTD_HcFindBestMatch_generic()
1869 FORCE_INLINE size_t ZSTD_HcFindBestMatch_selectMLS(ZSTD_CCtx *zc, const BYTE *ip, const BYTE *const… in ZSTD_HcFindBestMatch_selectMLS() argument
1874 case 4: return ZSTD_HcFindBestMatch_generic(zc, ip, iLimit, offsetPtr, maxNbAttempts, 4, 0); in ZSTD_HcFindBestMatch_selectMLS()
1875 case 5: return ZSTD_HcFindBestMatch_generic(zc, ip, iLimit, offsetPtr, maxNbAttempts, 5, 0); in ZSTD_HcFindBestMatch_selectMLS()
1877 case 6: return ZSTD_HcFindBestMatch_generic(zc, ip, iLimit, offsetPtr, maxNbAttempts, 6, 0); in ZSTD_HcFindBestMatch_selectMLS()
1881 FORCE_INLINE size_t ZSTD_HcFindBestMatch_extDict_selectMLS(ZSTD_CCtx *zc, const BYTE *ip, const BYT… in ZSTD_HcFindBestMatch_extDict_selectMLS() argument
1886 case 4: return ZSTD_HcFindBestMatch_generic(zc, ip, iLimit, offsetPtr, maxNbAttempts, 4, 1); in ZSTD_HcFindBestMatch_extDict_selectMLS()
1887 case 5: return ZSTD_HcFindBestMatch_generic(zc, ip, iLimit, offsetPtr, maxNbAttempts, 5, 1); in ZSTD_HcFindBestMatch_extDict_selectMLS()
1889 case 6: return ZSTD_HcFindBestMatch_generic(zc, ip, iLimit, offsetPtr, maxNbAttempts, 6, 1); in ZSTD_HcFindBestMatch_extDict_selectMLS()
1910 …typedef size_t (*searchMax_f)(ZSTD_CCtx * zc, const BYTE *ip, const BYTE *iLimit, size_t *offsetPt… in ZSTD_compressBlock_lazy_generic()
2077 …typedef size_t (*searchMax_f)(ZSTD_CCtx * zc, const BYTE *ip, const BYTE *iLimit, size_t *offsetPt… in ZSTD_compressBlock_lazy_extDict_generic()
2333 static size_t ZSTD_compressBlock_internal(ZSTD_CCtx *zc, void *dst, size_t dstCapacity, const void … in ZSTD_compressBlock_internal() argument
2335 …r const blockCompressor = ZSTD_selectBlockCompressor(zc->params.cParams.strategy, zc->lowLimit < z… in ZSTD_compressBlock_internal()
2336 const BYTE *const base = zc->base; in ZSTD_compressBlock_internal()
2341 ZSTD_resetSeqStore(&(zc->seqStore)); in ZSTD_compressBlock_internal()
2342 if (curr > zc->nextToUpdate + 384) in ZSTD_compressBlock_internal()
2343 …zc->nextToUpdate = curr - MIN(192, (U32)(curr - zc->nextToUpdate - 384)); /* update tree not updat… in ZSTD_compressBlock_internal()
2344 blockCompressor(zc, src, srcSize); in ZSTD_compressBlock_internal()
2345 return ZSTD_compressSequences(zc, dst, dstCapacity, srcSize); in ZSTD_compressBlock_internal()
2557 static size_t ZSTD_loadDictionaryContent(ZSTD_CCtx *zc, const void *src, size_t srcSize) in ZSTD_loadDictionaryContent() argument
2563 zc->lowLimit = zc->dictLimit; in ZSTD_loadDictionaryContent()
2564 zc->dictLimit = (U32)(zc->nextSrc - zc->base); in ZSTD_loadDictionaryContent()
2565 zc->dictBase = zc->base; in ZSTD_loadDictionaryContent()
2566 zc->base += ip - zc->nextSrc; in ZSTD_loadDictionaryContent()
2567 zc->nextToUpdate = zc->dictLimit; in ZSTD_loadDictionaryContent()
2568 zc->loadedDictEnd = zc->forceWindow ? 0 : (U32)(iend - zc->base); in ZSTD_loadDictionaryContent()
2570 zc->nextSrc = iend; in ZSTD_loadDictionaryContent()
2574 switch (zc->params.cParams.strategy) { in ZSTD_loadDictionaryContent()
2575 case ZSTD_fast: ZSTD_fillHashTable(zc, iend, zc->params.cParams.searchLength); break; in ZSTD_loadDictionaryContent()
2577 case ZSTD_dfast: ZSTD_fillDoubleHashTable(zc, iend, zc->params.cParams.searchLength); break; in ZSTD_loadDictionaryContent()
2583 ZSTD_insertAndFindFirstIndex(zc, iend - HASH_READ_SIZE, zc->params.cParams.searchLength); in ZSTD_loadDictionaryContent()
2590 …ZSTD_updateTree(zc, iend - HASH_READ_SIZE, iend, 1 << zc->params.cParams.searchLog, zc->params.cPa… in ZSTD_loadDictionaryContent()
2597 zc->nextToUpdate = (U32)(iend - zc->base); in ZSTD_loadDictionaryContent()