diff options
author | metamuffin <metamuffin@disroot.org> | 2023-11-18 02:08:41 +0100 |
---|---|---|
committer | metamuffin <metamuffin@disroot.org> | 2023-11-18 02:08:41 +0100 |
commit | ebd59fb09a4e094701f195d86662e1a9d00fed2b (patch) | |
tree | 2e24901b15493612c73ede8fcb4cacde49e9692e /flowy/src/motion/dec.wgsl | |
parent | 3deb911083605ad5b63a0ecd372e4ae437c11b4a (diff) | |
download | video-codec-experiments-ebd59fb09a4e094701f195d86662e1a9d00fed2b.tar video-codec-experiments-ebd59fb09a4e094701f195d86662e1a9d00fed2b.tar.bz2 video-codec-experiments-ebd59fb09a4e094701f195d86662e1a9d00fed2b.tar.zst |
rudimentary mcomp
Diffstat (limited to 'flowy/src/motion/dec.wgsl')
-rw-r--r-- | flowy/src/motion/dec.wgsl | 30 |
1 files changed, 30 insertions, 0 deletions
diff --git a/flowy/src/motion/dec.wgsl b/flowy/src/motion/dec.wgsl new file mode 100644 index 0000000..982a1be --- /dev/null +++ b/flowy/src/motion/dec.wgsl @@ -0,0 +1,30 @@ + +struct Params { + block_size: vec2<i32>, + offsets_stride: u32 +} + +struct BlockOffset { + score: f32, + offset: vec2<i32>, +} + +@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<bgra8unorm, 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); + textureStore(next, base, col); + }} +} + + |