M10.2: VP9 inter frames (motion search, MV prediction, loop filter, forward probability updates, rate control)

effectcraft-vp9enc gains inter frames: single LAST reference, 16x16/8x8 blocks,
candidate + diamond search refined to quarter samples with the regular 8-tap
filters, NEARESTMV/NEARMV/ZEROMV/NEWMV with spec MV prediction, skip blocks,
the in-loop deblocking filter, per-frame forward probability updates, a key
frame interval and target-bitrate rate control. Decoded output matches the
encoder's reconstruction exactly through FilmCraft's decoder and ffmpeg.
WebM export now encodes sequentially with a key frame every two seconds.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
Brandon Thomas
2026-10-03 03:44:03 -04:00
co-authored by Claude Opus 5.5
parent 7c9d865d19
commit b26fbb6247
14 changed files with 2511 additions and 732 deletions
-25
View File
@@ -64,31 +64,6 @@ impl BoolEncoder {
}
}
/// Write `value` with a tree (leaves stored negated, as in the decoder's tables).
pub fn tree(&mut self, tree: &[i8], probs: &[u8], value: u8) {
// Find the path to the leaf.
fn path(tree: &[i8], node: usize, value: u8, out: &mut Vec<(usize, bool)>) -> bool {
for b in 0..2 {
let t = tree[node + b];
out.push((node >> 1, b == 1));
if t <= 0 {
if (-t) as u8 == value {
return true;
}
} else if path(tree, t as usize, value, out) {
return true;
}
out.pop();
}
false
}
let mut p = Vec::with_capacity(8);
path(tree, 0, value, &mut p);
for (i, bit) in p {
self.write(bit, probs[i]);
}
}
/// Flush (RFC 6386 §7.3) and return the bytes.
pub fn finish(mut self) -> Vec<u8> {
let mut c = self.bit_count;