uint k = abs(signed_k);
if (k >= ESCAPE_LIMIT) {
- // ... boring stuff here
+ // Put the coefficient as a 1/(2^12) symbol _before_
+ // the 255 coefficient, since the decoder will read the
+ // 255 coefficient first.
RansEncPut(enc.rans, enc.rans_offset, k, 1, prob_bits);
k = ESCAPE_LIMIT;
}
uint sign_bias1 = ransdist[enc1.lut_base + 255].x + ransdist[enc1.lut_base + 255].y;
uint sign_bias2 = ransdist[enc2.lut_base + 255].x + ransdist[enc2.lut_base + 255].y;
- for (uint subblock_idx = BLOCKS_PER_STREAM; subblock_idx --> 0; ) {
+ for (uint subblock_idx = 0; subblock_idx < BLOCKS_PER_STREAM; ++subblock_idx) {
// TODO: Use SSBOs instead of a texture?
uint x = (streamgroup_num * BLOCKS_PER_STREAM + subblock_idx) % 160;
uint y = (streamgroup_num * BLOCKS_PER_STREAM + subblock_idx) / 160;