forge
Explore
Log in

Don't you dare go Hollow

Lane-hbd r4 charter -- widen Picture with checkpoints, wire set_bit_depth, then the gate

Browse files at this commit

7ae2956791db61d90b2b9c5e885a1c59ee00c547Ahmet Kaan GümüşParent: 0e64463
  • docs
    • lane-hbd r4 charter -- widen Picture with checkpoints, wire set_bit_depth, then the gate
Show full message
docs(av1): lane-hbd r4 charter -- widen Picture with checkpoints, wire set_bit_depth, then the gate
lanes/hbd-r4.charter.mdadded+67 -0
@@ -0,0 +1,67 @@
1+# lane-hbd r4 — widen Picture, then lift the refusal
2+
3+At 7bb2a18. Read `lanes/hbd-r3.report.md` first. r3 landed no code but did the
4+scoping that makes this round tractable, and it found the real blocker:
5+`encode::Picture.y/u/v` (`encode.rs:92`) are still `Vec<u8>`, and that type is
6+shared by the encoder AND by `decode_stream`'s return value and the DPB
7+reference slots — which are read back for motion compensation on frame 2+, not
8+just handed to the caller. So the refusal cannot lift honestly until `Picture`
9+widens.
10+
11+## Checkpoint policy — this applies to the whole round
12+r3 got `cargo check` from 61 errors down, ran out of budget, and **reverted**;
13+so did r10 of the predecessor lane. That is twice the same loss. Do NOT revert a
14+falling error count. Commit a `wip(hbd):` checkpoint every time the count drops
15+meaningfully, with the number in the message. A non-compiling commit is fine on
16+this branch under that prefix; it is never merged in that state. The count
17+reaching zero is when you run the suite and make a real commit.
18+
19+Its attempt diff is saved at
20+`/tmp/claude-1000/-home-user-Documents-Code-Rust-edith-codecs/baaa03f8-c4ff-4469-8ebb-83100429b150/scratchpad/hbd-r3-picture-widen-attempt.diff`
21+(128 lines, `pad_plane`/`crop_plane` genericized over `T: Copy + Default`, the
22+two `as u8` narrowing sites at `decode.rs` ~6823 and ~12594 dropped). `git apply`
23+it first rather than retyping.
24+
25+r3's measurement of what remains: the PRODUCTION blast radius is small (~10
26+sites in `encode.rs`, all genericizable or trivial local narrow boxes); the bulk
27+of the errors are ~50 mechanical `as u8` → `as u16` touch-ups in encoder TEST
28+FIXTURES. Do the production sites first and checkpoint, then sweep the fixtures.
29+
30+## Then, in order
31+1. **Wire `decode::set_bit_depth`.** It exists at `decode.rs:97` and is never
32+ called — `stream.rs` never passes `seq.color_config.bit_depth` into it, so the
33+ `BIT_DEPTH` thread-local is dead code defaulting to 8. Everything downstream
34+ silently assumes 8-bit until this is wired. Wire it, and make sure it is set
35+ per frame before decode, not once per process.
36+2. **Narrow refusals for the two paths that are still 8-bit by construction**:
37+ `film_grain.rs` (grain LUT is `[i32; 256]`) and `superres.rs`
38+ (`upscale_row` takes `&[u8]` and clamps to 255). Each gets its own named
39+ `bit_depth != 8` refusal — these are honest, scoped refusals, not the blanket
40+ one. Declare both in `refusal_inventory.rs`.
41+3. **Lift the blanket refusal** in `stream.rs`, in the same commit as the gate
42+ that proves 10-bit decodes.
43+4. **The 10-bit gate**: `ffmpeg_decode_sequence` hardcodes `-pix_fmt yuv420p`;
44+ add a second helper emitting `yuv420p10le` with u16 LE parsing, leaving the
45+ 8-bit helper untouched. aomenc needs `--bit-depth=10` and a 10-bit input.
46+ Confirm from the sequence header that `bit_depth` really is 10 before
47+ trusting a pixel match, and hard-assert it.
48+5. **His own films.** Both are `yuv420p10le`: ReelB (3840x1608, HDR10,
49+ Main, no film grain flagged) and ReelC (1920x792, bt709, Main, no film grain).
50+ Extract with `ffmpeg -i <file> -t 3 -c:v copy -f obu <out.obu>` into this
51+ worktree's `fixtures/`, probe with
52+ `cargo run -p ec-av1 --example decode_probe`, and record the next refusal
53+ verbatim — that is the next lane's charter. Never open his media in a GUI app.
54+
55+8-bit output must stay bit-exact throughout: 264 tests, every real-aomenc gate
56+among them.
57+
58+## Budget discipline
59+75 turns, no reset on resume. At about turn 55, stop starting new work, commit
60+your checkpoint, and write the report with the current error count in it.
61+
62+Hard rules: `CARGO_TARGET_DIR=$HOME/.cache/cargo-target-hbd`; foreground
63+`nice -n 19 cargo ... -j4`; every `cargo test` a timeout >= 600000 ms; ffmpeg
64+generates bounded with `-t`; `EC_AV1_REQUIRE_AOMENC=1`; aomenc
65+`--threads=1 --row-mt=0 --sb-size=64`. Sibling worktrees have live agents —
66+never build in or edit them. Never push, never merge into main; I handle merges.
67+End with `lanes/hbd-r4.report.md`, VERDICT on line 1.