Lines Matching refs:optPtr

78 static int ZSTD_compressedLiterals(optState_t const* const optPtr)  in ZSTD_compressedLiterals()  argument
80 return optPtr->literalCompressionMode != ZSTD_ps_disable; in ZSTD_compressedLiterals()
83 static void ZSTD_setBasePrices(optState_t* optPtr, int optLevel) in ZSTD_setBasePrices() argument
85 if (ZSTD_compressedLiterals(optPtr)) in ZSTD_setBasePrices()
86 optPtr->litSumBasePrice = WEIGHT(optPtr->litSum, optLevel); in ZSTD_setBasePrices()
87 optPtr->litLengthSumBasePrice = WEIGHT(optPtr->litLengthSum, optLevel); in ZSTD_setBasePrices()
88 optPtr->matchLengthSumBasePrice = WEIGHT(optPtr->matchLengthSum, optLevel); in ZSTD_setBasePrices()
89 optPtr->offCodeSumBasePrice = WEIGHT(optPtr->offCodeSum, optLevel); in ZSTD_setBasePrices()
142 ZSTD_rescaleFreqs(optState_t* const optPtr, in ZSTD_rescaleFreqs() argument
146 int const compressedLiterals = ZSTD_compressedLiterals(optPtr); in ZSTD_rescaleFreqs()
148 optPtr->priceType = zop_dynamic; in ZSTD_rescaleFreqs()
150 … if (optPtr->litLengthSum == 0) { /* no literals stats collected -> first block assumed -> init */ in ZSTD_rescaleFreqs()
155 optPtr->priceType = zop_predef; in ZSTD_rescaleFreqs()
158 assert(optPtr->symbolCosts != NULL); in ZSTD_rescaleFreqs()
159 if (optPtr->symbolCosts->huf.repeatMode == HUF_repeat_valid) { in ZSTD_rescaleFreqs()
162 optPtr->priceType = zop_dynamic; in ZSTD_rescaleFreqs()
167 assert(optPtr->litFreq != NULL); in ZSTD_rescaleFreqs()
168 optPtr->litSum = 0; in ZSTD_rescaleFreqs()
171 … U32 const bitCost = HUF_getNbBitsFromCTable(optPtr->symbolCosts->huf.CTable, lit); in ZSTD_rescaleFreqs()
173optPtr->litFreq[lit] = bitCost ? 1 << (scaleLog-bitCost) : 1 /*minimum to calculate cost*/; in ZSTD_rescaleFreqs()
174 optPtr->litSum += optPtr->litFreq[lit]; in ZSTD_rescaleFreqs()
179 FSE_initCState(&llstate, optPtr->symbolCosts->fse.litlengthCTable); in ZSTD_rescaleFreqs()
180 optPtr->litLengthSum = 0; in ZSTD_rescaleFreqs()
185optPtr->litLengthFreq[ll] = bitCost ? 1 << (scaleLog-bitCost) : 1 /*minimum to calculate cost*/; in ZSTD_rescaleFreqs()
186 optPtr->litLengthSum += optPtr->litLengthFreq[ll]; in ZSTD_rescaleFreqs()
191 FSE_initCState(&mlstate, optPtr->symbolCosts->fse.matchlengthCTable); in ZSTD_rescaleFreqs()
192 optPtr->matchLengthSum = 0; in ZSTD_rescaleFreqs()
197optPtr->matchLengthFreq[ml] = bitCost ? 1 << (scaleLog-bitCost) : 1 /*minimum to calculate cost*/; in ZSTD_rescaleFreqs()
198 optPtr->matchLengthSum += optPtr->matchLengthFreq[ml]; in ZSTD_rescaleFreqs()
203 FSE_initCState(&ofstate, optPtr->symbolCosts->fse.offcodeCTable); in ZSTD_rescaleFreqs()
204 optPtr->offCodeSum = 0; in ZSTD_rescaleFreqs()
209optPtr->offCodeFreq[of] = bitCost ? 1 << (scaleLog-bitCost) : 1 /*minimum to calculate cost*/; in ZSTD_rescaleFreqs()
210 optPtr->offCodeSum += optPtr->offCodeFreq[of]; in ZSTD_rescaleFreqs()
215 assert(optPtr->litFreq != NULL); in ZSTD_rescaleFreqs()
219 …HIST_count_simple(optPtr->litFreq, &lit, src, srcSize); /* use raw first block to init statistic… in ZSTD_rescaleFreqs()
220 optPtr->litSum = ZSTD_downscaleStats(optPtr->litFreq, MaxLit, 8, base_0possible); in ZSTD_rescaleFreqs()
230 ZSTD_memcpy(optPtr->litLengthFreq, baseLLfreqs, sizeof(baseLLfreqs)); in ZSTD_rescaleFreqs()
231 optPtr->litLengthSum = sum_u32(baseLLfreqs, MaxLL+1); in ZSTD_rescaleFreqs()
236 optPtr->matchLengthFreq[ml] = 1; in ZSTD_rescaleFreqs()
238 optPtr->matchLengthSum = MaxML+1; in ZSTD_rescaleFreqs()
246 ZSTD_memcpy(optPtr->offCodeFreq, baseOFCfreqs, sizeof(baseOFCfreqs)); in ZSTD_rescaleFreqs()
247 optPtr->offCodeSum = sum_u32(baseOFCfreqs, MaxOff+1); in ZSTD_rescaleFreqs()
255 optPtr->litSum = ZSTD_scaleStats(optPtr->litFreq, MaxLit, 12); in ZSTD_rescaleFreqs()
256 optPtr->litLengthSum = ZSTD_scaleStats(optPtr->litLengthFreq, MaxLL, 11); in ZSTD_rescaleFreqs()
257 optPtr->matchLengthSum = ZSTD_scaleStats(optPtr->matchLengthFreq, MaxML, 11); in ZSTD_rescaleFreqs()
258 optPtr->offCodeSum = ZSTD_scaleStats(optPtr->offCodeFreq, MaxOff, 11); in ZSTD_rescaleFreqs()
261 ZSTD_setBasePrices(optPtr, optLevel); in ZSTD_rescaleFreqs()
268 const optState_t* const optPtr, in ZSTD_rawLiteralsCost() argument
274 if (!ZSTD_compressedLiterals(optPtr)) in ZSTD_rawLiteralsCost()
277 if (optPtr->priceType == zop_predef) in ZSTD_rawLiteralsCost()
281 { U32 price = optPtr->litSumBasePrice * litLength; in ZSTD_rawLiteralsCost()
282 U32 const litPriceMax = optPtr->litSumBasePrice - BITCOST_MULTIPLIER; in ZSTD_rawLiteralsCost()
284 assert(optPtr->litSumBasePrice >= BITCOST_MULTIPLIER); in ZSTD_rawLiteralsCost()
286 U32 litPrice = WEIGHT(optPtr->litFreq[literals[u]], optLevel); in ZSTD_rawLiteralsCost()
296 static U32 ZSTD_litLengthPrice(U32 const litLength, const optState_t* const optPtr, int optLevel) in ZSTD_litLengthPrice() argument
299 if (optPtr->priceType == zop_predef) in ZSTD_litLengthPrice()
308 return BITCOST_MULTIPLIER + ZSTD_litLengthPrice(ZSTD_BLOCKSIZE_MAX - 1, optPtr, optLevel); in ZSTD_litLengthPrice()
313 + optPtr->litLengthSumBasePrice in ZSTD_litLengthPrice()
314 - WEIGHT(optPtr->litLengthFreq[llCode], optLevel); in ZSTD_litLengthPrice()
327 const optState_t* const optPtr, in ZSTD_getMatchPrice() argument
335 if (optPtr->priceType == zop_predef) /* fixed scheme, does not use statistics */ in ZSTD_getMatchPrice()
340 …price = (offCode * BITCOST_MULTIPLIER) + (optPtr->offCodeSumBasePrice - WEIGHT(optPtr->offCodeFreq… in ZSTD_getMatchPrice()
346 …price += (ML_bits[mlCode] * BITCOST_MULTIPLIER) + (optPtr->matchLengthSumBasePrice - WEIGHT(optPtr in ZSTD_getMatchPrice()
357 static void ZSTD_updateStats(optState_t* const optPtr, in ZSTD_updateStats() argument
362 if (ZSTD_compressedLiterals(optPtr)) { in ZSTD_updateStats()
365 optPtr->litFreq[literals[u]] += ZSTD_LITFREQ_ADD; in ZSTD_updateStats()
366 optPtr->litSum += litLength*ZSTD_LITFREQ_ADD; in ZSTD_updateStats()
371 optPtr->litLengthFreq[llCode]++; in ZSTD_updateStats()
372 optPtr->litLengthSum++; in ZSTD_updateStats()
378 optPtr->offCodeFreq[offCode]++; in ZSTD_updateStats()
379 optPtr->offCodeSum++; in ZSTD_updateStats()
385 optPtr->matchLengthFreq[mlCode]++; in ZSTD_updateStats()
386 optPtr->matchLengthSum++; in ZSTD_updateStats()