X-Git-Url: https://git.sesse.net/?a=blobdiff_plain;f=decoder.shader;h=616c3e2dfd0896e5cd035bacc42ec0720c5174a1;hb=5e1d27014149311318e97b8e04a6e05ec858e57c;hp=7136e03e5ff0de76095f1fd5974f68fe0bc5a3ba;hpb=bed1185c791ae562ae0b5934a64a95440285729b;p=narabu diff --git a/decoder.shader b/decoder.shader index 7136e03..616c3e2 100644 --- a/decoder.shader +++ b/decoder.shader @@ -16,6 +16,7 @@ const uint prob_bits = 12; const uint prob_scale = 1 << prob_bits; const uint NUM_SYMS = 256; const uint ESCAPE_LIMIT = NUM_SYMS - 1; +const uint BLOCKS_PER_STREAM = 320; // These need to be folded into quant_matrix. const float dc_scalefac = 8.0; @@ -161,8 +162,8 @@ void idct_1d(inout float y0, inout float y1, inout float y2, inout float y3, ino y0 = p6_0 + p6_7; y1 = p6_1 + p6_6; y2 = p6_2 + p6_5; - y3 = p6_3 - p4_4; - y4 = p6_3 + p4_4; + y3 = p6_3 + p4_4; + y4 = p6_3 - p4_4; y5 = p6_2 - p6_5; y6 = p6_1 - p6_6; y7 = p6_0 - p6_7; @@ -203,6 +204,8 @@ void main() 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; @@ -228,7 +231,7 @@ void main() pick_timer(start, local_timing[0]); - for (uint block_idx = 40; block_idx --> 0; ) { + for (uint block_idx = BLOCKS_PER_STREAM / 8; block_idx --> 0; ) { pick_timer(start, local_timing[1]); // rANS decode one coefficient across eight blocks (so 64x8 coefficients). @@ -306,8 +309,8 @@ void main() pick_timer(start, local_timing[6]); 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 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;