forge
Explore
Log in

Don't you dare go Hollow

Lane-lr r2 report -- what landed, why the gate is still missing, r3's next lever

Browse files at this commit

d1f514ea10067f248e932048b0aa51efb0562ff0Ahmet Kaan GümüşParent: dc215f7
  • docs
    • lane-lr r2 report -- what landed, why the gate is still missing, r3's next lever
Show full message
docs(av1): lane-lr r2 report -- what landed, why the gate is still missing, r3's next lever
lanes/lr.report.mdmodified+78 -1
@@ -110,7 +110,7 @@ self-pin firing counts for wiener/sgrproj/switchable via thread-local
110 `Cell<usize>` hit counters the way every other gate in this lane's charter110 `Cell<usize>` hit counters the way every other gate in this lane's charter
111 requires.111 requires.
112 112
113-## Turn budget113+## Turn budget (r1)
114 Spent ~55 of 75 turns on recon (spec/libaom read_lr shape, corner math,114 Spent ~55 of 75 turns on recon (spec/libaom read_lr shape, corner math,
115 subexp/recenter porting requirements, CDF value derivation) plus the CDF115 subexp/recenter porting requirements, CDF value derivation) plus the CDF
116 landing above; stopped short of wiring `read_lr` itself to avoid leaving a116 landing above; stopped short of wiring `read_lr` itself to avoid leaving a
@@ -118,3 +118,80 @@ half-edited, untested threading change across two large decode functions
118 uncommitted at the cap. Everything above is proven correct in principle118 uncommitted at the cap. Everything above is proven correct in principle
119 (SB-only firing is a real spec property, not skipped-and-hoped) but wiring119 (SB-only firing is a real spec property, not skipped-and-hoped) but wiring
120 + the gate itself are unstarted.120 + the gate itself are unstarted.
121+
122+## r2 landed (committed on `lane-lr`, 32892df; 235 passed / 0 failed,
123+EC_AV1_REQUIRE_AOMENC=1, `232` baseline + 3 new tests)
124+- `crates/ec-av1/src/restoration.rs` (new): msac-flavoured
125+ `decode_subexp_msac`/`decode_unsigned_subexp_with_ref_msac`/
126+ `decode_signed_subexp_with_ref_msac`/`ns_msac` (libaom
127+ `read_primitive_subexpfin_`/`aom_read_primitive_refsubexpfin_`/
128+ `read_primitive_quniform_`, `k` a per-call parameter unlike global
129+ motion's fixed 3) -- pinned by 3 roundtrip tests
130+ (`subexp_roundtrips_every_value`, `unsigned_subexp_with_ref_roundtrips`,
131+ `signed_subexp_with_ref_roundtrips`) against a hand-written encode-side
132+ mirror (`SymbolEncoder` has no LR writer of its own, this crate never
133+ writes LR). Also: `WienerInfo`/`SgrprojInfo`/`UnitFilter`,
134+ `SGR_PARAMS` (`av1_sgr_params`, restoration.c:36, all 16 entries),
135+ `read_wiener_filter`/`read_sgrproj_filter`/`read_lr_unit`/`read_lr`
136+ (spec 5.11.57, decodeframe.c ~1595-1723), `RestorationGrid` (per-plane
137+ unit grid + flattened `runit_idx` storage, `av1_lr_count_units`'s ROUND
138+ not ceil).
139+- `crates/ec-av1/src/decode.rs`: `decode_key_frame_tile_with_cdfs` and
140+ `decode_inter_frame_tile_with_cdfs` now take `lr: &LoopRestorationParams`
141+ and call `crate::restoration::read_lr` once per superblock (before
142+ `decode_partition`'s own symbol), building a `RestorationGrid` +
143+ per-plane `(WienerInfo, SgrprojInfo)` running reference state before the
144+ loop. The public one-star wrappers (`decode_key_frame_tile`/
145+ `decode_inter_frame_tile`) pass `&LoopRestorationParams::default()`
146+ unchanged, so their ~10 existing test call sites needed no edits.
147+- `crates/ec-av1/src/stream.rs`: both call sites thread
148+ `&header.loop_restoration` through; the refusal string is renamed from
149+ "never reads the per-unit lr symbols" to "the per-unit lr symbols are
150+ read but the Wiener/self-guided filters are not yet applied to pixels"
151+ -- the frame STILL refuses (no pixel filter is applied anywhere yet),
152+ but the refusal now names the true remaining gap per charter stage 2's
153+ exit criterion.
154+- NOT done this round, no gate written: I did not build the aomenc
155+ `--enable-restoration=1` gate the charter's stage 1/2 asks for (proving
156+ the partition walk survives past a real LR stream and self-pinning
157+ wiener/sgrproj/switchable firing counts via thread-local `Cell<usize>`
158+ hit counters). Ran out of turn budget before writing it; the full
159+ `cargo test -p ec-av1` suite (235/0, unrelated fixtures) is the only
160+ evidence this round has that the wiring compiles and does not regress
161+ anything -- it does NOT exercise a real LR stream at all, since no
162+ existing gate/fixture in this suite turns `--enable-restoration` on.
163+
164+## Next lever (r3)
165+1. Write the gate: `gradients_source` fixture through aomenc with
166+ `--threads=1 --row-mt=0 --enable-restoration=1` (default on already,
167+ so no flag omission risk), decode it, assert the NEW refusal string
168+ (not an `Err` from a block reader = partition desync, not the old
169+ string). Self-pin `WIENER_HITS`/`SGRPROJ_HITS`/`SWITCHABLE_HITS`
170+ thread-local `Cell<usize>` counters bumped inside `read_lr_unit`
171+ (`crates/ec-av1/src/restoration.rs`) -- a gate that cannot prove LR
172+ fired is vacuous per this lane's charter. Given how rare a `Wiener`
173+ frame-level restoration_type is likely to be vs `Switchable` at
174+ default aomenc settings, may need `EC_LR_GATE_ATTEMPTS` bumped like
175+ other lanes' flaky-firing gates (see ledger `lane-maskcomp`).
176+2. Wiener pixel filter (stage 3): apply after `apply_cdef` (LR runs on the
177+ post-CDEF, post-deblock frame, spec 7.17) as a new `apply_loop_restoration`
178+ pass over `lr_grid`, one restoration-unit rectangle at a time, using
179+ the already-decoded `vfilter`/`hfilter`. The 3-pixel stripe boundary
180+ save/restore (libaom's `rlbs`) is the known trap -- not investigated
181+ this round beyond the report's own citation.
182+3. SGR filter (stage 4): box-sum radii from `SGR_PARAMS`' `(r0, r1)`,
183+ `av1_apply_selfguided_restoration` shape -- not investigated this
184+ round.
185+4. Once both filters are wired, drop the `stream.rs` refusal entirely
186+ (stage 5) -- gate should then assert `Ok`, never `Err`.
187+
188+## Turn budget (r2)
189+Spent the full 75-turn allowance on: recon of libaom's exact `k`-per-tap
190+subexp/SGR-table/read_lr_unit shape (not fully covered by r1's report --
191+the report's own citations turned out right, but exact constants/ep-branch
192+logic needed a fresh libaom read from `~/.cache/aom-oracle`), writing +
193+pinning `restoration.rs`'s bitstream-read half, wiring it into both SB
194+loops, and confirming no regression (235/0). Did not reach the gate or
195+either pixel filter -- see "Next lever" above; r3 should start there
196+directly rather than re-reading libaom (this doc + `restoration.rs`'s own
197+doc comments now carry every file:line needed).