Lane-arfq report -- per-level delta_q census and the strength sweep
Browse files at this commitc8f4f8d94faa66d82c293a3cd776a6e031bca553Parent: 29220f1- docs
- lane-arfq report -- per-level delta_q census and the strength sweep
1 changed file +140 -0
- lanes/arfq.report.md +140 -0
lanes/arfq.report.mdadded+140 -0
| @@ -0,0 +1,140 @@ | ||
| 1 | +# lane-arfq (round 2) — a per-LEVEL strength for the objective `delta_q` | |
| 2 | + | |
| 3 | +Round 1 of this lane swept the pyramid's q ladder (`lanes/arfq.sweep.txt`); | |
| 4 | +this round is about the per-superblock quantizer lane-dq shipped and the | |
| 5 | +allocation levers around it. One behaviour change shipped: | |
| 6 | +`speed::DQ_LEVEL_K = [1.5, 1.0, 1.0]`. | |
| 7 | + | |
| 8 | +Deciding gate: `encode::tests::bd_rate_film_long_gop` (48 pictures, film rows | |
| 9 | +only, BD-rate vs libaom `cpu-used 6` / rav1e `speed 6`). Guard gate: | |
| 10 | +`encode::tests::bd_rate_screen_native` (12 pictures, all five rows). Both | |
| 11 | +controls were REPRODUCED on this worktree before any arm ran. | |
| 12 | + | |
| 13 | +## 1. Per-level census, film B, 48 pictures | |
| 14 | + | |
| 15 | +Ours: `EC_ENC_SS=00:40:00 enc_probe <film B> gate 0 48 150` = **75814 B**, | |
| 16 | +mean PSNR-Y **45.55 dB** — the long-GOP gate's own q=150 ladder point | |
| 17 | +(`46.82 dB/75814 B` in the gate table; the gate prints all-plane PSNR, the | |
| 18 | +census luma-only). Read back by our own decoder through | |
| 19 | +`EC_AV1_BITCENSUS=1 EC_CENSUS_PERFRAME=1 syntax_census`. rav1e's column is | |
| 20 | +lane-arfcen/lane-cen3's `speed 6 quantizer 110` point, **75452 B / 45.75 dB** | |
| 21 | +— within 0.5% of our bytes, so this is a MATCHED-RATE table. | |
| 22 | + | |
| 23 | +| level | n | q | bytes | share | B/frame | PSNR-Y | rav1e level | n | B/frame | PSNR-Y | | |
| 24 | +|---|---|---|---|---|---|---|---|---|---|---| | |
| 25 | +| key | 1 | 102 | 15827 | 21.2% | 15827 | 47.34 | key | 1 | 20763 | 47.95 | | |
| 26 | +| top ARF (dist 8) | 6 | 118 | 41401 | 55.5% | 6900 | 45.86 | L1 ARF (dist 4) | 11 | 3871 | 45.97 | | |
| 27 | +| mid ARF (dist 4) | 6 | 142 | 8063 | 10.8% | 1344 | 45.73 | L2 (dist 2) | 12 | 537 | 45.48 | | |
| 28 | +| leaf | 35 | 162 | 9350 | 12.5% | 267 | 45.42 | leaf | 24 | 178 | 45.69 | | |
| 29 | + | |
| 30 | +Same shape lane-cen3 found, one merge-worth of encoder improvements later: | |
| 31 | +our six top ARFs carry 55.5% of the stream at 6900 B each for 45.86 dB where | |
| 32 | +rav1e's eleven anchors carry 57% at 3871 B for 45.97 dB — **+78% bytes per | |
| 33 | +anchor frame for −0.11 dB** — and our key is 24% CHEAPER than rav1e's for | |
| 34 | +−0.61 dB, still the under-quality level. | |
| 35 | + | |
| 36 | +## 2. The tpl map per level — and why the objective mapping cannot fix this | |
| 37 | + | |
| 38 | +`EC_AV1_DQ_CENSUS=1` on the same run, aggregated per level (480 superblocks a | |
| 39 | +frame, `delta_q_res = 4`, the shipped `k = 0.25` at the time of the census): | |
| 40 | + | |
| 41 | +| level | n | `r_frame` (mean) | coded offsets: frame mean | \|mean\| | nonzero | range | | |
| 42 | +|---|---|---|---|---|---|---| | |
| 43 | +| top ARF (q 118) | 6 | **2.914** | −0.32 | 3.72 | 365/480 | −8..12 | | |
| 44 | +| mid ARF (q 142) | 6 | 1.828 | +0.02 | 2.90 | 295/480 | −4..8 | | |
| 45 | +| leaf (q 162) | 35 | 1.743 | +0.03 | 2.66 | 273/480 | −8..12 | | |
| 46 | + | |
| 47 | +The charter's hypothesis was that the top ARF's high `r_frame` (it feeds 16 | |
| 48 | +frames) would already pull its quantizer down. **It does not, and cannot**: | |
| 49 | +libaom's objective mapping is `beta = (1 + r_sb) / (1 + r_frame)`, i.e. every | |
| 50 | +superblock is measured against ITS OWN FRAME's ratio, so `r_frame` is the | |
| 51 | +divisor and cancels. The frame MEAN of the coded offsets is −0.32 qindex at | |
| 52 | +the top ARF and +0.02/+0.03 at the two lower levels — zero to within a third | |
| 53 | +of a quantizer step. A `delta_q` strength therefore moves the CONTRAST inside | |
| 54 | +a frame, never the allocation BETWEEN levels; only a frame q offset | |
| 55 | +(`Pyramid::arf_q_offset` / `key_q_offset`) moves quality toward a level. | |
| 56 | +That is the class `frame-blind normaliser`: a per-frame normalised map is | |
| 57 | +blind, by construction, to the thing the level census is asking about. | |
| 58 | + | |
| 59 | +## 3. Arms — long-GOP gate (48 pictures) | |
| 60 | + | |
| 61 | +BD-rate vs libaom `cpu-used 6` / rav1e `speed 6`; lower is better. | |
| 62 | + | |
| 63 | +| arm | film A | film B | verdict | | |
| 64 | +|---|---|---|---| | |
| 65 | +| control (`DQ_K` flat, `k = 0.25` everywhere) | +24.0 / −7.6 | +85.8 / +7.1 | — | | |
| 66 | +| **(a) top-ARF strength 0.375 (`EC_AV1_DQ_K=1.5:1:1`)** | **+23.5 / −8.0** | **+85.3 / +6.7** | **SHIPPED** | | |
| 67 | +| (a) top-ARF strength 0.5 (`2:1:1`) | +23.0 / −8.2 | +86.0 / +7.3 | film B up, 12-frame −0.4 | | |
| 68 | +| (a) top-ARF strength 0.75 (`3:1:1`) | +22.7 / −8.4 | +86.8 / +7.8 | film B up 1.0/0.7 | | |
| 69 | +| (a) top-ARF strength 1.0 (`4:1:1`) | +21.8 / −8.9 | +88.7 / +9.1 | film B up 2.9/2.0 | | |
| 70 | +| (b) top ARF at −24 (with 0.5) | +25.8 / −6.8 | +85.5 / +6.8 | film A +1.8 | | |
| 71 | +| (b) top ARF at −16 (with 0.5) | +28.8 / −5.2 | +90.7 / +9.8 | worse everywhere | | |
| 72 | +| (c) key at −56 (with 0.5) | +23.8 / −9.4 | +90.1 / +6.4 | libaom +0.8/+4.1 | | |
| 73 | +| (c) key at −64 (with 0.5) | +24.1 / −10.1 | +93.8 / +6.4 | libaom +1.0/+7.8 | | |
| 74 | + | |
| 75 | +Control reproduces the charter's numbers (+24.4/−7.5, +86.0/+7.3) to within | |
| 76 | +0.4 on one column and 0.2 on the others. | |
| 77 | + | |
| 78 | +**(a) is single-peaked in film B and monotone in film A.** Film A goes on | |
| 79 | +improving all the way to strength 1.0 (−2.2/−1.3 against control) while film B | |
| 80 | +turns at 0.375 — 0.375 is the last point down on ALL FOUR columns, which is the | |
| 81 | +strong form of the keep rule (both films improve on both columns). | |
| 82 | + | |
| 83 | +**(b) refuted a second time, now WITH the objective mapping on.** The | |
| 84 | +re-sweep was legitimate — lane-arfq round 1 swept the offsets with no per-SB | |
| 85 | +`delta_q` at all, so the trade had changed — and it lands where it did: | |
| 86 | +a shallower top ARF buys film B 0.3 and costs film A 1.8. | |
| 87 | + | |
| 88 | +**(c) refuted, and it splits the two columns.** A deeper key (−56, −64) is | |
| 89 | +worth 1.4 / 2.1 BD points on the rav1e column of film A and 0.7 on film B's, | |
| 90 | +and costs 0.8 / 1.0 and 4.1 / 7.8 on the libaom column: the two references | |
| 91 | +disagree in SIGN about the key's allocation (class `Opus gate metric split`), | |
| 92 | +and the keep rule needs both. The key stays at −48. | |
| 93 | + | |
| 94 | +**The key frame codes no `delta_q` at all**, so the charter's "(a) then the | |
| 95 | +key" half is inert by construction: the whole lever lives in | |
| 96 | +`encode_inter_frame`, and a key-frame strength has nothing to scale. That is | |
| 97 | +why `DqLevel` has three variants and `EC_AV1_DQ_K` three fields. | |
| 98 | + | |
| 99 | +## 4. Guard gate — 12 pictures, all five rows, at the shipped arm | |
| 100 | + | |
| 101 | +| clip | control | shipped (`DQ_LEVEL_K = [1.5, 1, 1]`) | Δ | | |
| 102 | +|---|---|---|---| | |
| 103 | +| bars 1080p | −3.1 / −18.7 | −3.2 / −18.8 | −0.1 / −0.1 | | |
| 104 | +| bars 2160p | +9.1 / −13.3 | +9.2 / −13.3 | +0.1 / 0.0 | | |
| 105 | +| film A | +20.3 / −5.0 | +20.3 / −4.9 | 0.0 / +0.1 | | |
| 106 | +| film B | +24.6 / −2.0 | +24.7 / −1.8 | +0.1 / +0.2 | | |
| 107 | +| screen capture | +14.6 / −33.2 | +14.6 / −33.2 | byte-identical | | |
| 108 | + | |
| 109 | +Nothing worse than +0.2, inside the charter's 0.3 bound. The 0.5 arm was | |
| 110 | +measured on this gate too and reads film B +25.0/−1.7 (+0.4/+0.3) — over the | |
| 111 | +bound, which is the second reason 0.375 ships rather than 0.5. | |
| 112 | + | |
| 113 | +## 5. Shipped | |
| 114 | + | |
| 115 | +* `speed::DQ_LEVEL_K: [f64; 3] = [1.5, 1.0, 1.0]` — a per-level multiplier on | |
| 116 | + `speed::DQ_TPL_K`, indexed by `encode::DqLevel` (top ARF / mid ARF / leaf). | |
| 117 | +* `encode::DqLevel` rides on `PyramidFrame`; `encode_pyramid_inter` sets it | |
| 118 | + from the offset it codes the frame at (the top ARF is the hidden frame at | |
| 119 | + the pyramid's own `arf_q_offset`), and the flat non-pyramid path is a leaf. | |
| 120 | +* `EC_AV1_DQ_K=<top>:<mid>:<leaf>` sweeps it; the `EC_AV1_DQ_CENSUS=1` line | |
| 121 | + now names the level it prices. | |
| 122 | +* Byte pins re-taken: `(150, 8252 → 8269)`, `(60, 33053 → 33044)`, green at | |
| 123 | + default and at `EC_AV1_SPEED=6`. | |
| 124 | +* Self-check: `encode::tests::the_per_level_delta_q_strength_indexes_the_levels_it_names`. | |
| 125 | + | |
| 126 | +## Deferred | |
| 127 | + | |
| 128 | +* `deferred: the mid-level and leaf strengths —` only the top ARF was swept | |
| 129 | + (it is the level the census names as overspent) and the two others were held | |
| 130 | + at the preset's 0.25 in every arm — `unblocked by a lane that can afford | |
| 131 | + another six 48-picture arms`. | |
| 132 | +* `deferred: film A wants 1.0 and film B wants 0.375 —` the strength is | |
| 133 | + content-dependent with opposite optima (class `heuristic with two optima`); | |
| 134 | + a per-frame decision (e.g. off the frame's own `r_frame` spread) is the | |
| 135 | + mechanism that could take both — `unblocked by a lane that charters a | |
| 136 | + content-adaptive strength`. | |
| 137 | +* `deferred: the top ARF's +78% bytes per anchor frame —` the census names it | |
| 138 | + and neither of this lane's allocation levers moves it; the mechanism is the | |
| 139 | + ARF's own coding cost (lane-arfcen's mode/block-count gap), not its | |
| 140 | + quantizer — `unblocked by a lane on the ARF's prediction, not its q`. |