aboutsummaryrefslogtreecommitdiff
path: root/flowy/src/main.rs
diff options
context:
space:
mode:
authormetamuffin <metamuffin@disroot.org>2023-11-18 02:08:41 +0100
committermetamuffin <metamuffin@disroot.org>2023-11-18 02:08:41 +0100
commitebd59fb09a4e094701f195d86662e1a9d00fed2b (patch)
tree2e24901b15493612c73ede8fcb4cacde49e9692e /flowy/src/main.rs
parent3deb911083605ad5b63a0ecd372e4ae437c11b4a (diff)
downloadvideo-codec-experiments-ebd59fb09a4e094701f195d86662e1a9d00fed2b.tar
video-codec-experiments-ebd59fb09a4e094701f195d86662e1a9d00fed2b.tar.bz2
video-codec-experiments-ebd59fb09a4e094701f195d86662e1a9d00fed2b.tar.zst
rudimentary mcomp
Diffstat (limited to 'flowy/src/main.rs')
-rw-r--r--flowy/src/main.rs16
1 files changed, 12 insertions, 4 deletions
diff --git a/flowy/src/main.rs b/flowy/src/main.rs
index 7755ab8..557417f 100644
--- a/flowy/src/main.rs
+++ b/flowy/src/main.rs
@@ -1,6 +1,6 @@
pub mod motion;
-use motion::{enc::MotionEncoder, CommonBuffers, Params};
+use motion::{dec::MotionDecoder, enc::MotionEncoder, CommonBuffers, Params};
use pollster::FutureExt;
use std::io::{stdin, stdout, Read, Write};
use wgpu::{
@@ -46,6 +46,8 @@ fn main() {
height: height as u32,
depth_or_array_layers: 1,
},
+ blocks_x: width / 8,
+ blocks_y: height / 8,
block_width: 8,
block_height: 8,
blocks: (width / 8) * (height / 8),
@@ -53,12 +55,16 @@ fn main() {
let bufs = CommonBuffers::create(&device, &params);
let menc = MotionEncoder::create(&device, &params, &bufs);
+ let mdec = MotionDecoder::create(&device, &params, &bufs);
let mut buffer = vec![0u8; width * height * 4];
+ menc.write_uniforms(&queue);
+ mdec.write_uniforms(&queue);
+
let mut i = 0;
loop {
- let rp = RoundParams { swap: i };
+ let rp = RoundParams { swap: i % 2 };
eprintln!("read");
stdin().read_exact(&mut buffer).unwrap();
@@ -69,7 +75,10 @@ fn main() {
let mut encoder = device.create_command_encoder(&Default::default());
- menc.pass(&mut encoder, &params, &rp);
+ if i > 1 {
+ menc.pass(&mut encoder, &params, &rp);
+ mdec.pass(&mut encoder, &params, &rp);
+ }
bufs.prepare_texture_download(&mut encoder, &params, &rp);
queue.submit(Some(encoder.finish()));
@@ -81,6 +90,5 @@ fn main() {
eprintln!("write");
stdout().write_all(&buffer).unwrap();
i += 1;
- i %= 2;
}
}