From a50740a9855ca468ddc8f34f9be3a39fbdd4e0d2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ahmet=20Kaan=20G=C3=BCm=C3=BC=C5=9F?= Date: Tue, 8 Sep 2026 06:18:33 +0300 Subject: [PATCH] test(av1): the stream pins are default-preset pins -- encode at speed 0 whatever EC_AV1_SPEED says Also: the search-free arm's screen row (byte-identical to the control, LAST2 never fires on the capture). --- crates/ec-av1/src/encode.rs | 24 ++++++++++++++++-------- lanes/last2.report.md | 7 +++++++ 2 files changed, 23 insertions(+), 8 deletions(-) diff --git a/crates/ec-av1/src/encode.rs b/crates/ec-av1/src/encode.rs index 80afabb6..3eb85166 100644 --- a/crates/ec-av1/src/encode.rs +++ b/crates/ec-av1/src/encode.rs @@ -15618,7 +15618,12 @@ mod tests { /// (`EC_AV1_ANGLE=0` restores that half). #[test] fn the_encoders_own_streams_are_byte_identical_to_their_pins() { - let _knobs = crate::speed::knob_read(); + // These are DEFAULT-PRESET pins: a speed preset switches search levers + // off, so it legitimately moves every byte. Encode at speed 0 whatever + // `EC_AV1_SPEED` says (write guard: the preset is process-global). + let _knobs = crate::speed::knob_write(); + let was = crate::speed::speed(); + crate::speed::set_speed(0); if !have_ffmpeg() { eprintln!("SKIP the_encoders_own_streams_are_byte_identical_to_their_pins: no ffmpeg"); return; @@ -15681,13 +15686,16 @@ mod tests { // now. `EC_AV1_I64=0` restores 8557 / 33345. let pins: [(u8, usize, u64); 2] = [(150, 8562, 0x66f5_4ffc_aacf_964f), (60, 33357, 0x1d61_9ca4_e960_b044)]; - for (q, bytes, hash) in pins { - let encoded = encode_sequence(&source, q, 0.5).unwrap(); - assert_eq!( - (encoded.stream.len(), fnv(&encoded.stream)), - (bytes, hash), - "q={q}: the encoder's stream moved" - ); + let coded: Vec<(u8, usize, u64)> = pins + .iter() + .map(|&(q, _, _)| { + let e = encode_sequence(&source, q, 0.5).unwrap(); + (q, e.stream.len(), fnv(&e.stream)) + }) + .collect(); + crate::speed::set_speed(was); + for (&(q, bytes, hash), &got) in pins.iter().zip(&coded) { + assert_eq!(got, (q, bytes, hash), "q={q}: the encoder's stream moved"); } } diff --git a/lanes/last2.report.md b/lanes/last2.report.md index b9b4a711..9ad2b42e 100644 --- a/lanes/last2.report.md +++ b/lanes/last2.report.md @@ -136,6 +136,13 @@ comes back (194 s / 171 s against the control's 208 s / 165 s, i.e. inside the gate's own wall noise), so the cost of the searched arm was indeed the second motion search — but the reference itself does not pay for its own syntax. +**The screen row** (`EC_AV1_NATIVE_SCREEN=1`, the keep rule's third column): +control and the search-free arm are BYTE-IDENTICAL at all four quantizers +(+19.8% / -30.5%, 143.6 s vs 144.1 s), and the census prints `LAST2 0 of 23942 +inter blocks` — the screen clip's leaves never take the older picture, so the +screen half of the keep rule is neutral either way and the decision rests on +the two film rows. + **Fire share, on the real film rows** (the census the gate now prints): | clip | LAST | LAST2 | GOLDEN | ALTREF | LAST2 share |