diff options
author | metamuffin <metamuffin@disroot.org> | 2025-05-07 18:59:55 +0200 |
---|---|---|
committer | metamuffin <metamuffin@disroot.org> | 2025-05-07 18:59:55 +0200 |
commit | 1f19723fef4bdfe809a03aa30270b60e150fad66 (patch) | |
tree | cab9a0aff466ab5fd5a2ffe4a0973c5c3b4dc067 | |
parent | 5a50400de98ddc84b1f0cc3dd1b319a0ee789ef6 (diff) | |
download | video-codec-experiments-1f19723fef4bdfe809a03aa30270b60e150fad66.tar video-codec-experiments-1f19723fef4bdfe809a03aa30270b60e150fad66.tar.bz2 video-codec-experiments-1f19723fef4bdfe809a03aa30270b60e150fad66.tar.zst |
explicit re-apply of diff for later quant error stuff
-rw-r--r-- | test2/src/encode.rs | 22 |
1 files changed, 15 insertions, 7 deletions
diff --git a/test2/src/encode.rs b/test2/src/encode.rs index b024c17..8db88b0 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 savblock = Vec::new(); - let mut refblock = Vec::new(); + let mut oldblock = Vec::new(); + let mut newblock = Vec::new(); for by in 0..frame.res.y / BLOCK_SIZE { for bx in 0..frame.res.x / BLOCK_SIZE { @@ -61,19 +61,27 @@ impl BitstreamFilter for Enc { } } - savblock.clear(); - frame.export_block(boff, &mut savblock); + oldblock.clear(); + frame.export_block(boff, &mut oldblock); - refblock.clear(); - self.last.export_block(best_off, &mut refblock); + Frame::copy_block(&self.last, &mut frame, best_off, boff); + + newblock.clear(); + frame.export_block(boff, &mut newblock); 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(savblock[i as usize] - refblock[i as usize]) + out.push(oldblock[i as usize] - newblock[i as usize]) } + + frame.import_block_diff( + boff, + &out[out.len() + - (BLOCK_SIZE * BLOCK_SIZE + BLOCK_SIZE * BLOCK_SIZE / 2) as usize..], + ); } } |