The ARFMODE intra arm cuts the top ARF's whole-32 candidates too -- the probe falsified the leaf-only scope (film A arm 1 byte-identical to the control at q150 AND q90: the ARF's 15% intra area lives in search_inter_block's whole-32 intra loop, not in the leaves), so the scene-cut hatch as chartered was a hatch nothing else was using
Browse files at this commit7ea51337a66ba545d25a2d0b8faeced518d87c0dParent: 5e19f1a- perf
- the ARFMODE intra arm cuts the top ARF's whole-32 candidates too -- the probe falsified the leaf-only scope (film A arm 1 byte-identical to the control at q150 AND q90: the ARF's 15% intra area lives in search_inter_block's whole-32 intra loop, not in the leaves), so the scene-cut hatch as chartered was a hatch nothing else was using
- per-block engagement counter moved to the whole-32 site, docs updated, witness and pins re-green
2 changed files +64 -50
- crates/ec-av1/src/encode.rs +55 -42
- crates/ec-av1/src/speed.rs +9 -8
crates/ec-av1/src/encode.rsmodified+55 -42
| @@ -7779,13 +7779,17 @@ struct Search<'a> { | |||
| 7779 | /// `intra_pruning_with_hog` -- never prunes it away). `None` runs every | 7779 | /// `intra_pruning_with_hog` -- never prunes it away). `None` runs every |
| 7780 | /// mode through full RD, unchanged from before this lever. | 7780 | /// mode through full RD, unchanged from before this lever. |
| 7781 | top_k: Option<usize>, | 7781 | top_k: Option<usize>, |
| 7782 | - /// lane-arfmode: the top ARF's leaf offer set ([`crate::speed::ARFMODE`]) | 7782 | + /// lane-arfmode: the top ARF's offer set ([`crate::speed::ARFMODE`]) |
| 7783 | - /// -- `false` cuts the named candidate group from the 16x16/8x8 LEAF | 7783 | + /// -- `false` cuts the named candidate group from the whole-32 search |
| 7784 | - /// search ([`code_square_inter`]) and the 8x8 split offer at the top ARF | 7784 | + /// ([`search_inter_block`]), the 16x16/8x8 leaf search |
| 7785 | + /// ([`code_square_inter`]) and the 8x8 split offer, at the top ARF | ||
| 7785 | /// ([`DqLevel::TopArf`] frames only). `true` everywhere else, which is | 7786 | /// ([`DqLevel::TopArf`] frames only). `true` everywhere else, which is |
| 7786 | - /// the pre-lane behaviour: the key frame never reaches | 7787 | + /// the pre-lane behaviour: the mid and quarter hidden frames, the shown |
| 7787 | - /// [`code_square_inter`], the 32x32 whole keeps its full set, and the | 7788 | + /// leaves and the flat path keep intra and compound, and the |
| 7788 | /// straddling-edge 8x8s are only mode-gated, never partition-gated. | 7789 | /// straddling-edge 8x8s are only mode-gated, never partition-gated. |
| 7790 | + /// The probe's correction: with the leaf gate ALONE the film A stream | ||
| 7791 | + /// was byte-identical to the control -- the ARF's intra area lives at | ||
| 7792 | + /// the whole-32 level, so the intra arm must cut it there too. | ||
| 7789 | arf_leaf_intra: bool, | 7793 | arf_leaf_intra: bool, |
| 7790 | arf_leaf8: bool, | 7794 | arf_leaf8: bool, |
| 7791 | arf_leaf_compound: bool, | 7795 | arf_leaf_compound: bool, |
| @@ -11018,43 +11022,52 @@ fn search_inter_block( | |||
| 11018 | _ => search.modes.to_vec(), | 11022 | _ => search.modes.to_vec(), |
| 11019 | }; | 11023 | }; |
| 11020 | census_add(5, 1); | 11024 | census_add(5, 1); |
| 11021 | - census_add(6, intra_modes.len()); | 11025 | + census_add(6, if search.arf_leaf_intra { intra_modes.len() } else { 0 }); |
| 11022 | - for &mode in &intra_modes { | 11026 | + // lane-arfmode: arm 1 drops the whole-32 block's intra candidates at the |
| 11023 | - let luma_trial = luma.trial( | 11027 | + // top ARF too -- the probe proved the ARF's intra AREA lives HERE, not at |
| 11024 | - At { | 11028 | + // the leaves (film A arm 1 vs control byte-identical with the leaf gate |
| 11025 | - x, | 11029 | + // alone), so "the 32x32 whole keeps intra as the scene-cut hatch" was a |
| 11026 | - y, | 11030 | + // hatch nothing else was using. Counted once per block. |
| 11027 | - side: BLOCK, | 11031 | + if search.arf_leaf_intra { |
| 11028 | - reach, | 11032 | + for &mode in &intra_modes { |
| 11029 | - set: luma_set, | 11033 | + let luma_trial = luma.trial( |
| 11030 | - }, | 11034 | + At { |
| 11031 | - mode, | 11035 | + x, |
| 11032 | - 0, | 11036 | + y, |
| 11033 | - search.base_q_idx, | 11037 | + side: BLOCK, |
| 11034 | - search.deadzone, fctx, | 11038 | + reach, |
| 11035 | - ); | 11039 | + set: luma_set, |
| 11036 | - let u = u_trial.clone(); | 11040 | + }, |
| 11037 | - let v = v_trial.clone(); | 11041 | + mode, |
| 11038 | - let cost = luma_trial.sse | 11042 | + 0, |
| 11039 | - + u.sse | 11043 | + search.base_q_idx, |
| 11040 | - + v.sse | 11044 | + search.deadzone, fctx, |
| 11041 | - + search.lambda | 11045 | + ); |
| 11042 | - * (luma_trial.bits | 11046 | + let u = u_trial.clone(); |
| 11043 | - + u.bits | 11047 | + let v = v_trial.clone(); |
| 11044 | - + v.bits | 11048 | + let cost = luma_trial.sse |
| 11045 | - + mode_bits[usize::from(mode)] | 11049 | + + u.sse |
| 11046 | - + skip_bits(false) | 11050 | + + v.sse |
| 11047 | - + intra_inter_bits(false)); | 11051 | + + search.lambda |
| 11048 | - consider(Candidate { | 11052 | + * (luma_trial.bits |
| 11049 | - cost, | 11053 | + + u.bits |
| 11050 | - luma: luma_trial, | 11054 | + + v.bits |
| 11051 | - u, | 11055 | + + mode_bits[usize::from(mode)] |
| 11052 | - v, | 11056 | + + skip_bits(false) |
| 11053 | - mode, | 11057 | + + intra_inter_bits(false)); |
| 11054 | - skip: false, | 11058 | + consider(Candidate { |
| 11055 | - inter: None, | 11059 | + cost, |
| 11056 | - mode_bits: mode_bits[usize::from(mode)], | 11060 | + luma: luma_trial, |
| 11057 | - }); | 11061 | + u, |
| 11062 | + v, | ||
| 11063 | + mode, | ||
| 11064 | + skip: false, | ||
| 11065 | + inter: None, | ||
| 11066 | + mode_bits: mode_bits[usize::from(mode)], | ||
| 11067 | + }); | ||
| 11068 | + } | ||
| 11069 | + } else { | ||
| 11070 | + arfmode_hit(0); | ||
| 11058 | } | 11071 | } |
| 11059 | 11072 | ||
| 11060 | // The reference frame buffer a spec decoder holds is exactly the true | 11073 | // The reference frame buffer a spec decoder holds is exactly the true |
crates/ec-av1/src/speed.rsmodified+9 -8
| @@ -460,14 +460,15 @@ pub(crate) const ARF_TF_WIN: [usize; 11] = [3; 11]; | |||
| 460 | /// so [`ARF_TF`] stays where lane-arftf put it. | 460 | /// so [`ARF_TF`] stays where lane-arftf put it. |
| 461 | pub(crate) const ARF_TF_WIN_FUT: [usize; 11] = [3; 11]; | 461 | pub(crate) const ARF_TF_WIN_FUT: [usize; 11] = [3; 11]; |
| 462 | 462 | ||
| 463 | -/// lane-arfmode: the top ARF's LEAF offer set, as a bitmask -- `1` the 16x16 | 463 | +/// lane-arfmode: the top ARF's offer set, as a bitmask -- `1` the group's |
| 464 | -/// and 8x8 leaves of the group's own anchor ([`crate::encode::DqLevel:: | 464 | +/// own anchor ([`crate::encode::DqLevel::TopArf`]) offers no INTRA |
| 465 | -/// TopArf`]) offer no INTRA candidate, `2` a 16x16 leaf under it is not | 465 | +/// candidate at any block size (the whole-32 search and the 16x16/8x8 |
| 466 | -/// offered the 8x8 split, `4` the leaves offer no compound candidates; | 466 | +/// leaves), `2` a 16x16 leaf under it is not offered the 8x8 split, `4` the |
| 467 | -/// combinations OR, `0` (the default) is bit-exact with the pre-lane | 467 | +/// leaves offer no compound candidates; combinations OR, `0` (the default) |
| 468 | -/// encoder. `EC_AV1_ARFMODE=<n>` overrides it. The 32x32 whole keeps its | 468 | +/// is bit-exact with the pre-lane encoder. `EC_AV1_ARFMODE=<n>` overrides |
| 469 | -/// full offer set (the scene-cut hatch), and the spec-forced 8x8s at | 469 | +/// it. The spec-forced 8x8s at straddling edges are untouched -- only |
| 470 | -/// straddling edges are untouched -- only RD-optional offers are cut. | 470 | +/// RD-optional offers are cut; the mid and quarter hidden frames and every |
| 471 | +/// shown leaf keep the full set. | ||
| 471 | /// | 472 | /// |
| 472 | /// The census it answers to (lanes/arfmode.charter.md, at 0d81d6c5): the top | 473 | /// The census it answers to (lanes/arfmode.charter.md, at 0d81d6c5): the top |
| 473 | /// ARF's syntax gap against rav1e's own ARF at the same position is | 474 | /// ARF's syntax gap against rav1e's own ARF at the same position is |