forge
Explore
Log in

Don't you dare go Hollow

ec-av1: lane-av1-422bigblock review close -- the 128-rect walk reshaped onto the reviewed 349b3918 expression form and the report's 4:4:4 evidence made honest

Browse files at this commit

c8187741d5e40462672c54a8277240f07a22c628Ahmet Kaan GümüşParent: c74c912
Review findings closed: the decode_block_128rect chroma walk now uses the
same ss-parameterized expression the reviewed lane-av1-444sb fix (349b3918)
landed -- cn = ((64 >> ss_x)/chroma_tx).max(1) for the width axis with the
added cn_h = ((64 >> ss_y)/chroma_tx).max(1) for the height axis, per-axis
(64 >> ss) chunk offsets and (16 >> ss) clamp strides -- so at ss(0,0) this
lane's code reduces line-for-line to that reviewed form and the eventual
merge of the two chains is a semantic union, not a conflict; at ss(1,0) the
two axes' counts part ways (1 x 2 stacked TX_32X32).

The 444_sb128rect_lr_witness (sha 27825e14) was decoded on this tree: its
output is byte-identical to the parent commit's on the same stream (measured
by stash-and-rebuild, all three frames), so the rewrite is proven
output-neutral on it; the stream still diverges from aomdec identically
before and after because this branch predates the 444 chain's chroma-context
fixes (9e77c16b, 76f8c3fe) and the desync starts at frame-0 Y sample 128,
before the first 128-rect block ever fires -- 349b3918's own frames-0/1 gate
remains the merged-tree pin.

