wip(rectx): r4 capped at 75 turns -- preserved by orchestrator
Browse files at this commite86194f4734420ddf4925a582845a5d3e4f38c66Parent: ae5d89d2 changed files +82 -2
- crates/ec-av1/src/encode.rs +6 -2
- lanes/rectx-r4.report.md +76 -0
crates/ec-av1/src/encode.rsmodified+6 -2
| @@ -1093,7 +1093,9 @@ fn has_tr_rect_table(bw: usize, bh: usize) -> &'static [u8] { | |||
| 1093 | (16, 8) => &[255, 0, 85, 0, 119, 0, 85, 0, 127, 0, 85, 0, 119, 0, 85, 0], | 1093 | (16, 8) => &[255, 0, 85, 0, 119, 0, 85, 0, 127, 0, 85, 0, 119, 0, 85, 0], |
| 1094 | (8, 16) => &[255, 255, 119, 119, 127, 127, 119, 119, 255, 127, 119, 119, 127, 127, 119, 119], | 1094 | (8, 16) => &[255, 255, 119, 119, 127, 127, 119, 119, 255, 127, 119, 119, 127, 127, 119, 119], |
| 1095 | (32, 16) => &[15, 5, 7, 5], | 1095 | (32, 16) => &[15, 5, 7, 5], |
| 1096 | - _ => &[255, 119, 127, 119], | 1096 | + (16, 32) => &[255, 119, 127, 119], |
| 1097 | + (64, 32) => &[19], | ||
| 1098 | + _ => &[127], | ||
| 1097 | } | 1099 | } |
| 1098 | } | 1100 | } |
| 1099 | 1101 | ||
| @@ -1102,7 +1104,9 @@ fn has_bl_rect_table(bw: usize, bh: usize) -> &'static [u8] { | |||
| 1102 | (16, 8) => &[254, 84, 254, 16, 254, 84, 254, 0, 254, 84, 254, 16, 254, 84, 254, 0], | 1104 | (16, 8) => &[254, 84, 254, 16, 254, 84, 254, 0, 254, 84, 254, 16, 254, 84, 254, 0], |
| 1103 | (8, 16) => &[16, 17, 0, 1, 16, 17, 0, 0, 16, 17, 0, 1, 16, 17, 0, 0], | 1105 | (8, 16) => &[16, 17, 0, 1, 16, 17, 0, 0, 16, 17, 0, 1, 16, 17, 0, 0], |
| 1104 | (32, 16) => &[78, 14, 78, 14], | 1106 | (32, 16) => &[78, 14, 78, 14], |
| 1105 | - _ => &[16, 0, 16, 0], | 1107 | + (16, 32) => &[16, 0, 16, 0], |
| 1108 | + (64, 32) => &[34], | ||
| 1109 | + _ => &[0], | ||
| 1106 | } | 1110 | } |
| 1107 | } | 1111 | } |
| 1108 | 1112 | ||
lanes/rectx-r4.report.mdadded+76 -0
| @@ -0,0 +1,76 @@ | |||
| 1 | +# lane-rectx r4 — the gate is GREEN: two defects, one cherry-picked, one found here | ||
| 2 | + | ||
| 3 | +Branch `lane-rectx`, commits on top of `main` 3808cf8. Round 3 left the lane's own gate red | ||
| 4 | +with the mode-neighbour defect precisely located; this round fixed it and one more. | ||
| 5 | + | ||
| 6 | +## What changed | ||
| 7 | + | ||
| 8 | +1. **Cherry-picked lane-sub8 `1841406`** (mi-exact intra mode neighbours + `has_tr_4x4`/ | ||
| 9 | + `has_bl_4x4`): `Neighbours::sub8_mode_col/row`, `record_mode_mi`, `mode_above_mi`/ | ||
| 10 | + `mode_left_mi` (`crates/ec-av1/src/decode.rs` ~1830, ~2533-2570), written by `record_rect` | ||
| 11 | + and `record_split_luma`/`decode_leaf8`, plus `crates/ec-av1/src/encode.rs`'s reach rows. | ||
| 12 | + The commit's `decode_leaf_split4`/`read_intra_mode_sub8` hunks were dropped — those | ||
| 13 | + functions exist only on lane-sub8. | ||
| 14 | +2. **`decode_leaf_rect` joins that map** (`decode.rs` ~3644 read, ~3786 write): it now reads | ||
| 15 | + `mode_above_mi`/`mode_left_mi` after the `prev_leaf` override and records its own | ||
| 16 | + `mi_w x mi_h` span, not one cell. This is r3's located defect (leaf mi=(4,12) read | ||
| 17 | + `kf_y_mode` from the coarse 16x16 slot, decoding `mode=0` where the oracle decodes | ||
| 18 | + `mode=2`). | ||
| 19 | +3. **ROOT CAUSE FOUND THIS ROUND — the rect reach tables were the wrong block size.** | ||
| 20 | + `Reach::of_rect` (`encode.rs` ~1096) indexed `HAS_TOP_RIGHT_RECT`/`HAS_BOTTOM_LEFT_RECT` | ||
| 21 | + by `bw == 16`; both arrays only ever held the 32x16/16x32 rows (lane-intradisp's sizes). | ||
| 22 | + A 16x8 block read `has_tr_16x32`/`has_bl_16x32` (4 bytes) where libaom reads | ||
| 23 | + `has_tr_16x8`/`has_bl_16x8` (16 bytes), an 8x16 read the 32x16 rows, and the index | ||
| 24 | + arithmetic (`table_stride = 128/side`, `% (len*8)`) was not libaom's either. | ||
| 25 | + `top_right_rect`/`bottom_left_rect` are now libaom `has_top_right`/`has_bottom_left` | ||
| 26 | + verbatim at block granularity (`row_off`/`col_off` 0, luma), with `has_tr_rect_table`/ | ||
| 27 | + `has_bl_rect_table` carrying 16x8, 8x16, 32x16, 16x32, 64x32 and 32x64 transcribed from | ||
| 28 | + `~/.cache/aom-oracle/src/av1/common/reconintra.c`. (`has_tr_vert_tables`/`has_bl_vert_tables` | ||
| 29 | + hold the SAME pointers for every W<H entry and NULL for W>H, so the partition type selects | ||
| 30 | + no different table at these sizes.) | ||
| 31 | +4. Gate recipe (`stream.rs` ~5366): mandelbrot `start_x=-0.6`, `--cq-level=16`, and | ||
| 32 | + `--enable-filter-intra=0` added (filter intra ON a strip is a separate, still-refused | ||
| 33 | + predictor). | ||
| 34 | +5. `examples/decode_probe.rs`: lane-sub8's optional second arg dumping raw yuv420p, which is | ||
| 35 | + what made the ffmpeg pixel diff a one-liner outside the test harness. | ||
| 36 | + | ||
| 37 | +## Evidence | ||
| 38 | + | ||
| 39 | +EVIDENCE: /tmp/claude-1000/.../scratchpad/{x.obu,pre_a.yuv.f0,pre_o.yuv.f0} | ffmpeg lavfi | ||
| 40 | +rgbtestsrc 64x64 -> aomenc cq50 --enable-rect-partitions=1 --enable-ab-partitions=0 | ||
| 41 | +--enable-filter-intra=0 --reduced-tx-type-set=1 --min-partition-size=8 --max-partition-size=32; | ||
| 42 | +`EC_AV1_PREFILT_DUMP` on instrumented aomdec vs `examples/decode_probe` | pre-loop-filter luma | ||
| 43 | +diffs 1440 -> 0, final vs `ffmpeg -f rawvideo` 1567 -> 0 bytes. The 1440 luma diffs were a | ||
| 44 | +D203 (`mode=7`) 16x8 strip at mi=(4,8): exact for the first rows, first mismatch at pixel | ||
| 45 | +(44,18) with a diagonal wavefront — the signature of a ray that has started reading BELOW the | ||
| 46 | +block's own height, i.e. wrong bottom-left availability. | ||
| 47 | + | ||
| 48 | +EVIDENCE: gate `a_real_aomenc_stream_with_a_coded_rect_strip_below_16x16_decodes_pixel_exact` | | ||
| 49 | +`EC_AV1_REQUIRE_AOMENC=1 cargo test -p ec-av1 --lib -- a_real_aomenc_stream_with_a_coded_rect_strip_below_16x16 --nocapture` | | ||
| 50 | +`pixel-exact, rect_leaf_coeff_hits=8`; the stream's own symbol trace shows 6 non-skip TX_16X8 | ||
| 51 | +luma leaves + 1 non-skip TX_8X16 (both orientations), 9 non-skip TX_8X4 and 3 non-skip TX_4X8 | ||
| 52 | +chroma halves. | ||
| 53 | + | ||
| 54 | +## Refusals | ||
| 55 | + | ||
| 56 | +- `a coded (non-skip) HORZ/VERT rect strip below 16x16` — the string was already removed from | ||
| 57 | + `decode.rs` in r2 (never in `refusal_inventory::REFUSALS`); this round is what finally PROVES | ||
| 58 | + it, with the gate above. Nothing to delete, the inventory test stays green. | ||
| 59 | +- `a non-skip rectangular (HORZ/VERT/HORZ_B) strip needs rectangular residual coding` | ||
| 60 | + (`decode.rs:9138`) — **NOT lifted.** It sits in the INTER square-block path | ||
| 61 | + (`reject_residual`, lane-warp r5), which this key-frame gate never reaches. Lifting it needs | ||
| 62 | + an inter gate. | ||
| 63 | +- `a coded (non-skip) HORZ_B/VERT_B rect strip below 16x16` — **NOT lifted**, HORZ_B/VERT_B | ||
| 64 | + never fired in the gate stream. | ||
| 65 | + | ||
| 66 | +## Open residue | ||
| 67 | + | ||
| 68 | +- accepted: `read_coeffs_rect` still refuses `V_DCT`/`H_DCT` (`a non-2D tx class on a | ||
| 69 | + rectangular transform`), hence `--reduced-tx-type-set=1` in the gate. | ||
| 70 | +- deferred(a lane for AB partitions below 16x16): the dominant refusal across the recipe sweep | ||
| 71 | + is still `a HORZ_A/HORZ_B/VERT_A partition below 16x16`. NOTE: unlike r3's premise, this | ||
| 72 | + survives the mode-grid fix, so at THIS size it is not (only) our own desync — 8 of 24 swept | ||
| 73 | + cells still refuse on it after both fixes. | ||
| 74 | +- fix-now(next round): two swept cells decode to completion but are NOT pixel-exact | ||
| 75 | + (rgbtestsrc cq24 3540 bytes, cq32 1714; mandelbrot start_x=-0.6 cq16 with | ||
| 76 | + `--enable-filter-intra=1` 126). Same ladder applies; the gate's own cell is exact. | ||