diff options
author | metamuffin <metamuffin@disroot.org> | 2025-05-05 15:09:54 +0200 |
---|---|---|
committer | metamuffin <metamuffin@disroot.org> | 2025-05-05 15:09:54 +0200 |
commit | 306f96164784a8cbf405e72fa4364d6523366e95 (patch) | |
tree | 51717fc139871baa438aad806f4923669ae0896c /old/flowy/src/motion/dec.wgsl | |
parent | 9cc089e2d6e841879e430b01d2f3d92c8820523e (diff) | |
download | video-codec-experiments-306f96164784a8cbf405e72fa4364d6523366e95.tar video-codec-experiments-306f96164784a8cbf405e72fa4364d6523366e95.tar.bz2 video-codec-experiments-306f96164784a8cbf405e72fa4364d6523366e95.tar.zst |
old dir
Diffstat (limited to 'old/flowy/src/motion/dec.wgsl')
-rw-r--r-- | old/flowy/src/motion/dec.wgsl | 31 |
1 files changed, 31 insertions, 0 deletions
diff --git a/old/flowy/src/motion/dec.wgsl b/old/flowy/src/motion/dec.wgsl new file mode 100644 index 0000000..f4db974 --- /dev/null +++ b/old/flowy/src/motion/dec.wgsl @@ -0,0 +1,31 @@ + +struct Params { + block_size: vec2<i32>, + offsets_stride: u32 +} + +struct BlockOffset { + score: f32, + offset: vec2<i32>, + tint: vec3<f32>, +} + +@group(0) @binding(0) var<uniform> params: Params; +@group(0) @binding(1) var<storage, read> offsets: array<BlockOffset>; +@group(0) @binding(2) var next: texture_storage_2d<rgba8unorm, write>; +@group(0) @binding(3) var prev: texture_2d<f32>; + +@compute @workgroup_size(1) fn main(@builtin(global_invocation_id) global_id: vec3<u32>) { + let uv = vec2<i32>(global_id.xy) * params.block_size; + + let bl = offsets[global_id.x + global_id.y * params.offsets_stride]; + + for (var x = 0; x < params.block_size.x; x++) { + for (var y = 0; y < params.block_size.y; y++) { + let base = uv+vec2(x,y); + let col = textureLoad(prev, base+bl.offset, 0)+vec4(bl.tint,1.); + textureStore(next, base, col); + }} +} + + |