From a500a02c87f09852c5fdb64386cabb7b38a9b09d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ahmet=20Kaan=20G=C3=BCm=C3=BC=C5=9F?= Date: Thu, 10 Sep 2026 02:49:24 +0300 Subject: [PATCH] fix(av1): the lookahead drain witness pins TPL_FUT=0 WIN=11 also reads the buffered next group, so the identity arm was testing the lambda window. Drain, order, and the filter-move arm stay. --- crates/ec-av1/src/encoder.rs | 16 +++++++++++----- 1 file changed, 11 insertions(+), 5 deletions(-) diff --git a/crates/ec-av1/src/encoder.rs b/crates/ec-av1/src/encoder.rs index d23a4360..9e2644f1 100644 --- a/crates/ec-av1/src/encoder.rs +++ b/crates/ec-av1/src/encoder.rs @@ -3755,11 +3755,15 @@ mod tests { /// (`Av1Encoder::drain_pending` hands the closed group to `ready` and /// codes the group before it) must not change WHAT is coded: /// - /// * with the future half of the filter window empty the stream is byte - /// for byte the one the encoder coded without a lookahead, at every - /// run length -- 1 picture (no hidden frame at all), 7 (a short group), - /// 8 (exactly `mini_gop`), 9 (a group plus a tail) and 17 -- and at a - /// GOP short enough (8) that key frames drain the buffer mid-run; + /// * with the future half of the filter window empty AND the top ARF's + /// temporal lambda window pinned to the past (`TPL_FUT=0`) the stream + /// is byte for byte the one the encoder coded without a lookahead, at + /// every run length -- 1 picture (no hidden frame at all), 7 (a short + /// group), 8 (exactly `mini_gop`), 9 (a group plus a tail) and 17 -- + /// and at a GOP short enough (8) that key frames drain the buffer + /// mid-run. lane-tplhalf's WIN=11 default also reads that buffer, so + /// the identity arm pins the lambda window off or this witness tests + /// a different lever; /// * every run decodes to exactly its picture count through OUR decoder /// and through ffmpeg, sample-exact between the two, so the flush and /// the `show_existing_frame` order survive the delay; @@ -3781,6 +3785,7 @@ mod tests { let run = |n: usize, gop: usize, on: bool, fut: usize| -> (Vec, Vec) { set_lookahead(Some(on)); set_arf_tf_future(Some(fut)); + set_tpl_fut(Some(0)); let config = EncoderConfig { // FINE (not the 120 the other facade tests use): at a coarse // quantizer this fixture's ARF codes almost pure skip (17 @@ -3849,6 +3854,7 @@ mod tests { let (symmetric, _) = run(17, 32, true, 1); set_lookahead(None); set_arf_tf_future(None); + set_tpl_fut(None); assert!( base != symmetric, "one display-future neighbour left the top ARF's filter unchanged \