Merge lane-refs docs (bc82141e): the LAST2 build charter
Browse files at this commit1 changed file +57 -0
- lanes/refs.report.md +57 -0
lanes/refs.report.mdmodified+57 -0
| @@ -140,3 +140,60 @@ Invariants, all green, all on the prebuilt release binary: | |||
| 140 | table is its refutation, not a gap. | 140 | table is its refutation, not a gap. |
| 141 | * The long-GOP gate was not run: nothing from this lane changes a default, so | 141 | * The long-GOP gate was not run: nothing from this lane changes a default, so |
| 142 | there is nothing for it to confirm. | 142 | there is nothing for it to confirm. |
| 143 | + | ||
| 144 | +## 6. The LAST2 build charter (the next lane) | ||
| 145 | + | ||
| 146 | +The census (§1) is the go/no-go and it says GO at the ARF level: 10.31% / | ||
| 147 | +8.38% of prediction SAD, ~4 blocks in 10 choosing the older picture. This | ||
| 148 | +section is the plan so the next lane spends its budget on the desync hunt and | ||
| 149 | +not on re-deriving the shape. | ||
| 150 | + | ||
| 151 | +**The slot plan.** Today's map has one free slot: | ||
| 152 | + | ||
| 153 | +| slot | holds | written by | read as | | ||
| 154 | +|---|---|---|---| | ||
| 155 | +| 0 (`LEAF_SLOT`) | the previous shown leaf | every leaf | `LAST_FRAME` of the next leaf | | ||
| 156 | +| 1 (`GOLDEN_SLOT`) | the key frame | the key | `GOLDEN_FRAME` everywhere | | ||
| 157 | +| 2 (`MID_SLOT`) | the mid ARF | the mid ARF | `LAST`/`ALTREF` of the leaves and quarters around it | | ||
| 158 | +| 3, 4 (`ANCHOR_SLOTS`) | this group's anchor and the next | the key, each top ARF | anchor = `LAST`, next = `ALTREF` | | ||
| 159 | +| 5, 6 (`QUARTER_SLOTS`) | the two quarter ARFs (off by default) | the quarter ARFs | `LAST`/`ALTREF` of the leaves beside them | | ||
| 160 | +| 7 | UNUSED: the key frame writes it and nothing ever reads it back | the key | -- | | ||
| 161 | + | ||
| 162 | +So: the LEAF chain alternates its refresh between slots 0 and 7 (leaf n | ||
| 163 | +refreshes the slot leaf n-2 wrote, which is read-before-write and safe), names | ||
| 164 | +the slot leaf n-1 wrote as `LAST_FRAME` and the other as `LAST2_FRAME`. The | ||
| 165 | +ARF levels need no new slot at all -- the anchor pair already holds two | ||
| 166 | +distinct past anchors (that is what `arf_altref()` exploits as `ALTREF`), so | ||
| 167 | +an ARF's `ref_frame_idx[1]` points at the anchor from two groups back. Both | ||
| 168 | +changes are `ref_frame_idx` + `refresh_frame_flags` bookkeeping in | ||
| 169 | +`encoder.rs`; `refresh_frame_flags` stays a single bit per frame. | ||
| 170 | + | ||
| 171 | +What must follow the slot, in one diff or the stream desyncs: `sign_bias[1]` | ||
| 172 | +(from the new slot's order hint, same `ahead()` walk), `order_hints[1]` (for | ||
| 173 | +`skipModeAllowed`), the mv stack for `LAST2_FRAME` and the compound pair | ||
| 174 | +`LAST_LAST2`, `record_mi` publishing the reference so neighbours vote it, the | ||
| 175 | +motion field, and `write_single_ref`'s tree (LAST2 is p1=0, p2=1 -- the | ||
| 176 | +pricer's `single_ref_bits` only knows LAST and GOLDEN today). | ||
| 177 | + | ||
| 178 | +**The search cost, which is the whole risk.** `search_inter_block` offers | ||
| 179 | +GOLDEN/ALTREF search-FREE (NEARESTMV/GLOBALMV only) precisely because a second | ||
| 180 | +motion search doubles the stage that owns most of the encode wall, and speed | ||
| 181 | +is the user's stated priority. Two arms, in this order: | ||
| 182 | + | ||
| 183 | +1. **Free arm**: LAST2 through the existing `extra` path, no search. Costs | ||
| 184 | + one extra `single_ref` price per block and no motion estimation. This is | ||
| 185 | + the arm that tells us how much of the census is reachable for free. | ||
| 186 | +2. **Seeded arm**: a REAL search on LAST2 seeded from LAST's own result -- the | ||
| 187 | + census showed a plain diamond from the zero mv finds the win, and the LAST | ||
| 188 | + search has already paid for the coarse stage, so LAST2 starts at LAST's | ||
| 189 | + best mv scaled by the order-hint distance ratio (`ref_distance` is already | ||
| 190 | + armed for the search) and runs the refinement steps only. That is the | ||
| 191 | + cheap second search; a second full search is NOT chartered. | ||
| 192 | + | ||
| 193 | +**Per-level offer**: ARF levels first (the census's strongest level, and the | ||
| 194 | +level libaom/rav1e spend their slots on), leaves only if the ARF arm keeps. | ||
| 195 | +Gate: the 12-frame native gate's keep rule, then the long-GOP arm at what | ||
| 196 | +ships. Witness the lane must land: a clip where the picture before LAST is the | ||
| 197 | +better reference, >= N blocks coded off LAST2 (a fire counter, not a | ||
| 198 | +byte-count claim -- class `gate blind to feature`), exact through ffmpeg AND | ||
| 199 | +`decode_stream`, with the hidden-frame display order intact. | ||