const unsigned prob_bits = 12;
const unsigned prob_scale = 1 << prob_bits;
const unsigned NUM_SYMS = 256;
-const unsigned NUM_TABLES = 16;
+const unsigned NUM_TABLES = 8;
struct RansDecSymbol {
unsigned sym_start;
exit(1);
}
- decode_tables[table].dsyms[(sym + 1) & 255].sym_start = cum_freq;
- decode_tables[table].dsyms[(sym + 1) & 255].sym_freq = *freq;
+ decode_tables[table].dsyms[(sym + 1) & (NUM_SYMS - 1)].sym_start = cum_freq;
+ decode_tables[table].dsyms[(sym + 1) & (NUM_SYMS - 1)].sym_freq = *freq;
for (uint32_t i = 0; i < freq; ++i) {
if (cum_freq < prob_scale)
- decode_tables[table].cum2sym[cum_freq] = (sym + 1) & 255;
+ decode_tables[table].cum2sym[cum_freq] = (sym + 1) & (NUM_SYMS - 1);
++cum_freq;
}
}