Lines Matching refs:optPtr

79 static int ZSTD_compressedLiterals(optState_t const* const optPtr)  in ZSTD_compressedLiterals()  argument
81 return optPtr->literalCompressionMode != ZSTD_lcm_uncompressed; in ZSTD_compressedLiterals()
84 static void ZSTD_setBasePrices(optState_t* optPtr, int optLevel) in ZSTD_setBasePrices() argument
86 if (ZSTD_compressedLiterals(optPtr)) in ZSTD_setBasePrices()
87 optPtr->litSumBasePrice = WEIGHT(optPtr->litSum, optLevel); in ZSTD_setBasePrices()
88 optPtr->litLengthSumBasePrice = WEIGHT(optPtr->litLengthSum, optLevel); in ZSTD_setBasePrices()
89 optPtr->matchLengthSumBasePrice = WEIGHT(optPtr->matchLengthSum, optLevel); in ZSTD_setBasePrices()
90 optPtr->offCodeSumBasePrice = WEIGHT(optPtr->offCodeSum, optLevel); in ZSTD_setBasePrices()
116 ZSTD_rescaleFreqs(optState_t* const optPtr, in ZSTD_rescaleFreqs() argument
120 int const compressedLiterals = ZSTD_compressedLiterals(optPtr); in ZSTD_rescaleFreqs()
122 optPtr->priceType = zop_dynamic; in ZSTD_rescaleFreqs()
124 if (optPtr->litLengthSum == 0) { /* first block : init */ in ZSTD_rescaleFreqs()
127 optPtr->priceType = zop_predef; in ZSTD_rescaleFreqs()
130 assert(optPtr->symbolCosts != NULL); in ZSTD_rescaleFreqs()
131 if (optPtr->symbolCosts->huf.repeatMode == HUF_repeat_valid) { in ZSTD_rescaleFreqs()
133 optPtr->priceType = zop_dynamic; in ZSTD_rescaleFreqs()
137 assert(optPtr->litFreq != NULL); in ZSTD_rescaleFreqs()
138 optPtr->litSum = 0; in ZSTD_rescaleFreqs()
141 U32 const bitCost = HUF_getNbBits(optPtr->symbolCosts->huf.CTable, lit); in ZSTD_rescaleFreqs()
143optPtr->litFreq[lit] = bitCost ? 1 << (scaleLog-bitCost) : 1 /*minimum to calculate cost*/; in ZSTD_rescaleFreqs()
144 optPtr->litSum += optPtr->litFreq[lit]; in ZSTD_rescaleFreqs()
149 FSE_initCState(&llstate, optPtr->symbolCosts->fse.litlengthCTable); in ZSTD_rescaleFreqs()
150 optPtr->litLengthSum = 0; in ZSTD_rescaleFreqs()
155optPtr->litLengthFreq[ll] = bitCost ? 1 << (scaleLog-bitCost) : 1 /*minimum to calculate cost*/; in ZSTD_rescaleFreqs()
156 optPtr->litLengthSum += optPtr->litLengthFreq[ll]; in ZSTD_rescaleFreqs()
161 FSE_initCState(&mlstate, optPtr->symbolCosts->fse.matchlengthCTable); in ZSTD_rescaleFreqs()
162 optPtr->matchLengthSum = 0; in ZSTD_rescaleFreqs()
167optPtr->matchLengthFreq[ml] = bitCost ? 1 << (scaleLog-bitCost) : 1 /*minimum to calculate cost*/; in ZSTD_rescaleFreqs()
168 optPtr->matchLengthSum += optPtr->matchLengthFreq[ml]; in ZSTD_rescaleFreqs()
173 FSE_initCState(&ofstate, optPtr->symbolCosts->fse.offcodeCTable); in ZSTD_rescaleFreqs()
174 optPtr->offCodeSum = 0; in ZSTD_rescaleFreqs()
179optPtr->offCodeFreq[of] = bitCost ? 1 << (scaleLog-bitCost) : 1 /*minimum to calculate cost*/; in ZSTD_rescaleFreqs()
180 optPtr->offCodeSum += optPtr->offCodeFreq[of]; in ZSTD_rescaleFreqs()
185 assert(optPtr->litFreq != NULL); in ZSTD_rescaleFreqs()
188 …HIST_count_simple(optPtr->litFreq, &lit, src, srcSize); /* use raw first block to init statistic… in ZSTD_rescaleFreqs()
189 optPtr->litSum = ZSTD_downscaleStat(optPtr->litFreq, MaxLit, 1); in ZSTD_rescaleFreqs()
194 optPtr->litLengthFreq[ll] = 1; in ZSTD_rescaleFreqs()
196 optPtr->litLengthSum = MaxLL+1; in ZSTD_rescaleFreqs()
200 optPtr->matchLengthFreq[ml] = 1; in ZSTD_rescaleFreqs()
202 optPtr->matchLengthSum = MaxML+1; in ZSTD_rescaleFreqs()
206 optPtr->offCodeFreq[of] = 1; in ZSTD_rescaleFreqs()
208 optPtr->offCodeSum = MaxOff+1; in ZSTD_rescaleFreqs()
215 optPtr->litSum = ZSTD_downscaleStat(optPtr->litFreq, MaxLit, 1); in ZSTD_rescaleFreqs()
216 optPtr->litLengthSum = ZSTD_downscaleStat(optPtr->litLengthFreq, MaxLL, 0); in ZSTD_rescaleFreqs()
217 optPtr->matchLengthSum = ZSTD_downscaleStat(optPtr->matchLengthFreq, MaxML, 0); in ZSTD_rescaleFreqs()
218 optPtr->offCodeSum = ZSTD_downscaleStat(optPtr->offCodeFreq, MaxOff, 0); in ZSTD_rescaleFreqs()
221 ZSTD_setBasePrices(optPtr, optLevel); in ZSTD_rescaleFreqs()
228 const optState_t* const optPtr, in ZSTD_rawLiteralsCost() argument
233 if (!ZSTD_compressedLiterals(optPtr)) in ZSTD_rawLiteralsCost()
236 if (optPtr->priceType == zop_predef) in ZSTD_rawLiteralsCost()
240 { U32 price = litLength * optPtr->litSumBasePrice; in ZSTD_rawLiteralsCost()
243 …assert(WEIGHT(optPtr->litFreq[literals[u]], optLevel) <= optPtr->litSumBasePrice); /* literal co… in ZSTD_rawLiteralsCost()
244 price -= WEIGHT(optPtr->litFreq[literals[u]], optLevel); in ZSTD_rawLiteralsCost()
252 static U32 ZSTD_litLengthPrice(U32 const litLength, const optState_t* const optPtr, int optLevel) in ZSTD_litLengthPrice() argument
254 if (optPtr->priceType == zop_predef) return WEIGHT(litLength, optLevel); in ZSTD_litLengthPrice()
259 + optPtr->litLengthSumBasePrice in ZSTD_litLengthPrice()
260 - WEIGHT(optPtr->litLengthFreq[llCode], optLevel); in ZSTD_litLengthPrice()
271 const optState_t* const optPtr, in ZSTD_getMatchPrice() argument
279 if (optPtr->priceType == zop_predef) /* fixed scheme, do not use statistics */ in ZSTD_getMatchPrice()
283 …price = (offCode * BITCOST_MULTIPLIER) + (optPtr->offCodeSumBasePrice - WEIGHT(optPtr->offCodeFreq… in ZSTD_getMatchPrice()
289 …price += (ML_bits[mlCode] * BITCOST_MULTIPLIER) + (optPtr->matchLengthSumBasePrice - WEIGHT(optPtr in ZSTD_getMatchPrice()
300 static void ZSTD_updateStats(optState_t* const optPtr, in ZSTD_updateStats() argument
305 if (ZSTD_compressedLiterals(optPtr)) { in ZSTD_updateStats()
308 optPtr->litFreq[literals[u]] += ZSTD_LITFREQ_ADD; in ZSTD_updateStats()
309 optPtr->litSum += litLength*ZSTD_LITFREQ_ADD; in ZSTD_updateStats()
314 optPtr->litLengthFreq[llCode]++; in ZSTD_updateStats()
315 optPtr->litLengthSum++; in ZSTD_updateStats()
321 optPtr->offCodeFreq[offCode]++; in ZSTD_updateStats()
322 optPtr->offCodeSum++; in ZSTD_updateStats()
328 optPtr->matchLengthFreq[mlCode]++; in ZSTD_updateStats()
329 optPtr->matchLengthSum++; in ZSTD_updateStats()
1250 MEM_STATIC void ZSTD_upscaleStats(optState_t* optPtr) in ZSTD_upscaleStats() argument
1252 if (ZSTD_compressedLiterals(optPtr)) in ZSTD_upscaleStats()
1253 optPtr->litSum = ZSTD_upscaleStat(optPtr->litFreq, MaxLit, 0); in ZSTD_upscaleStats()
1254 optPtr->litLengthSum = ZSTD_upscaleStat(optPtr->litLengthFreq, MaxLL, 0); in ZSTD_upscaleStats()
1255 optPtr->matchLengthSum = ZSTD_upscaleStat(optPtr->matchLengthFreq, MaxML, 0); in ZSTD_upscaleStats()
1256 optPtr->offCodeSum = ZSTD_upscaleStat(optPtr->offCodeFreq, MaxOff, 0); in ZSTD_upscaleStats()