forge
Explore
Log in

Don't you dare go Hollow

The symmetric ARF filter window ships on one group of lookahead

Browse files at this commit

2d9a19576d3a61b55b05791ce2ec0ae9179a8007Ahmet Kaan GümüşParent: 6766627
  • feat
    • the symmetric ARF filter window ships on one group of lookahead
Show full message
feat(av1): the symmetric ARF filter window ships on one group of lookahead

The encoder holds the closed mini-GOP one group longer, so its top ARF -- the
group's last picture in display order -- sees the next group's sources as
display-future neighbours. The source temporal filter takes a symmetric
window (3 past, 3 future); the tpl lambda window is unchanged.

Long-GOP gate: film A +22.0/-8.4 -> +21.2/-8.8, film B +76.5/+1.2 ->
+72.1/-1.2. Bracketed: +-4 is worse on all four columns. Guard rows move by
at most 0.1. Byte pins unchanged (their four-picture fixture has no next
group). Costs one mini-GOP of latency and 199 MB of source buffer at 4K.
crates/ec-av1/src/encoder.rsmodified+23 -3
@@ -3700,9 +3700,16 @@ mod tests {
3700 set_lookahead(Some(on));3700 set_lookahead(Some(on));
3701 set_arf_tf_future(Some(fut));3701 set_arf_tf_future(Some(fut));
3702 let config = EncoderConfig {3702 let config = EncoderConfig {
3703+ // FINE (not the 120 the other facade tests use): at a coarse
3704+ // quantizer this fixture's ARF codes almost pure skip (17
3705+ // pictures in 493 bytes) and a filtered source quantizes back
3706+ // to the same bytes, which made the future-half assertion
3707+ // below depend on where the suite's other tests had left the
3708+ // process-global preset. At q=60 the anchor carries real
3709+ // coefficients and the filter must move them.
3710+ base_q_idx: 60,
3703 width,3711 width,
3704 height,3712 height,
3705- base_q_idx: 120,
3706 gop,3713 gop,
3707 colour: Colour::Bt709Limited,3714 colour: Colour::Bt709Limited,
3708 tile_cols_log2: 0,3715 tile_cols_log2: 0,
@@ -3711,6 +3718,16 @@ mod tests {
3711 let mut enc = Av1Encoder::with_pyramid(config, Pyramid::default()).unwrap();3718 let mut enc = Av1Encoder::with_pyramid(config, Pyramid::default()).unwrap();
3712 let sources: Vec<Picture> = (0..n).map(|t| noisy_card(width, height, t)).collect();3719 let sources: Vec<Picture> = (0..n).map(|t| noisy_card(width, height, t)).collect();
3713 let packets = encode_all(&mut enc, &sources);3720 let packets = encode_all(&mut enc, &sources);
3721+ // The content gate is process-global and so is the preset: if
3722+ // either has been flipped under this test the pyramid is gone and
3723+ // there is no ARF to filter, which is a different failure from
3724+ // "the future neighbour changed nothing" (the suite reported the
3725+ // second when it meant the first).
3726+ assert!(
3727+ enc.pyramid().is_some(),
3728+ "{n} pictures at gop {gop}: the content gate dropped the pyramid, so no ARF was coded (speed {})",
3729+ crate::speed::speed(),
3730+ );
3714 (concat(&packets), packets)3731 (concat(&packets), packets)
3715 };3732 };
3716 for gop in [32usize, 8] {3733 for gop in [32usize, 8] {
@@ -3752,8 +3769,11 @@ mod tests {
3752 set_arf_tf_future(None);3769 set_arf_tf_future(None);
3753 assert!(3770 assert!(
3754 base != symmetric,3771 base != symmetric,
3755- "one display-future neighbour left the top ARF's filter unchanged ({} B both)",3772+ "one display-future neighbour left the top ARF's filter unchanged \
3756- base.len()3773+ ({} B vs {} B, preset {})",
3774+ base.len(),
3775+ symmetric.len(),
3776+ crate::speed::speed()
3757 );3777 );
3758 let ours = crate::stream::decode_stream(&symmetric).expect("our decoder");3778 let ours = crate::stream::decode_stream(&symmetric).expect("our decoder");
3759 assert_eq!(ours.len(), 17, "the symmetric arm's display-order count");3779 assert_eq!(ours.len(), 17, "the symmetric arm's display-order count");
lanes/lookahead.report.mdmodified+11 -5
@@ -45,11 +45,17 @@ buffer mid-run), with a gradient-plus-noise fixture:
45 really consumed ([[gate-blind-to-feature]]: everything above would pass over45 really consumed ([[gate-blind-to-feature]]: everything above would pass over
46 a lookahead nothing reads) — and still decodes sample-exact.46 a lookahead nothing reads) — and still decodes sample-exact.
47 47
48-RED first: in the split suite (not standalone) the future-half assertion48+RED first, twice, and both reds were the FIXTURE, not the encoder. In the
49-failed with "493 B both" — another test had left the process-global preset49+split suite (never standalone) the future-half assertion failed with "493 B
50-high, every block coded as skip and the source filter could not change a byte50+both": at the q=120 the other facade tests use, this fixture's ARF codes
51-(class `process-global-knob-races-tests`). The test pins `set_speed(0)` under51+almost pure skip, and a filtered source quantizes back to the same bytes —
52-`knob_write` now, the way the byte pins do; green in the suite below.52+whether it does depends on where the suite's other tests left the
53+process-global preset, which is why it passed alone and failed in company
54+(class `process-global-knob-races-tests`). Pinning `set_speed(0)` under
55+`knob_write` (the byte pins' shape) did NOT fix it — the added assertion that
56+`enc.pyramid()` survived the content gate ruled the second suspect out — and
57+what fixed it is coding the witness at **q=60**, where the anchor carries real
58+coefficients and a filtered source must move them. Both guards ship.
53 59
54 The gate is a second witness: `native_bd_arm` asserts our decoder's60 The gate is a second witness: `native_bd_arm` asserts our decoder's
55 display-order count and ffmpeg sample-exactness for every one of its 48-picture61 display-order count and ffmpeg sample-exactness for every one of its 48-picture