mirror of
https://github.com/storytold/filmcraft.git
synced 2026-10-24 01:58:19 -06:00
* Tests: one integration-test binary per crate Each crate with several tests/*.rs files keeps them as modules of tests/it/, so cargo links one test executable per crate instead of one per file. Files that change process-wide state or time a workload stay binaries of their own. * Profiles: line tables for workspace crates, no debug info for dependencies * Windows ARM64: nightly and on release pushes instead of every push to main * xtask ci: clippy and tests in the dev profile The release profile's thin LTO and single codegen unit made linking the test binaries take most of the gate. The codec and audio crates stay at opt-level 3 in the dev profile, so their tests run at release speed. * xtask ci: nextest, doctests, no examples, one wasm check Tests run with cargo nextest when it is installed (cargo test otherwise) and build with --lib --bins --tests, so examples aren't linked; doctests run separately. The wasm check keeps going past the first failing crate. VP8 fixture generation locks across processes, since nextest runs each test in its own. * VP9 synthetic fixtures: write aside and rename A test in another process could read a fixture ffmpeg was still writing. * Fuzz tests: a third of each sweep by default, all of it with FILMCRAFT_FUZZ_ITERS Every seed, mutation kind and thread count still runs. Header bytes each get one overwrite value and two bit flips in rotation, so every value and bit index still occurs across the region. FILMCRAFT_FUZZ_ITERS=N runs the whole sweep plus N random rounds per seed, as before. * Platform fallback tests: one failure point per hybrid path The failure-anywhere test injected a failure at four points around every restart point; the hybrid's paths differ only in the first GOP, around the second and last restart points, at the end and never. The replay test needs the first two GOPs. * Export tests: shorter ranges with the same checks The bitrate test measures 0.5–1.5 s, where each preset reaches its own target (on 0–3 s the simple demo left two presets at the same rate). The every-preset test exports three frames per preset. * Audio tests: effects in parallel, a table-driven FFT for the Opus quality metric The extreme-settings test keeps both settings and the 40 s tail for every effect, one thread each. The Opus quality metric's FFT builds its twiddles once and allocates nothing per transform (same algorithm and summation order). * CI: dev-profile gate with nextest xtask ci no longer builds with --release, so the release-profile overrides go; nextest is installed for the test step. * CI: apt packages through the cached install-apt-packages action * Review fixes: fuzz tests with a panic hook in their own binaries, loud fixture lock The fuzz tests of av1, h264, hevc, mpeg2v, vp8 and vp9 count panics through a process-wide hook, so a panic in another test of the same process would fail them; they are binaries of their own again. The VP8 fixture lock fails the test instead of skipping it silently, and the full-sweep doc comments say how many truncation points the full run samples. * Fuzz tests: rotate the default subset per run (FILMCRAFT_FUZZ_SEED replays one) * platform tests: decode-switch tests in their own binaries, one NVENC lock
120 lines
5.0 KiB
Rust
120 lines
5.0 KiB
Rust
//! Inter-frame bit-exactness against libdav1d (run as an external ffmpeg process): SVT-AV1
|
|
//! GOPs with hierarchical references, compound prediction, OBMC / warped motion, global motion,
|
|
//! motion-field projection and all loop filters.
|
|
|
|
use crate::common;
|
|
use common::*;
|
|
|
|
fn specs() -> Vec<Spec> {
|
|
let p = |preset: &'static str, crf: &'static str| -> Vec<&'static str> { vec!["-preset", preset, "-crf", crf] };
|
|
vec![
|
|
Spec::new("inter_testsrc_p8", "testsrc2=s=320x240:r=25", 10, "yuv420p", &p("8", "35")),
|
|
Spec::new("inter_testsrc_p3", "testsrc2=s=352x288:r=25", 24, "yuv420p", &p("3", "30")),
|
|
Spec::new("inter_mandel_10bit_p5", "mandelbrot=s=416x240:r=25", 16, "yuv420p10le", &p("5", "40")),
|
|
Spec::new("inter_noise_odd_p6", "testsrc2=s=203x117:r=25,noise=alls=15:allf=t", 12, "yuv420p", &p("6", "45")),
|
|
]
|
|
}
|
|
|
|
/// Super-resolution (denominator 12 on the inter frames) and film grain synthesis.
|
|
fn specs_tools() -> Vec<Spec> {
|
|
let p = |params: &'static str| -> Vec<&'static str> { vec!["-preset", "6", "-crf", "35", "-svtav1-params", params] };
|
|
vec![
|
|
Spec::new("inter_superres", "testsrc2=s=416x240:r=25", 8, "yuv420p", &p("superres-mode=1:superres-denom=12:superres-kf-denom=13")),
|
|
Spec::new("inter_film_grain", "testsrc2=s=352x288:r=25,noise=alls=20:allf=t", 8, "yuv420p", &p("film-grain=10")),
|
|
]
|
|
}
|
|
|
|
#[test]
|
|
fn inter_superres_and_grain() {
|
|
let Some(ff) = ffmpeg() else { return };
|
|
for s in specs_tools() {
|
|
check_bit_exact(&ff, &s);
|
|
}
|
|
}
|
|
|
|
#[test]
|
|
fn inter_gops() {
|
|
let Some(ff) = ffmpeg() else { return };
|
|
for s in specs() {
|
|
check_bit_exact(&ff, &s);
|
|
}
|
|
}
|
|
|
|
/// Draft mode: frames that refresh no reference slot skip the in-loop filters and are flagged;
|
|
/// every other picture stays bit-exact, with 1 and several threads.
|
|
#[test]
|
|
fn draft_mode_changes_only_flagged_non_reference_frames() {
|
|
let Some(ff) = ffmpeg() else { return };
|
|
let s = &specs()[0];
|
|
let path = make(&ff, s);
|
|
let first = decode_all_threads(&path, 1).expect("decode");
|
|
let raw = reference(&ff, &path, pix_fmt_for(&first[0]));
|
|
let per = picture_samples(&first[0]);
|
|
for threads in [1, 4] {
|
|
let pics = decode_all_opts(&path, threads, true).expect("decode");
|
|
assert_eq!(pics.len(), first.len(), "threads {threads}");
|
|
let (mut draft, mut changed) = (0, 0);
|
|
for (i, p) in pics.iter().enumerate() {
|
|
let (_, count) = compare(p, &raw[i * per..(i + 1) * per]);
|
|
if p.draft {
|
|
draft += 1;
|
|
changed += (count > 0) as usize;
|
|
} else {
|
|
assert_eq!(count, 0, "threads {threads}: unflagged frame {i} differs");
|
|
}
|
|
}
|
|
assert!(draft > 0, "threads {threads}: no non-reference frames");
|
|
assert!(changed > 0, "threads {threads}: draft frames identical to the filtered ones");
|
|
}
|
|
}
|
|
|
|
/// Several tiles (decoded in parallel into private buffers, then merged).
|
|
fn specs_tiles() -> Vec<Spec> {
|
|
let p = |preset: &'static str, params: &'static str| -> Vec<&'static str> { vec!["-preset", preset, "-crf", "32", "-svtav1-params", params] };
|
|
vec![
|
|
Spec::new("inter_tiles_4x2", "testsrc2=s=1280x720:r=25,noise=alls=4:allf=t", 8, "yuv420p", &p("8", "tile-columns=2:tile-rows=1")),
|
|
Spec::new("inter_tiles_odd_10bit", "mandelbrot=s=650x370:r=25", 8, "yuv420p10le", &p("6", "tile-columns=1:tile-rows=1")),
|
|
]
|
|
}
|
|
|
|
#[test]
|
|
fn inter_tiles() {
|
|
let Some(ff) = ffmpeg() else { return };
|
|
for s in specs_tiles() {
|
|
check_bit_exact(&ff, &s);
|
|
}
|
|
}
|
|
|
|
/// The 1080p performance fixtures (slow; part of the extended run).
|
|
#[test]
|
|
#[ignore]
|
|
fn inter_1080p() {
|
|
let Some(ff) = ffmpeg() else { return };
|
|
let p = |crf: &'static str, params: &'static str| -> Vec<&'static str> { vec!["-preset", "8", "-crf", crf, "-svtav1-params", params] };
|
|
let src = "testsrc2=s=1920x1080:r=25,noise=alls=6:allf=t";
|
|
for s in [
|
|
Spec::new("perf_1080p_gop", src, 60, "yuv420p", &p("30", "keyint=60")),
|
|
Spec::new("perf_1080p_gop_10bit", src, 60, "yuv420p10le", &p("30", "keyint=60")),
|
|
Spec::new("perf_1080p_gop_hq", src, 60, "yuv420p", &p("18", "keyint=60")),
|
|
Spec::new("perf_1080p_gop_tiles", src, 60, "yuv420p", &p("30", "keyint=60:tile-columns=2:tile-rows=1")),
|
|
] {
|
|
check_bit_exact(&ff, &s);
|
|
}
|
|
}
|
|
|
|
/// 4:2:2 and 4:4:4 (libaom; SVT-AV1 only makes 4:2:0): the post-filters run in row bands whose
|
|
/// chroma rows depend on the vertical subsampling, so these check the band edges there too.
|
|
#[test]
|
|
fn inter_chroma_444_422() {
|
|
let Some(ff) = ffmpeg_libaom() else { return };
|
|
let p = ["-cpu-used", "8", "-crf", "40", "-enable-restoration", "1"];
|
|
let src = "testsrc2=s=416x400:r=25,noise=alls=8:allf=t";
|
|
for s in [
|
|
Spec::new("inter_aom_444", src, 6, "yuv444p", &p).encoder("libaom-av1"),
|
|
Spec::new("inter_aom_422", src, 6, "yuv422p", &p).encoder("libaom-av1"),
|
|
Spec::new("inter_aom_444_10bit", src, 6, "yuv444p10le", &p).encoder("libaom-av1"),
|
|
] {
|
|
check_bit_exact(&ff, &s);
|
|
}
|
|
}
|