U32 log2matchLengthSum; /* pow2 to compare log2(mlfreq) to */
U32 log2offCodeSum; /* pow2 to compare log2(offreq) to */
/* end : updated by ZSTD_setLog2Prices */
- ZSTD_OptPrice_e priceType; /* prices follow a pre-defined cost structure, statistics are irrelevant */
- const ZSTD_entropyCTables_t* symbolCosts; /* pre-calculated symbol costs, from dictionary */
+ ZSTD_OptPrice_e priceType; /* prices can be determined dynamically, or follow dictionary statistics, or a pre-defined cost structure */
+ const ZSTD_entropyCTables_t* symbolCosts; /* pre-calculated dictionary statistics */
} optState_t;
typedef struct {
} else { /* not a dictionary */
assert(optPtr->litFreq != NULL);
- optPtr->litSum = 0;
{ unsigned lit = MaxLit;
- FSE_count(optPtr->litFreq, &lit, src, srcSize); /* use raw first block to init statistics */
+ FSE_count_simple(optPtr->litFreq, &lit, src, srcSize); /* use raw first block to init statistics */
+ optPtr->litSum = 0;
for (lit=0; lit<=MaxLit; lit++) {
optPtr->litFreq[lit] = 1 + (optPtr->litFreq[lit] >> (ZSTD_FREQ_DIV+1));
optPtr->litSum += optPtr->litFreq[lit];
/* dynamic statistics */
{ U32 const llCode = ZSTD_LLcode(litLength);
int const contribution = (LL_bits[llCode]
- + ZSTD_highbit32(optPtr->litLengthFreq[0]+1)
+ + ZSTD_highbit32(optPtr->litLengthFreq[0]+1) /* note: log2litLengthSum cancels out with following one */
- ZSTD_highbit32(optPtr->litLengthFreq[llCode]+1))
* BITCOST_MULTIPLIER;
#if 1