X-Git-Url: https://git.sesse.net/?a=blobdiff_plain;f=rans.shader;h=925543ef7dfa284d0fddbce411a61444438dbc9f;hb=dc3e3a2a88b2b1f0e177f613a8b355116e6020ff;hp=8e9c4226a80a0b8595f4072490f93c072cac710d;hpb=68af7105a45805cfd8d951313dbe35e678055b29;p=narabu diff --git a/rans.shader b/rans.shader index 8e9c422..925543e 100644 --- a/rans.shader +++ b/rans.shader @@ -97,7 +97,9 @@ void encode_coeff(int signed_k, uint sign_bias, inout RansEncoder enc) 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; } @@ -125,7 +127,7 @@ void encode_9_7(uint streamgroup_num, uint coeff_row, layout(r16ui) restrict rea 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;