Merge branch 'lane-band46': band-fixture seed-46 mismatch was per-transform-unit reach (third instance); seed 46 un-excluded from the chroma-rect gate
Browse files at this commit4 changed files +364 -19
- crates/ec-av1/src/decode.rs +71 -4
- crates/ec-av1/src/encode.rs +1 -1
- crates/ec-av1/src/stream.rs +201 -14
- lanes/band46-r1.report.md +91 -0
crates/ec-av1/src/decode.rsmodified+71 -4
| @@ -680,6 +680,48 @@ pub(crate) fn smooth_luma_hits() -> usize { | ||
| 680 | 680 | SMOOTH_LUMA_HITS.with(|c| c.get()) |
| 681 | 681 | } |
| 682 | 682 | |
| 683 | +thread_local! { | |
| 684 | + /// lane-band46 r1: how many split-transform units answered their intra | |
| 685 | + /// reach DIFFERENTLY under libaom's per-unit rules ([`Reach::of_tu`], the | |
| 686 | + /// palette2 r12 fix) than the standalone-block lookup this decoder used to | |
| 687 | + /// apply to them (class reach-is-per-transform-unit). Every hit is a | |
| 688 | + /// transform unit whose above-right / below-left reference samples would | |
| 689 | + /// be wrong without that fix. | |
| 690 | + static SPLIT_TU_REACH_FIX_HITS: std::cell::Cell<usize> = | |
| 691 | + const { std::cell::Cell::new(0) }; | |
| 692 | +} | |
| 693 | + | |
| 694 | +/// Current value of [`SPLIT_TU_REACH_FIX_HITS`]. | |
| 695 | +pub(crate) fn split_tu_reach_fix_hits() -> usize { | |
| 696 | + SPLIT_TU_REACH_FIX_HITS.with(|c| c.get()) | |
| 697 | +} | |
| 698 | + | |
| 699 | +/// [`Reach::of_tu`] for one transform unit, counting how often that per-unit | |
| 700 | +/// answer differs from the standalone-block answer the call sites used before | |
| 701 | +/// lane-palette2 r12 -- the counter a gate asserts on to prove a stream really | |
| 702 | +/// exercised the fix. `col_off`/`row_off` are in SAMPLES from the parent | |
| 703 | +/// block's top-left `(px, py)`. | |
| 704 | +#[allow(clippy::too_many_arguments)] | |
| 705 | +fn tu_reach( | |
| 706 | + bw: usize, | |
| 707 | + bh: usize, | |
| 708 | + col_off: usize, | |
| 709 | + row_off: usize, | |
| 710 | + tx: usize, | |
| 711 | + block: Reach, | |
| 712 | + px: usize, | |
| 713 | + py: usize, | |
| 714 | + width: usize, | |
| 715 | + height: usize, | |
| 716 | +) -> Reach { | |
| 717 | + let fixed = Reach::of_tu(bw, bh, col_off, row_off, tx, block); | |
| 718 | + let standalone = Reach::of(tx, px + col_off, py + row_off, width, height); | |
| 719 | + if fixed != standalone { | |
| 720 | + SPLIT_TU_REACH_FIX_HITS.with(|c| c.set(c.get() + 1)); | |
| 721 | + } | |
| 722 | + fixed | |
| 723 | +} | |
| 724 | + | |
| 683 | 725 | // How many `uv_mode` reads resolved to `SMOOTH_PRED..=PAETH_PRED` (9..=12), |
| 684 | 726 | // across every call on the current thread -- lane-chroma r3's own before/after |
| 685 | 727 | // counter, proving a stream actually exercised chroma's smooth/paeth |
| @@ -7859,13 +7901,17 @@ fn decode_block( | ||
| 7859 | 7901 | // top-right 8x8 unit of a 16x16 D203 block bottom-left |
| 7860 | 7902 | // pixels libaom refuses outright (`col_off > 0`), which is |
| 7861 | 7903 | // the diagonal wedge seed 46 reconstructed wrong. |
| 7862 | - let tu_reach = Reach::of_tu( | |
| 7904 | + let tu_reach = tu_reach( | |
| 7863 | 7905 | side, |
| 7864 | 7906 | side, |
| 7865 | 7907 | tu_col * logical_tx, |
| 7866 | 7908 | tu_row * logical_tx, |
| 7867 | 7909 | logical_tx, |
| 7868 | 7910 | reach, |
| 7911 | + px, | |
| 7912 | + py, | |
| 7913 | + y.width, | |
| 7914 | + y.height, | |
| 7869 | 7915 | ); |
| 7870 | 7916 | // This transform unit's own bsize (`logical_tx`) is smaller |
| 7871 | 7917 | // than the block it sits in (`side`), so `txb_skip_ctx` is |
| @@ -8251,7 +8297,18 @@ fn decode_leaf8( | ||
| 8251 | 8297 | if crate::encode::Reach::in_vert_ab() { |
| 8252 | 8298 | VERT_AB_TX4_HITS.with(|c| c.set(c.get() + 1)); |
| 8253 | 8299 | } |
| 8254 | - let tu_reach = Reach::of_tu(8, 8, tu_col * 4, tu_row * 4, 4, reach); | |
| 8300 | + let tu_reach = tu_reach( | |
| 8301 | + 8, | |
| 8302 | + 8, | |
| 8303 | + tu_col * 4, | |
| 8304 | + tu_row * 4, | |
| 8305 | + 4, | |
| 8306 | + reach, | |
| 8307 | + px, | |
| 8308 | + py, | |
| 8309 | + y.width, | |
| 8310 | + y.height, | |
| 8311 | + ); | |
| 8255 | 8312 | let tu_skip_ctx = neighbours.luma_skip_ctx(tu_mi, 1); |
| 8256 | 8313 | let tu_grid = read_plane( |
| 8257 | 8314 | dec, |
| @@ -8799,8 +8856,18 @@ fn decode_leaf_rect8( | ||
| 8799 | 8856 | // (lane-palette2 r12): a transform unit inside a block is not |
| 8800 | 8857 | // a block at that position, so its reach comes from the |
| 8801 | 8858 | // block's own row, offset by the unit's position. |
| 8802 | - let tu_reach = | |
| 8803 | - Reach::of_tu(bw, bh, tu_px - px, tu_py - py, 4, reach); | |
| 8859 | + let tu_reach = tu_reach( | |
| 8860 | + bw, | |
| 8861 | + bh, | |
| 8862 | + tu_px - px, | |
| 8863 | + tu_py - py, | |
| 8864 | + 4, | |
| 8865 | + reach, | |
| 8866 | + px, | |
| 8867 | + py, | |
| 8868 | + y.width, | |
| 8869 | + y.height, | |
| 8870 | + ); | |
| 8804 | 8871 | let tu_skip_ctx = neighbours.luma_skip_ctx(tu_mi, 1); |
| 8805 | 8872 | if skip { |
| 8806 | 8873 | // A skipped leaf still predicts per transform unit: the |
crates/ec-av1/src/encode.rsmodified+1 -1
| @@ -1008,7 +1008,7 @@ struct At { | ||
| 1008 | 1008 | /// block whose transform covers it whole, whether the samples above its right |
| 1009 | 1009 | /// (or below its left) are decoded depends only on where the block sits inside |
| 1010 | 1010 | /// its 64x64 superblock, which is a pinned table per block size. |
| 1011 | -#[derive(Clone, Copy, Debug)] | |
| 1011 | +#[derive(Clone, Copy, Debug, PartialEq, Eq)] | |
| 1012 | 1012 | pub(crate) struct Reach { |
| 1013 | 1013 | pub(crate) above_right: bool, |
| 1014 | 1014 | pub(crate) below_left: bool, |
crates/ec-av1/src/stream.rsmodified+201 -14
| @@ -17637,13 +17637,10 @@ mod tests { | ||
| 17637 | 17637 | fn a_real_aomenc_stream_with_a_coded_strip_whose_chroma_is_a_4to1_or_sub8_rect_decodes_pixel_exact() |
| 17638 | 17638 | { |
| 17639 | 17639 | const NAME: &str = "a_real_aomenc_stream_with_a_coded_strip_whose_chroma_is_a_4to1_or_sub8_rect_decodes_pixel_exact"; |
| 17640 | - // Seed 46 mismatches ffmpeg at cq 32 on BOTH depths while carrying | |
| 17641 | - // ZERO 1:4 strips -- an open defect of another shape, being diagnosed | |
| 17642 | - // by lane-band46. Excluded here by name so this gate's | |
| 17643 | - // `out_of_scope_mismatch` assert stays a hard 0 instead of swallowing | |
| 17644 | - // it; the pin below decodes exactly that seed and is what un-ignoring | |
| 17645 | - // will prove. | |
| 17646 | - const EXCLUDED_SEEDS: &[u32] = &[46]; | |
| 17640 | + // No seed is excluded any more: seed 46's cq-32 mismatch was the | |
| 17641 | + // per-transform-unit reach (lane-band46 / palette2 r12), and the pin | |
| 17642 | + // below decodes it pixel-exact at both depths. | |
| 17643 | + const EXCLUDED_SEEDS: &[u32] = &[]; | |
| 17647 | 17644 | let _gate_lock = lock_gate_counters(); |
| 17648 | 17645 | if !have_ffmpeg() { |
| 17649 | 17646 | eprintln!("SKIP {NAME}: no ffmpeg"); |
| @@ -17795,7 +17792,7 @@ mod tests { | ||
| 17795 | 17792 | out_of_scope_mismatch, 0, |
| 17796 | 17793 | "{NAME}: {out_of_scope_mismatch} attempts carrying no 1:4 strip mismatched \ |
| 17797 | 17794 | ffmpeg -- a defect of another shape, not out of scope for the suite (the one \ |
| 17798 | - known case, seed 46, is in EXCLUDED_SEEDS and pinned separately)" | |
| 17795 | + known case, seed 46, was the per-TU reach and is fixed)" | |
| 17799 | 17796 | ); |
| 17800 | 17797 | assert!( |
| 17801 | 17798 | matched > 0, |
| @@ -17932,13 +17929,11 @@ mod tests { | ||
| 17932 | 17929 | out.stdout |
| 17933 | 17930 | } |
| 17934 | 17931 | |
| 17935 | - /// PIN for the one stream the chroma-rect gate excludes: cq 32 seed 46 | |
| 17936 | - /// mismatches ffmpeg at BOTH bit depths while carrying zero 1:4 strips, | |
| 17937 | - /// so the defect belongs to some other shape -- the stream decodes, the | |
| 17938 | - /// pixels are wrong. Undiagnosed; lane-band46 owns it. Un-ignoring this | |
| 17939 | - /// test is the proof that it is fixed. | |
| 17932 | + /// PIN for the stream the chroma-rect gate used to exclude: cq 32 seed 46 | |
| 17933 | + /// mismatched ffmpeg at BOTH bit depths while carrying zero 1:4 strips. | |
| 17934 | + /// The defect was the per-transform-unit intra reach (lane-band46 / | |
| 17935 | + /// palette2 r12); un-ignored 2026-09-02 once it decoded pixel-exact. | |
| 17940 | 17936 | #[test] |
| 17941 | - #[ignore = "band fixture cq32 seed 46 mismatches ffmpeg with zero 1:4 strips (8- and 10-bit) -- undiagnosed, lane-band46"] | |
| 17942 | 17937 | fn the_chroma_rect_gates_excluded_seed_46_decodes_pixel_exact() { |
| 17943 | 17938 | const NAME: &str = "the_chroma_rect_gates_excluded_seed_46_decodes_pixel_exact"; |
| 17944 | 17939 | let _gate_lock = lock_gate_counters(); |
| @@ -17970,4 +17965,196 @@ mod tests { | ||
| 17970 | 17965 | } |
| 17971 | 17966 | } |
| 17972 | 17967 | |
| 17968 | + | |
| 17969 | + /// lane-band46 r1: a real `aomenc` band stream whose 16x16 (and 8x8) | |
| 17970 | + /// intra blocks SPLIT their transform, so every unit but the first | |
| 17971 | + /// answers `has_top_right`/`has_bottom_left` from its `row_off`/`col_off` | |
| 17972 | + /// inside the parent block rather than from the standalone-block tables | |
| 17973 | + /// (libaom `reconintra.c`; class reach-is-per-transform-unit). | |
| 17974 | + /// | |
| 17975 | + /// Seed 46 of the sibling 1:4-strip recipe is the stream that found it: | |
| 17976 | + /// it carries ZERO 1:4 strips, so that gate skipped it as out of scope | |
| 17977 | + /// while frame 0 luma mismatched ffmpeg over 916 samples -- the first at | |
| 17978 | + /// (x 14, y 18), the second 8x8 transform unit of the D203_PRED block at | |
| 17979 | + /// mi (4, 0), whose bottom-left samples sit in a unit that is not | |
| 17980 | + /// reconstructed yet (`col_off > 0` => `has_bottom_left` is 0). The full | |
| 17981 | + /// mode-info range ladder matched aomdec element for element, so the | |
| 17982 | + /// defect was reconstruction, never entropy. | |
| 17983 | + /// | |
| 17984 | + /// The gate asserts the fix FIRED (`split_tu_reach_fix_hits`, transform | |
| 17985 | + /// units whose reach differs from the old standalone answer) on 8 AND 10 | |
| 17986 | + /// bit, and that seed 46 itself decodes pixel-exact. | |
| 17987 | + #[test] | |
| 17988 | + fn a_real_aomenc_band_stream_seed46_decodes_pixel_exact() { | |
| 17989 | + const NAME: &str = "a_real_aomenc_band_stream_seed46_decodes_pixel_exact"; | |
| 17990 | + let _gate_lock = lock_gate_counters(); | |
| 17991 | + if !have_ffmpeg() { | |
| 17992 | + eprintln!("SKIP {NAME}: no ffmpeg"); | |
| 17993 | + return; | |
| 17994 | + } | |
| 17995 | + if !have_aomenc() { | |
| 17996 | + eprintln!("SKIP {NAME}: no aomenc at {}", aomenc_path().display()); | |
| 17997 | + return; | |
| 17998 | + } | |
| 17999 | + let (width, height) = (192usize, 128usize); | |
| 18000 | + let mut matched = 0u32; | |
| 18001 | + let mut refusals = 0u32; | |
| 18002 | + let mut fixed_tus = 0usize; | |
| 18003 | + let mut fixed_tus_10bit = 0usize; | |
| 18004 | + let mut seed46_compared = [false; 2]; | |
| 18005 | + for (di, bit_depth) in [8u32, 10].into_iter().enumerate() { | |
| 18006 | + let pix_fmt = if bit_depth == 10 { "yuv420p10le" } else { "yuv420p" }; | |
| 18007 | + for seed in 42u32..=51 { | |
| 18008 | + // Byte-identical recipe to the 1:4-strip sibling gate, whose | |
| 18009 | + // seed-46 attempt is what exposed this defect (that gate | |
| 18010 | + // classes a no-1:4 stream as out of scope; this one compares | |
| 18011 | + // it). | |
| 18012 | + let bands = format!( | |
| 18013 | + "geq=lum='mod(floor(Y/16),2)*160+48':cb=128:cr=128,noise=alls=10:all_seed={seed}" | |
| 18014 | + ); | |
| 18015 | + let source = if seed % 2 == 0 { | |
| 18016 | + format!("color=c=black:size={width}x{height}:duration=0.04:rate=25,{bands}") | |
| 18017 | + } else { | |
| 18018 | + format!( | |
| 18019 | + "color=c=black:size={height}x{width}:duration=0.04:rate=25,{bands},transpose=1" | |
| 18020 | + ) | |
| 18021 | + }; | |
| 18022 | + let y4m = Command::new("ffmpeg") | |
| 18023 | + .args([ | |
| 18024 | + "-v", "error", "-f", "lavfi", "-i", &source, "-t", "0.04", "-pix_fmt", | |
| 18025 | + pix_fmt, "-strict", "-1", "-f", "yuv4mpegpipe", "-", | |
| 18026 | + ]) | |
| 18027 | + .stdin(Stdio::null()) | |
| 18028 | + .stdout(Stdio::piped()) | |
| 18029 | + .stderr(Stdio::piped()) | |
| 18030 | + .output() | |
| 18031 | + .expect("ffmpeg failed to run"); | |
| 18032 | + assert!( | |
| 18033 | + y4m.status.success(), | |
| 18034 | + "{NAME}: ffmpeg refused the {bit_depth}-bit fixture: {}", | |
| 18035 | + String::from_utf8_lossy(&y4m.stderr) | |
| 18036 | + ); | |
| 18037 | + let depth_arg = format!("--bit-depth={bit_depth}"); | |
| 18038 | + let input_depth_arg = format!("--input-bit-depth={bit_depth}"); | |
| 18039 | + let mut child = Command::new(aomenc_path()) | |
| 18040 | + .args([ | |
| 18041 | + "--codec=av1", | |
| 18042 | + "--passes=1", | |
| 18043 | + "--end-usage=q", | |
| 18044 | + "--cq-level=32", | |
| 18045 | + "--cpu-used=0", | |
| 18046 | + "--threads=1", | |
| 18047 | + "--row-mt=0", | |
| 18048 | + "--sb-size=64", | |
| 18049 | + &depth_arg, | |
| 18050 | + &input_depth_arg, | |
| 18051 | + "--enable-rect-partitions=1", | |
| 18052 | + "--enable-ab-partitions=0", | |
| 18053 | + "--enable-1to4-partitions=1", | |
| 18054 | + "--min-partition-size=16", | |
| 18055 | + "--max-partition-size=64", | |
| 18056 | + // Left ON: this is what makes a 16x16 block code four | |
| 18057 | + // 8x8 transform units, the shape the fix is about. | |
| 18058 | + "--enable-tx-size-search=1", | |
| 18059 | + "--enable-restoration=0", | |
| 18060 | + "--enable-palette=0", | |
| 18061 | + "--deltaq-mode=0", | |
| 18062 | + "--enable-filter-intra=0", | |
| 18063 | + "--enable-cfl-intra=0", | |
| 18064 | + "--enable-intrabc=0", | |
| 18065 | + "--obu", | |
| 18066 | + "-o", | |
| 18067 | + "-", | |
| 18068 | + "-", | |
| 18069 | + ]) | |
| 18070 | + .stdin(Stdio::piped()) | |
| 18071 | + .stdout(Stdio::piped()) | |
| 18072 | + .stderr(Stdio::piped()) | |
| 18073 | + .spawn() | |
| 18074 | + .expect("aomenc failed to start"); | |
| 18075 | + child | |
| 18076 | + .stdin | |
| 18077 | + .take() | |
| 18078 | + .expect("aomenc stdin") | |
| 18079 | + .write_all(&y4m.stdout) | |
| 18080 | + .expect("writing y4m to aomenc"); | |
| 18081 | + let out = child.wait_with_output().expect("aomenc failed to run"); | |
| 18082 | + assert!( | |
| 18083 | + out.status.success(), | |
| 18084 | + "{NAME}: aomenc refused the fixture: {}", | |
| 18085 | + String::from_utf8_lossy(&out.stderr) | |
| 18086 | + ); | |
| 18087 | + let stream = out.stdout; | |
| 18088 | + let before = crate::decode::split_tu_reach_fix_hits(); | |
| 18089 | + let frames = match decode_stream(&stream) { | |
| 18090 | + Err(e) => { | |
| 18091 | + let msg = e.to_string(); | |
| 18092 | + assert!( | |
| 18093 | + msg.contains("unsupported"), | |
| 18094 | + "{NAME} failed outright, not a named refusal ({bit_depth}-bit seed \ | |
| 18095 | + {seed}): {msg}" | |
| 18096 | + ); | |
| 18097 | + assert!( | |
| 18098 | + seed != 46, | |
| 18099 | + "{NAME}: seed 46 ({bit_depth}-bit) must decode -- it is this gate's \ | |
| 18100 | + pinned stream, and it refused: {msg}" | |
| 18101 | + ); | |
| 18102 | + refusals += 1; | |
| 18103 | + eprintln!("{NAME}: {bit_depth}-bit seed {seed} refusal: {msg}"); | |
| 18104 | + continue; | |
| 18105 | + } | |
| 18106 | + Ok(frames) => frames, | |
| 18107 | + }; | |
| 18108 | + let reference = if bit_depth == 10 { | |
| 18109 | + ffmpeg_decode_sequence_10bit(&stream, width, height, frames.len()) | |
| 18110 | + } else { | |
| 18111 | + ffmpeg_decode_sequence(&stream, width, height, frames.len()) | |
| 18112 | + }; | |
| 18113 | + assert_eq!(frames.len(), reference.len(), "{NAME}: frame count"); | |
| 18114 | + for (i, (got, want)) in frames.iter().zip(&reference).enumerate() { | |
| 18115 | + assert_eq!( | |
| 18116 | + got.y, want.y, | |
| 18117 | + "{NAME} frame {i} luma vs ffmpeg ({bit_depth}-bit seed {seed})" | |
| 18118 | + ); | |
| 18119 | + assert_eq!( | |
| 18120 | + got.u, want.u, | |
| 18121 | + "{NAME} frame {i} U vs ffmpeg ({bit_depth}-bit seed {seed})" | |
| 18122 | + ); | |
| 18123 | + assert_eq!( | |
| 18124 | + got.v, want.v, | |
| 18125 | + "{NAME} frame {i} V vs ffmpeg ({bit_depth}-bit seed {seed})" | |
| 18126 | + ); | |
| 18127 | + } | |
| 18128 | + let fixed = crate::decode::split_tu_reach_fix_hits() - before; | |
| 18129 | + fixed_tus += fixed; | |
| 18130 | + if bit_depth == 10 { | |
| 18131 | + fixed_tus_10bit += fixed; | |
| 18132 | + } | |
| 18133 | + if seed == 46 { | |
| 18134 | + seed46_compared[di] = true; | |
| 18135 | + } | |
| 18136 | + matched += 1; | |
| 18137 | + } | |
| 18138 | + } | |
| 18139 | + eprintln!( | |
| 18140 | + "{NAME}: {matched} pixel-exact streams, {refusals} named refusals out of 20; \ | |
| 18141 | + {fixed_tus} split transform units took the per-TU reach ({fixed_tus_10bit} of them \ | |
| 18142 | + 10-bit)" | |
| 18143 | + ); | |
| 18144 | + assert!( | |
| 18145 | + seed46_compared[0] && seed46_compared[1], | |
| 18146 | + "{NAME}: seed 46 was not compared on both depths (8-bit {}, 10-bit {})", | |
| 18147 | + seed46_compared[0], seed46_compared[1] | |
| 18148 | + ); | |
| 18149 | + assert!( | |
| 18150 | + fixed_tus > 0, | |
| 18151 | + "{NAME}: no split transform unit answered its reach from its offset inside the \ | |
| 18152 | + parent block -- the recipe lost the shape this gate pins" | |
| 18153 | + ); | |
| 18154 | + assert!( | |
| 18155 | + fixed_tus_10bit > 0, | |
| 18156 | + "{NAME}: the shape never appeared in a 10-BIT pixel-exact stream (his films are \ | |
| 18157 | + yuv420p10le)" | |
| 18158 | + ); | |
| 18159 | + } | |
| 17973 | 18160 | } |
lanes/band46-r1.report.mdadded+91 -0
| @@ -0,0 +1,91 @@ | ||
| 1 | +# lane-band46 r1 — the seed-46 "out-of-scope" mismatch: split transform units answered their intra reach as standalone blocks | |
| 2 | + | |
| 3 | +## Premise, re-measured on main 146896f (not the chartered 8262b99) | |
| 4 | +`git log --oneline -1` in the worktree = `146896f` (lane-cfl merged after the charter was written). | |
| 5 | +The defect reproduces there, so it is a main defect, not a rectchroma-branch one. | |
| 6 | + | |
| 7 | +Stream: the rectchroma gate recipe verbatim (192x128 bands + `noise=alls=10:all_seed=46`, | |
| 8 | +`--enable-ab-partitions=0 --enable-1to4-partitions=1 --enable-tx-size-search=1`, cq 32, 8-bit), | |
| 9 | +pinned twice: `sha256 9952fd31a1d51ccd5e066bd249babf676f6bb59318a1877272fa8fbd060d809b` both runs. | |
| 10 | + | |
| 11 | +## Root cause — class `reach-is-per-transform-unit` | |
| 12 | +`crates/ec-av1/src/decode.rs` computed a split transform unit's intra reach with | |
| 13 | +`Reach::of(logical_tx, tu_px, tu_py, ..)` — the *standalone-block* `has_top_right`/ | |
| 14 | +`has_bottom_left` table lookup, asking "what may a block of this size at this superblock | |
| 15 | +position read". libaom (`av1/common/reconintra.c`) never does that for a unit inside a block: | |
| 16 | +it answers from the unit's `row_off`/`col_off` within its parent, and only the (0,0) unit ever | |
| 17 | +reaches the table. | |
| 18 | + | |
| 19 | +* `has_bottom_left`: `if (col_off > 0) return 0;` — the bottom-left samples of any unit but the | |
| 20 | + leftmost column live in a unit that is not reconstructed yet. | |
| 21 | +* `has_bottom_left`, leftmost-superblock-column branch: counts `row_off + tx_size_high_unit` | |
| 22 | + from the UNIT, not the block. | |
| 23 | +* `has_top_right`: `if (row_off > 0) return col_off + tx_size_wide_unit < plane_bw_unit;` — a | |
| 24 | + lower row of units never consults the table at all. | |
| 25 | + | |
| 26 | +Seed 46, frame 0: block at mi (4,0) is `D203_PRED` (mode symbol 7, angle_delta 0) with | |
| 27 | +`tx_depth=1`, i.e. four 8x8 units. Unit 1 (`col_off = 2`) got `below_left = true` from the | |
| 28 | +standalone 8x8 table; libaom gives 0. D203 is a zone-3 (left + bottom-left) predictor, so the | |
| 29 | +unit came out as a lower-right triangle of wrong samples that then propagated right across the | |
| 30 | +row of blocks. | |
| 31 | + | |
| 32 | +## Changed | |
| 33 | +* `crates/ec-av1/src/encode.rs:1281` — new `Reach::of_tu(bw, bh, tx, row_off, col_off, px, py, w, h)`: | |
| 34 | + libaom's per-unit ladder, delegating the (0,0) fallback to the existing square/rect block-level | |
| 35 | + answers. `Reach` gained `PartialEq, Eq` (`encode.rs:1011`) so the counter below can compare. | |
| 36 | +* `crates/ec-av1/src/decode.rs:683` — `SPLIT_TU_REACH_FIX_HITS` + `split_tu_reach_fix_hits()` and | |
| 37 | + the `tu_reach(..)` wrapper, which returns the per-TU answer and counts every unit where it | |
| 38 | + DIFFERS from the old standalone answer (a hit == a unit whose reference samples used to be wrong). | |
| 39 | +* `crates/ec-av1/src/decode.rs` — three call sites rewired to `tu_reach(..)`: | |
| 40 | + the multi-TU square-block loop (16x16+ blocks with `tx_depth > 0`), the 8x8 leaf's 2x2 4x4 grid, | |
| 41 | + and the 4x8/8x4 leaf's depth-1 pair. | |
| 42 | +* `crates/ec-av1/src/stream.rs` — new gate `a_real_aomenc_band_stream_seed46_decodes_pixel_exact`. | |
| 43 | + | |
| 44 | +## Class sweep (`grep -n "Reach::of(" crates/ec-av1/src/decode.rs`) | |
| 45 | +9 sites. 3 were the defect (fixed above). 1 (`decode.rs:4652`, the rect-strip per-TU loop) already | |
| 46 | +hand-rolls the correct libaom ladder inline — a previous lane found the same class there; left as | |
| 47 | +is, gated by its own strip gates. The remaining 5 (`7037`, `7499`, `7920`, `14881`, `16388`) and the | |
| 48 | +two `group_reach` sites are genuine BLOCK-level questions where the transform covers the block. | |
| 49 | + | |
| 50 | +## Gate | |
| 51 | +`a_real_aomenc_band_stream_seed46_decodes_pixel_exact` (`crates/ec-av1/src/stream.rs`, end of file): | |
| 52 | +the sibling recipe, seeds 42..=51 on 8 AND 10 bit, every decoded stream compared to ffmpeg | |
| 53 | +plane by plane, non-`unsupported` errors fail, seed 46 is asserted to decode (never refuse) on | |
| 54 | +both depths, and `split_tu_reach_fix_hits` must be > 0 overall AND > 0 in a 10-bit pixel-exact | |
| 55 | +stream (his films are `yuv420p10le`). | |
| 56 | + | |
| 57 | +``` | |
| 58 | +EC_NOMEMGUARD=1 EC_AV1_REQUIRE_AOMENC=1 CARGO_TARGET_DIR=$HOME/.cache/cargo-target-band46 \ | |
| 59 | + cargo test -p ec-av1 --lib seed46 -- --nocapture | |
| 60 | +``` | |
| 61 | +result: `ok. 1 passed` — `10 pixel-exact streams, 10 named refusals out of 20; 22 split transform | |
| 62 | +units took the per-TU reach (10 of them 10-bit)`. The 10 refusals are the sibling lane's open | |
| 63 | +1:4-chroma refusal, by name. | |
| 64 | + | |
| 65 | +EVIDENCE: /home/user/.cache/band46/s46_1.obu, ourspre.f0 vs aompre.f0 | regenerate seed 46 twice (sha256 identical), decode_probe vs `ffmpeg -f rawvideo` and EC_AV1_PREFILT_DUMP both decoders | BEFORE: 916 luma samples differ, first (x=14,y=18) ours 217 vs 208, bbox x 8..191 y 18..23, U and V exact, and the pre-loop-filter dump differs identically (913) so the defect is reconstruction | |
| 66 | +EVIDENCE: /home/user/.cache/band46/ours.step vs aom.step | EC_TRACE_MODE_STEP both decoders, `diff` of the range ladders excluding tx_depth print lines | LADDER IDENTICAL, 147 vs 160 lines differing only in tx_depth *printing* (ours prints at 7 of 20 sites) => entropy decode exact, first divergent element = NONE | |
| 67 | +EVIDENCE: /home/user/.cache/band46/ours.yuv vs ff.yuv | same decode after the fix | `cmp` PIXEL-EXACT (36864 bytes) | |
| 68 | + | |
| 69 | +## Suite | |
| 70 | +`systemd-run --user --unit=band46-suite2-... -p MemoryMax=10G` running | |
| 71 | +`EC_NOMEMGUARD=1 EC_AV1_REQUIRE_AOMENC=1 CARGO_TARGET_DIR=$HOME/.cache/cargo-target-band46 cargo test -p ec-av1 --lib -j3` | |
| 72 | +-> `$HOME/.cache/band46-suite.log`: **ok. 323 passed; 0 failed; 30 ignored** (499.87s). | |
| 73 | +Sibling gates over the same tables (every `stream::tests::a_real_*` intra/strip/split gate, | |
| 74 | +`encode::tests::reach_matches_libaom_has_top_right_and_has_bottom_left`, | |
| 75 | +`rect_reach_tables_are_indexed_with_a_32_mi_row_stride`) are in that run and green. | |
| 76 | + | |
| 77 | +`gate_coverage::tests::never_on_10bit_matches_the_gate_recipes` failed on the first suite run and | |
| 78 | +is fixed in the same commit: the new gate is the first 10-bit recipe to spell | |
| 79 | +`--enable-tx-size-search=1`, so `enable-tx-size-search` left `NEVER_ON_10BIT` | |
| 80 | +(`crates/ec-av1/src/gate_coverage.rs:283`). No refusal was lifted, so `refusal_inventory` is | |
| 81 | +unchanged (3 passed). | |
| 82 | + | |
| 83 | +## Residue | |
| 84 | +* accepted: our `EC_TRACE_MODE_STEP` prints `tx_depth` at only 7 of the 20 sites aomdec prints | |
| 85 | + (and prints `dq` value 0 where aomdec prints 128) — instrument coverage, not a decode | |
| 86 | + difference; the ladder ranges match at every line. | |
| 87 | +* deferred(a lane owning the 1:4 chroma shapes): 10 of the 20 gate attempts still stop at | |
| 88 | + "a coded HORZ/VERT strip whose chroma transform has no rect coefficient tables here" | |
| 89 | + (lane-rectchroma's territory). The gate counts and prints them, never skips. | |
| 90 | +* accepted: `decode.rs:4652` keeps its inline copy of the per-TU ladder rather than calling | |
| 91 | + `Reach::of_tu`; unifying them would re-open pinned rect-strip gates for no behavioural change. |