From 0bdb3cc5966643f703af4c81c03df2c6ceda6dc2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ahmet=20Kaan=20G=C3=BCm=C3=BC=C5=9F?= Date: Wed, 2 Sep 2026 06:43:10 +0300 Subject: [PATCH] docs(r14): r1 report -- 16-level 1:4 partition, paired chroma, split transform --- lanes/r14-r1.report.md | 109 +++++++++++++++++++++++++++++++++++++++++ 1 file changed, 109 insertions(+) create mode 100644 lanes/r14-r1.report.md diff --git a/lanes/r14-r1.report.md b/lanes/r14-r1.report.md new file mode 100644 index 00000000..87598745 --- /dev/null +++ b/lanes/r14-r1.report.md @@ -0,0 +1,109 @@ +# lane-r14 r1 -- the 16x16-level 1:4 partition (four 16x4 / 4x16 strips) + +Branch `lane-r14` off main `0df090a`; commits `9bde843` (partition + paired +chroma) and `ccd58a2` (split transform). + +## Film first + +`ffmpeg -ss 300 -t 0.4 -i -c:v copy -f obu kf300.obu`, +then `decode_probe`: + +* BEFORE: `REFUSED: a 1:4 partition below 16x16 (PARTITION_HORZ_4/VERT_4, four + 16x4/4x16 strips ...)`. +* AFTER 9bde843: `REFUSED: a 16x4/4x16 strip whose transform is split` -- every + 16-level 1:4 strip in that key frame reads `tx_depth != 0`, so the partition + alone was not enough. +* AFTER ccd58a2: `REFUSED: a non-skip rectangular (HORZ/VERT/HORZ_B) strip needs + rectangular residual coding` -- ANOTHER lane's wall; the 1:4 one is gone, with + 104 16x4 + 172 4x16 strips decoded at the 32 level alone before it stops. + +EVIDENCE: /tmp/claude-1000/-home-user-Documents-Code-Rust-edith-codecs/b6d8a07f-96a4-4bbb-b378-af9ae25cf7c9/scratchpad/r14/kf300.obu | decode_probe before/after each commit | refusal string moved 1:4-partition -> 1:4-split-transform -> rect-residual (another lane) + +## What changed + +* `crates/ec-av1/src/decode.rs` -- `decode_rect4_16` (new): the four strips of a + 16-level `PARTITION_HORZ_4`/`VERT_4`, wired at the key-frame 16-level + partition site (the old refusal is now + "a 16x16-level partition value outside PARTITION_NONE..PARTITION_VERT_4", + the SB-level wording one size down). + - CHROMA is what is new at this size: `is_chroma_reference` is false for a + 4:2:0 block one mi tall (wide) on an EVEN mi row (column), so strips 0 and 2 + read no `uv_mode`/`cfl_alpha`/`angle_delta_uv` and code no chroma; strips 1 + and 3 close the pair and carry the 8x4 (4x8) chroma of the whole 16x8 (8x16) + luma pair at the PAIR's origin (`setup_pred_plane`'s `mi_row -= 1`), CfL + averaging the pair's luma. + - `read_intra_mode_rect` grew a `has_chroma` (`is_chroma_reference`) parameter; + the four existing call sites pass `true`. + - Split transform: `decode_rect_split`'s per-unit walk inlined (its chroma is + the block's, ours is the pair's). depth 1 = TX_8X4/TX_4X8 rect units + (`TxbSet::LumaRect4x8`), depth 2 = square TX_4X4 via `read_plane`. + - `filter_intra_size_class_rect`: classes 12/13 for 16x4/4x16. + - `palette_bsize_ctx_wh`: DEFECT SWEPT -- `av1_allow_palette`'s + `sb_type >= BLOCK_8X8` is an ENUM INDEX test that BLOCK_4X16 (16) and + BLOCK_16X4 (17) clear, so a 64-pixel 1:4 strip DOES read `palette_y_mode` + (ctx 0) in a screen-content frame; the old "both sides >= 8" bound dropped + that symbol. Now `bw <= 64 && bh <= 64 && bw * bh >= 64`, which reproduces + the enum-index rule for every shape. +* `crates/ec-av1/src/cdf.rs` -- `FILTER_INTRA` rows 12/13 (10368/12770), the + values `filter_intra_classes_carry_their_own_libaom_default_row` already + pinned for BLOCK_16X4/BLOCK_4X16; that test now lists both as owning a class. +* `crates/ec-av1/src/cdf_state.rs` -- `TxbSet::LumaRect16x4{,Set1}`: `Luma8`'s + coefficient tables (`get_txsize_entropy_ctx(TX_16X4)` = the 8x8 class, 64 + positions) with the `TX_4X4` `tx_type` row. +* `crates/ec-av1/src/refusal_inventory.rs` -- the 1:4-below-16x16 refusal is + gone; the 16-level partition-value guard replaces it. +* `crates/ec-av1/src/stream.rs` -- the gate. + +## Gate + +`a_real_aomenc_stream_with_a_16_level_1to4_partition_decodes_pixel_exact` +(4-pixel bands, transposed per attempt, explicit-seed noise, 192x128, +`--enable-1to4-partitions=1 --enable-rect-partitions=1 --enable-ab-partitions=0 +--min-partition-size=4 --max-partition-size=16 --enable-filter-intra=1 +--cpu-used=0`, second half of the window `--enable-tx-size-search=1`), 8 seeds x +2 tx-search arms x 2 bit depths. + +``` +systemd-run --user --scope -q -p MemoryMax=8G env CARGO_TARGET_DIR=$HOME/.cache/cargo-target-r14 \ + EC_NOMEMGUARD=1 EC_AV1_REQUIRE_AOMENC=1 nice -n 10 cargo test -p ec-av1 --lib -j3 \ + a_real_aomenc_stream_with_a_16_level_1to4 -- --nocapture +``` + +Result (both green): + +* 8-bit: 15 compared attempts, 192 16x4 / 288 4x16 strips, 240 chroma pairs, + 486 coded units, 102 split-transform strips, 0 refusals, 1 out of scope. +* 10-bit: 16 compared attempts, 148 16x4 / 280 4x16 strips, 214 chroma pairs, + 433 coded units, 82 split-transform strips, 0 refusals, 0 out of scope. + +Every decoded frame is pixel-compared against ffmpeg (`assert_eq` on all three +planes); a decode error is asserted to be a NAMED refusal, never a SKIP. + +EVIDENCE: cargo test output above | 31 real aomenc streams encoded, decoded and compared | 340 16x4 + 568 4x16 strips, 454 chroma pairs, 184 split-transform strips, 0 mismatches + +Encoder-side proof the shape is really in the stream (independent of our +counters): instrumented `aomdec EC_TRACE=1` on the same recipe prints +`EC_PART bsize=6 value=8` (HORZ_4 at BLOCK_16X16) 6x and `value=9` (VERT_4) +10x on the two axes of the fixture. + +## Refusals + +* LIFTED: "a 1:4 partition below 16x16 (PARTITION_HORZ_4/VERT_4, four 16x4/4x16 + strips ...)". +* STILL REFUSED at this shape: "a 1:4 rect strip that actually uses a palette" + (shared with the 32-level pair; reconstruction unported). +* NEW (replacing the lifted one, same site): "a 16x16-level partition value + outside PARTITION_NONE..PARTITION_VERT_4". + +## Residue + +* deferred: the INTER twin of this partition (the inter 16-level site still + refuses 1:4 by its own name) -- unblocked by an inter fixture that reaches a + 16-level 1:4, out of this lane's intra scope. +* deferred: CfL over the pair is written but no gate proves it fired -- + `--enable-cfl-intra` stays `=0` on this recipe because there is no CfL hit + counter, and enabling the flag alone would falsely retire the tool from + `gate_coverage::NEVER_EXERCISED_*`. Unblocked by a CfL counter + a fixture + whose chroma actually correlates with luma. +* accepted: no `--tile-columns` arm in this gate -- the lane added no per-mi + neighbour map, it reuses the existing tile-edge-guarded ones.