ec-av1: pin witnesses for the two side>64 mu-chunk walks at 4:2:2
Browse files at this commit18c7610e259a9e5816f8043e54aae591e7528b82Parent: d5d28375 changed files +404 -0
- crates/ec-av1/fixtures/422_muchunk_compound_128root.obu +0 -0
- crates/ec-av1/fixtures/422_muchunk_intra_in_inter_128root.obu +0 -0
- crates/ec-av1/src/decode.rs +63 -0
- crates/ec-av1/src/stream.rs +250 -0
- lanes/av1muchunk422b.report.md +91 -0
crates/ec-av1/fixtures/422_muchunk_compound_128root.obuadded+0 -0
Binary file changed
crates/ec-av1/fixtures/422_muchunk_intra_in_inter_128root.obuadded+0 -0
Binary file changed
crates/ec-av1/src/decode.rsmodified+63 -0
| @@ -36022,6 +36022,46 @@ thread_local! { | ||
| 36022 | 36022 | pub(crate) static CHROMA_SPLIT_TX_HITS: std::cell::Cell<usize> = const { std::cell::Cell::new(0) }; |
| 36023 | 36023 | } |
| 36024 | 36024 | |
| 36025 | +thread_local! { | |
| 36026 | + /// lane-av1muchunk422b: how many TX_32X32 chroma units the **compound** | |
| 36027 | + /// `side > 64` mu-chunk walk allocated (`decode_inter_block`'s compound | |
| 36028 | + /// arm, `mu_units(.., chroma_side * chroma_side)`). This is the walk | |
| 36029 | + /// `lanes/av1muchunk422.report.md` called site 2 and could not reach at | |
| 36030 | + /// 4:2:2; `CHROMA_SPLIT_TX_HITS` fires at all seventeen unit sites and | |
| 36031 | + /// cannot attribute a bump to this arm. The single-reference twin (that | |
| 36032 | + /// report's site 5) shares this exact source text, so the bump is routed | |
| 36033 | + /// through `is_compound` and only this counter names site 2. | |
| 36034 | + /// | |
| 36035 | + /// Counted at the ALLOCATION, not at the `side > 64` guard: the arm's | |
| 36036 | + /// lossless branch returns before the unit loop, so `W_intrabc.obu` | |
| 36037 | + /// reaches the guard at ss (1,0) four times and allocates nothing -- a | |
| 36038 | + /// guard-level counter would call that stream a witness of this walk. | |
| 36039 | + pub(crate) static MU_CHUNK_COMPOUND_UNITS: std::cell::Cell<usize> = const { std::cell::Cell::new(0) }; | |
| 36040 | +} | |
| 36041 | + | |
| 36042 | +thread_local! { | |
| 36043 | + /// lane-av1muchunk422b: the intra-in-inter twin of | |
| 36044 | + /// [`MU_CHUNK_COMPOUND_UNITS`] -- TX_32X32 chroma units allocated by the | |
| 36045 | + /// intra-in-inter `side > 64` mu-chunk walk (site 8 of the same report). | |
| 36046 | + /// Same allocation-vs-guard argument: `INTRA_128_IN_INTER_MU_CHROMA_HITS` | |
| 36047 | + /// is bumped once per mu chunk BEFORE this arm's own lossless branch, so | |
| 36048 | + /// it is not a witness of the per-unit walk, and `W_intrabc.obu` fires it | |
| 36049 | + /// eight times at ss (1,0) with zero allocations. | |
| 36050 | + pub(crate) static MU_CHUNK_INTRA_IN_INTER_UNITS: std::cell::Cell<usize> = const { std::cell::Cell::new(0) }; | |
| 36051 | +} | |
| 36052 | + | |
| 36053 | +/// Current value of [`MU_CHUNK_COMPOUND_UNITS`], for a gate's before/after | |
| 36054 | +/// delta. | |
| 36055 | +pub fn mu_chunk_compound_units() -> usize { | |
| 36056 | + MU_CHUNK_COMPOUND_UNITS.with(std::cell::Cell::get) | |
| 36057 | +} | |
| 36058 | + | |
| 36059 | +/// Current value of [`MU_CHUNK_INTRA_IN_INTER_UNITS`], for a gate's | |
| 36060 | +/// before/after delta. | |
| 36061 | +pub fn mu_chunk_intra_in_inter_units() -> usize { | |
| 36062 | + MU_CHUNK_INTRA_IN_INTER_UNITS.with(std::cell::Cell::get) | |
| 36063 | +} | |
| 36064 | + | |
| 36025 | 36065 | thread_local! { |
| 36026 | 36066 | /// lane-av1h5: how many blocks had their leaf walk actually PERMUTED into |
| 36027 | 36067 | /// libaom's chunk-major order by [`mu_chunk_order`] -- a block above 64 |
| @@ -43944,6 +43984,16 @@ fn decode_inter_block( | ||
| 43944 | 43984 | ); |
| 43945 | 43985 | hit!(CHROMA_SPLIT_TX_HITS); |
| 43946 | 43986 | mu_chroma = true; |
| 43987 | + // lane-av1muchunk422b: the allocation of this | |
| 43988 | + // mu-chunk walk, counted per TX_32X32 UNIT. | |
| 43989 | + // The compound and single-reference arms share | |
| 43990 | + // this source text, so `is_compound` routes the | |
| 43991 | + // bump: `MU_CHUNK_COMPOUND_UNITS` names site 2 | |
| 43992 | + // and the single-reference twin (site 5) stays | |
| 43993 | + // out of it. | |
| 43994 | + if is_compound { | |
| 43995 | + hit!(MU_CHUNK_COMPOUND_UNITS); | |
| 43996 | + } | |
| 43947 | 43997 | let dst = mu_units( |
| 43948 | 43998 | if plane_idx == 1 { |
| 43949 | 43999 | &mut u_units |
| @@ -45737,6 +45787,16 @@ fn decode_inter_block( | ||
| 45737 | 45787 | ); |
| 45738 | 45788 | hit!(CHROMA_SPLIT_TX_HITS); |
| 45739 | 45789 | mu_chroma = true; |
| 45790 | + // lane-av1muchunk422b: the allocation of this | |
| 45791 | + // mu-chunk walk, counted per TX_32X32 UNIT. | |
| 45792 | + // The compound and single-reference arms share | |
| 45793 | + // this source text, so `is_compound` routes the | |
| 45794 | + // bump: `MU_CHUNK_COMPOUND_UNITS` names site 2 | |
| 45795 | + // and the single-reference twin (site 5) stays | |
| 45796 | + // out of it. | |
| 45797 | + if is_compound { | |
| 45798 | + hit!(MU_CHUNK_COMPOUND_UNITS); | |
| 45799 | + } | |
| 45740 | 45800 | let dst = mu_units( |
| 45741 | 45801 | if plane_idx == 1 { |
| 45742 | 45802 | &mut u_units |
| @@ -46751,6 +46811,9 @@ fn decode_inter_block( | ||
| 46751 | 46811 | // libaom never selects (class |
| 46752 | 46812 | // `override-slot-on-one-arm`). |
| 46753 | 46813 | mu_chroma = true; |
| 46814 | + // lane-av1muchunk422b: the allocation of the intra-in-inter | |
| 46815 | + // mu-chunk walk (site 8), per TX_32X32 unit. | |
| 46816 | + hit!(MU_CHUNK_INTRA_IN_INTER_UNITS); | |
| 46754 | 46817 | let dst = mu_units( |
| 46755 | 46818 | if plane_idx == 1 { |
| 46756 | 46819 | &mut u_units |
crates/ec-av1/src/stream.rsmodified+250 -0
| @@ -42836,6 +42836,256 @@ exit 0 | ||
| 42836 | 42836 | } |
| 42837 | 42837 | } |
| 42838 | 42838 | |
| 42839 | + /// lane-av1muchunk422b: read a pinned 4:2:2 128-root mu-chunk fixture, | |
| 42840 | + /// asserting its byte length and FNV-1a64 -- a missing fixture is a | |
| 42841 | + /// failure, not a skip. | |
| 42842 | + fn read_pinned_muchunk_fixture(name: &str, len: usize, fnv: u64, gate: &str) -> Vec<u8> { | |
| 42843 | + let path = std::path::PathBuf::from(env!("CARGO_MANIFEST_DIR")) | |
| 42844 | + .join("fixtures") | |
| 42845 | + .join(name); | |
| 42846 | + let bytes = std::fs::read(&path).unwrap_or_else(|e| { | |
| 42847 | + panic!( | |
| 42848 | + "{gate}: pinned fixture {} is missing ({e}) -- the gate cannot run, which is a \ | |
| 42849 | + failure, not a skip", | |
| 42850 | + path.display() | |
| 42851 | + ) | |
| 42852 | + }); | |
| 42853 | + assert_eq!(bytes.len(), len, "{gate}: {name} length moved"); | |
| 42854 | + assert_eq!(fnv1a64(&bytes), fnv, "{gate}: {name} bytes moved"); | |
| 42855 | + bytes | |
| 42856 | + } | |
| 42857 | + | |
| 42858 | + /// lane-av1muchunk422b: `(use_128x128_superblock, ss_x, ss_y, mono_chrome)` | |
| 42859 | + /// of an OBU stream's sequence header. Shape first: a stream that came back | |
| 42860 | + /// 4:2:0 would leave the `side > 64` mu-chunk walk unexercised while every | |
| 42861 | + /// counter assert below still passed. | |
| 42862 | + fn obu_stream_shape(stream: &[u8]) -> Option<(bool, u8, u8, bool)> { | |
| 42863 | + let mut parser = ec_av1_syntax::Av1Parser::new(); | |
| 42864 | + let mut pos = 0usize; | |
| 42865 | + while let Ok(obu) = parser.parse_obu(&stream[pos..]) { | |
| 42866 | + pos += obu.total_size; | |
| 42867 | + if pos >= stream.len() { | |
| 42868 | + break; | |
| 42869 | + } | |
| 42870 | + } | |
| 42871 | + parser.sequence_header().map(|q| { | |
| 42872 | + ( | |
| 42873 | + q.use_128x128_superblock, | |
| 42874 | + q.color_config.subsampling_x, | |
| 42875 | + q.color_config.subsampling_y, | |
| 42876 | + q.color_config.mono_chrome, | |
| 42877 | + ) | |
| 42878 | + }) | |
| 42879 | + } | |
| 42880 | + | |
| 42881 | + /// lane-av1muchunk422b: the **compound** `side > 64` mu-chunk walk -- | |
| 42882 | + /// per-unit chroma allocation of `decode_inter_block`'s compound arm, site | |
| 42883 | + /// 2 of `lanes/av1muchunk422.report.md`, which that lane's recipes all | |
| 42884 | + /// missed (`part128 none=0` on a 384x256 frame). | |
| 42885 | + /// | |
| 42886 | + /// Reachability, shared with the intra-in-inter twin below: the streams | |
| 42887 | + /// that reach this walk are 128-as-the-whole-frame (`--sb-size=128 | |
| 42888 | + /// --min-partition-size=128 --max-partition-size=128`, PARTITION_NONE | |
| 42889 | + /// forced; here `part128 none=7`) and LOSSY, which is load-bearing: each arm | |
| 42890 | + /// has a lossless branch that returns before the unit loop, and | |
| 42891 | + /// `W_intrabc.obu` reaches both guards at ss (1,0) allocating nothing. That | |
| 42892 | + /// is why [`crate::decode::mu_chunk_compound_units`] counts at the | |
| 42893 | + /// ALLOCATION and not at the guard; the counter-proof at the end of the | |
| 42894 | + /// intra test pins that gap. The single-reference twin of site 2 (site 5) | |
| 42895 | + /// shares this exact source text and is routed out of the counter by | |
| 42896 | + /// `is_compound`. | |
| 42897 | + /// | |
| 42898 | + /// **7 of the 8 streams this lane generated DIVERGE from ffmpeg; only | |
| 42899 | + /// `i6_grad128_iis` (the intra-in-inter fixture, pinned in the twin test | |
| 42900 | + /// below) is byte-exact. This compound pin is therefore the COUNTER | |
| 42901 | + /// WITNESS, not an exactness witness** -- it asserts the walk ran, and | |
| 42902 | + /// nothing about pixels. The divergence on this tip is Y and U exact, V | |
| 42903 | + /// differing on a fixed column band (2063/8192, 2138/8192, 2105/8192 and | |
| 42904 | + /// 1988/8192 V samples on shown frames 1-4, first at V row 60 col 36), the | |
| 42905 | + /// same shape on all four compound streams this lane produced, while the | |
| 42906 | + /// committed 4:2:2 128-root SINGLE-reference stream (`422_sb128_3f.obu`) | |
| 42907 | + /// and the committed compound-warp stream whose blocks are all <= 64 | |
| 42908 | + /// (`422_residual_compound_warp_16f.obu`) both stay exact against the same | |
| 42909 | + /// oracle -- so it tracks the 128-root COMPOUND path these counters name. | |
| 42910 | + /// It is a NEW defect and fixing the walk is explicitly out of this lane's | |
| 42911 | + /// charter. When a fix lane lands, add the oracle compare to this test; the | |
| 42912 | + /// counter half already stops this fixture silently ceasing to reach the | |
| 42913 | + /// walk it was pinned for. | |
| 42914 | + /// | |
| 42915 | + /// Recipe (byte-reproducible; whole aomenc argv): | |
| 42916 | + /// ```text | |
| 42917 | + /// ffmpeg -v error -f lavfi -i "testsrc2=size=128x128:rate=25" -t 0.24 \ | |
| 42918 | + /// -pix_fmt yuv422p -f yuv4mpegpipe - > tsrc128.y4m | |
| 42919 | + /// aomenc --codec=av1 --profile=2 --input-chroma-subsampling-x=1 \ | |
| 42920 | + /// --input-chroma-subsampling-y=0 --passes=1 --end-usage=q --cq-level=62 \ | |
| 42921 | + /// --cpu-used=0 --threads=1 --row-mt=0 --sb-size=128 \ | |
| 42922 | + /// --min-partition-size=128 --max-partition-size=128 \ | |
| 42923 | + /// --enable-rect-partitions=0 --enable-ab-partitions=0 \ | |
| 42924 | + /// --enable-1to4-partitions=0 --enable-palette=0 --enable-intrabc=0 \ | |
| 42925 | + /// --deltaq-mode=0 --enable-tx-size-search=0 --enable-interintra-comp=1 \ | |
| 42926 | + /// --enable-interintra-wedge=1 --enable-smooth-interintra=1 --obu -o X | |
| 42927 | + /// ``` | |
| 42928 | + #[test] | |
| 42929 | + fn a_422_muchunk_compound_128root_pinned_stream_reaches_its_unit_walk() { | |
| 42930 | + const NAME: &str = "a_422_muchunk_compound_128root_pinned_stream_reaches_its_unit_walk"; | |
| 42931 | + const FILE: &str = "422_muchunk_compound_128root.obu"; | |
| 42932 | + const LEN: usize = 895; | |
| 42933 | + const FNV: u64 = 0xfb28_f9a7_cf23_9897; | |
| 42934 | + const MIN_UNITS: usize = 32; | |
| 42935 | + let _gate_lock = lock_gate_counters(); | |
| 42936 | + let stream = read_pinned_muchunk_fixture(FILE, LEN, FNV, NAME); | |
| 42937 | + assert_eq!( | |
| 42938 | + obu_stream_shape(&stream), | |
| 42939 | + Some((true, 1, 0, false)), | |
| 42940 | + "{NAME}: {FILE} is not a 4:2:2 (ss 1/0, non-mono) 128x128-superblock stream" | |
| 42941 | + ); | |
| 42942 | + let before = ( | |
| 42943 | + crate::decode::mu_chunk_compound_units(), | |
| 42944 | + crate::decode::mu_chunk_intra_in_inter_units(), | |
| 42945 | + ); | |
| 42946 | + let frames = crate::stream::decode_stream(&stream) | |
| 42947 | + .unwrap_or_else(|e| panic!("{NAME}: {FILE} no longer decodes cleanly: {e}")) | |
| 42948 | + .len(); | |
| 42949 | + let (compound, intra) = ( | |
| 42950 | + crate::decode::mu_chunk_compound_units() - before.0, | |
| 42951 | + crate::decode::mu_chunk_intra_in_inter_units() - before.1, | |
| 42952 | + ); | |
| 42953 | + assert_eq!(frames, 6, "{NAME}: {FILE} shown-frame count"); | |
| 42954 | + assert!( | |
| 42955 | + compound >= MIN_UNITS, | |
| 42956 | + "{NAME}: {FILE} allocated only {compound} compound `side > 64` mu-chunk units \ | |
| 42957 | + (expected >= {MIN_UNITS}) -- the walk this gate names did not run" | |
| 42958 | + ); | |
| 42959 | + assert_eq!( | |
| 42960 | + intra, 0, | |
| 42961 | + "{NAME}: {FILE} also ran the intra-in-inter walk ({intra} units) -- the two fixtures \ | |
| 42962 | + no longer separate the cells" | |
| 42963 | + ); | |
| 42964 | + // DELIBERATELY NO ORACLE COMPARE: 7 of the 8 streams this lane generated | |
| 42965 | + // diverge and this fixture is one of them. This test is the counter | |
| 42966 | + // witness, not an exactness witness -- see the doc comment. | |
| 42967 | + eprintln!( | |
| 42968 | + "{NAME}: {FILE} compound_units={compound} intra_in_inter_units={intra} -- counter \ | |
| 42969 | + witness, pixels NOT asserted (this stream is measured DIVERGENT)" | |
| 42970 | + ); | |
| 42971 | + } | |
| 42972 | + | |
| 42973 | + /// lane-av1muchunk422b: the **intra-in-inter** `side > 64` mu-chunk walk -- | |
| 42974 | + /// per-unit chroma allocation of the intra-in-inter arm (site 8 of | |
| 42975 | + /// `lanes/av1muchunk422.report.md`). This is the ONE stream of the eight | |
| 42976 | + /// this lane generated that is BYTE-EXACT against the ffmpeg/aom oracle | |
| 42977 | + /// (`i6_grad128_iis`), so unlike its compound twin this gate asserts | |
| 42978 | + /// pixel-exactness over every decode-order frame AND that the site counter | |
| 42979 | + /// moved. See the compound test above for the shared reachability and | |
| 42980 | + /// count-at-the-ALLOCATION argument. | |
| 42981 | + /// | |
| 42982 | + /// Recipe (byte-reproducible; same aomenc argv as the compound test except | |
| 42983 | + /// for the source): | |
| 42984 | + /// ```text | |
| 42985 | + /// ffmpeg -v error -f lavfi -i "gradients=size=128x256:c0=0xa1128f:\ | |
| 42986 | + /// c1=0xd98c48:c2=0x120601:c3=0x4abfba:seed=63:duration=0.24:rate=25,\ | |
| 42987 | + /// noise=all_seed=63:alls=6:allf=t" -t 0.24 -pix_fmt yuv422p \ | |
| 42988 | + /// -f yuv4mpegpipe - > grad256.y4m | |
| 42989 | + /// aomenc --codec=av1 --profile=2 --input-chroma-subsampling-x=1 \ | |
| 42990 | + /// --input-chroma-subsampling-y=0 --passes=1 --end-usage=q --cq-level=62 \ | |
| 42991 | + /// --cpu-used=0 --threads=1 --row-mt=0 --sb-size=128 \ | |
| 42992 | + /// --min-partition-size=128 --max-partition-size=128 \ | |
| 42993 | + /// --enable-rect-partitions=0 --enable-ab-partitions=0 \ | |
| 42994 | + /// --enable-1to4-partitions=0 --enable-palette=0 --enable-intrabc=0 \ | |
| 42995 | + /// --deltaq-mode=0 --enable-tx-size-search=0 --enable-interintra-comp=1 \ | |
| 42996 | + /// --enable-interintra-wedge=1 --enable-smooth-interintra=1 --obu -o X | |
| 42997 | + /// ``` | |
| 42998 | + #[test] | |
| 42999 | + fn a_422_muchunk_intra_in_inter_128root_pinned_stream_is_exact_and_reaches_its_unit_walk() { | |
| 43000 | + const NAME: &str = | |
| 43001 | + "a_422_muchunk_intra_in_inter_128root_pinned_stream_is_exact_and_reaches_its_unit_walk"; | |
| 43002 | + const FILE: &str = "422_muchunk_intra_in_inter_128root.obu"; | |
| 43003 | + const LEN: usize = 391; | |
| 43004 | + const FNV: u64 = 0xe4d7_2c19_5a11_1f4f; | |
| 43005 | + const MIN_UNITS: usize = 16; | |
| 43006 | + // 6 shown frames + the 1 hidden alt-ref frame the oracle also emits. | |
| 43007 | + const DECODED: usize = 7; | |
| 43008 | + let _gate_lock = lock_gate_counters(); | |
| 43009 | + let stream = read_pinned_muchunk_fixture(FILE, LEN, FNV, NAME); | |
| 43010 | + assert_eq!( | |
| 43011 | + obu_stream_shape(&stream), | |
| 43012 | + Some((true, 1, 0, false)), | |
| 43013 | + "{NAME}: {FILE} is not a 4:2:2 (ss 1/0, non-mono) 128x128-superblock stream" | |
| 43014 | + ); | |
| 43015 | + let before = ( | |
| 43016 | + crate::decode::mu_chunk_compound_units(), | |
| 43017 | + crate::decode::mu_chunk_intra_in_inter_units(), | |
| 43018 | + ); | |
| 43019 | + let frames = crate::stream::decode_stream(&stream) | |
| 43020 | + .unwrap_or_else(|e| panic!("{NAME}: {FILE} no longer decodes cleanly: {e}")) | |
| 43021 | + .len(); | |
| 43022 | + let (compound, intra) = ( | |
| 43023 | + crate::decode::mu_chunk_compound_units() - before.0, | |
| 43024 | + crate::decode::mu_chunk_intra_in_inter_units() - before.1, | |
| 43025 | + ); | |
| 43026 | + assert_eq!(frames, 6, "{NAME}: {FILE} shown-frame count"); | |
| 43027 | + assert!( | |
| 43028 | + intra >= MIN_UNITS, | |
| 43029 | + "{NAME}: {FILE} allocated only {intra} intra-in-inter `side > 64` mu-chunk units \ | |
| 43030 | + (expected >= {MIN_UNITS}) -- the site counter this gate names did not move" | |
| 43031 | + ); | |
| 43032 | + assert_eq!( | |
| 43033 | + compound, 0, | |
| 43034 | + "{NAME}: {FILE} also ran the compound walk ({compound} units) -- the two fixtures no \ | |
| 43035 | + longer separate the cells" | |
| 43036 | + ); | |
| 43037 | + if aomdec_available(NAME) { | |
| 43038 | + let (decoded, hidden) = decode_all_frames_vs_oracle(&stream, NAME); | |
| 43039 | + assert_eq!(decoded, DECODED, "{NAME}: {FILE} decode-order frame count"); | |
| 43040 | + eprintln!( | |
| 43041 | + "{NAME}: {FILE} byte-exact over {decoded} decode-order frame(s) ({hidden} \ | |
| 43042 | + hidden), intra_in_inter_units={intra}" | |
| 43043 | + ); | |
| 43044 | + } | |
| 43045 | + | |
| 43046 | + // The counter-proof: the LOSSLESS 4:2:2 stream that reaches both | |
| 43047 | + // `side > 64` guards at ss (1,0) and allocates nothing. `W_intrabc` | |
| 43048 | + // is the fixture the prior lane measured `site 2 = 0` on, and this | |
| 43049 | + // pins why that zero was real -- the arm's lossless branch returns | |
| 43050 | + // before the unit loop. | |
| 43051 | + let dir = std::path::PathBuf::from(env!("CARGO_MANIFEST_DIR")).join("fixtures"); | |
| 43052 | + let intrabc = std::fs::read(dir.join("W_intrabc.obu")) | |
| 43053 | + .expect("W_intrabc.obu is missing -- the counter-proof cannot run"); | |
| 43054 | + let proof_before = ( | |
| 43055 | + crate::decode::mu_chunk_compound_units(), | |
| 43056 | + crate::decode::mu_chunk_intra_in_inter_units(), | |
| 43057 | + crate::decode::intra_128_in_inter_mu_chroma_hits(), | |
| 43058 | + ); | |
| 43059 | + let proof_frames = crate::stream::decode_stream(&intrabc) | |
| 43060 | + .expect("W_intrabc.obu no longer decodes") | |
| 43061 | + .len(); | |
| 43062 | + let proof = ( | |
| 43063 | + crate::decode::mu_chunk_compound_units() - proof_before.0, | |
| 43064 | + crate::decode::mu_chunk_intra_in_inter_units() - proof_before.1, | |
| 43065 | + crate::decode::intra_128_in_inter_mu_chroma_hits() - proof_before.2, | |
| 43066 | + ); | |
| 43067 | + assert_eq!(proof_frames, 16, "{NAME}: W_intrabc shown-frame count"); | |
| 43068 | + assert_eq!( | |
| 43069 | + (proof.0, proof.1), | |
| 43070 | + (0, 0), | |
| 43071 | + "{NAME}: W_intrabc now allocates mu-chunk units ({}, {}) -- it cannot be the \ | |
| 43072 | + counter-proof any more", | |
| 43073 | + proof.0, | |
| 43074 | + proof.1 | |
| 43075 | + ); | |
| 43076 | + assert!( | |
| 43077 | + proof.2 > 0, | |
| 43078 | + "{NAME}: W_intrabc no longer reaches the intra-in-inter guard at all \ | |
| 43079 | + (INTRA_128_IN_INTER_MU_CHROMA_HITS delta 0), so its zero allocations prove \ | |
| 43080 | + nothing about the guard-to-allocation gap this gate rests on" | |
| 43081 | + ); | |
| 43082 | + eprintln!( | |
| 43083 | + "{NAME}: counter-proof W_intrabc allocations=({}, {}) with the intra-in-inter guard \ | |
| 43084 | + fired {} time(s)", | |
| 43085 | + proof.0, proof.1, proof.2 | |
| 43086 | + ); | |
| 43087 | + } | |
| 43088 | + | |
| 42839 | 43089 | /// lane-sbpart r2: a real `aomenc` stream whose superblock-level |
| 42840 | 43090 | /// partition decision is genuinely HORZ/VERT (not NONE/SPLIT) must |
| 42841 | 43091 | /// decode pixel-exact through [`crate::decode::decode_block_rect64`] -- |
lanes/av1muchunk422b.report.mdadded+91 -0
| @@ -0,0 +1,91 @@ | ||
| 1 | +# lane-av1muchunk422b — witnesses for the two `side > 64` mu-chunk walks | |
| 2 | + | |
| 3 | +Base: `main` @ `66210824`. Branch: `lane/av1muchunk422b`. | |
| 4 | + | |
| 5 | +**Verdict: `2/2 walks witnessed`.** Two committed counters and two pinned | |
| 6 | +fixtures reach the exact sites `lanes/av1muchunk422.report.md` spent 12 | |
| 7 | +attempts on and could not reach at 4:2:2. Both gates are green; the | |
| 8 | +intra-in-inter gate is red-proven. The compound gate is a **counter witness, not | |
| 9 | +an exactness witness**. | |
| 10 | + | |
| 11 | +## What the prior lane missed | |
| 12 | + | |
| 13 | +The prior lane's eight recipes all read `part128 none=0`: a 384x256 frame leaves | |
| 14 | +aomenc free to split every 128 superblock, so the `side > 64` walks never ran | |
| 15 | +even though a 128x128 superblock was available. The streams that DO reach these | |
| 16 | +walks are 128-as-the-whole-frame — `--sb-size=128 --min-partition-size=128 | |
| 17 | +--max-partition-size=128` (PARTITION_NONE forced) — and **LOSSY**. The lossless | |
| 18 | +branch of each arm returns before the unit loop, which is why | |
| 19 | +`W_intrabc.obu` reaches both guards at ss (1,0) and allocates nothing. That | |
| 20 | +zero is real, and it is why the new counters count at the **allocation**, not at | |
| 21 | +the guard. | |
| 22 | + | |
| 23 | +## The two verdicts | |
| 24 | + | |
| 25 | +| # | gate | fixture (sha256) | bytes | counter | verdict | | |
| 26 | +|---|---|---|---|---|---| | |
| 27 | +| 1 | `a_422_muchunk_compound_128root_pinned_stream_reaches_its_unit_walk` | `422_muchunk_compound_128root.obu` (`9942bae2…`) | 895 | `MU_CHUNK_COMPOUND_UNITS` (+32) | **COUNTER witness only** — pixels NOT asserted | | |
| 28 | +| 2 | `a_422_muchunk_intra_in_inter_128root_pinned_stream_is_exact_and_reaches_its_unit_walk` | `422_muchunk_intra_in_inter_128root.obu` (`4676fbc1…`) | 391 | `MU_CHUNK_INTRA_IN_INTER_UNITS` (+16) | **EXACT + counter** — byte-exact over 7 decode-order frames (6 shown + 1 hidden alt-ref) | | |
| 29 | + | |
| 30 | +Both fixtures were generated by this lane's eight-stream campaign | |
| 31 | +(`/home/user/.cache/av1muchunk422b/`); the intra fixture is `i6_grad128_iis`, | |
| 32 | +the only one of the eight that is byte-exact against the oracle. | |
| 33 | + | |
| 34 | +## Why the compound gate is not an exactness witness | |
| 35 | + | |
| 36 | +**7 of the 8 streams this lane generated DIVERGE from ffmpeg; only | |
| 37 | +`i6_grad128_iis` is byte-exact.** The compound fixture (`i8_tsrc128_iis`) is one | |
| 38 | +of the seven. On this tip the divergence is Y and U exact, V differing on a | |
| 39 | +fixed column band (2063/8192, 2138/8192, 2105/8192, 1988/8192 V samples on | |
| 40 | +shown frames 1-4, first at V row 60 col 36) — the same shape on all four | |
| 41 | +compound streams, while the committed 4:2:2 128-root SINGLE-reference stream | |
| 42 | +(`422_sb128_3f.obu`) and the committed compound-warp stream whose blocks are all | |
| 43 | +<= 64 (`422_residual_compound_warp_16f.obu`) both stay exact. So the divergence | |
| 44 | +tracks the 128-root COMPOUND path — which is exactly what these counters name. | |
| 45 | + | |
| 46 | +It is a **NEW defect** and out of this lane's charter (the charter was the | |
| 47 | +witness). The test says so in its comment; when a fix lane lands, add the oracle | |
| 48 | +compare to the compound test. The counter half is already in place so the | |
| 49 | +fixture cannot silently stop reaching the walk it was pinned for. | |
| 50 | + | |
| 51 | +## Non-vacuity | |
| 52 | + | |
| 53 | +- **Shape assert first.** Each gate asserts the fixture parses as | |
| 54 | + `use_128x128_superblock=true, ss=(1,0), non-mono`; a stream that came back | |
| 55 | + 4:2:0 would leave the walk unexercised while every counter assert still passed. | |
| 56 | +- **Cross-cell separation.** Each gate asserts the *other* arm's counter at | |
| 57 | + ZERO, so neither can pass by running its sibling's walk. `is_compound` routes | |
| 58 | + the single-reference twin (site 5) out of the compound counter. | |
| 59 | +- **Fixture pin.** Length + FNV-1a64 asserted; a missing/moved fixture is a | |
| 60 | + failure, not a skip. | |
| 61 | +- **Red-proof (intra gate).** Forcing the site-8 bump to never fire | |
| 62 | + (`if false { hit!(MU_CHUNK_INTRA_IN_INTER_UNITS); }`) reddens gate 2 at | |
| 63 | + `stream.rs:43027`: | |
| 64 | + | |
| 65 | + ``` | |
| 66 | + ... allocated only 0 intra-in-inter `side > 64` mu-chunk units (expected >= 16) | |
| 67 | + -- the site counter this gate names did not move | |
| 68 | + ``` | |
| 69 | + | |
| 70 | + Reverted; re-run green. | |
| 71 | +- **Counter-proof (in gate 2).** `W_intrabc.obu` is decoded and asserted to | |
| 72 | + allocate `(0, 0)` mu-chunk units while `INTRA_128_IN_INTER_MU_CHROMA_HITS` | |
| 73 | + fires 8 times — pinning the guard-to-allocation gap the design rests on. | |
| 74 | + | |
| 75 | +## Instrument provenance | |
| 76 | + | |
| 77 | +The two counters live in `crates/ec-av1/src/decode.rs` | |
| 78 | +(`MU_CHUNK_COMPOUND_UNITS`, `MU_CHUNK_INTRA_IN_INTER_UNITS` + two `pub fn` | |
| 79 | +getters). The compound counter bumps at the two compound-arm allocation sites | |
| 80 | +(`is_compound`-routed; both share source text with the single-ref twin). The | |
| 81 | +intra counter bumps at the intra-in-inter allocation site. No env-gated probe | |
| 82 | +ships: the temporary `decode_probe.rs` print was removed and `decode_probe.rs` | |
| 83 | +is unmodified in this commit. | |
| 84 | + | |
| 85 | +## Run | |
| 86 | + | |
| 87 | +``` | |
| 88 | +EC_AV1_REQUIRE_AOMDEC=1 cargo test -p ec-av1 --lib -- a_422_muchunk \ | |
| 89 | + --test-threads=1 | |
| 90 | +# 2 passed | |
| 91 | +``` |