h264enc: never crash — no unwrap/expect/unreachable, encode returns Result

- `Encoder::encode` returns `Result` (it was `try_encode(..).expect(..)`, panicking on short
  planes); tests and the example unwrap explicitly.
- P/B macroblock analysis without a reference codes intra instead of `expect`/`unwrap`;
  spatial direct without a list-1 picture predicts zero motion.
- Rate control prior, DPB sliding window, DTS queue, reconstruction buffers, CAVLC writer,
  SAD rows and forward 8x8 transforms without `unwrap`/`expect`; skip-macroblock arms in
  `write_mb` debug-assert instead of `unreachable!`.
- `#![deny(clippy::unwrap_used, …)]` outside tests.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
Brandon Thomas
2026-10-04 14:14:06 -04:00
co-authored by Claude Opus 5.5
parent 7b96f22684
commit b05833ef67
10 changed files with 48 additions and 39 deletions
+1 -1
View File
@@ -64,7 +64,7 @@ fn main() {
enc.set_recon_capture(false);
}
for (i, f) in frames.iter().enumerate() {
pk.extend(enc.encode(&f.frame(), i as i64));
pk.extend(enc.encode(&f.frame(), i as i64).unwrap());
}
pk.extend(enc.flush());
let el = t0.elapsed().as_secs_f64();