X-Git-Url: https://git.sesse.net/?a=blobdiff_plain;f=decoder.shader;h=09027915633af93b69a883039836bdecc16f8df2;hb=34138d5b1a1302a7a1050fd46d2fb95c0186140a;hp=77ae2869f08c54cf3a4fafbc6d101e6dba62a408;hpb=755cd83d9f558a3a08d1c63d9944738f41a852c7;p=narabu diff --git a/decoder.shader b/decoder.shader index 77ae286..0902791 100644 --- a/decoder.shader +++ b/decoder.shader @@ -9,6 +9,7 @@ layout(local_size_x = 64*PARALLEL_SLICES) in; 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; const uint prob_bits = 12; const uint prob_scale = 1 << prob_bits; @@ -39,6 +40,16 @@ const uint ff_zigzag_direct[64] = { 58, 59, 52, 45, 38, 31, 39, 46, 53, 60, 61, 54, 47, 55, 62, 63 }; +const uint stream_mapping[64] = { + 0, 0, 1, 1, 2, 2, 3, 3, + 0, 0, 1, 2, 2, 2, 3, 3, + 1, 1, 2, 2, 2, 3, 3, 3, + 1, 1, 2, 2, 2, 3, 3, 3, + 1, 2, 2, 2, 2, 3, 3, 3, + 2, 2, 2, 2, 3, 3, 3, 3, + 2, 2, 3, 3, 3, 3, 3, 3, + 3, 3, 3, 3, 3, 3, 3, 3, +}; layout(std430, binding = 9) buffer layoutName { @@ -203,7 +214,7 @@ void main() //const uint coeff_num = ff_zigzag_direct[thread_num]; const uint coeff_num = thread_num; const uint stream_num = coeff_num * num_blocks + block_row; - const uint model_num = min((coeff_num % 8) + (coeff_num / 8), 7); + const uint model_num = stream_mapping[coeff_num]; const uint sign_bias = sign_bias_per_model[model_num]; // Initialize rANS decoder. @@ -251,6 +262,12 @@ void main() last_k = k; } +#if 0 + uint y = block_row * 16 + block_y * 8 + local_y; + uint x = block_x * 64 + subblock_idx * 8 + local_x; + imageStore(coeff_tex, ivec2(x, y), ivec4(k, 0,0,0)); +#endif + temp[slice_num * 64 * 8 + subblock_idx * 64 + coeff_num] = k * q; //temp[subblock_idx * 64 + 8 * y + x] = (2 * k * w * 4) / 32; // 100% matching unquant }