Lines Matching refs:optPtr
20211 static int ZSTD_compressedLiterals(optState_t const* const optPtr) in ZSTD_compressedLiterals() argument
20213 return optPtr->literalCompressionMode != ZSTD_lcm_uncompressed; in ZSTD_compressedLiterals()
20216 static void ZSTD_setBasePrices(optState_t* optPtr, int optLevel) in ZSTD_setBasePrices() argument
20218 if (ZSTD_compressedLiterals(optPtr)) in ZSTD_setBasePrices()
20219 optPtr->litSumBasePrice = WEIGHT(optPtr->litSum, optLevel); in ZSTD_setBasePrices()
20220 optPtr->litLengthSumBasePrice = WEIGHT(optPtr->litLengthSum, optLevel); in ZSTD_setBasePrices()
20221 optPtr->matchLengthSumBasePrice = WEIGHT(optPtr->matchLengthSum, optLevel); in ZSTD_setBasePrices()
20222 optPtr->offCodeSumBasePrice = WEIGHT(optPtr->offCodeSum, optLevel); in ZSTD_setBasePrices()
20248 ZSTD_rescaleFreqs(optState_t* const optPtr, in ZSTD_rescaleFreqs() argument
20252 int const compressedLiterals = ZSTD_compressedLiterals(optPtr); in ZSTD_rescaleFreqs()
20254 optPtr->priceType = zop_dynamic; in ZSTD_rescaleFreqs()
20256 if (optPtr->litLengthSum == 0) { /* first block : init */ in ZSTD_rescaleFreqs()
20259 optPtr->priceType = zop_predef; in ZSTD_rescaleFreqs()
20262 assert(optPtr->symbolCosts != NULL); in ZSTD_rescaleFreqs()
20263 if (optPtr->symbolCosts->huf.repeatMode == HUF_repeat_valid) { in ZSTD_rescaleFreqs()
20265 optPtr->priceType = zop_dynamic; in ZSTD_rescaleFreqs()
20269 assert(optPtr->litFreq != NULL); in ZSTD_rescaleFreqs()
20270 optPtr->litSum = 0; in ZSTD_rescaleFreqs()
20273 U32 const bitCost = HUF_getNbBits(optPtr->symbolCosts->huf.CTable, lit); in ZSTD_rescaleFreqs()
20275 … optPtr->litFreq[lit] = bitCost ? 1 << (scaleLog-bitCost) : 1 /*minimum to calculate cost*/; in ZSTD_rescaleFreqs()
20276 optPtr->litSum += optPtr->litFreq[lit]; in ZSTD_rescaleFreqs()
20281 FSE_initCState(&llstate, optPtr->symbolCosts->fse.litlengthCTable); in ZSTD_rescaleFreqs()
20282 optPtr->litLengthSum = 0; in ZSTD_rescaleFreqs()
20287 … optPtr->litLengthFreq[ll] = bitCost ? 1 << (scaleLog-bitCost) : 1 /*minimum to calculate cost*/; in ZSTD_rescaleFreqs()
20288 optPtr->litLengthSum += optPtr->litLengthFreq[ll]; in ZSTD_rescaleFreqs()
20293 FSE_initCState(&mlstate, optPtr->symbolCosts->fse.matchlengthCTable); in ZSTD_rescaleFreqs()
20294 optPtr->matchLengthSum = 0; in ZSTD_rescaleFreqs()
20299 … optPtr->matchLengthFreq[ml] = bitCost ? 1 << (scaleLog-bitCost) : 1 /*minimum to calculate cost*/; in ZSTD_rescaleFreqs()
20300 optPtr->matchLengthSum += optPtr->matchLengthFreq[ml]; in ZSTD_rescaleFreqs()
20305 FSE_initCState(&ofstate, optPtr->symbolCosts->fse.offcodeCTable); in ZSTD_rescaleFreqs()
20306 optPtr->offCodeSum = 0; in ZSTD_rescaleFreqs()
20311 … optPtr->offCodeFreq[of] = bitCost ? 1 << (scaleLog-bitCost) : 1 /*minimum to calculate cost*/; in ZSTD_rescaleFreqs()
20312 optPtr->offCodeSum += optPtr->offCodeFreq[of]; in ZSTD_rescaleFreqs()
20317 assert(optPtr->litFreq != NULL); in ZSTD_rescaleFreqs()
20320 …HIST_count_simple(optPtr->litFreq, &lit, src, srcSize); /* use raw first block to init statistic… in ZSTD_rescaleFreqs()
20321 optPtr->litSum = ZSTD_downscaleStat(optPtr->litFreq, MaxLit, 1); in ZSTD_rescaleFreqs()
20326 optPtr->litLengthFreq[ll] = 1; in ZSTD_rescaleFreqs()
20328 optPtr->litLengthSum = MaxLL+1; in ZSTD_rescaleFreqs()
20332 optPtr->matchLengthFreq[ml] = 1; in ZSTD_rescaleFreqs()
20334 optPtr->matchLengthSum = MaxML+1; in ZSTD_rescaleFreqs()
20338 optPtr->offCodeFreq[of] = 1; in ZSTD_rescaleFreqs()
20340 optPtr->offCodeSum = MaxOff+1; in ZSTD_rescaleFreqs()
20347 optPtr->litSum = ZSTD_downscaleStat(optPtr->litFreq, MaxLit, 1); in ZSTD_rescaleFreqs()
20348 optPtr->litLengthSum = ZSTD_downscaleStat(optPtr->litLengthFreq, MaxLL, 0); in ZSTD_rescaleFreqs()
20349 optPtr->matchLengthSum = ZSTD_downscaleStat(optPtr->matchLengthFreq, MaxML, 0); in ZSTD_rescaleFreqs()
20350 optPtr->offCodeSum = ZSTD_downscaleStat(optPtr->offCodeFreq, MaxOff, 0); in ZSTD_rescaleFreqs()
20353 ZSTD_setBasePrices(optPtr, optLevel); in ZSTD_rescaleFreqs()
20360 const optState_t* const optPtr, in ZSTD_rawLiteralsCost() argument
20365 if (!ZSTD_compressedLiterals(optPtr)) in ZSTD_rawLiteralsCost()
20368 if (optPtr->priceType == zop_predef) in ZSTD_rawLiteralsCost()
20372 { U32 price = litLength * optPtr->litSumBasePrice; in ZSTD_rawLiteralsCost()
20375 …assert(WEIGHT(optPtr->litFreq[literals[u]], optLevel) <= optPtr->litSumBasePrice); /* literal co… in ZSTD_rawLiteralsCost()
20376 price -= WEIGHT(optPtr->litFreq[literals[u]], optLevel); in ZSTD_rawLiteralsCost()
20384 static U32 ZSTD_litLengthPrice(U32 const litLength, const optState_t* const optPtr, int optLevel) in ZSTD_litLengthPrice() argument
20386 if (optPtr->priceType == zop_predef) return WEIGHT(litLength, optLevel); in ZSTD_litLengthPrice()
20391 + optPtr->litLengthSumBasePrice in ZSTD_litLengthPrice()
20392 - WEIGHT(optPtr->litLengthFreq[llCode], optLevel); in ZSTD_litLengthPrice()
20403 const optState_t* const optPtr, in ZSTD_getMatchPrice() argument
20411 if (optPtr->priceType == zop_predef) /* fixed scheme, do not use statistics */ in ZSTD_getMatchPrice()
20415 …price = (offCode * BITCOST_MULTIPLIER) + (optPtr->offCodeSumBasePrice - WEIGHT(optPtr->offCodeFreq… in ZSTD_getMatchPrice()
20421 …price += (ML_bits[mlCode] * BITCOST_MULTIPLIER) + (optPtr->matchLengthSumBasePrice - WEIGHT(optPtr… in ZSTD_getMatchPrice()
20432 static void ZSTD_updateStats(optState_t* const optPtr, in ZSTD_updateStats() argument
20437 if (ZSTD_compressedLiterals(optPtr)) { in ZSTD_updateStats()
20440 optPtr->litFreq[literals[u]] += ZSTD_LITFREQ_ADD; in ZSTD_updateStats()
20441 optPtr->litSum += litLength*ZSTD_LITFREQ_ADD; in ZSTD_updateStats()
20446 optPtr->litLengthFreq[llCode]++; in ZSTD_updateStats()
20447 optPtr->litLengthSum++; in ZSTD_updateStats()
20453 optPtr->offCodeFreq[offCode]++; in ZSTD_updateStats()
20454 optPtr->offCodeSum++; in ZSTD_updateStats()
20460 optPtr->matchLengthFreq[mlCode]++; in ZSTD_updateStats()
20461 optPtr->matchLengthSum++; in ZSTD_updateStats()
21236 MEM_STATIC void ZSTD_upscaleStats(optState_t* optPtr) in ZSTD_upscaleStats() argument
21238 if (ZSTD_compressedLiterals(optPtr)) in ZSTD_upscaleStats()
21239 optPtr->litSum = ZSTD_upscaleStat(optPtr->litFreq, MaxLit, 0); in ZSTD_upscaleStats()
21240 optPtr->litLengthSum = ZSTD_upscaleStat(optPtr->litLengthFreq, MaxLL, 0); in ZSTD_upscaleStats()
21241 optPtr->matchLengthSum = ZSTD_upscaleStat(optPtr->matchLengthFreq, MaxML, 0); in ZSTD_upscaleStats()
21242 optPtr->offCodeSum = ZSTD_upscaleStat(optPtr->offCodeFreq, MaxOff, 0); in ZSTD_upscaleStats()