ec-av1: lane-av1-422n -- correct the 8x32 4:2:2 chroma chunk from eight TX_4X4 to four TX_4X8 units (reviewer fix on e24dc84b): BLOCK_INVALID is 255 and the out-of-bounds max_txsize_rect_lookup byte is TX_4X8, not TX_4X4; the units keep a tx type via the inherited luma type reduced into the TX_4X8 ext-tx set; header refusal stays (stream stops at the (2,16) rect-pair chroma shape, not pixel-exact)
Browse files at this commit09ed9145bc13d16a5ddffe8562473e37bf646bb9Parent: 8cb8b422 changed files +94 -16
- crates/ec-av1/src/decode.rs +20 -16
- lanes/av1422n.report.md +74 -0
crates/ec-av1/src/decode.rsmodified+20 -16
| @@ -22767,25 +22767,29 @@ fn read_inter_rect_chroma( | |||
| 22767 | fctx: &crate::decode::FrameCtx, | 22767 | fctx: &crate::decode::FrameCtx, |
| 22768 | ) -> Result<(Grid, Grid, Vec<((usize, usize), usize, Grid, usize, usize)>)> { | 22768 | ) -> Result<(Grid, Grid, Vec<((usize, usize), usize, Grid, usize, usize)>)> { |
| 22769 | let (uw, uh) = (write_chroma_w.min(32), write_chroma_h.min(32)); | 22769 | let (uw, uh) = (write_chroma_w.min(32), write_chroma_h.min(32)); |
| 22770 | - // lane-av1-422m: an 8x32 luma block HAS no 4:2:2 plane residual block -- | 22770 | + // lane-av1-422m, CORRECTED lane-av1-422n: an 8x32 luma block HAS no |
| 22771 | - // `av1_ss_size_lookup[BLOCK_8X32][1][0]` is BLOCK_INVALID | 22771 | + // 4:2:2 plane residual block -- `av1_ss_size_lookup[BLOCK_8X32][1][0]` |
| 22772 | - // (`av1/common/common_data.c:38`) -- so libaom never codes its chroma as | 22772 | + // is BLOCK_INVALID (= 255, blockd.h) -- so libaom never codes its chroma |
| 22773 | - // a (4, 32) unit, and no such coefficient set exists (no TX_4X32 | 22773 | + // as a (4, 32) unit, and no such coefficient set exists (no TX_4X32 |
| 22774 | - // either). The plane is still coded, CHUNKED at luma-granular TX_4X4: | 22774 | + // either). The plane is still coded, CHUNKED: `decode_token_recon_block` |
| 22775 | - // `decode_token_recon_block` (`decodeframe.c:1022`) steps the plane in | 22775 | + // (`decodeframe.c:1022`) steps the plane in `get_vartx_max_txsize` |
| 22776 | - // `get_vartx_max_txsize` units, where the `BLOCK_INVALID` plane size | 22776 | + // units, where the `BLOCK_INVALID` plane size indexes |
| 22777 | - // indexes `max_txsize_rect_lookup` one past its end and in the pinned | 22777 | + // `max_txsize_rect_lookup` OUT OF BOUNDS and the byte read there in the |
| 22778 | - // release build reads the adjacent `vtx_tab[0]` = DCT_1D = 0 = TX_4X4; | 22778 | + // pinned Release oracle build is TX_4X8 -- the committed |
| 22779 | - // `decode_reconstruct_tx`'s `if (tx_size == plane_tx_size || plane)` | 22779 | + // "adjacent `vtx_tab[0]` = TX_4X4" reading was wrong (reviewer FAIL on |
| 22780 | - // never recurses for chroma, so every unit reads at TX_4X4. Chunk the | 22780 | + // e24dc84b). `decode_reconstruct_tx`'s |
| 22781 | - // same way: 8 units per plane over the 4x32 chroma plane. TX_4X4 units | 22781 | + // `if (tx_size == plane_tx_size || plane)` never recurses for chroma, so |
| 22782 | - // also never inherit a tx_type (`av1_get_tx_type` returns DCT_DCT for | 22782 | + // every unit reads at TX_4X8: FOUR stacked 4x8 units per plane over the |
| 22783 | - // `tx_size == TX_4X4`, blockd.h), so the inherited luma type is dropped. | 22783 | + // 4x32 chroma plane. The units KEEP a tx type: `av1_get_tx_type` |
| 22784 | + // (blockd.h) has no TX_4X4 early-out -- it derives from the block's | ||
| 22785 | + // inherited luma type reduced into the TX_4X8 ext-tx set | ||
| 22786 | + // (`reduce_inherited_chroma_tx_type`), exactly like every other rect | ||
| 22787 | + // unit here, so the 4:2:2 drop-the-type special case is gone. | ||
| 22784 | let invalid_ss_plane = ss_x(fctx) == 1 | 22788 | let invalid_ss_plane = ss_x(fctx) == 1 |
| 22785 | && ss_y(fctx) == 0 | 22789 | && ss_y(fctx) == 0 |
| 22786 | && (write_chroma_w, write_chroma_h) == (4, 32); | 22790 | && (write_chroma_w, write_chroma_h) == (4, 32); |
| 22787 | - let (uw, uh) = if invalid_ss_plane { (4, 4) } else { (uw, uh) }; | 22791 | + let (uw, uh) = if invalid_ss_plane { (4, 8) } else { (uw, uh) }; |
| 22788 | - let inherit_tx_type = if invalid_ss_plane { None } else { Some(luma_tx_type) }; | 22792 | + let inherit_tx_type = Some(luma_tx_type); |
| 22789 | let (nx, ny) = (write_chroma_w / uw, write_chroma_h / uh); | 22793 | let (nx, ny) = (write_chroma_w / uw, write_chroma_h / uh); |
| 22790 | let multi = nx * ny > 1; | 22794 | let multi = nx * ny > 1; |
| 22791 | let set = rect_inter_chroma_set(uw, uh)?; | 22795 | let set = rect_inter_chroma_set(uw, uh)?; |
lanes/av1422n.report.mdadded+74 -0
| @@ -0,0 +1,74 @@ | |||
| 1 | +# lane-av1-422n — e24dc84b's (4, 32) chunk is corrected from eight TX_4X4 to | ||
| 2 | +# FOUR TX_4X8 units; the header refusal STAYS (the stream is not pixel-exact | ||
| 3 | +# and stops at the (2, 16) rect-pair chroma shape) | ||
| 4 | + | ||
| 5 | +## Outcome | ||
| 6 | + | ||
| 7 | +1. `read_inter_rect_chroma`'s invalid-ss-size arm now chunks the (4, 32) | ||
| 8 | + 4:2:2 chroma plane of an 8x32 luma block into FOUR TX_4X8 units per plane | ||
| 9 | + (a 1x4 grid: 4 wide, 8 tall each). The committed eight-TX_4X4 chunking | ||
| 10 | + was wrong: reviewer FAIL on e24dc84b. `BLOCK_INVALID` is 255, and the | ||
| 11 | + out-of-bounds byte `get_vartx_max_txsize` reads from | ||
| 12 | + `max_txsize_rect_lookup` in the pinned Release oracle build is TX_4X8 — | ||
| 13 | + not the "adjacent `vtx_tab[0]` = TX_4X4" the m report claimed. | ||
| 14 | +2. The units KEEP a tx type: `av1_get_tx_type` (blockd.h) has no TX_4X4 | ||
| 15 | + early-out, so the m lane's `inherit_tx_type = None` special case is gone. | ||
| 16 | + The units derive the type from the block's luma type through | ||
| 17 | + `reduce_inherited_chroma_tx_type` into the TX_4X8 ext-tx set, exactly | ||
| 18 | + like every other rect unit on this path. `(4, 8)` resolves through the | ||
| 19 | + existing `rect_inter_chroma_set` row `(8, 4) | (4, 8) => ChromaRect8x4`; | ||
| 20 | + no table row was added, and the (4, 32) refusal arm below it stays. | ||
| 21 | +3. The (32, 64) intra chroma edit made earlier this session was REVERTED | ||
| 22 | + per instruction before the chunk fix; the intra arm is byte-identical to | ||
| 23 | + e24dc84b. 4:2:0 paths untouched. | ||
| 24 | + | ||
| 25 | +## Counter (first real exercise of `CHROMA422_CHUNK_HITS`) | ||
| 26 | + | ||
| 27 | +With the header refusal temporarily bypassed (probe only, restored | ||
| 28 | +byte-identical — see below), the fixture walks 32 TX_4X8 chunk units | ||
| 29 | +(`CHROMA422_CHUNK_HITS`, instrumented per unit) before the next stop. The | ||
| 30 | +m report's count never printed because the probe panicked first; with the | ||
| 31 | +corrected chunking the units demonstrably run. | ||
| 32 | + | ||
| 33 | +## Frontier (NOT fixed — another shape, another lane's arm) | ||
| 34 | + | ||
| 35 | +`decode_rect4_16_strip`'s closed chroma-shape set (`decode.rs:14902`) has no | ||
| 36 | +`(2, 16)` row: a 4x16 luma pair's 4:2:2 chroma plane arrives there and hits | ||
| 37 | +the `unreachable!`. The probe decodes frame 1 and stops early in frame 2, | ||
| 38 | +after the 32 TX_4X8 units. The (32, 64) intra scratch panic did NOT | ||
| 39 | +reproduce on this walk — this stop precedes it. | ||
| 40 | + | ||
| 41 | +## Pixels — delete condition unmet, refusal STAYS | ||
| 42 | + | ||
| 43 | +- Frame 1 (keyframe): luma byte-exact vs `aomdec` (oracle: 16 shown I422 | ||
| 44 | + frames); U/V diverge from chroma (23, 0) on — a pre-existing keyframe | ||
| 45 | + 4:2:2 chroma gap present at e24dc84b too (frame 1 decodes through | ||
| 46 | + `decode_block`, which neither `read_inter_rect_chroma` nor the intra arm | ||
| 47 | + touches). | ||
| 48 | +- Frames 2+ are not comparable (the frame-2 stop above). | ||
| 49 | +- The 16-frame pixel-exact + counter delete condition is unmet, so the | ||
| 50 | + header refusal stands untouched. | ||
| 51 | + | ||
| 52 | +## Verification | ||
| 53 | + | ||
| 54 | +- `cargo check -p ec-av1 --all-targets` (target dir | ||
| 55 | + `~/.cache/cargo-target-av1422n`): **0 warnings**. | ||
| 56 | +- 420 gate green under `EC_AV1_REQUIRE_AOMENC=1`: | ||
| 57 | + `a_real_aomenc_stream_with_a_skipped_8x8_intra_leaf_whose_tx_split_decodes_ | ||
| 58 | + pixel_exact`: 1 passed, 0 failed. | ||
| 59 | +- Probe bypass reverted: `git diff` after the run shows ONLY | ||
| 60 | + `crates/ec-av1/src/decode.rs` (the chunk fix + comment rewrite); the | ||
| 61 | + default 4:2:2 refusal fires as before (`REFUSED: unsupported: ... 4:2:2 | ||
| 62 | + ...`). | ||
| 63 | +- Oracle reference: `$HOME/.cache/aom-oracle/build/aomdec` on the fixture | ||
| 64 | + (sha256 `d3fa4beeb1309033e4a03f5ae5c431c8fa8386ba1ada088684710423c7938129`) | ||
| 65 | + → 16 shown frames. | ||
| 66 | +- Untouched: the (4, 32) refusal arm in `rect_inter_chroma_set`, the 4:2:0 | ||
| 67 | + group-tail chroma SKIP arm, the k lane's `read_rect_chroma_unit` arms, | ||
| 68 | + `decode_probe.rs` (byte-identical to e24dc84b). | ||
| 69 | + | ||
| 70 | +## State | ||
| 71 | + | ||
| 72 | +- Commit on lane-av1-422n (no push): the corrected chunking + this report. | ||
| 73 | +- Next stop named for the owning lane: `decode_rect4_16_strip` chroma shape | ||
| 74 | + `(2, 16)`. | ||