Files
craft-libs/crates/video/tests/av1_decode/conformance.rs
Dylan M. Taylor 16564be34b craft-video: AV1 decoder from FilmCraft, with DeckCraft's hardening (av1-decode) (#836)
* craft-video: AV1 decoder from FilmCraft (`av1-decode` feature)

FilmCraft's crates/av1 at 4c0d2ad7 becomes craft_video::av1::decode. The encoder moves to
av1/encode and is still exported from craft_video::av1. Feature av1 now turns on av1-decode and
av1-encode, so either half can be built without the other.

The ignored speed tests no longer read the thread CPU clock (FilmCraft used rustix for it).
craft_video::budget (the picture memory budget from DeckCraft's bitstream crate) is added for the
next commit. craft-video is built at opt-level 3 in the dev profile, as FilmCraft built its
codecs.

* craft-video: AV1 decoder hardening from DeckCraft's copy

- The picture store (eight reference slots, the new frame, frames in flight) is checked against
  a memory budget before a frame is allocated; Decoder::set_memory_budget.
- Non-uniform tile spacing is refused past MAX_TILE_COLS columns or MAX_TILE_ROWS rows.

* craft-video: AV1 fuzz seeds are 64x64 so SVT-AV1 2.x can encode them

FilmCraft's seeds were 64x48; the SVT-AV1 2.3 on the Ubuntu runners refuses a source under 64
lines, and an encoder that exists but fails is a test failure, not a skip.
2026-11-11 17:43:10 -05:00

63 lines
2.1 KiB
Rust

//! libaom conformance test vectors (downloaded on first use), compared with libdav1d.
use crate::common;
use common::*;
/// Vectors the decoder handles today (more are added as stages land).
const VECTORS: &[&str] =
&["av1-1-b8-02-allintra.ivf", "av1-1-b8-05-mv.ivf", "av1-1-b8-06-mfmv.ivf", "av1-1-b8-24-monochrome.ivf", "av1-1-b10-23-film_grain-50.ivf"];
#[test]
fn conformance_vectors() {
let Some(ff) = ffmpeg_dav1d() else { return };
for name in VECTORS {
let Some(path) = test_vector(name) else { return };
check_file(&ff, name, &path);
}
}
/// The wider libaom set (slow: many downloads and decodes):
/// `cargo test -p craft-video --features av1-decode,threads --test av1_decode conformance:: -- --ignored`; `AV1_VECTORS=a,b` overrides it.
#[test]
#[ignore]
fn conformance_vectors_extended() {
let Some(ff) = ffmpeg_dav1d() else { return };
let list: Vec<String> = match std::env::var("AV1_VECTORS") {
Ok(v) => v.split(',').map(str::to_string).collect(),
Err(_) => EXTENDED.iter().map(|s| s.to_string()).collect(),
};
let mut failed = Vec::new();
for name in &list {
let Some(path) = test_vector(name) else { continue };
let r = std::panic::catch_unwind(|| check_file(&ff, name, &path));
if r.is_err() {
failed.push(name.clone());
}
}
assert!(failed.is_empty(), "failed: {failed:?}");
}
const EXTENDED: &[&str] = &[
"av1-1-b8-01-size-16x16.ivf",
"av1-1-b8-01-size-66x66.ivf",
"av1-1-b8-01-size-196x196.ivf",
"av1-1-b8-01-size-226x226.ivf",
"av1-1-b8-00-quantizer-00.ivf",
"av1-1-b8-00-quantizer-31.ivf",
"av1-1-b8-00-quantizer-63.ivf",
"av1-1-b10-00-quantizer-00.ivf",
"av1-1-b10-00-quantizer-40.ivf",
"av1-1-b8-04-cdfupdate.ivf",
"av1-1-b8-05-mv.ivf",
"av1-1-b8-06-mfmv.ivf",
"av1-1-b8-22-svc-L1T2.ivf",
"av1-1-b8-22-svc-L2T1.ivf",
"av1-1-b8-22-svc-L2T2.ivf",
"av1-1-b8-24-monochrome.ivf",
"av1-1-b10-24-monochrome.ivf",
"av1-1-b8-16-intra_only-intrabc-extreme-dv.ivf",
"av1-1-b8-16-intra-only.ivf",
"av1-1-b8-23-film_grain-50.ivf",
"av1-1-b10-23-film_grain-50.ivf",
];