]> git.sesse.net Git - narabu/blobdiff - decoder.shader
Predict DC across the entire slice instead of resetting each row. Opens up for slices...
[narabu] / decoder.shader
index 09027915633af93b69a883039836bdecc16f8df2..cab6f8cbecbb508421b01740a208b431a8387136 100644 (file)
@@ -10,6 +10,7 @@ layout(r8ui) uniform restrict readonly uimage2D cum2sym_tex;
 layout(rg16ui) uniform restrict readonly uimage2D dsyms_tex;
 layout(r8) uniform restrict writeonly image2D out_tex;
 layout(r16i) uniform restrict writeonly iimage2D coeff_tex;
+uniform int num_blocks;
 
 const uint prob_bits = 12;
 const uint prob_scale = 1 << prob_bits;
@@ -206,7 +207,6 @@ void main()
        const uint local_y = (gl_LocalInvocationID.x / 8) % 8;
        const uint local_z = gl_LocalInvocationID.x / 64;
 
-       const uint num_blocks = 720 / 16;  // FIXME: make a uniform
        const uint slice_num = local_z;
        const uint thread_num = local_y * 8 + local_x;
 
@@ -229,10 +229,6 @@ void main()
        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).
@@ -309,8 +305,12 @@ void main()
 
                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 % 160;
+               uint block_y = global_block_idx / 160;
+
+               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));
                }