forge
Explore
Log in

Don't you dare go Hollow

A split 16x4/4x16 INTER strip's 8x4 var-tx leaf had no luma coefficient set (sub_tx_size_map[TX_16X4] = TX_8X4), reachable only after the general read_var_tx_size merge

Browse files at this commit

e73ab1307059b6e16ebc023765b23dc8d063dbccAhmet Kaan GümüşParent: e8291f8
  • fix
    • a split 16x4/4x16 INTER strip's 8x4 var-tx leaf had no luma coefficient set (sub_tx_size_map[TX_16X4] = TX_8X4), reachable only after the general read_var_tx_size merge
    • r2 report -- gate fires at 10-bit and is RED on pixels
Show full message
fix(av1): a split 16x4/4x16 INTER strip's 8x4 var-tx leaf had no luma coefficient set (sub_tx_size_map[TX_16X4] = TX_8X4), reachable only after the general read_var_tx_size merge; r2 report -- gate fires at 10-bit and is RED on pixels
crates/ec-av1/src/cdf_state.rsmodified+39 -0
@@ -243,6 +243,21 @@ pub(crate) enum TxbSet {
243 /// TX_16X16, so `av1_get_ext_tx_set_type` returns `EXT_TX_SET_ALL16` --243 /// TX_16X16, so `av1_get_ext_tx_set_type` returns `EXT_TX_SET_ALL16` --
244 /// sixteen symbols, `inter_tx_type_4_set1`.244 /// sixteen symbols, `inter_tx_type_4_set1`.
245 LumaRect16x4Inter1,245 LumaRect16x4Inter1,
246+ /// The luma 8x4/4x8 INTER transform unit a split 16x4/4x16 inter strip
247+ /// resolves to (`sub_tx_size_map[TX_16X4] == TX_8X4`, common_data.h:180).
248+ /// `get_txsize_entropy_ctx(TX_8X4)` ((`txsize_sqr_map` = TX_4X4 +
249+ /// `txsize_sqr_up_map` = TX_8X8 + 1) >> 1) is TX_8X8, so every coefficient
250+ /// table is [`Luma8`](TxbSet::Luma8)'s, except `eob_pt`: `av1_get_max_eob`
251+ /// is 32 positions, [`LumaRect4x8`](TxbSet::LumaRect4x8)'s alphabet. The
252+ /// `tx_type` row is `txsize_sqr_map[TX_8X4]` = TX_4X4 and
253+ /// `av1_get_ext_tx_set_type` with `tx_size_sqr_up == TX_8X8` under
254+ /// `reduced_tx_set` returns `EXT_TX_SET_DCT_IDTX` -- `inter_tx_type_4`,
255+ /// the INTER twin of `LumaRect4x8`.
256+ LumaRect8x4Inter,
257+ /// [`LumaRect8x4Inter`](TxbSet::LumaRect8x4Inter)'s `reduced_tx_set: false`
258+ /// counterpart: `tx_size_sqr` is TX_4X4, so `av1_get_ext_tx_set_type`
259+ /// returns `EXT_TX_SET_ALL16` -- sixteen symbols, `inter_tx_type_4_set1`.
260+ LumaRect8x4Inter1,
246 }261 }
247 262
248 /// The tables one transform block is coded with, borrowed from the state for263 /// The tables one transform block is coded with, borrowed from the state for
@@ -1901,6 +1916,30 @@ impl Cdfs {
1901 tx_type: Some(self.inter_tx_type_4_set1.as_mut_slice()),1916 tx_type: Some(self.inter_tx_type_4_set1.as_mut_slice()),
1902 eob_pt_class1: Some(&mut self.eob_pt_64_luma_class1),1917 eob_pt_class1: Some(&mut self.eob_pt_64_luma_class1),
1903 },1918 },
1919+ TxbSet::LumaRect8x4Inter => TxbTables {
1920+ side: 8,
1921+ txb_skip: &mut self.txb_skip_luma_8,
1922+ eob_pt: &mut self.eob_pt_32_luma,
1923+ eob_extra: &mut self.eob_extra_luma_8,
1924+ base: &mut self.base_luma_8,
1925+ base_eob: &mut self.base_eob_luma_8,
1926+ br: &mut self.br_luma_8,
1927+ dc_sign: &mut self.dc_sign_luma,
1928+ tx_type: Some(self.inter_tx_type_4.as_mut_slice()),
1929+ eob_pt_class1: Some(&mut self.eob_pt_32_luma_class1),
1930+ },
1931+ TxbSet::LumaRect8x4Inter1 => TxbTables {
1932+ side: 8,
1933+ txb_skip: &mut self.txb_skip_luma_8,
1934+ eob_pt: &mut self.eob_pt_32_luma,
1935+ eob_extra: &mut self.eob_extra_luma_8,
1936+ base: &mut self.base_luma_8,
1937+ base_eob: &mut self.base_eob_luma_8,
1938+ br: &mut self.br_luma_8,
1939+ dc_sign: &mut self.dc_sign_luma,
1940+ tx_type: Some(self.inter_tx_type_4_set1.as_mut_slice()),
1941+ eob_pt_class1: Some(&mut self.eob_pt_32_luma_class1),
1942+ },
1904 TxbSet::LumaRect16x8Inter => TxbTables {1943 TxbSet::LumaRect16x8Inter => TxbTables {
1905 side: 16,1944 side: 16,
1906 txb_skip: &mut self.txb_skip_luma_16,1945 txb_skip: &mut self.txb_skip_luma_16,
crates/ec-av1/src/decode.rsmodified+16 -0
@@ -6555,6 +6555,11 @@ fn decode_intra_rect_in_inter(
6555 v[depth.min(2)] += 1;6555 v[depth.min(2)] += 1;
6556 h.set(v);6556 h.set(v);
6557 });6557 });
6558+ if std::env::var_os("EC_SPLITSTRIP").is_some() {
6559+ eprintln!(
6560+ "EC_SPLITSTRIP mi_row={mi_r} mi_col={mi_c} bw={bw} bh={bh} depth={depth}"
6561+ );
6562+ }
6558 }6563 }
6559 let (tx_w, tx_h) = depth_to_tx_wh(bw, bh, depth);6564 let (tx_w, tx_h) = depth_to_tx_wh(bw, bh, depth);
6560 let modes = RectStripModes {6565 let modes = RectStripModes {
@@ -12040,6 +12045,17 @@ fn rect_inter_luma_set(w: usize, h: usize) -> TxbSet {
12040 TxbSet::LumaRect16x4Inter112045 TxbSet::LumaRect16x4Inter1
12041 }12046 }
12042 }12047 }
12048+ // lane-intrasplit r2: the leaf a SPLIT 16x4/4x16 inter strip resolves
12049+ // to -- libaom `sub_tx_size_map[TX_16X4] == TX_8X4` (common_data.h:180).
12050+ // Reachable only since lane-r14's general `read_var_tx_size`; before
12051+ // that merge the strip's split was refused by name.
12052+ (8, 4) | (4, 8) => {
12053+ if REDUCED_TX_SET_INTER.with(std::cell::Cell::get) {
12054+ TxbSet::LumaRect8x4Inter
12055+ } else {
12056+ TxbSet::LumaRect8x4Inter1
12057+ }
12058+ }
12043 (16, 8) | (8, 16) => {12059 (16, 8) | (8, 16) => {
12044 if REDUCED_TX_SET_INTER.with(std::cell::Cell::get) {12060 if REDUCED_TX_SET_INTER.with(std::cell::Cell::get) {
12045 TxbSet::LumaRect16x8Inter12061 TxbSet::LumaRect16x8Inter
lanes/intrasplit-r2.report.mdadded+90 -0
@@ -0,0 +1,90 @@
1+# lane-intrasplit r2 — RED (gate now FIRES at 10-bit and MISMATCHES; 8-bit arm still never fires)
2+
3+Base: 45bdc87 (r1) + main 48b35ab + lane-sqdrift 7d498c0 + lane-r14 b86eb38 +
4+lane-inter16ab 4811488 + lane-intra14 f4b5419 (live tips read with `git log`, NOT the
5+charter's stale `af7de9f`/`8313c4a`).
6+
7+## Merges (step 1)
8+- `git merge main` (48b35ab) — clean.
9+- `lane-sqdrift 7d498c0` — clean.
10+- `lane-r14 b86eb38` — conflict in `stream.rs`: git interleaved THREE different gates
11+ (the two no-CFL `uv_mode` gates from sqdrift/sbrect10 and r14's 64-axis 1:4 gate).
12+ Resolved by reconstructing each side's full test and keeping all three
13+ (`a_real_aomenc_inter_frame_with_a_64x64_intra_block_reads_the_no_cfl_uv_alphabet`,
14+ `a_real_aomenc_square_only_inter_sequence_with_a_64x64_intra_superblock_decodes_pixel_exact`,
15+ `real_aomenc_1to4_streams_decode_pixel_exact_and_rect_vartx_leaves_fire_before_a_named_refusal`).
16+- `lane-inter16ab 4811488` — clean.
17+- `lane-intra14 f4b5419` — conflicts in `decode_probe.rs` (kept both counter blocks),
18+ `refusal_inventory.rs` (kept intra14's NARROWED "an intra-coded 16x4/4x16 strip on the
19+ inter block path"; dropped both main's broad 1:4 line and intra14's copy of THIS lane's
20+ lifted split-tx refusal) and `decode.rs` (kept both thread-locals; kept both the
21+ sbrect10 `is_cfl_allowed` narrowing and intra14's `INTRA_IN_INTER_MODE` skip/mode split
22+ in `read_intra_mode_rect`, in that order).
23+- `crates/ec-av1/src/cdf.rs` is byte-identical to main (`git diff main -- cdf.rs` = 0 lines).
24+
25+## Fix this round (the merge cross-product the ledger predicted)
26+`crates/ec-av1/src/decode.rs` `rect_inter_luma_set` + `crates/ec-av1/src/cdf_state.rs`
27+`TxbSet::LumaRect8x4Inter{,Inter1}` — with lane-r14's general `read_var_tx_size` in, a
28+SPLIT 16x4/4x16 inter strip resolves to an 8x4 leaf (`sub_tx_size_map[TX_16X4] == TX_8X4`,
29+oracle `av1/common/common_data.h:180`) and hit `unreachable!("rect_inter_residual_supported
30+gates every shape that reaches here")`. The new set is `LumaRect4x8`'s coefficient tables
31+(`get_txsize_entropy_ctx(TX_8X4)` = TX_8X8, 32-position `eob_pt`) with the INTER `tx_type`
32+row `txsize_sqr_map[TX_8X4]` = TX_4X4 (`inter_tx_type_4` / `_set1`). No refusal was lifted
33+by this: `rect_inter_residual_supported` (the BLOCK-footprint gate) is untouched.
34+
35+EVIDENCE: $HOME/.cache/intrasplit-gate-r2b.log | temporary `(w={w} h={h})` in the
36+unreachable, gate arm re-run | panic message `... (w=8 h=4)`.
37+
38+## Gate result: RED
39+`cargo test -p ec-av1 --lib -- --test-threads=1 split_transform_intra_strip`
40+- 8-bit arm: 40/40 attempts still stop at OTHER lanes' named refusals — histogram
41+ non-skip rect strip residual 14, inter SB-level AB 8, split intra strip w/ 64x32 unit 4,
42+ non-DC chroma on 8x8 inter leaf 4, inter partition below 8x8 4, 32x64 unit 2, Golomb
43+ tail 2, angle delta on 8x8 intra leaf 1, intra 16x4 inside a 16-level 1:4 partition 1.
44+- 10-bit arm: **one attempt (seed 74, cq 12, cpu 2) now decodes all 8 frames and FIRES**
45+ (`depth1=1`) — and MISMATCHES ffmpeg: frame 1 Y first diff at (163, 58), 5203 samples;
46+ frames 2-7 ~24.5k each (drift). This is the first time this lane's lifted path was ever
47+ pixel-compared on a real stream.
48+
49+EVIDENCE: $HOME/.cache/intrasplit-gate-r2.log | 2 arms x 40 attempts, merged tree | 8-bit
50+0 firing / 40 refusals; 10-bit 1 firing attempt, frame 1 Y 5203 samples wrong.
51+
52+### What is known about the 10-bit mismatch (r3 starts here)
53+Stream pinned: `<scratchpad>/intrasplit/s74.obu`, md5 `50ea2b42423f1c8b4eed9fa48c4775a6`
54+(192x128 yuv420p10le, mandelbrot start_scale 3.08, cq 12 cpu-used 2, recipe = the gate's).
55+- The ONLY split-transform intra strip in the whole 8-frame stream is in decode-order
56+ frame 1 at `mi_row=8 mi_col=0 bw=32 bh=16 depth=1` (pixels x 0..31, y 32..47) — new
57+ env-gated print `EC_SPLITSTRIP=1` (decode.rs, next to the counter bump).
58+- Its own footprint is pixel-CLEAN in frame 1 (raster first diff is at (163, 58), i.e. the
59+ LAST block of the same 32-px block row), so the strip's coefficients and prediction are
60+ right and the divergence is downstream of it — either a symbol this arm reads/does not
61+ read after the strip, or another shape's defect in that block row.
62+- Not yet done: the msac RANGE ladder vs the instrumented aomdec. Our tags for frame 1
63+ are `EC_MODE`/`EC_MODE_VAL`/`EC_STACK` (`EC_TRACE_MODE=1`, 338 lines for the stream);
64+ aomdec's are `EC_IMODE*` for the key frame and `EC_MODE*`/`EC_MODE_MV`/`EC_STACK`
65+ (219 lines) — the two emitters do NOT line up 1:1 and need reconciling before diffing
66+ (compare RANGE, never tell()).
67+- Do NOT triage this with the probe's `-o` dump: `decode_probe` writes 8-bit samples for a
68+ 10-bit stream, so a byte compare against aomdec's `--rawvideo` output is meaningless
69+ (frame 0 reads as 22667 "diffs" although the gate proves it exact).
70+
71+## Film probes
72+EVIDENCE: <scratchpad>/intrasplit/{reelb1200,reelc1800}.obu | `decode_probe` with
73+EC_AV1_FINAL_DUMP=1 on the merged tree | new stop strings:
74+- 2160p10 HDR AV1 film, -ss 1200: `a split intra strip whose transform unit is 32x64`
75+ (was "a non-skip rectangular (HORZ/VERT/HORZ_B) strip needs rectangular residual
76+ coding" at r1) — 0 frames dumped.
77+- 1080p10 AV1 film, -ss 1800: `a COMPOUND_WEDGE mask on a rectangular inter block (the
78+ wedge codebook is square-only)` (was "an intra-coded 1:4 (or other non-2:1) rect strip
79+ on the inter block path" at r1, lifted by lane-intra14) — 0 frames dumped.
80+
81+## Suite
82+See `$HOME/.cache/intrasplit-suite-r2.log` (unit `intrasplit-suite-r2-*`, MemoryMax=10G).
83+
84+## Residue
85+- fix-now (r3): the 10-bit seed-74 mismatch above — the lane's own gate finally fires and
86+ is red; the refusal must NOT be considered lifted until it is green.
87+- deferred(lane owning 64-axis luma tables): the "split intra strip whose transform unit is
88+ 64x32 / 32x64" refusals — now the FIRST blocker on the 2160p film segment.
89+- deferred(other lanes): the 8-bit arm cannot fire until the non-skip rect-strip residual,
90+ inter SB-level AB and sub-8x8 inter refusals are lifted (14+8+4 of 40 attempts).