From 5a50400de98ddc84b1f0cc3dd1b319a0ee789ef6 Mon Sep 17 00:00:00 2001 From: metamuffin Date: Wed, 7 May 2025 18:22:05 +0200 Subject: works --- test2/src/encode.rs | 16 +++++++--------- 1 file changed, 7 insertions(+), 9 deletions(-) (limited to 'test2/src/encode.rs') diff --git a/test2/src/encode.rs b/test2/src/encode.rs index c120e79..b024c17 100644 --- a/test2/src/encode.rs +++ b/test2/src/encode.rs @@ -25,8 +25,8 @@ impl BitstreamFilter for Enc { }; let mut out = Vec::new(); - let mut oldblock = Vec::new(); - let mut newblock = Vec::new(); + let mut savblock = Vec::new(); + let mut refblock = Vec::new(); for by in 0..frame.res.y / BLOCK_SIZE { for bx in 0..frame.res.x / BLOCK_SIZE { @@ -61,20 +61,18 @@ impl BitstreamFilter for Enc { } } - oldblock.clear(); - frame.export_block(boff, &mut oldblock); + savblock.clear(); + frame.export_block(boff, &mut savblock); - Frame::copy_block(&self.last, &mut frame, best_off, boff); - - newblock.clear(); - frame.export_block(boff, &mut newblock); + refblock.clear(); + self.last.export_block(best_off, &mut refblock); let reloff = best_off - boff; out.push((reloff.x + 127) as u8); out.push((reloff.y + 127) as u8); for i in 0..(BLOCK_SIZE * BLOCK_SIZE + BLOCK_SIZE * BLOCK_SIZE / 2) { - out.push(newblock[i as usize] - oldblock[i as usize] + 127) + out.push(savblock[i as usize] - refblock[i as usize]) } } } -- cgit v1.2.3-70-g09d2