diff --git a/crates/ec-av1/src/decode.rs b/crates/ec-av1/src/decode.rs index ed9133aa..36145ad6 100644 --- a/crates/ec-av1/src/decode.rs +++ b/crates/ec-av1/src/decode.rs @@ -3975,6 +3975,33 @@ impl Neighbours { /// strip path ([`decode_leaf_rect`] took this override in r4; a 32x16 strip /// whose left neighbour was a 16x8 leaf still read the stale row and picked /// a different CDF for the same mode value). + /// lane-rectsplitx r2: availability-correct above/left luma modes for a + /// block whose top-left mi is `(mi_r, mi_c)`. libaom reads `above_mbmi` + /// only when `up_available` and `left_mbmi` only when `left_available`; + /// the coarse [`SUB`] bands cannot express that, and with 8-px strips they + /// actively lie -- four 32x8 strips of one `HORZ_4` share ONE 16x16 + /// `left_mode` cell, so the second strip at tile column 0 read the FIRST + /// strip's mode as its "left neighbour" (measured on the band fixture at + /// mi(10,0): mode 2 where libaom has DC, a different `kf_y_mode` row). + fn modes_above_left_mi( + &self, + mi_r: usize, + mi_c: usize, + fallback: (usize, usize), + ) -> (usize, usize) { + let above = if mi_r > self.tile_row0_mi { + self.mode_above_mi(mi_r, mi_c).unwrap_or(fallback.0) + } else { + DC_PRED + }; + let left = if mi_c > self.tile_col0_mi { + self.mode_left_mi(mi_r, mi_c).unwrap_or(fallback.1) + } else { + DC_PRED + }; + (above, left) + } + fn modes_above_left(&self, r: usize, c: usize) -> (usize, usize) { let (mi_r, mi_c) = (r * (SUB / MI), c * (SUB / MI)); let above = self.mode_above_mi(mi_r, mi_c).unwrap_or(self.above_mode[c]); @@ -4892,12 +4919,6 @@ fn decode_rect_split( // 32-level 1:4 band fixture (8-bit, cq 12, seed 42). The tables and the // per-unit rect walk stay wired above/below; the round that finds that // defect deletes this refusal and nothing else. - if tx_w != tx_h { - return Err(unsupported(format!( - "a split intra strip whose transform unit is the rect {tx_w}x{tx_h} (the depth-1 \ - step of a 1:4 strip; measured wrong pixels, refused rather than shipped)" - ))); - } let luma_set = txbset_for(tx_w.min(tx_h), reduced_tx_set); let luma_scan = default_scan(tx_w.min(tx_h)); let zero_tu = vec![0i32; tx_w * tx_h]; @@ -5572,12 +5593,12 @@ fn decode_leaf_rect( // cannot hold the modes a split (or a pair of strips) leaves behind, so // when the map holds the block at exactly this strip's above/left mi it // is the neighbour libaom's `above_mi`/`left_mi` reads. - if let Some(m) = neighbours.mode_above_mi(leaf_mi.0, leaf_mi.1) { - above_mode = m; - } - if let Some(m) = neighbours.mode_left_mi(leaf_mi.0, leaf_mi.1) { - left_mode = m; - } + // lane-rectsplitx r2 (same class as the 1:4 fix): mi-exact AND + // availability-correct -- four 16x8 strips share one coarse 16x16 + // `left_mode` cell too, so the fallback must not stand in for an absent + // tile-edge neighbour. + let (above_mode, left_mode) = + neighbours.modes_above_left_mi(leaf_mi.0, leaf_mi.1, (above_mode, left_mode)); let smooth_neighbor = is_smooth_mode(above_mode) || is_smooth_mode(left_mode); if smooth_neighbor { @@ -5813,6 +5834,12 @@ fn decode_block_rect4( left_mode = pmode; } } + // lane-rectsplitx r2, ROOT CAUSE of the 1:4 mismatch: mi-exact + + // availability-correct neighbour modes (see + // [`Neighbours::modes_above_left_mi`]). The coarse 16x16 bands alias every + // 8-px strip of a `HORZ_4`/`VERT_4` onto one cell. + let (above_mode, left_mode) = + neighbours.modes_above_left_mi(mi_r, mi_c, (above_mode, left_mode)); let (skip, mode, angle_delta_y, uv_mode, angle_delta_uv, alpha, filter_intra) = read_intra_mode_rect( dec, @@ -5832,8 +5859,13 @@ fn decode_block_rect4( if smooth_neighbor { SMOOTH_LUMA_HITS.with(|c| c.set(c.get() + 1)); } - let smooth_neighbor_uv = - neighbours.smooth_uv_neighbour(r * (SUB / MI), c * (SUB / MI), r, c); + // lane-rectsplitx r2: this strip's REAL mi, not the [`SUB`] cell's + // top-left -- a 1:4 strip starts 8 px into a 16-px cell, so + // `r * (SUB / MI)` names a different mi column and the chroma + // edge-filter strength was read from the wrong neighbour (measured: + // seed 43, the last 8x32 strip at luma (152,32), chroma-only mismatch + // with luma bit-exact). + let smooth_neighbor_uv = neighbours.smooth_uv_neighbour(mi_r, mi_c, r, c); if filter_intra.is_some() { FILTER_INTRA_RECT_HITS.with(|c| c.set(c.get() + 1)); } @@ -5856,20 +5888,11 @@ fn decode_block_rect4( // both interleave in every real stream. TX_DEPTH_HITS.with(|c| c.set(c.get() + 1)); let (tx_w, tx_h) = depth_to_tx_wh(bw, bh, depth); - // lane-rectsplitx r1 MEASURED (gate below, 8-bit band fixture, cq - // 12..28): depth 1 -- the 2:1 RECT unit -- fires FIRST in every - // attempt that splits at all, and its per-unit walk mismatched - // ffmpeg, so no attempt ever reaches a pixel-compared depth-2 strip. - // A depth-2-only lift is therefore ungatable (the handoff predicted - // exactly this: the two depths interleave and must land together), - // and an ungated lift is not a lift -- both refuse by name until the - // rect-unit defect is found. - if tx_w != tx_h { - return Err(unsupported(format!( - "a 32x32-level 1:4 strip with a split transform (per-unit 4:1 prediction is \ - not ported, depth={depth})" - ))); - } + // lane-rectsplitx r2: both depths ship together, as the r1 handoff + // predicted -- depth 1 fires FIRST in every attempt that splits at + // all, so a depth-2-only lift could never be gated. The r1 mismatch + // was never the rect unit: it was the neighbour MODE the strip reads + // (see `modes_above_left_mi`). let which = if depth == 1 { &RECT4_SPLIT_DEPTH1_HITS } else { @@ -5928,6 +5951,14 @@ fn decode_block_rect4( neighbours.left_uv_mode[r + cell] = uv_predict_mode; neighbours.left_side[r + cell] = bh; } + // ...and the mi-EXACT maps the coarse cells alias away, exactly as + // [`decode_leaf_rect`] does (the split arm above records these through + // `record_mi_luma_rect`). Without this an unsplit 32x8 strip left + // `sub8_mode_row` holding the previous block, and the next 32x32's + // strips read a stale `kf_y_mode` row (measured: mi(4,8) on the band + // fixture). + neighbours.record_mode_mi(mi_r, mi_c, mi_w, mi_h, mode); + neighbours.record_uv_mode_mi(mi_r, mi_c, mi_w, mi_h, uv_predict_mode); let (px, py) = (mi_c * MI, mi_r * MI); let (cpx, cpy) = (px / 2, py / 2); let (chroma_w, chroma_h) = (bw / 2, bh / 2); @@ -7878,12 +7909,12 @@ fn decode_leaf8( // `prev_leaf`: one 16x16 slot cannot hold the two different modes its // two 8x8 (or four 4x4) columns leave behind, so a leaf whose above/left // neighbour sits in a split cell read the wrong `kf_y_mode` row. - if let Some(m) = neighbours.mode_above_mi(leaf_mi.0, leaf_mi.1) { - above_mode = m; - } - if let Some(m) = neighbours.mode_left_mi(leaf_mi.0, leaf_mi.1) { - left_mode = m; - } + // lane-rectsplitx r2 swept this arm into + // [`Neighbours::modes_above_left_mi`]: the mi-exact map ALSO has to answer + // "no neighbour" at a tile edge, where the coarse cell holds the block + // above/left of it inside the same 16x16. + let (above_mode, left_mode) = + neighbours.modes_above_left_mi(leaf_mi.0, leaf_mi.1, (above_mode, left_mode)); let smooth_neighbor = is_smooth_mode(above_mode) || is_smooth_mode(left_mode); // Chroma's edge-filter type reads the CHROMA neighbour's `uv_mode` // (`get_intra_edge_filter_type`, reconintra.c:974), never the luma mode diff --git a/crates/ec-av1/src/refusal_inventory.rs b/crates/ec-av1/src/refusal_inventory.rs index 35211016..ce71ee0f 100644 --- a/crates/ec-av1/src/refusal_inventory.rs +++ b/crates/ec-av1/src/refusal_inventory.rs @@ -34,13 +34,11 @@ const REFUSALS: &[&str] = &[ "a coded (non-skip) HORZ_B/VERT_B rect strip below 16x16 (this decoder ports only the skip case at this size)", "a coded HORZ/VERT strip whose chroma transform has no rect coefficient tables here", "a split intra strip whose transform unit is {tx_w}x{tx_h} (no luma coefficient tables for that shape here)", - "a split intra strip whose transform unit is the rect {tx_w}x{tx_h} (the depth-1 step of a 1:4 strip; measured wrong pixels, refused rather than shipped)", "a HORZ_A/HORZ_B/VERT_A partition below 16x16 (this decoder codes only the square arms, HORZ, VERT, VERT_B, and a clean split below 16x16)", "an inter partition below 8x8 (this decoder codes no inter leaf smaller than 8x8; lane-sub8 scoped to intra)", "a 16x16 block whose true edge cuts through both axes needs a rectangular transform this decoder does not code yet", "a 16x16 inter block whose true edge cuts through both axes needs a rectangular transform this decoder does not code yet", "a 32x32 partition type this decoder does not code (value={part32})", - "a 32x32-level 1:4 strip with a split transform (per-unit 4:1 prediction is not ported, depth={depth})", "a Golomb tail longer than this decoder reads", "a tx_type symbol outside its CDF's own set: {t}", "an INTER 32x32 partition type this decoder does not code (value={part32})", diff --git a/crates/ec-av1/src/stream.rs b/crates/ec-av1/src/stream.rs index d30f0b22..c1cb6fff 100644 --- a/crates/ec-av1/src/stream.rs +++ b/crates/ec-av1/src/stream.rs @@ -11697,7 +11697,7 @@ mod tests { /// `encode::tests::every_rect_shape_reaches_what_libaom_says_over_the_whole_superblock` /// against libaom's own `has_tr_*`/`has_bl_*` arrays. #[test] - #[ignore = "lane-rectsplitx r1: the sub16 split-transform refusal is lifted and the stream now decodes, but seed 700 cq 45 mismatches ffmpeg on LUMA with 4 strips and 0 of them reaching -- a defect that refusal was hiding, not this gate's own subject"] + #[ignore = "lane-rectsplitx r2 (re-measured after the neighbour-mode fix): every seed 700..739 attempt now stops at another lane's refusal 'a HORZ_A/HORZ_B/VERT_A partition below 16x16', so the gate reaches no strip at all -- blocked on AB partitions below 16x16, not on this lane"] fn a_directional_16x8_strip_reads_the_right_above_right_samples() { const NAME: &str = "a_directional_16x8_strip_reads_the_right_above_right_samples"; if !have_ffmpeg() { @@ -14960,7 +14960,7 @@ mod tests { /// arm's 10-bit encode is a different stream, so they are a widening, not /// a measured firing set for this recipe -- the round that un-ignores /// this gate must re-measure which 10-bit seeds fire it). - #[ignore = "lane-rectsplitx r1: the sub16 split-transform refusal is lifted (the pinned 16x8 fixture now decodes its whole frame pixel-exact), but seed 55 mismatches ffmpeg on the U plane -- a chroma defect that refusal was hiding, open"] + #[ignore = "lane-rectsplitx r2 (re-measured after the neighbour-mode fix): still a CHROMA-only defect behind the lifted split refusal -- 10-bit seed 49 frame 0 plane V first diff at row 4 col 60, ours 510 vs ffmpeg 509, filter_intra_rect_sub16_hits=2; sub-16 filter-intra chroma prediction, open"] #[test] fn a_real_aomenc_10bit_filter_intra_on_a_sub16_strip_decodes_pixel_exact() { const NAME: &str = "a_real_aomenc_10bit_filter_intra_on_a_sub16_strip_decodes_pixel_exact"; @@ -15104,7 +15104,7 @@ mod tests { /// itself is pinned by /// [`a_pinned_aomenc_16x8_strip_reads_its_use_filter_intra_flag`], whose /// `expect_err` must become a pixel compare in that same round. - #[ignore = "lane-rectsplitx r1: the sub16 split-transform refusal is lifted (the pinned 16x8 fixture now decodes its whole frame pixel-exact), but seed 55 mismatches ffmpeg on the U plane -- a chroma defect that refusal was hiding, open"] + #[ignore = "lane-rectsplitx r2 (re-measured after the neighbour-mode fix): still a CHROMA-only defect behind the lifted split refusal -- 10-bit seed 49 frame 0 plane V first diff at row 4 col 60, ours 510 vs ffmpeg 509, filter_intra_rect_sub16_hits=2; sub-16 filter-intra chroma prediction, open"] #[test] fn a_real_aomenc_stream_with_filter_intra_on_a_sub16_horz_vert_strip_decodes_pixel_exact() { const NAME: &str = @@ -16402,19 +16402,16 @@ mod tests { // have fired inside an attempt that then compared pixel-exact // (class counter-from-refused-stream -- a global counter would // count strips of attempts that later refused). - // depth 2 (square TX_8X8 units) is what this round ported and what - // the ReelB extract needed; depth 1 (the 2:1 rect unit) is - // refused by name, so it can only show up here as a refusal. - // Both 1:4 split depths are refused by name (the rect-unit - // measurement above), so these counters are REPORTED, never - // asserted: the tx-size-search half of the window exists to keep - // that refusal honest -- the attempts must refuse, never mismatch. - assert_eq!( - depth1_proved + depth2_proved, - 0, - "{NAME}: {bit_depth}-bit: a 1:4 split-transform strip decoded \ - (depth1={depth1_proved}, depth2={depth2_proved}) although both depths are \ - refused -- the refusal above is dead" + // lane-rectsplitx r2: BOTH depths are now decoded, so both are + // HARD-asserted -- depth 1 is the 2:1 rect unit + // (`sub_tx_size_map[TX_32X8] == TX_16X8`), depth 2 the square + // TX_8X8, and they interleave across the window; a run that only + // reached one of them proves half the walk. + assert!( + depth1_proved > 0 && depth2_proved > 0, + "{NAME}: {bit_depth}-bit: a 1:4 split-transform depth never fired inside a \ + pixel-exact attempt (depth1={depth1_proved}, depth2={depth2_proved}) -- the \ + tx-size-search half of the window proved nothing" ); eprintln!( "{NAME}: {bit_depth}-bit split-transform 1:4 strips: depth1={depth1_proved}, \ diff --git a/lanes/COMMON-20260901.md b/lanes/COMMON-20260901.md index 6da7ff3d..07c3a305 100644 --- a/lanes/COMMON-20260901.md +++ b/lanes/COMMON-20260901.md @@ -89,3 +89,14 @@ NEVER wait with a foreground `until/while ... sleep` loop or `tail --pid`. ## NEVER pkill BY BINARY NAME (2026-09-02: one lane's `pkill -f ec_av1-` killed another lane's suite) The test binary hash is identical across worktrees. Kill only by PID you own (`$!`, or the systemd unit name you started). `pkill -f`/`killall` on cargo/ec_av1 patterns is forbidden. + +## NEVER `cargo fmt` IN A LANE (3 lanes lost their diffs to it on 2026-09-02) +main is not rustfmt-clean (~6000 lines of churn). Hand-indent; `cargo test --no-run` is the check. +If you ran it: extract your own hunks, `git checkout -- crates/`, re-apply. + +## MEMORY (user order 2026-09-02: an unsteady box fails the job) +30 GB box shared by ~10 agents. Every decode/encode/probe invocation runs under +`systemd-run --user --scope -q -p MemoryMax=6G `; suites under a unit with `-p MemoryMax=10G`; +never two suites per lane; film extracts ≤2 s; a watchdog (`ec-memwatch` user unit, log +`$HOME/.cache/ec-memwatch.log`) SIGKILLs any codec/test process above 6 GiB RSS or the largest one +when MemAvailable < 3 GiB — a killed run means YOUR command exceeded the budget: bound it, do not retry as-is.