# lane-kf900 r3 HANDOFF Tip: see `git log --oneline -3 lane-kf900` (merge `4267082`, fix+gate `667eb51`, this commit). Worktree `/home/user/Documents/Code/Rust/edith_codecs-kf900`, base `18bf7dc`, merged main `8e9ba81`. Full detail in `lanes/kf900-r3.report.md`. ## 1. The silent 10-bit desync -- ROOT CAUSE FOUND AND FIXED Stream: `testsrc2=s=256x192 --bit-depth=10 --cq-level=59 --cpu-used=0`, recipe `$HOME/.cache/kf900/sweep/sweep.sh`, md5 `e5f033d8fe34e4418d8cca3ac9d2b595` (`$HOME/.cache/kf900/sweep/g.obu`). Symbol: the FIRST block's Y palette colours. mi(0,0) is BLOCK_32X16, DC_PRED, 2-colour Y palette. `decode.rs::read_palette_colors_y` / `read_palette_colors_uv` read every raw literal at a hardcoded 8 bits; libaom `decodemv.c:478` (Y) and `:509` (UV) size them all by the sequence `bit_depth`: first colour `aom_read_literal(r, bit_depth)`, `min_bits = bit_depth - 3` (Y/U) and `bit_depth - 4` (V delta mode), `range = (1 << bit_depth) - first - 1` (Y) / `- first` (U), clamp bound `(1 << bit_depth) - 1`, V wrap modulus `1 << bit_depth`. So a 10-bit palette block read TWO BITS TOO FEW per transmitted colour and decoded the whole rest of the tile from the wrong bit position, with no refusal. Fix (commit `667eb51`): `let bd = u32::from(bit_depth());` (the already-present thread-local, decode.rs:200) inside both readers; no signature threading. Before: `OK: 1 frames decoded` with 73687/73728 samples differing from ffmpeg, max |d| 933 (Y 49117/49152, U 12286/12288, V 12284/12288, first diff at (0,0)). After: the entropy stream is in lockstep with aomdec -- our first 1024 `EC_PAL`/`EC_PAL_VAL` lines are byte-identical to aomdec's `EC_TRACE_PALETTE`, and the block grid follows aomdec's (`EC_IMODE` mi(0,0) 32x16, (4,0) 16x16, (4,4) 16x16, (0,8) 32x8, (2,8) 32x8, (4,8) 32x8 == aomdec bsize 8,6,6,19,19,19). WHY 108 SWEEP RECIPES AND A RANGE LADDER MISSED IT: raw literals are EQUIPROBABLE and at the ranges this content reaches an equiprobable read is a FIXED POINT of the msac range (62728 -> v=31364, either branch 31364, renorm 62728). A cross-decoder RANGE ladder stays bit-identical straight through a wrong literal WIDTH; only the decoded VALUE moves. aomdec and we both printed `rng=62728` and disagreed on the first colour index (0 vs 1). Compare VALUES, not range alone. This stream is NOT a whole-frame gate: at mi(4,8) it hits a 32x8 (4:1) strip that really uses a palette, and the 1:4 rect decoder is called with `palette: None` (decode.rs:7167 and :7556), so it now stops at the pre-existing refusal `"a 1:4 rect strip that actually uses a palette (reconstruction is not ported at this shape)"`. Silent desync -> named refusal. ## 2. The chroma residual at mi(97,320) -- GONE, and not by my fix r2's first remaining chroma difference on the s=900 4K key frame -- chroma (195,640) = mi(97,320) -- is ZERO on the merged tree. No ladder was needed: the census (below) came back clean. Credit is the merged lane-reelckf `55532c7` (skipped CfL blocks still predict; the 1:4 chroma pair edge-filter mi), NOT the palette fix -- the film frame reads zero palette symbols (`EC_AV1_TRACE=1 decode_probe crates/ec-av1/fixtures/reelb_kf900.obu | grep -c "^EC_PAL "` = 0). The charter's chroma-`tx_type` suspicion was audited and cleared rather than needed: `av1_get_tx_type`'s `plane > 0` intra path is `intra_mode_to_tx_type(mbmi, PLANE_TYPE_UV)` = our `default_intra_tx_type` (decode.rs:3229) fed with `uv_predict_mode`, which already maps `UV_CFL_PRED` -> `DC_PRED`; the `!av1_ext_tx_used[tx_set_type][tx_type]` narrowing can only bite at `txsize_sqr_up >= TX_32X32`, and both chroma call sites already force `DCT_DCT` there (decode.rs:6089 `chroma_w.max(chroma_h) >= 32`, decode.rs:9254 `side >= 32`). All four values the table can produce are members of `EXT_TX_SET_DTT4_IDTX` and `..._1DDCT`, the only two intra sets below 32. ## 3. Census -- 24/24 BIT-EXACT (was 15/24 at r2) `$HOME/.cache/kf900/census_r3.sh` -> `$HOME/.cache/kf900/census_r3.tsv`: all 24 key frames decode `OK: 1 frames decoded, 3840x1608` with Y=U=V=0 differing samples and max |d| 0/0/0. Full table in the report. ## 4. Gate state NEW, committed, PASSING: `crates/ec-av1/src/stream.rs::a_real_aomenc_palette_stream_decodes_pixel_exact_at_8_and_10_bit` -- the existing 8-bit `..._with_palette_y_...` recipe (smptebars 64x64, `--tune-content=screen --enable-palette=1`, rect/AB/1:4 off) with the depth as the only variable (depth flags appended AFTER the base recipe: last flag wins). Each arm hard-asserts `decode::palette_hits()` moved and compares Y, U and V vs ffmpeg. `cargo test -p ec-av1 --lib palette_stream_decodes_pixel_exact_at_8_and_10` -> 1 passed, 0 failed. DISCRIMINATION CHECK RUN: with `let bd = u32::from(bit_depth())` reverted to `let bd = 8u32` the test FAILS on "luma at 10-bit" and the 8-bit arm still passes (tree restored from a scratch copy afterwards). No refusal was lifted this round, so `refusal_inventory.rs` / `gate_coverage.rs` are untouched (byte-identical to main's). Class sweep for the same shape (bit-depth-scaled reader hardcoding 8): `grep -n "literal(8)\|255i32\|, 255)\|(1 << 8)" crates/ec-av1/src/decode.rs` -> only the qindex clamps at :332 and :544 survive, and those are correct at every depth. No sibling instances. ## 5. Suite state -- INCOMPLETE, ZERO FAILURES SO FAR `systemd-run --user --unit=kf900-suite-r3-1788328486 -p MemoryMax=10G ... cargo test -p ec-av1 --lib -j3 > $HOME/.cache/kf900-suite-r3.log`. At the turn cap: **272 `ok`, 0 `FAILED`, no `test result` line yet**. Resolve the unit name with `systemctl --user list-units --all | grep kf900` before believing it finished. ## 6. EXACT NEXT STEP 1. `grep -E "^test result|FAILED" $HOME/.cache/kf900-suite-r3.log` -- expect `374 passed; 0 failed` (373 at r2 + the new depth gate). If a `FAILED` appears, the only behavioural change on this branch is the palette bit-depth widening, so look at the three existing palette gates first (`a_real_aomenc_stream_with_palette_y_...`, `..._palette_uv_...`, `..._rect_palette_...`, `a_real_aomenc_multi_tile_palette_stream_...`). 2. Merge into main. 3. Then the open lane work, in this order: a. Tighten `..._skipped_8x8_intra_leaves_that_split_their_transform_decodes_luma_exact` from luma-only to all three planes -- the census is 24/24 exact now, so its U/V arms should hold. b. Port palette reconstruction to the 1:4 rect decoder (decode.rs:7167 and :7556 pass `palette: None`); that is the ONLY thing between us and a whole-frame pixel gate for `skip_split_tx` on the pinned 10-bit stream above. Probably lane-palette2's territory. c. Carry-over: block-position printing on refusal in `decode_probe`.