Lines Matching +full:low +full:- +full:cost
5 * This source code is licensed under both the BSD-style license (found in the
8 * You may select, at your option, one of the above-listed licenses.
11 /*-*************************************
17 * -log2(x / 256) lookup table for x in [0, 256).
19 * Else: Return floor(-log2(x / 256) * 256)
54 * Returns true if we should use ncount=-1 else we should
55 * use ncount=1 for low probability symbols instead.
67 * Returns the cost in bytes of encoding the normalized count header.
81 * Returns the cost in bits of encoding the distribution described by count
86 unsigned cost = 0; in ZSTD_entropyCost() local
95 cost += count[s] * kInverseProbabilityLog256[norm]; in ZSTD_entropyCost()
97 return cost >> 8; in ZSTD_entropyCost()
101 * Returns the cost in bits of encoding the distribution in count using ctable.
110 size_t cost = 0; in ZSTD_fseBitCost() local
129 cost += (size_t)count[s] * bitCost; in ZSTD_fseBitCost()
131 return cost >> kAccuracyLog; in ZSTD_fseBitCost()
135 * Returns the cost in bits of encoding the distribution in count using the
137 * norm must be valid for every symbol with non-zero probability in count.
142 unsigned const shift = 8 - accuracyLog; in ZSTD_crossEntropyCost()
143 size_t cost = 0; in ZSTD_crossEntropyCost() local
147 unsigned const normAcc = (norm[s] != -1) ? (unsigned)norm[s] : 1; in ZSTD_crossEntropyCost()
151 cost += count[s] * kInverseProbabilityLog256[norm256]; in ZSTD_crossEntropyCost()
153 return cost >> 8; in ZSTD_crossEntropyCost()
170 * since RLE uses 1 byte, but set_basic uses 5-6 bits per symbol. in ZSTD_selectEncodingType()
182 size_t const mult = 10 - strategy; in ZSTD_selectEncodingType()
184 …Seq_min = (((size_t)1 << defaultNormLog) * mult) >> baseLog; /* 28-36 for offset, 56-72 for lengt… in ZSTD_selectEncodingType()
193 || (mostFrequent < (nbSeq >> (defaultNormLog-1))) ) { in ZSTD_selectEncodingType()
265 …defaultNormLog, entropyWorkspace, entropyWorkspaceSize), ""); /* note : could be pre-calculated */ in ZSTD_buildCTable()
271 if (count[codeTable[nbSeq-1]] > 1) { in ZSTD_buildCTable()
272 count[codeTable[nbSeq-1]]--; in ZSTD_buildCTable()
273 nbSeq_1--; in ZSTD_buildCTable()
278 …FORWARD_IF_ERROR(FSE_normalizeCount(wksp->norm, tableLog, count, nbSeq_1, max, ZSTD_useLowProbCoun… in ZSTD_buildCTable()
280 …{ size_t const NCountSize = FSE_writeNCount(op, (size_t)(oend - op), wksp->norm, max, tableLog);… in ZSTD_buildCTable()
282 …ORWARD_IF_ERROR(FSE_buildCTable_wksp(nextCTable, wksp->norm, max, tableLog, wksp->wksp, sizeof(wks… in ZSTD_buildCTable()
307 (int)(blockStream.endPtr - blockStream.startPtr), in ZSTD_encodeSequences_body()
311 FSE_initCState2(&stateMatchLength, CTable_MatchLength, mlCodeTable[nbSeq-1]); in ZSTD_encodeSequences_body()
312 FSE_initCState2(&stateOffsetBits, CTable_OffsetBits, ofCodeTable[nbSeq-1]); in ZSTD_encodeSequences_body()
313 FSE_initCState2(&stateLitLength, CTable_LitLength, llCodeTable[nbSeq-1]); in ZSTD_encodeSequences_body()
314 BIT_addBits(&blockStream, sequences[nbSeq-1].litLength, LL_bits[llCodeTable[nbSeq-1]]); in ZSTD_encodeSequences_body()
316 BIT_addBits(&blockStream, sequences[nbSeq-1].mlBase, ML_bits[mlCodeTable[nbSeq-1]]); in ZSTD_encodeSequences_body()
319 U32 const ofBits = ofCodeTable[nbSeq-1]; in ZSTD_encodeSequences_body()
320 unsigned const extraBits = ofBits - MIN(ofBits, STREAM_ACCUMULATOR_MIN-1); in ZSTD_encodeSequences_body()
322 BIT_addBits(&blockStream, sequences[nbSeq-1].offBase, extraBits); in ZSTD_encodeSequences_body()
325 BIT_addBits(&blockStream, sequences[nbSeq-1].offBase >> extraBits, in ZSTD_encodeSequences_body()
326 ofBits - extraBits); in ZSTD_encodeSequences_body()
328 BIT_addBits(&blockStream, sequences[nbSeq-1].offBase, ofCodeTable[nbSeq-1]); in ZSTD_encodeSequences_body()
333 for (n=nbSeq-2 ; n<nbSeq ; n--) { /* intentional underflow */ in ZSTD_encodeSequences_body()
340 DEBUGLOG(6, "encoding: litlen:%2u - matchlen:%2u - offCode:%7u", in ZSTD_encodeSequences_body()
350 if (MEM_32bits() || (ofBits+mlBits+llBits >= 64-7-(LLFSELog+MLFSELog+OffFSELog))) in ZSTD_encodeSequences_body()
357 unsigned const extraBits = ofBits - MIN(ofBits, STREAM_ACCUMULATOR_MIN-1); in ZSTD_encodeSequences_body()
363 ofBits - extraBits); /* 31 */ in ZSTD_encodeSequences_body()
368 DEBUGLOG(7, "remaining space : %i", (int)(blockStream.endPtr - blockStream.ptr)); in ZSTD_encodeSequences_body()