Lane-hbd r5 charter -- wire set_bit_depth, narrow refusals, 10-bit gate, then his films
Browse files at this commit6820e1a9b6b7a177813c96fff321d0ae33f29ba2Parent: 8d71aab- docs
- lane-hbd r5 charter -- wire set_bit_depth, narrow refusals, 10-bit gate, then his films
1 changed file +57 -0
- lanes/hbd-r5.charter.md +57 -0
lanes/hbd-r5.charter.mdadded+57 -0
| @@ -0,0 +1,57 @@ | ||
| 1 | +# lane-hbd r5 — steps 1 to 5, nothing to widen | |
| 2 | + | |
| 3 | +At main-merged HEAD. **The Picture widen is DONE and merged** (main fff022d, | |
| 4 | +264/0, workspace clean). Do not re-attempt it. r4 never got to write its report | |
| 5 | +to disk — its content is in `lanes/hbd-r4.report.md` if a later hand copied it; | |
| 6 | +if that file is missing, do not spend turns reconstructing it, the facts you | |
| 7 | +need are here. | |
| 8 | + | |
| 9 | +I also fixed one thing r4 could not see: it checked `-p ec-av1` only, and | |
| 10 | +`tools/ec-bench` builds a `Picture` from 8-bit y4m. Widened at the call site. | |
| 11 | +Check `--workspace --all-targets`, not just this crate, before you call a | |
| 12 | +compile clean. | |
| 13 | + | |
| 14 | +## The round: charter steps 1-5, in order, each committed | |
| 15 | +1. **Wire `decode::set_bit_depth`.** It is at `decode.rs:97`, never called, so | |
| 16 | + the `BIT_DEPTH` thread-local is dead code defaulting to 8 — the compiler says | |
| 17 | + so (`function set_bit_depth is never used`). Call it from `stream.rs` with | |
| 18 | + `seq.color_config.bit_depth`, per frame before decode, not once per process. | |
| 19 | + Everything downstream silently assumes 8 until this lands. | |
| 20 | +2. **Narrow refusals** for the two paths that are 8-bit by construction: | |
| 21 | + `film_grain.rs` (grain LUT is `[i32; 256]`) and `superres.rs` (`upscale_row` | |
| 22 | + is `&[u8]`, clamps at 255). Each gets its own named `bit_depth != 8` refusal, | |
| 23 | + declared in `refusal_inventory.rs`. These are honest scoped refusals; the | |
| 24 | + blanket one is not. | |
| 25 | +3. **The 10-bit gate.** `ffmpeg_decode_sequence` hardcodes `-pix_fmt yuv420p`; | |
| 26 | + add a second helper emitting `yuv420p10le` with u16 LE parsing, leaving the | |
| 27 | + 8-bit helper untouched — every existing gate depends on it. aomenc needs | |
| 28 | + `--bit-depth=10` and a 10-bit input. Confirm from the sequence header that | |
| 29 | + `bit_depth` really is 10 before trusting a pixel match, and hard-assert it. | |
| 30 | +4. **Lift the blanket refusal** in `stream.rs`, in the SAME commit as that gate, | |
| 31 | + updating `refusal_inventory.rs`. | |
| 32 | +5. **His own films.** Both `yuv420p10le`: ReelB (3840x1608, HDR10, Main, | |
| 33 | + no film grain flagged) and ReelC (1920x792, bt709, Main, no film grain). | |
| 34 | + Extract into this worktree's `fixtures/` with | |
| 35 | + `ffmpeg -i <file> -t 3 -c:v copy -f obu <out.obu>` (note `-f obu`), probe with | |
| 36 | + `cargo run -p ec-av1 --example decode_probe -- <out.obu>`, and record the next | |
| 37 | + refusal VERBATIM with the film and header state. That sentence is the next | |
| 38 | + lane's charter. Never open his media in a GUI app. | |
| 39 | + | |
| 40 | +Expect 10-bit to expose rounding that 8-bit hid — the inverse transform's | |
| 41 | +intermediate clamps already take `bit_depth`, but anything still assuming a 255 | |
| 42 | +ceiling shows up as a small pixel delta, not a crash. Bisect against the oracle, | |
| 43 | +not by inspection. | |
| 44 | + | |
| 45 | +If a step does not fit, commit the ones that do and say which. Landing red on | |
| 46 | +this branch is fine; only merging red is forbidden, and I do the merges. | |
| 47 | + | |
| 48 | +## Budget discipline | |
| 49 | +75 turns, no reset on resume. At about turn 55, stop starting new work: commit, | |
| 50 | +and write `lanes/hbd-r5.report.md` — r4 hit the cap before it could write its | |
| 51 | +report at all, which is the one artifact I cannot reconstruct. | |
| 52 | + | |
| 53 | +Hard rules: `CARGO_TARGET_DIR=$HOME/.cache/cargo-target-hbd`; foreground | |
| 54 | +`nice -n 19 cargo ... -j4`; every `cargo test` a timeout >= 600000 ms; ffmpeg | |
| 55 | +generates bounded with `-t`; `EC_AV1_REQUIRE_AOMENC=1`; aomenc | |
| 56 | +`--threads=1 --row-mt=0 --sb-size=64`. Sibling worktrees have live agents — | |
| 57 | +never build in or edit them. Never push, never merge into main. |