forge
Explore
Log in

Don't you dare go Hollow

The top ARF codes its delta_q at 1.5x the preset's strength

Browse files at this commit

29220f1a7a91f9256ab918f4863f1d2aa6f6c198Ahmet Kaan GümüşParent: 657e043
  • feat
    • the top ARF codes its delta_q at 1.5x the preset's strength
Show full message
feat(av1): the top ARF codes its delta_q at 1.5x the preset's strength

lane-arfq: `speed::DQ_LEVEL_K = [1.5, 1.0, 1.0]` -- at preset 0 the mini-GOP's
own hidden ALTREF now maps the tpl ratio onto its superblock quantizers at
0.375 where the mid level and the leaves keep 0.25.

Long-GOP gate (48 pictures, BD vs libaom / rav1e), control reproduced first:
  film A +24.0/-7.6 -> +23.5/-8.0, film B +85.8/+7.1 -> +85.3/+6.7
i.e. both films down on both columns. 12-frame gate: bars 1080p -3.1/-18.7 ->
-3.2/-18.8, bars 2160p +9.1/-13.3 -> +9.2/-13.3, film A +20.3/-5.0 ->
+20.3/-4.9, film B +24.6/-2.0 -> +24.7/-1.8, screen +14.6/-33.2 unchanged
(a screen frame codes no delta syntax at all).

0.5 buys film A twice as much (+23.0/-8.2) and turns film B back up
(+86.0/+7.3) while costing the 12-frame film B row 0.4; the strength sweep and
the per-level census are in lanes/arfq.report.md.

Byte pins re-taken with a five-line comment: 8252 -> 8269 at q=150 and
33053 -> 33044 at q=60; green at default and at EC_AV1_SPEED=6.
crates/ec-av1/src/encode.rsmodified+6 -1
@@ -16813,7 +16813,12 @@ mod tests {
16813 // quantizer grid -- and every decision priced against it -- moved16813 // quantizer grid -- and every decision priced against it -- moved
16814 // (8325 -> 8419 / 33014 -> 33029 on its own base); re-taken once more16814 // (8325 -> 8419 / 33014 -> 33029 on its own base); re-taken once more
16815 // at the merge of both lanes.16815 // at the merge of both lanes.
16816- let pins: [(u8, usize, u64); 2] = [(150, 8252, 0x5b6e40a2b5498988), (60, 33053, 0x9a0abfc234eccc37)];16816+ // Re-taken on lane-arfq: the top ARF of a mini-GOP codes its
16817+ // per-superblock `delta_qindex` at 1.5x the preset's strength
16818+ // ([`crate::speed::DQ_LEVEL_K`]), so the hidden frames' quantizer
16819+ // grids -- and every decision priced against them -- moved:
16820+ // 8252 -> 8269 bytes at q=150 and 33053 -> 33044 at q=60.
16821+ let pins: [(u8, usize, u64); 2] = [(150, 8269, 0xf0a10bafe7b45fe2), (60, 33044, 0x077e9c22ff6f41fb)];
16817 let coded: Vec<(u8, usize, u64)> = pins16822 let coded: Vec<(u8, usize, u64)> = pins
16818 .iter()16823 .iter()
16819 .map(|&(q, _, _)| {16824 .map(|&(q, _, _)| {
crates/ec-av1/src/speed.rsmodified+23 -3
@@ -342,9 +342,29 @@ pub(crate) const DQ_TPL_K: [f64; 11] = [0.25, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0,
342 /// [`crate::encode::DqLevel`] -- `[top ARF, mid ARF, leaf]`. The key frame is342 /// [`crate::encode::DqLevel`] -- `[top ARF, mid ARF, leaf]`. The key frame is
343 /// absent because it codes no `delta_q` syntax at all.343 /// absent because it codes no `delta_q` syntax at all.
344 ///344 ///
345-/// `EC_AV1_DQ_K=<top>:<mid>:<leaf>` overrides it for an A/B. The default is345+/// `EC_AV1_DQ_K=<top>:<mid>:<leaf>` overrides it for an A/B.
346-/// flat: see `lanes/arfq.report.md` for the sweep this table records.346+///
347-pub(crate) const DQ_LEVEL_K: [f64; 3] = [1.0, 1.0, 1.0];347+/// The top ARF is coded 1.5x the preset's strength (0.375 at preset 0, where
348+/// the leaves keep 0.25): it feeds a whole mini-GOP, and the census
349+/// (`EC_AV1_DQ_CENSUS=1`, film B 48 pictures) says the objective mapping is
350+/// normalised BY the frame's own dependence ratio, so the top ARF's much
351+/// higher `r_frame` (2.91 vs the leaves' 1.74) buys it nothing at all --
352+/// what a level's strength moves is the CONTRAST inside that frame. Long-GOP
353+/// gate (48 pictures, BD vs libaom / rav1e):
354+///
355+/// | top-ARF strength | film A | film B |
356+/// |---|---|---|
357+/// | 0.25 (flat, control) | +24.0/-7.6 | +85.8/+7.1 |
358+/// | **0.375** | **+23.5/-8.0** | **+85.3/+6.7** |
359+/// | 0.5 | +23.0/-8.2 | +86.0/+7.3 |
360+/// | 0.75 | +22.7/-8.4 | +86.8/+7.8 |
361+/// | 1.0 | +21.8/-8.9 | +88.7/+9.1 |
362+///
363+/// Film A goes on improving with strength and film B turns at 0.375, which is
364+/// the last point down on all four columns; 0.5 is also the point where the
365+/// 12-frame gate hands film B back 0.4 (0.375 costs it 0.1). See
366+/// `lanes/arfq.report.md`.
367+pub(crate) const DQ_LEVEL_K: [f64; 3] = [1.5, 1.0, 1.0];
348 368
349 /// `encode::SPLIT_RD_THRESHOLD`: how cheap a block has to be before its split369 /// `encode::SPLIT_RD_THRESHOLD`: how cheap a block has to be before its split
350 /// trial is withheld. The single biggest wall lever in the tile search.370 /// trial is withheld. The single biggest wall lever in the tile search.