local_timing[0] = start;
#endif
+ const uint blocks_per_row = (imageSize(out_tex).x + 7) / 8;
+
const uint local_x = gl_LocalInvocationID.x % 8;
const uint local_y = (gl_LocalInvocationID.x / 8) % 8;
const uint local_z = gl_LocalInvocationID.x / 64;
float q = (coeff_num == 0) ? 1.0 : (quant_matrix[coeff_num] * quant_scalefac / 128.0 / sqrt(2.0)); // FIXME: fold
q *= (1.0 / 255.0);
//int w = (coeff_num == 0) ? 32 : int(quant_matrix[coeff_num]);
- int last_k = 0;
+ int last_k = 128;
pick_timer(start, local_timing[0]);
for (uint block_idx = 40; block_idx --> 0; ) {
- uint block_x = block_idx % 20;
- uint block_y = block_idx / 20;
- if (block_x == 19) last_k = 0;
-
pick_timer(start, local_timing[1]);
// rANS decode one coefficient across eight blocks (so 64x8 coefficients).
pick_timer(start, local_timing[6]);
- uint y = block_row * 16 + block_y * 8;
- uint x = block_x * 64 + local_y * 8 + local_x;
+ uint global_block_idx = (block_row * 40 + block_idx) * 8 + local_y;
+ uint block_x = global_block_idx % blocks_per_row;
+ uint block_y = global_block_idx / blocks_per_row;
+
+ uint y = block_y * 8;
+ uint x = block_x * 8 + local_x;
for (uint yl = 0; yl < 8; ++yl) {
imageStore(out_tex, ivec2(x, yl + y), vec4(temp[row_offset + yl * 8], 0.0, 0.0, 1.0));
}