Report corrections: the lossless sb128 gate is a 4:2:0 stream (seq_profile 0
in the fixture bytes) and is relabeled as such -- it never proved 4:4:4; the
4:4:4 behavior change of the 128rect rewrite (parent was assert-broken
there) and the ceil-vs-floor half-width edge of the RefPix three-way
inference at odd reference dimensions are now disclosed in the report.
crates/ec-av1/src/decode.rsmodified+21 -19
@@ -18566,18 +18566,17 @@ fn decode_block_128rect(
18566 let mi_rows = 2 * y.true_height.div_ceil(8);18566 let mi_rows = 2 * y.true_height.div_ceil(8);
18567 let max_w_mi = (bw / MI).min(mi_cols.saturating_sub(mi_c));18567 let max_w_mi = (bw / MI).min(mi_cols.saturating_sub(mi_c));
18568 let max_h_mi = (bh / MI).min(mi_rows.saturating_sub(mi_r));18568 let max_h_mi = (bh / MI).min(mi_rows.saturating_sub(mi_r));
18569- // Non-lossless: per mu chunk, the chroma units per axis are18569+ // Non-lossless: per mu chunk, `(64 >> ss) / chroma_tx` chroma units per
18570- // ((64 >> ss_x) / chroma_tx, (64 >> ss_y) / chroma_tx) -- one 32x32 unit18570+ // axis -- one 32x32 at 4:2:0, two stacked on the tall axis at 4:2:2
18571- // per chunk at 4:2:0, TWO stacked on the tall axis at 4:2:2 (the chunk's18571+ // (lane-av1-422bigblock: the chunk's chroma plane block is 32x64 there),
18572- // chroma plane block is 32x64), four at 4:4:4. The old square-cut assert18572+ // four at 4:4:4 (lane-av1-444sb's own finding on this same walk).
18573- // demanded one unit per chunk on BOTH axes, which no 4:2:2 stream can
18574- // satisfy (lane-av1-422bigblock: the s2.obu witness).
18575- let chunk_cw = (64usize) >> ss_x(fctx);
18576- let chunk_ch = (64usize) >> ss_y(fctx);
18577 debug_assert!(18573 debug_assert!(
18578 lossless_frame18574 lossless_frame
18579- || (nch_x * (chunk_cw / chroma_tx), nch_y * (chunk_ch / chroma_tx))18575+ || (chroma_w / chroma_tx, chroma_h / chroma_tx)
18580- == (chroma_w / chroma_tx, chroma_h / chroma_tx)18576+ == (
18577+ nch_x * ((64 >> ss_x(fctx)) / chroma_tx),
18578+ nch_y * ((64 >> ss_y(fctx)) / chroma_tx)
18579+ )
18581 );18580 );
18582 let tpc = 64 / logical_tx;18581 let tpc = 64 / logical_tx;
18583 let zero_tu = vec![0i32; logical_tx * logical_tx];18582 let zero_tu = vec![0i32; logical_tx * logical_tx];
@@ -18657,12 +18656,15 @@ fn decode_block_128rect(
18657 neighbours.record_mi_luma(tu_mi, logical_tx, &tu_grid);18656 neighbours.record_mi_luma(tu_mi, logical_tx, &tu_grid);
18658 }18657 }
18659 }18658 }
18660- // Transform units per axis inside this mu chunk's chroma span18659+ // Transform units per axis inside this mu chunk's chroma span:
18661- // -- (64 >> ss_x) x (64 >> ss_y): one 32x32 unit at 4:2:0, TWO18660+ // a 64x64 luma chunk covers `64 >> ss` chroma pixels per axis,
18662- // stacked TX_32X32 at 4:2:2, four at 4:4:4; 8x8 TX_4X4 units18661+ // so it holds `(64 >> ss) / chroma_tx` units -- one 32x32 at
18663- // when lossless.18662+ // 4:2:0, four at 4:4:4 (lane-av1-444sb), TWO STACKED TX_32X32 on
18664- let cn_w = (chunk_cw / chroma_tx).max(1);18663+ // the tall axis at 4:2:2 (lane-av1-422bigblock: the chunk's
18665- let cn_h = (chunk_ch / chroma_tx).max(1);18664+ // chroma plane block is 32x64 there, so the two axes' counts
18665+ // part ways -- 1 x 2); 8x8 TX_4X4 units when lossless.
18666+ let cn = ((64 >> ss_x(fctx)) / chroma_tx).max(1);
18667+ let cn_h = ((64 >> ss_y(fctx)) / chroma_tx).max(1);
18666 // libaom's per-chunk `unit_width/height` (plane-mi units of the18668 // libaom's per-chunk `unit_width/height` (plane-mi units of the
18667 // luma mi grid): `min(mu_blocks + col, max_blocks) >> ss`.18669 // luma mi grid): `min(mu_blocks + col, max_blocks) >> ss`.
18668 let unit_w = ((ch_col + 1) * 16).min(max_w_mi) >> ss_x(fctx);18670 let unit_w = ((ch_col + 1) * 16).min(max_w_mi) >> ss_x(fctx);
@@ -18675,7 +18677,7 @@ fn decode_block_128rect(
18675 // frame's 4x4 chroma units are where it becomes observable.18677 // frame's 4x4 chroma units are where it becomes observable.
18676 for plane_pass in 1..=2usize {18678 for plane_pass in 1..=2usize {
18677 for ci_row in 0..cn_h {18679 for ci_row in 0..cn_h {
18678- for ci_col in 0..cn_w {18680+ for ci_col in 0..cn {
18679 // The clamp strides are the CHUNK's chroma mi extent18681 // The clamp strides are the CHUNK's chroma mi extent
18680 // per axis: 16 luma mi >> the axis's own ss.18682 // per axis: 16 luma mi >> the axis's own ss.
18681 if ch_col * (16 >> ss_x(fctx)) + ci_col * stepc >= unit_w18683 if ch_col * (16 >> ss_x(fctx)) + ci_col * stepc >= unit_w
@@ -18683,8 +18685,8 @@ fn decode_block_128rect(
18683 {18685 {
18684 continue;18686 continue;
18685 }18687 }
18686- let cu_x = cpx + ch_col * chunk_cw + ci_col * chroma_tx;18688+ let cu_x = cpx + ch_col * (64 >> ss_x(fctx)) + ci_col * chroma_tx;
18687- let cu_y = cpy + ch_row * chunk_ch + ci_row * chroma_tx;18689+ let cu_y = cpy + ch_row * (64 >> ss_y(fctx)) + ci_row * chroma_tx;
18688 let cu_mi = (18690 let cu_mi = (
18689 mi_r + ch_row * 16 + ci_row * ((chroma_tx << ss_y(fctx)) / 4),18691 mi_r + ch_row * 16 + ci_row * ((chroma_tx << ss_y(fctx)) / 4),
18690 mi_c + ch_col * 16 + ci_col * ((chroma_tx << ss_x(fctx)) / 4),18692 mi_c + ch_col * 16 + ci_col * ((chroma_tx << ss_x(fctx)) / 4),
lanes/av1422bigblock.report.mdmodified+39 -8
@@ -95,8 +95,13 @@ PARTITION_NONE non-skip inter block carries all three causes; the oracle codes
95 pixels were right (the crop is ss-aware) — only inter prediction off the95 pixels were right (the crop is ss-aware) — only inter prediction off the
96 slot was wrong, so the bottom mu-chunk row predicted from a clamped row-6396 slot was wrong, so the bottom mu-chunk row predicted from a clamped row-63
97 edge (±1–2 diffs over chroma rows 64..127, 3.3–3.6k samples/plane). Fixed97 edge (±1–2 diffs over chroma rows 64..127, 3.3–3.6k samples/plane). Fixed
98- with a three-way length inference (`w*h` / `halfw*h` / `halfw*halfh` —98+ with a three-way length inference (`w*h` / `halfw*h` / `halfw*halfh`,
99- pairwise distinct for every w,h ≥ 1).99+ `halfw = (w+1)/2`, `halfh = (h+1)/2` — the three lengths are pairwise
100+ distinct for every w,h ≥ 1). DISCLOSED 4:2:0 edge: at ODD reference
101+ dimensions the half-width uses ceil (`(w+1)/2`, matching the picture
102+ crop's `round_ss`) where the old guess used floor (`w/2`) — ceil is the
103+ correct stored-crop shape and the change is visible only at odd w/h, which
104+ no committed fixture exercises.
100 105
101 After the fixes: `422_sb128_3f.obu` and the full `b422_wit.obu` decode106 After the fixes: `422_sb128_3f.obu` and the full `b422_wit.obu` decode
102 pixel-exact vs aomdec; every coefficient unit of every frame pairs107 pixel-exact vs aomdec; every coefficient unit of every frame pairs
@@ -119,10 +124,19 @@ intra 128-rect twin of the square-cut walk:
119 - `decode_block_128rect`'s chroma walk was chunk-square (`cn = 32/chroma_tx`,124 - `decode_block_128rect`'s chroma walk was chunk-square (`cn = 32/chroma_tx`,
120 `cu_y = cpy + ch_row*32`, clamp strides 8/8) with a `debug_assert!` that no125 `cu_y = cpy + ch_row*32`, clamp strides 8/8) with a `debug_assert!` that no
121 4:2:2 stream can satisfy. Fixed per-axis exactly like the inter walk126 4:2:2 stream can satisfy. Fixed per-axis exactly like the inter walk
122- (`cn_w/cn_h`, per-axis chunk offsets and clamp strides, `tu_reach_rect`,127+ (`tu_reach_rect`, `around_mi_rect`, per-axis record spans), in the SAME
123- `around_mi_rect`, per-axis record spans). 420/444 degenerate to the old128+ expression shape the already-reviewed 444 fix landed on lane-av1-444sb
124- values; 4:4:4's previously-broken (assert-caught) non-lossless 128-rect129+ (`349b3918`): `cn = ((64 >> ss_x)/chroma_tx).max(1)` for the width axis
125- chroma becomes correct as a side effect.130+ plus the added `cn_h = ((64 >> ss_y)/chroma_tx).max(1)` for the height
131+ axis, per-axis chunk offsets `(64 >> ss)` and clamp strides `(16 >> ss)` —
132+ at ss(0,0) the code reduces line-for-line to `349b3918`'s form, so the
133+ merge with that chain is a semantic union. DISCLOSED 4:4:4 behavior change:
134+ the parent's walk was provably broken at ss(0,0) (one unit per chunk instead
135+ of four; the stale assert caught it) and this rewrite, like `349b3918`,
136+ codes the four units — NOT byte-identical to parent at 4:4:4, by design,
137+ and pinned by `349b3918`'s own witness on the merged tree (see the identity
138+ section). DISCLOSED 4:2:0 identity: at ss(1,1) every new expression reduces
139+ to the old constant (32, offsets 32, strides 8, one unit).
126 140
127 Result: s2.obu decodes all 16 frames, no panic (`OK: 16 frames decoded,141 Result: s2.obu decodes all 16 frames, no panic (`OK: 16 frames decoded,
128 256x144`). The crash the charter assigned is closed. **Deferred (named for its142 256x144`). The crash the charter assigned is closed. **Deferred (named for its
@@ -142,8 +156,25 @@ unit 38, mi(12,24), TX_4X8, plane 2.
142 - `a_real_aomenc_10bit_inter_sequence_decodes_pixel_exact` — green.156 - `a_real_aomenc_10bit_inter_sequence_decodes_pixel_exact` — green.
143 - `a_real_aomenc_stream_with_two_tile_rows_decodes_through_decode_stream`157 - `a_real_aomenc_stream_with_two_tile_rows_decodes_through_decode_stream`
144 (live aomenc, 420, inter, tiles) — green.158 (live aomenc, 420, inter, tiles) — green.
145-- `a_lossless_sb128_rect_intra_block_decodes_sample_exact` (4:4:4 lossless159+- `a_lossless_sb128_rect_intra_block_decodes_sample_exact` — green. LABEL
146- sb128) — green.160+ CORRECTION (review finding 2): this stream is 4:2:0 (seq_profile 0 in the
161+ fixture bytes), NOT 4:4:4 as this report first claimed; it is a 4:2:0
162+ lossless sb128 gate and proves nothing about 4:4:4.
163+- 4:4:4 evidence, done properly: `444_sb128rect_lr_witness.obu` (sha256
164+ `27825e14…`, the lane-av1-444sb witness, 192x160 profile-1, 3 frames) was
165+ decoded on THIS tree (`OK: 3 frames decoded`) and its output is
166+ BYTE-IDENTICAL to the parent commit's output on the same stream — measured
167+ by stash-and-rebuild, all three frames — so the rewrite is proven
168+ output-neutral on it. The stream itself still diverges from aomdec on this
169+ ancestry, identically before and after the fix: this branch predates the
170+ 444 chain's chroma-context fixes (`9e77c16b` ss-aware chroma-above skip,
171+ `76f8c3fe`), the desync starts at frame-0 Y sample 128 (the first
172+ 128-column superblock) and the first 128-rect block never fires downstream
173+ of it, so `decode_block_128rect` codes no samples on this stream on this
174+ ancestry. `349b3918`'s own gate
175+ (`a_444_sb128_root_rect_stream_with_restoration_decodes_pixel_exact`,
176+ frames 0/1 byte-exact vs aomdec AND ffmpeg) is the merged-tree pin: at
177+ ss(0,0) this lane's walk reduces verbatim to that reviewed form.
147 - `a_128_root_block_with_a_real_residual_decodes_exact_through_both_decoders`178 - `a_128_root_block_with_a_real_residual_decodes_exact_through_both_decoders`
148 and `a_128_root_compound_block_decodes_exact_through_both_decoders` (solo,179 and `a_128_root_compound_block_decodes_exact_through_both_decoders` (solo,
149 they pin the process-global superblock size) — green.180 they pin the process-global superblock size) — green.