diff --git a/crates/ec-av1/src/decode.rs b/crates/ec-av1/src/decode.rs index 73921411..3b237b97 100644 --- a/crates/ec-av1/src/decode.rs +++ b/crates/ec-av1/src/decode.rs @@ -6938,7 +6938,10 @@ fn decode_rect_split( // first 50 frame OBUs of the 10-bit 3840x1608 stream's head decode // all 33 frames pixel-exact against ffmpeg while this arm fires 90x // 64x32 + 5x 32x64 -- pinned as `fixtures/reelb_rect64_intra16x4_witness.obu` - // and gated by `a_10bit_film_frames_with_intra_16x4_strips_and_rect64_corner_tus_decode_pixel_exact`. + // and gated by `a_10bit_film_frames_with_rect64_corner_tus_decode_pixel_exact`. + // lane-wit16x4 r1 re-measured that fixture on the merged tip: this arm + // fires 64x32=148 32x64=123 (the 90/5 above were counted out of the + // frame-33 desync lane-frame36 r2 fixed), all 33 frames pixel-exact. (64, 32) | (32, 64) => None, _ => { return Err(unsupported(format!( @@ -22082,13 +22085,35 @@ fn decode_inter_block( // the first 50 frame OBUs of the 10-bit 3840x1608 stream's head decode // all 33 frames pixel-exact while this arm fires 31x 16x4 + 17x 4x16 // (23 of them chroma-paired). Pinned as - // `fixtures/reelb_rect64_intra16x4_witness.obu`, gated by - // `a_10bit_film_frames_with_intra_16x4_strips_and_rect64_corner_tus_decode_pixel_exact`. + // `fixtures/reelb_rect64_intra16x4_witness.obu` -- MEASURED WRONG, see + // the lane-wit16x4 note below. // The refusal below is NARROWED, not deleted: it still stands for a // 16x4/4x16 strip with no chroma-pair record and for every other // sub-8 shape. + // + // lane-wit16x4 r1: RE-WIDENED to the whole shape, because r3's witness + // was a PHANTOM (class `counter-from-refused-stream`): the pinned + // fixture was measured while decode-order frame 33 was desynced, and + // on the merged tip (lane-frame36 r2 fixed that desync) the very same + // fixture decodes all 33 frames pixel-exact with `intra16x4_in_inter` + // 16x4=0 4x16=0 chroma_ref=0 -- the 31/17/23 were counted out of a + // wrong decode. Re-measured this round: NO stream anywhere decodes + // exactly while this arm fires. Two 2 s 10-bit film cuts (3840x1608 at + // 0 s: OK, 48 frames exact, 0 hits; at 300 s: 138/559 hits but frames + // 1 and 2 mismatch ffmpeg by 14105680 / 12470780 bytes), four 1920x792 + // 128-SB cuts (hits only inside frames that refuse or are never shown + // -- the 6300 s cut's key frame is exact with 0 hits and its no-show + // frame 1 carries 169/445 with no display frame reachable before the + // 128x64-intra-on-inter refusal), and the aomenc gate + // `a_real_aomenc_inter_sequence_with_intra_16x4_strips_in_1to4_partitions_decodes_pixel_exact` + // (run `--include-ignored` on this tip: FAILED, 0 pixel-exact attempts + // carrying the strip, per-arm [0, 0, 0]). A lifted refusal with no + // witness is a capability claim (class `refusal-lifted-without-a-gate`), + // so the decode path stays behind `EC_INTRA16X4_DECODE` for the round + // that finds a witness. let strip16 = strip_chroma .filter(|_| write_w.min(write_h) == 4 && write_w.max(write_h) == 16) + .filter(|_| std::env::var_os("EC_INTRA16X4_DECODE").is_some()) .map(|s| (s.horz, s.has_chroma)); if write_w.min(write_h) < 8 && strip16.is_none() { if std::env::var_os("EC_INTRA16X4").is_some() { diff --git a/crates/ec-av1/src/refusal_inventory.rs b/crates/ec-av1/src/refusal_inventory.rs index 89f27916..3e834aa9 100644 --- a/crates/ec-av1/src/refusal_inventory.rs +++ b/crates/ec-av1/src/refusal_inventory.rs @@ -85,6 +85,12 @@ const REFUSALS: &[&str] = &[ // r2 residue: `decode_intra_rect_in_inter` codes chroma at the strip's own // halved footprint, which for a 16x4 strip is an 8x2 transform libaom // never wrote (its chroma is the PAIR's 8x4, coded by the odd strip). + // lane-sub8x4 r3 narrowed this to "a strip with no chroma-pair record"; + // lane-wit16x4 r1 put it back at FULL width: r3's witness counters were + // phantoms of a desync, no stream on this tree decodes pixel-exact while + // the arm fires, and the decode path now needs `EC_INTRA16X4_DECODE` + // (class `refusal-lifted-without-a-gate`; numbers in decode.rs's `strip16` + // note and lanes/wit16x4-r1.report.md). "an intra 16x4/4x16 strip inside an inter 16x16-level 1:4 partition (its 4:2:0 chroma pair is coded once for two strips; only the inter path implements that pairing)", "an intra mode this decoder does not code (round 2)", // lane-intrarect r1 lifted the whole-shape refusal that stood here (the diff --git a/crates/ec-av1/src/stream.rs b/crates/ec-av1/src/stream.rs index 19870506..c9f9bd16 100644 --- a/crates/ec-av1/src/stream.rs +++ b/crates/ec-av1/src/stream.rs @@ -11170,14 +11170,18 @@ mod tests { #[test] - #[ignore = "RED at lane-intra16x4 r2, but NOT on this lane's shape: the r2 OBMC \ - pair-merge fix makes the decode entropy-exact through the intra 16x4 strips \ - (620/620 all_zero symbols match aomdec, value and range), and the new arm 4 \ - (bar_h, cq63, --min-partition-size=8, 192x128, 5 strips) decodes 6 frames \ - bit-exact vs ffmpeg outside the harness. Attempt 0 (noise, cq60, 128x128) \ - still mismatches from (122, 13) -- 99 rows ABOVE its first strip, measured in \ - r1 as another shape's defect -- and panics before arm 4 runs. Un-ignore once \ - attempt 0's defect is owned -- lanes/intra16x4-r2.handoff.md"] + #[ignore = "RED, RE-MEASURED lane-wit16x4 r1 on the merged tip (with sub-8x8 intra, \ + the mvstack/OBMC and the lane-frame36 r2 txfm-band fixes all in): \ + `cargo test -p ec-av1 --lib ..._1to4_partitions -- --include-ignored` \ + FAILS at stream.rs's arm assert with `0 named refusals, 0 pixel-exact \ + attempts carrying an intra 1:4 strip, per-arm attempts \ + 16x4/4x16/chroma-reference=[0, 0, 0], 2 attempts carried none (2 of them \ + mismatched)`; attempts 1..3 mismatch ffmpeg from frame 1 or 2 (max |delta| \ + up to 248) and attempts 0/4 mismatch while carrying NO 1:4 strip at all -- \ + another shape's defect, unchanged since r2. The 16x4/4x16-in-inter refusal \ + is re-added this round, so the shape now refuses by name unless \ + `EC_INTRA16X4_DECODE` is set: un-ignore only together with a witness \ + (lanes/wit16x4-r1.report.md)"] // lane-intra16x4 r1: an INTRA-coded 16x4 / 4x16 strip inside an INTER // frame's 16x16-level 1:4 partition -- the wall all six of his film cuts // stopped at once lane-rectres landed. The shape's chroma is the pair's: @@ -30028,7 +30032,26 @@ mod tests { /// lane-sub8x4 r3: un-`#[ignore]`d. The sibling refusal it waited on (the /// un-split TX_64X32/TX_32X64 corner unit) is lifted in this round, so the /// frame this gate exists for now finishes. + /// + /// lane-wit16x4 r1, MEASURED: this gate is blind to the frame it counts + /// (class `gate-blind-to-hidden-frames`). The fixture has two frame OBUs + /// and ONE shown frame, and `decode_probe` on the fixture truncated to its + /// first frame OBU reads `intra_rect4_in_inter 0/0/0/0` and + /// `intra16x4_in_inter 0/0/0` while matching ffmpeg exactly -- so all of + /// 4/23/28/72 (and the 4 intra 16x4 strips with them) live in the SECOND, + /// NO-SHOW frame, whose pixels ffmpeg never emits and this gate never + /// compares. Since that hidden frame also carries the intra 16x4/4x16 + /// strip whose refusal this round re-adds (no stream anywhere decodes + /// pixel-exact while that arm fires -- lanes/wit16x4-r1.report.md), the + /// decode now stops by name here. Un-`#[ignore]` it together with the + /// witness: a prefix of the same film whose LATER frame displays this ARF + /// makes both counters pixel-backed at once. #[test] + #[ignore = "lane-wit16x4 r1: every strip this gate counts is in the fixture's NO-SHOW \ + second frame (truncated to one frame OBU the counters read 0/0/0/0 and the \ + shown frame is exact), and that frame now stops at the re-added intra \ + 16x4/4x16-in-inter refusal -- needs a prefix that DISPLAYS the frame, \ + lanes/wit16x4-r1.report.md"] fn a_10bit_film_inter_frame_with_intra_1to4_strips_decodes_pixel_exact() { const NAME: &str = "a_10bit_film_inter_frame_with_intra_1to4_strips_decodes_pixel_exact"; if !have_ffmpeg() { @@ -30080,35 +30103,39 @@ mod tests { eprintln!("{NAME}: {fired} intra 1:4 strips in an inter frame, the shown frame pixel-exact"); } - /// lane-sub8x4 r3: the FILM witness that lifts BOTH the intra 16x4/4x16 - /// strip inside an inter 16x16-level 1:4 partition and the un-split + /// lane-sub8x4 r3 / lane-wit16x4 r1: the FILM witness for the un-split /// TX_64X32/TX_32X64 corner unit of a split intra strip. /// + /// r3 wrote this gate as a witness for TWO arms; its intra 16x4/4x16 + /// numbers were PHANTOMS (class `counter-from-refused-stream`), counted + /// while decode-order frame 33 of this very prefix was desynced. On the + /// merged tip (lane-frame36 r2 fixed that desync) the fixture decodes all + /// 33 frames pixel-exact and `intra16x4_in_inter` reads 0/0/0, so the gate + /// panicked "the intra 16x4/4x16 strip arm did not fire". lane-wit16x4 r1 + /// re-measured every counter, split the claim, and re-added the + /// 16x4/4x16-in-inter refusal (no stream on this tree decodes exactly + /// while that arm fires -- see the note at `decode.rs`'s `strip16`). + /// /// `crates/ec-av1/fixtures/reelb_rect64_intra16x4_witness.obu`, 23472 bytes, /// sha256 `c9e721088766163b9dbeb9fa8dd8b257ff0ec7f9157fc350de4d3c33cd9ec4e4`: /// the first 50 frame-carrying OBUs of `ffmpeg -ss 0 -t 2 -i <3840x1608 /// 10-bit AV1 HDR10 mkv> -c:v copy -f obu`, cut twice from independent /// ffmpeg runs that hashed identically. 33 decode-order frames. /// - /// MEASURED, and why no earlier round had this: r1/r2 of two lanes - /// reported "no firing witness exists" because every film frame that fires - /// these two arms ALSO carries a sub-8x8 intra leaf, which refused until - /// this lane's r2 lifted it. On that tip the whole 33-frame prefix decodes - /// with no refusal and matches ffmpeg on every plane of every frame, while - /// both arms fire: `intra16x4_in_inter` 16x4=31 4x16=17 chroma_ref=23 and - /// `rect64_corner_tu` 64x32=90 32x64=5. (The full 48-frame 2 s segment - /// diverges at decode-order frame 36, which is a separate wall; the - /// fixture is the exact prefix, not a truncation chosen to hide it.) + /// MEASURED on the merged tip (`decode_probe`, EC_PROBE_OUT16 vs + /// `ffmpeg -pix_fmt yuv420p10le`): all 33 frames 0 differing bytes, and + /// `rect64_corner_tu` fires 64x32=148 32x64=123 (r3's 90/5 came out of the + /// desynced decode). `intra16x4_in_inter` reads 0/0/0 here and is asserted + /// as such -- if a later change makes that arm fire on this stream, the + /// refusal that now guards it moved and this gate says so. /// - /// Both refusal strings stay in `refusal_inventory` because both are - /// NARROWED, not deleted: "a split intra strip whose transform unit is - /// {tx_w}x{tx_h}" still stands for every shape other than 64x32/32x64, and - /// "an intra 16x4/4x16 strip inside an inter 16x16-level 1:4 partition" - /// still stands for a strip with no chroma-pair record. + /// Refusal strings: "a split intra strip whose transform unit is + /// {tx_w}x{tx_h}" stays NARROWED (every shape other than 64x32/32x64 -- + /// that is what this gate lifts), and "an intra 16x4/4x16 strip inside an + /// inter 16x16-level 1:4 partition" is back to its FULL width. #[test] - fn a_10bit_film_frames_with_intra_16x4_strips_and_rect64_corner_tus_decode_pixel_exact() { - const NAME: &str = - "a_10bit_film_frames_with_intra_16x4_strips_and_rect64_corner_tus_decode_pixel_exact"; + fn a_10bit_film_frames_with_rect64_corner_tus_decode_pixel_exact() { + const NAME: &str = "a_10bit_film_frames_with_rect64_corner_tus_decode_pixel_exact"; if !have_ffmpeg() { eprintln!("SKIP {NAME}: no ffmpeg"); return; @@ -30137,14 +30164,14 @@ mod tests { crate::decode::rect64_corner_tu_hits(0) - before64.0, crate::decode::rect64_corner_tu_hits(1) - before64.1, ); - // Hard counter asserts: neither lift may rest on a stream that stopped + // Hard counter asserts: the lift may not rest on a stream that stopped // carrying its shape (class `tool-disabled-in-every-gate`). - assert!( - fired16.0 > 0 && fired16.1 > 0 && fired16.2 > 0, - "{NAME}: the intra 16x4/4x16 strip arm did not fire (16x4={} 4x16={} chroma_ref={})", - fired16.0, - fired16.1, - fired16.2 + assert_eq!( + fired16, + (0, 0, 0), + "{NAME}: this stream carries NO intra 16x4/4x16 strip in an inter 1:4 \ + partition (r3's 31/17/23 were phantoms of the frame-33 desync); a \ + non-zero count here means the refusal guarding that arm moved" ); assert!( fired64.0 > 0 && fired64.1 > 0, @@ -30168,9 +30195,9 @@ mod tests { assert_eq!(ours.v, theirs.v, "{NAME}: frame {i} V vs ffmpeg"); } eprintln!( - "{NAME}: 33 frames pixel-exact, intra16x4_in_inter 16x4={} 4x16={} chroma_ref={}, \ - rect64_corner_tu 64x32={} 32x64={}", - fired16.0, fired16.1, fired16.2, fired64.0, fired64.1 + "{NAME}: 33 frames pixel-exact, rect64_corner_tu 64x32={} 32x64={} \ + (intra16x4_in_inter {} {} {}, refused shape)", + fired64.0, fired64.1, fired16.0, fired16.1, fired16.2 ); } diff --git a/lanes/wit16x4-r1.report.md b/lanes/wit16x4-r1.report.md new file mode 100644 index 00000000..30c3b750 --- /dev/null +++ b/lanes/wit16x4-r1.report.md @@ -0,0 +1,111 @@ +# lane-wit16x4 r1 report (branch `lane-wit16x4`, off main 5d81a67) + +## Verdict + +The intra 16x4/4x16-in-inter lift had NO witness. The refusal is RE-ADDED +(narrow: only that shape, on the inter path, behind `EC_INTRA16X4_DECODE`). +The film gate is split and kept as the rect64 corner-TU witness only. + +## 1. The pinned fixture, re-measured on this tree + +`crates/ec-av1/fixtures/reelb_rect64_intra16x4_witness.obu` (10-bit 3840x1608, +33 decode-order frames), `decode_probe`: + +``` +OK: 33 frames decoded, 3840x1608 diff vs ffmpeg: all 33 frames 0 bytes +rect64_corner_tu: 64x32=148 32x64=123 (r3 claimed 90 / 5) +intra16x4_in_inter: 16x4=0 4x16=0 chroma_ref=0 (r3 claimed 31 / 17 / 23) +intra_rect4_in_inter: 64x16=24 16x64=28 32x8=0 8x32=0 +inter_rect: 64x32=1996 32x64=152 64x16=24 16x64=28 +inter_edge_strip: h64=1822 v64=0 h32=279 v32=0 h16=59 v16=0 +rect_inter: tu=429 txsplit=0 obmc_leaf=4 +sub8_intra_rect: 0/0/0/0/0 inter16_1to4: 0/0/0/0 +vartx_rect_leaf: 0/0 vartx_rect_leaf4: 0/0 rect32x8_inter_tu: 0/0 +cdef_band: rect_skip_writes=1797 mixed_skip_units=0 rect_intrabc_reads: 0 +``` + +So r3's two hard asserts were both wrong numbers off a desynced decode +(class `counter-from-refused-stream`): the rect64 arm fires ~1.7x more than +claimed, and the intra-16x4 arm does not fire at all. + +## 2. Witness hunt for intra 16x4/4x16 in an inter 1:4 partition -- NONE + +| stream | decode | intra16x4 16x4/4x16/chroma_ref | pixel | +|---|---|---|---| +| 2 s 10-bit 3840x1608 head cut | OK, 48 frames | 0 / 0 / 0 | (exact, frame36 r2) | +| same title, 300 s cut | REFUSED (Golomb tail), 8 frames | 158 / 603 / 379 | truncated to its 8 frames: 3 shown, frame 0 exact, frames 1/2 differ by 14105680 / 12470780 bytes -> counters are phantoms | +| 1920x792 128-SB cut @900 s | REFUSED (128x64 intra on inter path) after 1 frame | 58 / 68 / 64 | only the key frame decodes; no inter frame reachable | +| same @5400 s | REFUSED, 1 frame | 18 / 26 / 24 | same | +| same @6300 s | REFUSED, 2 frames | 187 / 560 / 365 | trunc(2): 1 shown frame, 0 differing bytes, counters 169/445/300 -- but trunc(1) (that same key frame alone) fires 0/0/0, so EVERY hit lives in the NO-SHOW frame 1, which no display frame reaches: trunc(3)/(4)/(5) all refuse on the 128x64 intra block (class `gate-blind-to-hidden-frames`) | +| same @8100 s | REFUSED, 1 frame | 0 / 4 / 2 | only the key frame decodes | +| aomenc gate `a_real_aomenc_inter_sequence_with_intra_16x4_strips_in_1to4_partitions_decodes_pixel_exact` | FAILED with `--include-ignored` | per-arm attempts `[0, 0, 0]` | 0 named refusals, 0 pixel-exact attempts carrying an intra 1:4 strip; attempts 1..3 mismatch ffmpeg from frame 1-2 (max abs delta 248), attempts 0/4 mismatch while carrying no 1:4 strip at all (another shape's defect, unchanged since intra16x4 r2) | + +No exact, firing witness exists on this tree. Per class +`refusal-lifted-without-a-gate` the refusal goes back in. + +## 3. Changes + +- `crates/ec-av1/src/decode.rs` (`strip16` in the intra arm of the inter block + path): the chroma-pair record that let a 16x4/4x16 strip past the refusal is + now `.filter(|_| std::env::var_os("EC_INTRA16X4_DECODE").is_some())` -- the + shape refuses by name again by default; the decode path (and its counter) + stay wired for the round that finds a witness. Full measured note in place. +- `crates/ec-av1/src/decode.rs` (rect64 corner-TU comment): re-measured + counters 148 / 123 and the new gate name. +- `crates/ec-av1/src/refusal_inventory.rs`: string unchanged, note records the + re-widening and why. +- `crates/ec-av1/src/stream.rs`: gate renamed + `a_10bit_film_frames_with_intra_16x4_strips_and_rect64_corner_tus_decode_pixel_exact` + -> `a_10bit_film_frames_with_rect64_corner_tus_decode_pixel_exact`; hard + assert kept on `rect64_corner_tu` both orientations, the intra-16x4 assert + replaced by `assert_eq!(fired16, (0, 0, 0))` (a non-zero count means the + refusal guarding that arm moved); doc block rewritten with the measured + numbers. +- `crates/ec-av1/src/stream.rs` (aomenc 1:4 gate): stays `#[ignore]d`, reason + replaced by this round's measured failure output. + +## 4. Gates + +Command: `EC_NOMEMGUARD=1 EC_AV1_REQUIRE_AOMENC=1 CARGO_TARGET_DIR=$HOME/.cache/cargo-target-wit16x4 nice -n 10 cargo test -p ec-av1 --lib -j3 -- --nocapture` + +| filter | result | +|---|---| +| `a_10bit_film_frames_with_rect64_corner_tus` | ok, 1 passed, 63.37 s -- `33 frames pixel-exact, rect64_corner_tu 64x32=148 32x64=123 (intra16x4_in_inter 0 0 0, refused shape)` | +| `a_10bit_film_hidden_arf` | ok, 1 passed, 89.48 s (`rect64_split_txfm_publish=4`) | +| `refusal_inventory` | ok, 3 passed | +| `gate_coverage` | ok, 9 passed | +| `sub8` | ok, 7 passed, 35.16 s | +| `1to4` | 9 passed, 1 FAILED, 3 ignored (see below), 118.75 s | + +The `1to4` red was `a_10bit_film_inter_frame_with_intra_1to4_strips_decodes_pixel_exact`, +which stopped at the re-added refusal. MEASURED before deciding: its fixture +`reelb_intra14_witness.obu` has 2 frame OBUs and ONE shown frame; truncated to its +first frame OBU it decodes exact with `intra_rect4_in_inter 0/0/0/0` and +`intra16x4_in_inter 0/0/0`. So all of the 4/23/28/72 strips it asserts -- and +the 4 intra 16x4 strips with them -- live in the SECOND, NO-SHOW frame, whose +pixels ffmpeg never writes and the gate never compared (class +`gate-blind-to-hidden-frames`); the gate was green on a counter nothing backed. +It is `#[ignore]`d with that measured reason, to be un-ignored by a prefix of +the same film that DISPLAYS that frame -- which would make both this gate and +the intra-16x4 lift pixel-backed at once. + +Suite (systemd unit, `cargo test -p ec-av1 --lib -j3`): `test result: ok. 425 passed; 0 failed; 38 ignored; 0 measured; 0 filtered out; finished in 730.11s` + +## 5. EVIDENCE + +EVIDENCE: ~/.cache/wit16x4-tmp/{o.raw,r.raw} | `decode_probe EC_PROBE_OUT16` on the pinned fixture vs `ffmpeg -pix_fmt yuv420p10le`, diff16.py 3840x1608 | 33 frames, all 0 differing bytes; rect64_corner_tu 148/123, intra16x4_in_inter 0/0/0 +EVIDENCE: ~/.cache/wit16x4-tmp/census.txt | `decode_probe` on 2 film cuts + 4 1920x792 cuts under 6G scopes | only the 0 s cut decodes without a refusal, and it fires 0 intra 16x4/4x16 strips +EVIDENCE: ~/.cache/wit16x4-tmp/{h300t.obu,o3.raw,r3.raw} | 300 s cut truncated to its 8 decoded frame OBUs, decoded and compared | frames 1 and 2 differ by 14105680 / 12470780 bytes -> its 138/559/347 hits are phantoms +EVIDENCE: ~/.cache/wit16x4-tmp/{t6300.1.obu,o5.raw,r5.raw} + tcensus.txt | 6300 s cut truncated to 1 vs 2 frame OBUs | 1 OBU: exact, 0 hits; 2 OBUs: exact shown frame but 169/445/300 hits, all inside the no-show frame; 3/4/5 OBUs refuse +EVIDENCE: ~/.cache/wit16x4-tmp/ig.log | aomenc 1:4 gate `--include-ignored --nocapture` | FAILED, per-arm attempts [0, 0, 0], 0 pixel-exact attempts carrying the strip + +## 6. Residue + +- deferred(a witness): the intra 16x4/4x16-in-inter decode path is written and + believed correct but unproven -- the unblockers are the 128x64-intra-on-inter + refusal (a display frame would then follow the 6300 s cut's no-show frame + that carries 169/445 strips) or the Golomb-tail refusal + whatever desyncs + the 300 s cut's frame 1. +- accepted: `a_real_aomenc_inter_sequence_with_intra_16x4_strips_in_1to4_partitions_decodes_pixel_exact` + stays `#[ignore]d`; its attempts 0/4 mismatch with NO 1:4 strip present, an + open defect of another shape (lanes/intra16x4-r2.handoff.md).