forge
Explore
Log in

Don't you dare go Hollow

A group's top ARF names the ARF two groups back as its second anchor

Browse files at this commit

6aa3e57f58674d47af78cc49336c34e3c79fe267Ahmet Kaan GümüşParent: 51ec13e
  • feat
    • a group's top ARF names the ARF two groups back as its second anchor
Show full message
feat(av1): a group's top ARF names the ARF two groups back as its second anchor

The ARF-vs-ARF census found our first top ARF naming the SAME picture as LAST
and GOLDEN (refs LAST@-8 GOLDEN@-8), where rav1e's ARFs read two distinct
anchors of their own chain. The slot the ARF is about to refresh still holds
the anchor from two groups back while this frame is coded, so naming it as
ALTREF costs no DPB slot and no extra encode.

Long-GOP gate on top of the pyramid tpl window: film A +42.8/+4.5 ->
+40.9/+3.1, film B +127.3/+32.9 -> +125.6/+32.0 -- both films down on both
columns. Pins re-taken: 9853 at q=150, 35866 at q=60; EC_AV1_ARF_ALTREF=0
restores 9859 / 35904.
crates/ec-av1/src/encode.rsmodified+6 -1
@@ -13636,8 +13636,13 @@ mod tests {
13636 // superblock of these four pictures is priced at its own lambda --13636 // superblock of these four pictures is priced at its own lambda --
13637 // 9835 -> 9859 at q=150 and 35798 -> 35904 at q=60.13637 // 9835 -> 9859 at q=150 and 35798 -> 35904 at q=60.
13638 // `EC_AV1_TPL_PYRAMID=0` restores these.13638 // `EC_AV1_TPL_PYRAMID=0` restores these.
13639+ // Re-taken again on lane-arfcen: a group's top ARF names the ARF from
13640+ // two groups back as its own `ALTREF_FRAME`
13641+ // (`crate::encoder::arf_altref`) instead of the key frame it already
13642+ // reads as `GOLDEN` -- 9859 -> 9853 at q=150 and 35904 -> 35866 at
13643+ // q=60. `EC_AV1_ARF_ALTREF=0` restores these.
13639 let pins: [(u8, usize, u64); 2] =13644 let pins: [(u8, usize, u64); 2] =
13640- [(150, 9859, 0x4409_f8db_e152_9fe7), (60, 35904, 0xc408_f126_2877_0ffb)];13645+ [(150, 9853, 0x0f6d_bbc8_b72c_ceb3), (60, 35866, 0xbd00_f4ed_e283_3ce4)];
13641 for (q, bytes, hash) in pins {13646 for (q, bytes, hash) in pins {
13642 let encoded = encode_sequence(&source, q, 0.5).unwrap();13647 let encoded = encode_sequence(&source, q, 0.5).unwrap();
13643 assert_eq!(13648 assert_eq!(
crates/ec-av1/src/encoder.rsmodified+5 -2
@@ -918,8 +918,11 @@ fn arf_altref() -> bool {
918 }918 }
919 }919 }
920 920
921-/// [`arf_altref`]'s default.921+/// [`arf_altref`]'s default. ON since its long-GOP arm: film A
922-const ARF_ALTREF: bool = false;922+/// +42.8%/+4.5% -> +40.9%/+3.1% and film B +127.3%/+32.9% -> +125.6%/+32.0%
923+/// (BD vs libaom cpu-used 6 / vs rav1e speed 6), i.e. both films down on both
924+/// columns.
925+const ARF_ALTREF: bool = true;
923 926
924 /// The AV1 software encoder: [`EncoderConfig`] in, one [`Packet`] out per927 /// The AV1 software encoder: [`EncoderConfig`] in, one [`Packet`] out per
925 /// [`Av1Encoder::encode`] call — or, with a [`Pyramid`] configured, a928 /// [`Av1Encoder::encode`] call — or, with a [`Pyramid`] configured, a
lanes/arfcen.report.mdmodified+19 -2
@@ -133,8 +133,25 @@ recorded defaults to the digit:
133 | control (`EC_AV1_TPL_PYRAMID=0`) | +43.1% / +4.6% | +129.0% / +34.3% |133 | control (`EC_AV1_TPL_PYRAMID=0`) | +43.1% / +4.6% | +129.0% / +34.3% |
134 | **arm 1: tpl on the pyramid path** | **+42.8% / +4.5%** | **+127.3% / +32.9%** |134 | **arm 1: tpl on the pyramid path** | **+42.8% / +4.5%** | **+127.3% / +32.9%** |
135 135
136-Both film rows improve on both columns: the keep rule passes, so arm 1 ships136+| **arm 2: + a second past anchor on the top ARF** | **+40.9% / +3.1%** | **+125.6% / +32.0%** |
137-on by default.137+
138+Both arms pass the keep rule on their own control (every film row down on
139+both columns), so both ship on by default. Together: film A +43.1/+4.6 ->
140++40.9/+3.1 and film B +129.0/+34.3 -> +125.6/+32.0, i.e. -2.2/-1.5 and
141+-3.4/-2.3 points.
142+
143+### Arm 2: what it is
144+
145+The census read `refs [LAST@-8 GOLDEN@-8]` on our first top ARF -- one
146+picture named twice -- and `LAST@-8 GOLDEN@-16/-24` after, against rav1e's
147+`LAST@-4 LAST2@-8` (two distinct anchors of its own chain). Our top ARF's
148+`ALTREF` slot was pinned to `GOLDEN_SLOT`, the key frame it already reads.
149+The slot the ARF is ABOUT to refresh still holds the ARF from two groups back
150+while the frame is coded, so naming that slot gives the frame a second,
151+distinct past anchor for no extra DPB slot and no extra encode:
152+`crate::encoder::arf_altref`, `EC_AV1_ARF_ALTREF=0` restores the old wiring.
153+Probe arms on film B: 91262 B/45.518 dB and 479578 B/47.996 dB against arm
154+1's 91206/45.511 and 482161/47.989 (0.4% and 0.6% better at equal PSNR).
138 155
139 12-frame arm (`bd_rate_screen_native`), control re-run the same way:156 12-frame arm (`bd_rate_screen_native`), control re-run the same way:
140 157