Lines Matching refs:ssPtr
19 FORCE_INLINE void ZSTD_setLog2Prices(seqStore_t *ssPtr) in ZSTD_setLog2Prices() argument
21 ssPtr->log2matchLengthSum = ZSTD_highbit32(ssPtr->matchLengthSum + 1); in ZSTD_setLog2Prices()
22 ssPtr->log2litLengthSum = ZSTD_highbit32(ssPtr->litLengthSum + 1); in ZSTD_setLog2Prices()
23 ssPtr->log2litSum = ZSTD_highbit32(ssPtr->litSum + 1); in ZSTD_setLog2Prices()
24 ssPtr->log2offCodeSum = ZSTD_highbit32(ssPtr->offCodeSum + 1); in ZSTD_setLog2Prices()
25 …ssPtr->factor = 1 + ((ssPtr->litSum >> 5) / ssPtr->litLengthSum) + ((ssPtr->litSum << 1) / (ssPtr-… in ZSTD_setLog2Prices()
28 ZSTD_STATIC void ZSTD_rescaleFreqs(seqStore_t *ssPtr, const BYTE *src, size_t srcSize) in ZSTD_rescaleFreqs() argument
32 ssPtr->cachedLiterals = NULL; in ZSTD_rescaleFreqs()
33 ssPtr->cachedPrice = ssPtr->cachedLitLength = 0; in ZSTD_rescaleFreqs()
34 ssPtr->staticPrices = 0; in ZSTD_rescaleFreqs()
36 if (ssPtr->litLengthSum == 0) { in ZSTD_rescaleFreqs()
38 ssPtr->staticPrices = 1; in ZSTD_rescaleFreqs()
41 ssPtr->litFreq[u] = 0; in ZSTD_rescaleFreqs()
43 ssPtr->litFreq[src[u]]++; in ZSTD_rescaleFreqs()
45 ssPtr->litSum = 0; in ZSTD_rescaleFreqs()
46 ssPtr->litLengthSum = MaxLL + 1; in ZSTD_rescaleFreqs()
47 ssPtr->matchLengthSum = MaxML + 1; in ZSTD_rescaleFreqs()
48 ssPtr->offCodeSum = (MaxOff + 1); in ZSTD_rescaleFreqs()
49 ssPtr->matchSum = (ZSTD_LITFREQ_ADD << Litbits); in ZSTD_rescaleFreqs()
52 ssPtr->litFreq[u] = 1 + (ssPtr->litFreq[u] >> ZSTD_FREQ_DIV); in ZSTD_rescaleFreqs()
53 ssPtr->litSum += ssPtr->litFreq[u]; in ZSTD_rescaleFreqs()
56 ssPtr->litLengthFreq[u] = 1; in ZSTD_rescaleFreqs()
58 ssPtr->matchLengthFreq[u] = 1; in ZSTD_rescaleFreqs()
60 ssPtr->offCodeFreq[u] = 1; in ZSTD_rescaleFreqs()
62 ssPtr->matchLengthSum = 0; in ZSTD_rescaleFreqs()
63 ssPtr->litLengthSum = 0; in ZSTD_rescaleFreqs()
64 ssPtr->offCodeSum = 0; in ZSTD_rescaleFreqs()
65 ssPtr->matchSum = 0; in ZSTD_rescaleFreqs()
66 ssPtr->litSum = 0; in ZSTD_rescaleFreqs()
69 ssPtr->litFreq[u] = 1 + (ssPtr->litFreq[u] >> (ZSTD_FREQ_DIV + 1)); in ZSTD_rescaleFreqs()
70 ssPtr->litSum += ssPtr->litFreq[u]; in ZSTD_rescaleFreqs()
73 ssPtr->litLengthFreq[u] = 1 + (ssPtr->litLengthFreq[u] >> (ZSTD_FREQ_DIV + 1)); in ZSTD_rescaleFreqs()
74 ssPtr->litLengthSum += ssPtr->litLengthFreq[u]; in ZSTD_rescaleFreqs()
77 ssPtr->matchLengthFreq[u] = 1 + (ssPtr->matchLengthFreq[u] >> ZSTD_FREQ_DIV); in ZSTD_rescaleFreqs()
78 ssPtr->matchLengthSum += ssPtr->matchLengthFreq[u]; in ZSTD_rescaleFreqs()
79 ssPtr->matchSum += ssPtr->matchLengthFreq[u] * (u + 3); in ZSTD_rescaleFreqs()
81 ssPtr->matchSum *= ZSTD_LITFREQ_ADD; in ZSTD_rescaleFreqs()
83 ssPtr->offCodeFreq[u] = 1 + (ssPtr->offCodeFreq[u] >> ZSTD_FREQ_DIV); in ZSTD_rescaleFreqs()
84 ssPtr->offCodeSum += ssPtr->offCodeFreq[u]; in ZSTD_rescaleFreqs()
88 ZSTD_setLog2Prices(ssPtr); in ZSTD_rescaleFreqs()
91 FORCE_INLINE U32 ZSTD_getLiteralPrice(seqStore_t *ssPtr, U32 litLength, const BYTE *literals) in ZSTD_getLiteralPrice() argument
95 if (ssPtr->staticPrices) in ZSTD_getLiteralPrice()
99 return ssPtr->log2litLengthSum - ZSTD_highbit32(ssPtr->litLengthFreq[0] + 1); in ZSTD_getLiteralPrice()
102 if (ssPtr->cachedLiterals == literals) { in ZSTD_getLiteralPrice()
103 U32 const additional = litLength - ssPtr->cachedLitLength; in ZSTD_getLiteralPrice()
104 const BYTE *literals2 = ssPtr->cachedLiterals + ssPtr->cachedLitLength; in ZSTD_getLiteralPrice()
105 price = ssPtr->cachedPrice + additional * ssPtr->log2litSum; in ZSTD_getLiteralPrice()
107 price -= ZSTD_highbit32(ssPtr->litFreq[literals2[u]] + 1); in ZSTD_getLiteralPrice()
108 ssPtr->cachedPrice = price; in ZSTD_getLiteralPrice()
109 ssPtr->cachedLitLength = litLength; in ZSTD_getLiteralPrice()
111 price = litLength * ssPtr->log2litSum; in ZSTD_getLiteralPrice()
113 price -= ZSTD_highbit32(ssPtr->litFreq[literals[u]] + 1); in ZSTD_getLiteralPrice()
116 ssPtr->cachedLiterals = literals; in ZSTD_getLiteralPrice()
117 ssPtr->cachedPrice = price; in ZSTD_getLiteralPrice()
118 ssPtr->cachedLitLength = litLength; in ZSTD_getLiteralPrice()
126 …price += LL_bits[llCode] + ssPtr->log2litLengthSum - ZSTD_highbit32(ssPtr->litLengthFreq[llCode] +… in ZSTD_getLiteralPrice()