layout(local_size_x = 1) in;
-const uint prob_bits = 13; // Note!
+const uint prob_bits = 12;
const uint prob_scale = 1 << prob_bits;
const uint RANS_BYTE_L = (1u << 23);
const uint BLOCKS_PER_STREAM = 320;
if (k >= ESCAPE_LIMIT) {
// ... boring stuff here
- RansEncPut(enc.rans, enc.rans_offset, k, 1, prob_bits - 1);
+ RansEncPut(enc.rans, enc.rans_offset, k, 1, prob_bits);
k = ESCAPE_LIMIT;
}
- uvec2 sym = ransdist[enc.lut_base + ((k + NUM_SYMS - 1) & (NUM_SYMS - 1))];
- RansEncPut(enc.rans, enc.rans_offset, sym.x, sym.y, prob_bits);
+ uvec2 sym = ransdist[enc.lut_base + ((k - 1) & (NUM_SYMS - 1))];
+ RansEncPut(enc.rans, enc.rans_offset, sym.x, sym.y, prob_bits + 1);
if (signed_k < 0) {
enc.rans += sign_bias;