Merge lane/av1444palw: the palette walk's HORIZONTAL arm (nw>1) and a 12-bit cell are MEASURED, not "correct by construction"
Browse files at this commit6 changed files +365 -0
- crates/ec-av1/fixtures/444_palette_chroma_hstrip_640x480_10b.obu +0 -0
- crates/ec-av1/fixtures/444_palette_chroma_hstrip_640x480_12b.obu +0 -0
- crates/ec-av1/src/decode.rs +16 -0
- crates/ec-av1/src/stream.rs +131 -0
- lanes/av1444palw.report.md +199 -0
- lanes/refute-av1444d10.report.md +19 -0
crates/ec-av1/fixtures/444_palette_chroma_hstrip_640x480_10b.obuadded+0 -0
Binary file changed
crates/ec-av1/fixtures/444_palette_chroma_hstrip_640x480_12b.obuadded+0 -0
Binary file changed
crates/ec-av1/src/decode.rsmodified+16 -0
| @@ -20154,6 +20154,22 @@ fn decode_block_rect64( | |||
| 20154 | } | 20154 | } |
| 20155 | }; | 20155 | }; |
| 20156 | let bigger = nw * nh > 1; | 20156 | let bigger = nw * nh > 1; |
| 20157 | + // lane-av1444palw: the reach census for the horizontal arm of this | ||
| 20158 | + // walk. `EC_PALWALK=1` prints, per rect64 block, the plane-block | ||
| 20159 | + // geometry, the unit grid it was tiled into, and whether a chroma | ||
| 20160 | + // palette was present -- so a fixture search can tell `nw >= 2` (the | ||
| 20161 | + // arm nothing had reached) from `nh >= 2` (the arm the corpus census | ||
| 20162 | + // already covered), and can see WHY a candidate block did not fire. | ||
| 20163 | + // Diagnostic only; no decode behaviour depends on it. | ||
| 20164 | + if crate::envflags::env_flag!("EC_PALWALK") { | ||
| 20165 | + eprintln!( | ||
| 20166 | + "EC_PALWALK mi={r},{c} px={px} py={py} bw={bw} bh={bh} cw={chroma_w} \ | ||
| 20167 | + ch={chroma_h} uw={uw} uh={uh} nw={nw} nh={nh} ast={allow_screen_content_tools} \ | ||
| 20168 | + puv={} py={}", | ||
| 20169 | + palette_uv.is_some() as i32, | ||
| 20170 | + palette_y.is_some() as i32 | ||
| 20171 | + ); | ||
| 20172 | + } | ||
| 20157 | let mut u_levels = vec![0i32; chroma_w * chroma_h]; | 20173 | let mut u_levels = vec![0i32; chroma_w * chroma_h]; |
| 20158 | let mut v_levels = vec![0i32; chroma_w * chroma_h]; | 20174 | let mut v_levels = vec![0i32; chroma_w * chroma_h]; |
| 20159 | // The tiled units below stamp their own coefficient context | 20175 | // The tiled units below stamp their own coefficient context |
crates/ec-av1/src/stream.rsmodified+131 -0
| @@ -50911,6 +50911,137 @@ exit 0 | |||
| 50911 | } | 50911 | } |
| 50912 | } | 50912 | } |
| 50913 | 50913 | ||
| 50914 | + /// lane-av1444palw: the gate for the arm | ||
| 50915 | + /// `a_444_lossy_palette_chroma_unit_window_is_byte_exact_at_352x242_10bit` | ||
| 50916 | + /// could NOT reach -- the HORIZONTAL half of the same 32-capped chroma | ||
| 50917 | + /// walk in `decode_block_rect64` (`palette_window(pbuf, chroma_w, | ||
| 50918 | + /// cu_col * uw, cu_row * uh, uw, uh)`, the arms at decode.rs:20131 and | ||
| 50919 | + /// :20199). Its `cu_col` term is the axis the corpus census never | ||
| 50920 | + /// exercised: a 106-fixture trace of that walk found 16 windowed units and | ||
| 50921 | + /// every one had `nw == 1`, i.e. only the `cu_row` term (`nh = 2`) was | ||
| 50922 | + /// ever load-bearing. | ||
| 50923 | + /// | ||
| 50924 | + /// **What makes `nw >= 2` reachable.** At ss (0,0) the chroma plane block | ||
| 50925 | + /// equals the luma one, so a 64-WIDE luma rect block keeps `cw = 64` and | ||
| 50926 | + /// the 32-cap tiles it into `nw = 2` units. `decode_block_rect64` is the | ||
| 50927 | + /// only function owning this walk at a 64-wide block, reached from | ||
| 50928 | + /// `PARTITION_HORZ`/`HORZ_A`/`HORZ_B` (64x32) and `HORZ_4` (64x16). The | ||
| 50929 | + /// cells here came from sweeping `--min-partition-size` x `--cq-level` over | ||
| 50930 | + /// a 4:4:4 testsrc2 640x480 cell encoded with the lane-av1rect14 | ||
| 50931 | + /// `ibc640` flag set (rect + 1:4 partitions, `--min-partition-size=8 | ||
| 50932 | + /// --sb-size=64 --tune-content=screen --enable-palette=1 | ||
| 50933 | + /// --enable-intrabc=1 --enable-tx-size-search=0 --cpu-used=0 | ||
| 50934 | + /// --lag-in-frames=0 --kf-max-dist=1 --limit=1 --threads=1 | ||
| 50935 | + /// --tile-columns=0 --passes=1 --end-usage=q --profile=1`): | ||
| 50936 | + /// `--min-partition-size=8` is what yields the 64-wide strip, and | ||
| 50937 | + /// `cq-level=45` is what makes the chroma palette win on it. Census read | ||
| 50938 | + /// off `EC_PALWALK=1`, the diagnostic rung this lane added to | ||
| 50939 | + /// `decode_block_rect64`: | ||
| 50940 | + /// | ||
| 50941 | + /// * 10-bit `cq 45`: `bw=64 bh=16 cw=64 ch=16 uw=32 uh=16 nw=2 nh=1 puv=1` | ||
| 50942 | + /// -- the RECT-unit arm (`uw != uh`) carrying a chroma palette, `nw = 2`. | ||
| 50943 | + /// * 12-bit `cq 45`: `bw=64 bh=32 cw=64 ch=32 uw=32 uh=32 nw=2 nh=1 puv=1` | ||
| 50944 | + /// -- the SQUARE-unit arm carrying a chroma palette, `nw = 2`, on the | ||
| 50945 | + /// 12-bit chroma plane no prior gate had built. | ||
| 50946 | + /// | ||
| 50947 | + /// **Both cells are byte-exact against the instrumented `aomdec`** per | ||
| 50948 | + /// plane over the single decode-order frame (10-bit 0/0/0, 12-bit 0/0/0), | ||
| 50949 | + /// and the comparator's liveness is proved by a one-byte oracle tamper | ||
| 50950 | + /// moving the mismatch count 0 -> 1 at each depth. | ||
| 50951 | + /// | ||
| 50952 | + /// **Red without the per-unit window, by this gate's own numbers.** | ||
| 50953 | + /// Reverting both `palette_window` calls to the whole-block buffer (the | ||
| 50954 | + /// counter left armed) gives 0 / 25553 / 26139 on the 10-bit cell, first | ||
| 50955 | + /// wrong sample decode frame 0 plane U row 96 col 448 (mutant 810, oracle | ||
| 50956 | + /// 763; plane V the same sample 891 vs 767), and 0 / 6400 / 6400 on the | ||
| 50957 | + /// 12-bit cell, first wrong sample plane U row 352 col 160 (866 vs 2004). | ||
| 50958 | + /// Both are the `cu_col = 1` unit reading the block's column 0 -- this arm, | ||
| 50959 | + /// not a cascade. | ||
| 50960 | + /// | ||
| 50961 | + /// **Non-vacuity.** (1) pinned bytes: 3301 / 2571 with FNV-1a64 and | ||
| 50962 | + /// sha256 asserted. (2) the DERIVED condition: the counter is guarded on | ||
| 50963 | + /// `nw * nh > 1`, so a hit proves the tiled arm ran, and the floors below | ||
| 50964 | + /// are re-measured on these two streams (the pinned gate's floor of 4 was | ||
| 50965 | + /// a floor from ONE stream, not a census). (3) 640x480 with | ||
| 50966 | + /// FULL-RESOLUTION chroma, so a 4:2:0 extent cannot pass. (4) the crate's | ||
| 50967 | + /// own one-byte oracle-comparator liveness control. | ||
| 50968 | + #[test] | ||
| 50969 | + fn a_444_palette_chroma_horizontal_unit_window_is_byte_exact_10bit_and_12bit() { | ||
| 50970 | + const NAME: &str = | ||
| 50971 | + "a_444_palette_chroma_horizontal_unit_window_is_byte_exact_10bit_and_12bit"; | ||
| 50972 | + // (fixture, len, fnv1a64, bit_depth, min_windowed_units) | ||
| 50973 | + const ARMS: [(&str, usize, u64, usize, usize); 2] = [ | ||
| 50974 | + ( | ||
| 50975 | + "fixtures/444_palette_chroma_hstrip_640x480_10b.obu", | ||
| 50976 | + 3301, | ||
| 50977 | + 0x6f94_da75_95cd_9a17, | ||
| 50978 | + 10, | ||
| 50979 | + 8, | ||
| 50980 | + ), | ||
| 50981 | + ( | ||
| 50982 | + "fixtures/444_palette_chroma_hstrip_640x480_12b.obu", | ||
| 50983 | + 2571, | ||
| 50984 | + 0x65a5_8561_c1f3_538e, | ||
| 50985 | + 12, | ||
| 50986 | + 4, | ||
| 50987 | + ), | ||
| 50988 | + ]; | ||
| 50989 | + const W: usize = 640; | ||
| 50990 | + const H: usize = 480; | ||
| 50991 | + let _guard = lock_gate_counters(); | ||
| 50992 | + for (fixture, len, fnv, depth, min_units) in ARMS { | ||
| 50993 | + let obu = std::path::PathBuf::from(env!("CARGO_MANIFEST_DIR")).join(fixture); | ||
| 50994 | + let stream = std::fs::read(&obu).unwrap_or_else(|e| { | ||
| 50995 | + panic!( | ||
| 50996 | + "{NAME}: pinned fixture {fixture} is missing ({e}) -- the gate cannot \ | ||
| 50997 | + run, which is a failure, not a skip" | ||
| 50998 | + ) | ||
| 50999 | + }); | ||
| 51000 | + assert_eq!(stream.len(), len, "{NAME}: {fixture} length moved"); | ||
| 51001 | + assert_eq!(fnv1a64(&stream), fnv, "{NAME}: {fixture} bytes moved"); | ||
| 51002 | + | ||
| 51003 | + crate::decode::reset_chroma_palette_window_hits(); | ||
| 51004 | + let frames = decode_stream(&stream) | ||
| 51005 | + .unwrap_or_else(|e| panic!("{NAME}: {fixture} no longer decodes cleanly: {e}")); | ||
| 51006 | + let windowed = crate::decode::chroma_palette_window_hits(); | ||
| 51007 | + assert!( | ||
| 51008 | + windowed >= min_units, | ||
| 51009 | + "{NAME}: {fixture} ran {windowed} windowed palette chroma unit(s), expected \ | ||
| 51010 | + at least {min_units} -- the 32-cap tiled chroma walk did not reach enough \ | ||
| 51011 | + palette blocks, so the horizontal windowing under test never ran and this \ | ||
| 51012 | + gate is blind to the defect (class gate-blind-to-feature)" | ||
| 51013 | + ); | ||
| 51014 | + assert_eq!( | ||
| 51015 | + frames.len(), | ||
| 51016 | + 1, | ||
| 51017 | + "{NAME}: {fixture} decode-order frame count" | ||
| 51018 | + ); | ||
| 51019 | + for (i, f) in frames.iter().enumerate() { | ||
| 51020 | + assert_eq!( | ||
| 51021 | + (f.width, f.height), | ||
| 51022 | + (W, H), | ||
| 51023 | + "{NAME}: {fixture} frame {i} dimensions" | ||
| 51024 | + ); | ||
| 51025 | + assert_eq!( | ||
| 51026 | + f.u.len(), | ||
| 51027 | + W * H, | ||
| 51028 | + "{NAME}: {fixture} frame {i} chroma plane is {} samples; at 4:4:4 it must \ | ||
| 51029 | + be full resolution ({W}x{H}) -- a {depth}-bit decoder that kept the \ | ||
| 51030 | + 4:2:0 extent cannot pass this compare", | ||
| 51031 | + f.u.len() | ||
| 51032 | + ); | ||
| 51033 | + } | ||
| 51034 | + if aomdec_available(NAME) { | ||
| 51035 | + let (decoded, hidden) = decode_all_frames_vs_oracle(&stream, NAME); | ||
| 51036 | + eprintln!( | ||
| 51037 | + "{NAME}: {fixture} ({depth}-bit) {decoded} decode-order frame(s) \ | ||
| 51038 | + ({hidden} hidden) byte-exact vs aomdec, {windowed} windowed palette \ | ||
| 51039 | + chroma unit(s)" | ||
| 51040 | + ); | ||
| 51041 | + } | ||
| 51042 | + } | ||
| 51043 | + } | ||
| 51044 | + | ||
| 50914 | /// lane-av1cfl: the 4:4:4 CfL AC body is a DIFFERENT function from the | 51045 | /// lane-av1cfl: the 4:4:4 CfL AC body is a DIFFERENT function from the |
| 50915 | /// 4:2:0 one, and this gate is the proof that the format-blind | 51046 | /// 4:2:0 one, and this gate is the proof that the format-blind |
| 50916 | /// `cfl_ac_q3_at` (`bw / 2, bh / 2`, a 2x2 luma average per chroma | 51047 | /// `cfl_ac_q3_at` (`bw / 2, bh / 2`, a 2x2 luma average per chroma |
lanes/av1444palw.report.mdadded+199 -0
| @@ -0,0 +1,199 @@ | |||
| 1 | +# lane-av1444palw — the 4:4:4 palette chroma walk's HORIZONTAL arm (nw >= 2) and a 12-bit cell | ||
| 2 | + | ||
| 3 | +## Verdict | ||
| 4 | + | ||
| 5 | +| claim | before this lane | after | | ||
| 6 | +| --- | --- | --- | | ||
| 7 | +| horizontal windowing (`cu_col * uw`, `nw >= 2`) on a palette chroma block | "correct by construction", reached by **nothing** in 106 committed fixtures | **MEASURED**: 2 committed fixtures, 8 windowed units on the `nw = 2` arm, byte-exact vs `aomdec`, reds without the window | | ||
| 8 | +| 12-bit 4:4:4 palette chroma | never built | **MEASURED**: 1 committed 12-bit fixture, 4 windowed units on the `nw = 2` arm, byte-exact, reds without the window | | ||
| 9 | +| coverage-debt counter floor | `MIN_WINDOWED_UNITS = 4`, a floor from ONE stream | re-measured per stream below; no single floor is a census | | ||
| 10 | + | ||
| 11 | +No second defect was found. The horizontal window is byte-exact wherever it is reached. | ||
| 12 | + | ||
| 13 | +## The mechanism, and why the arm was dead | ||
| 14 | + | ||
| 15 | +`decode_block_rect64`'s 32-capped chroma walk (`decode.rs:20075`): | ||
| 16 | + | ||
| 17 | +```rust | ||
| 18 | +let (uw, uh) = (chroma_w.min(32), chroma_h.min(32)); | ||
| 19 | +let (nw, nh) = (chroma_w / uw, chroma_h / uh); | ||
| 20 | +``` | ||
| 21 | + | ||
| 22 | +and both tiled arms hand each unit | ||
| 23 | + | ||
| 24 | +```rust | ||
| 25 | +palette_window(pbuf, chroma_w, cu_col * uw, cu_row * uh, uw, uh) | ||
| 26 | +``` | ||
| 27 | + | ||
| 28 | +(`decode.rs:20132` square-unit arm, `decode.rs:20200` rect-unit arm). At 4:4:4 (ss | ||
| 29 | +0,0) the chroma plane block equals the luma one, so a **64-wide** luma rect | ||
| 30 | +block keeps `cw = 64` and the cap tiles it into `nw = 2`. That shape is only | ||
| 31 | +reachable from `PARTITION_HORZ` / `HORZ_A` / `HORZ_B` (64x32) and `HORZ_4` | ||
| 32 | +(64x16) — the horizontal siblings of the `PARTITION_VERT` 32x64 strip the | ||
| 33 | +pinned gate already covered. | ||
| 34 | + | ||
| 35 | +## Reach census (this lane's own measurement) | ||
| 36 | + | ||
| 37 | +`EC_PALWALK=1` — a new env-gated rung in `decode_block_rect64`, printing | ||
| 38 | +`bw/bh/cw/ch/uw/uh/nw/nh/ast/puv/py` per block. Diagnostic only; nothing in the | ||
| 39 | +decode path depends on it. | ||
| 40 | + | ||
| 41 | +**Census over every committed fixture** (108 `.obu` files, `decode_probe` per | ||
| 42 | +file, `EC_PALWALK=1`): | ||
| 43 | + | ||
| 44 | +| fixture | walks | geometry | | ||
| 45 | +| --- | --- | --- | | ||
| 46 | +| `420_intrabc_rect4_witness.obu` | 4 | `bw=64 bh=32 cw=32 ch=16` / `bw=64 bh=16 cw=32 ch=8` — 4:2:0, so `nw = 1` by subsampling | | ||
| 47 | +| `444_lossy_palette_chroma_352x242_10b.obu` | 1 | `bw=32 bh=64 cw=32 ch=64 uw=32 uh=32 nw=1 nh=2` | | ||
| 48 | +| `r512_rect2x1_1x2_444.obu` | 1 | `bw=32 bh=64 cw=32 ch=64 uw=32 uh=32 nw=1 nh=2` | | ||
| 49 | + | ||
| 50 | +That reproduces the charter's census exactly: **every windowed unit in the | ||
| 51 | +corpus has `nw = 1`**. The 4:2:0 fixture is the interesting near-miss — it owns | ||
| 52 | +a genuine 64-WIDE luma palette rect block, and subsampling collapses its chroma | ||
| 53 | +to 32, so the horizontal term stays dead there too. | ||
| 54 | + | ||
| 55 | +## The search that reached `nw >= 2` | ||
| 56 | + | ||
| 57 | +Dead ends, all measured (walks = `EC_PALWALK` lines, `nw2_puv` = lines with | ||
| 58 | +`nw >= 2` **and** a chroma palette): | ||
| 59 | + | ||
| 60 | +| family | cells | result | | ||
| 61 | +| --- | --- | --- | | ||
| 62 | +| testsrc2 4:4:4, width sweep 256…640 x cq 16/24/36 (the pinned gate's recipe verbatim) | 26 | 3 cells with any walk, all `nw = 1` | | ||
| 63 | +| the same cell with `--sb-size=64` | 4 | 309 PALSET but 0 walks — palette fires, never on a 64-wide rect64 block | | ||
| 64 | +| the same cell, raw planes transposed (edges swap axis) | 6 | 0 walks | | ||
| 65 | +| flat synthetic colour cells (64x64 / 64x32 / 128x64 / 64x128 grids, 2-colour halves, 4-colour quadrants, horizontal bands with a growing palette downwards) at cq 20/24/40 x screen-tune on/off | 120 | 0 walks — the encoder picks 32x16 / 16x8 strips there | | ||
| 66 | +| **lane-av1rect14 `ibc640` flag set, 4:4:4 640x480, `--min-partition-size` x `cq` grid** | 12 | **2 cells with `nw = 2` AND `puv = 1`** | | ||
| 67 | + | ||
| 68 | +The lever that worked is `--min-partition-size=8` (at 4 it stays `puv = 0`; at | ||
| 69 | +16 the 12-bit cell stops firing) combined with the rect + 1:4 partition flags: | ||
| 70 | +those keep the 64-wide strip in the partition search while a small minimum | ||
| 71 | +partition size stops the encoder from subdividing it past 64. | ||
| 72 | + | ||
| 73 | +## The two cells | ||
| 74 | + | ||
| 75 | +Provenance, both `aomenc` from `~/.cache/aom-oracle/build/aomenc` on | ||
| 76 | +`ffmpeg -f lavfi -i 'testsrc2=s=640x480:r=25' -frames:v 1 -pix_fmt yuv444p{10,12}le -f yuv4mpegpipe`: | ||
| 77 | + | ||
| 78 | +``` | ||
| 79 | +aomenc --codec=av1 --profile=1 --input-bit-depth=$D --bit-depth=$D \ | ||
| 80 | + --width=640 --height=480 --passes=1 --end-usage=q --threads=1 --tile-columns=0 \ | ||
| 81 | + --enable-rect-partitions=1 --enable-1to4-partitions=1 --min-partition-size=8 \ | ||
| 82 | + --sb-size=64 --tune-content=screen --enable-intrabc=1 --enable-palette=1 \ | ||
| 83 | + --enable-tx-size-search=0 --cpu-used=0 --lag-in-frames=0 --kf-max-dist=1 \ | ||
| 84 | + --limit=1 --cq-level=45 --obu -o <out>.obu <in>.y4m | ||
| 85 | +``` | ||
| 86 | + | ||
| 87 | +| fixture | bytes | sha256 | FNV-1a64 | depth | `EC_PALWALK` on the reaching block | | ||
| 88 | +| --- | --- | --- | --- | --- | --- | | ||
| 89 | +| `444_palette_chroma_hstrip_640x480_10b.obu` | 3301 | `40cebc523b327ff41f00d1e813046976990f29fec7da40e730c981b489de6493` | `0x6f94da7595cd9a17` | 10 | `bw=64 bh=16 cw=64 ch=16 uw=32 uh=16 nw=2 nh=1 ast=true puv=1 py=1` — the **rect-unit** arm | | ||
| 90 | +| `444_palette_chroma_hstrip_640x480_12b.obu` | 2571 | `2fb5ba97d7257756a0a2bf781d9f3300ff2d66009989d297758d848561daee9a` | `0x65a58561c1f3538e` | 12 | `bw=64 bh=32 cw=64 ch=32 uw=32 uh=32 nw=2 nh=1 ast=true puv=1 py=0` — the **square-unit** arm | | ||
| 91 | + | ||
| 92 | +Both tiled arms of the walk are now covered, at two bit depths. | ||
| 93 | + | ||
| 94 | +## Measurement vs the oracle (per plane, per decode-order frame) | ||
| 95 | + | ||
| 96 | +Oracle: the instrumented `aomdec` at `~/.cache/aom-oracle/build/aomdec`, | ||
| 97 | +`--rawvideo --output-bit-depth=$D`; ours: `EC_AV1_FINAL_DUMP` u16 LE. 640x480, | ||
| 98 | +one decode-order frame, no hidden frames. | ||
| 99 | + | ||
| 100 | +| cell | Y | U | V | | ||
| 101 | +| --- | --- | --- | --- | | ||
| 102 | +| 10-bit | 0 | 0 | 0 | | ||
| 103 | +| 12-bit | 0 | 0 | 0 | | ||
| 104 | + | ||
| 105 | +**Comparator liveness, proved per depth before trusting the zero.** Flipping | ||
| 106 | +ONE byte of the oracle's own dump: | ||
| 107 | + | ||
| 108 | +``` | ||
| 109 | +10-bit: clean diffs 0 -> tampered diffs 1 | ||
| 110 | +12-bit: clean diffs 0 -> tampered diffs 1 | ||
| 111 | +``` | ||
| 112 | + | ||
| 113 | +## Mutation proof (the gate reds without the per-unit window) | ||
| 114 | + | ||
| 115 | +Reverting both `palette_window(...)` calls at `decode.rs:20132` / `decode.rs:20200` | ||
| 116 | +to the whole-block buffer `pbuf.clone()`, leaving the counter armed, then | ||
| 117 | +running the gate: | ||
| 118 | + | ||
| 119 | +``` | ||
| 120 | +$ cargo test -p ec-av1 --lib a_444_palette_chroma_horizontal_unit_window_is_byte_exact_10bit_and_12bit -- --nocapture | ||
| 121 | +thread 'stream::tests::a_444_palette_chroma_horizontal_unit_window_is_byte_exact_10bit_and_12bit' panicked at crates/ec-av1/src/stream.rs:10848:17: | ||
| 122 | +a_444_palette_chroma_horizontal_unit_window_is_byte_exact_10bit_and_12bit: decode-order frame 0 of 1 (1 shown, 0 hidden) differs from the oracle at byte 738176 (ours 42 vs 251), 54278 bytes differ | ||
| 123 | +test result: FAILED. 0 passed; 1 failed | ||
| 124 | +``` | ||
| 125 | + | ||
| 126 | +(10-bit arm; the 12-bit arm alone, with the 10-bit row removed from `ARMS`, | ||
| 127 | +fails the same way at byte 1065280, 13312 bytes differ.) The reachability assert | ||
| 128 | +stays green through both mutations — the counter is untouched by the mutation — | ||
| 129 | +so it is the PIXEL compare that reds, which is what a non-vacuous gate needs. | ||
| 130 | + | ||
| 131 | +Per-plane counts of the same mutation, from the dumps: | ||
| 132 | + | ||
| 133 | +| cell | Y | U | V | first wrong sample | | ||
| 134 | +| --- | --- | --- | --- | --- | | ||
| 135 | +| 10-bit | 0 | 25553 | 26139 | frame 0 plane U r96 c448, mutant 810 vs oracle 763 (plane V same sample 891 vs 767) | | ||
| 136 | +| 12-bit | 0 | 6400 | 6400 | frame 0 plane U r352 c160, mutant 866 vs oracle 2004 | | ||
| 137 | + | ||
| 138 | +Both are the `cu_col = 1` unit reading the block's column 0 — the horizontal arm | ||
| 139 | +itself, not a downstream cascade (luma stays at 0 in both, so no luma-side | ||
| 140 | +neighbour context is involved). | ||
| 141 | + | ||
| 142 | +## The re-measured counter census | ||
| 143 | + | ||
| 144 | +`decode::chroma_palette_window_hits()` is guarded on `nw * nh > 1`, so a hit | ||
| 145 | +means "the 32-cap tiled this block", i.e. per unit per plane: | ||
| 146 | + | ||
| 147 | +| stream | windowed units | of which `nw >= 2` | | ||
| 148 | +| --- | --- | --- | | ||
| 149 | +| `444_lossy_palette_chroma_352x242_10b.obu` (pinned, existing gate) | 4 | 0 | | ||
| 150 | +| `444_palette_chroma_hstrip_640x480_10b.obu` (new) | 8 | 4 | | ||
| 151 | +| `444_palette_chroma_hstrip_640x480_12b.obu` (new) | 4 | 4 | | ||
| 152 | + | ||
| 153 | +The charter's "floor of 4" was one stream's number. Across the three committed | ||
| 154 | +palette-chroma streams the total is **16 units, 8 of them on the horizontal | ||
| 155 | +arm**, and the per-stream numbers are what the gate now asserts (8 and 4, both | ||
| 156 | +exactly the measured values — the asserts are `>=` on those measurements, so a | ||
| 157 | +future encoder-side change that drops a block still reds the gate). | ||
| 158 | + | ||
| 159 | +## Regression gate | ||
| 160 | + | ||
| 161 | +`stream.rs::a_444_palette_chroma_horizontal_unit_window_is_byte_exact_10bit_and_12bit` | ||
| 162 | +— pinned length + FNV-1a64 per arm, the derived-condition counter as a floor, one | ||
| 163 | +decode-order frame at 640x480 with **full-resolution** chroma asserted (so a | ||
| 164 | +4:2:0 extent cannot pass the compare), and `decode_all_frames_vs_oracle` (which | ||
| 165 | +carries the crate's own one-byte oracle-tamper liveness control). | ||
| 166 | + | ||
| 167 | +Scoped runs on this branch: | ||
| 168 | + | ||
| 169 | +``` | ||
| 170 | +$ CARGO_TARGET_DIR=$HOME/.cache/cargo-target-av1444palw \ | ||
| 171 | + cargo test -p ec-av1 --lib a_444_palette_chroma_horizontal_unit_window_is_byte_exact_10bit_and_12bit -- --nocapture | ||
| 172 | +a_444_palette_chroma_horizontal_unit_window_is_byte_exact_10bit_and_12bit: fixtures/444_palette_chroma_hstrip_640x480_10b.obu (10-bit) 1 decode-order frame(s) (0 hidden) byte-exact vs aomdec, 8 windowed palette chroma unit(s) | ||
| 173 | +a_444_palette_chroma_horizontal_unit_window_is_byte_exact_10bit_and_12bit: fixtures/444_palette_chroma_hstrip_640x480_12b.obu (12-bit) 1 decode-order frame(s) (0 hidden) byte-exact vs aomdec, 4 windowed palette chroma unit(s) | ||
| 174 | +test stream::tests::a_444_palette_chroma_horizontal_unit_window_is_byte_exact_10bit_and_12bit ... ok | ||
| 175 | +test result: ok. 1 passed; 0 failed; 0 ignored; 0 measured; 803 filtered out; finished in 0.50s | ||
| 176 | + | ||
| 177 | +$ cargo test -p ec-av1 --lib a_444_lossy_palette_chroma_unit_window_is_byte_exact_at_352x242_10bit -- --nocapture | ||
| 178 | +a_444_lossy_palette_chroma_unit_window_is_byte_exact_at_352x242_10bit: fixtures/444_lossy_palette_chroma_352x242_10b.obu 17 decode-order frame(s) (1 hidden) byte-exact vs aomdec, 4 windowed palette chroma unit(s) | ||
| 179 | +test result: ok. 1 passed; 0 failed; 0 ignored; 0 measured; 803 filtered out; finished in 1.20s | ||
| 180 | + | ||
| 181 | +$ cargo test -p ec-av1 --lib palette -- --nocapture | ||
| 182 | +test result: ok. 24 passed; 0 failed; 0 ignored; 0 measured; 780 filtered out; finished in 27.07s | ||
| 183 | +``` | ||
| 184 | + | ||
| 185 | +## Scope and honesty notes | ||
| 186 | + | ||
| 187 | +* The only `decode.rs` change is the `EC_PALWALK` diagnostic rung inside | ||
| 188 | + `decode_block_rect64`; no decode logic changed. Announced over IRC to the | ||
| 189 | + three peer lanes before landing; `Agent23-4` and `Agent05-5` confirmed no overlap. | ||
| 190 | +* `EC_PALWALK` is an env-gated `eprintln` in the same style as the existing | ||
| 191 | + `EC_PALSYN` / `EC_DEBUG_PAL` rungs, so the census stays reproducible on any | ||
| 192 | + future fixture without re-deriving it. | ||
| 193 | +* The 12-bit cell needed its own sweep (`--min-partition-size=16`, cq 45): at 8 | ||
| 194 | + the 12-bit chroma never lands a palette on the 64-wide strip. Both settings | ||
| 195 | + are recorded above so either cell can be reproduced exactly. | ||
| 196 | +* The `nw = 2` walk is still reachable only through the `decode_block_rect64` | ||
| 197 | + partition arms. A 128-wide chroma plane block (`nw = 4`) would need a | ||
| 198 | + `128x64` intra block, which this decoder routes elsewhere; that shape remains | ||
| 199 | + **unmeasured**, and no gate claims it. | ||
lanes/refute-av1444d10.report.mdmodified+19 -0
| @@ -21,3 +21,22 @@ file: crates/ec-av1/src/decode.rs:2721-2731 confidence: 0.75 | |||
| 21 | 21 | ||
| 22 | The doc comment on CHROMA_PALETTE_WINDOW_HITS (decode.rs:2721-2731, added by eb73ef89) says it counts 'units that are NOT the block's top-left corner', but the hit! sits unconditionally next to set_palette_pred(palette_window(...)) on both fixed lines, so it also fires for nw*nh==1 blocks where the window is a pure re-stride copy of the whole buffer — the exact units the comment says it excludes. Measured on the pinned fixture the two coincide (all 4 hits are nw=1, nh=2), so nothing is mis-gated today, but a reader auditing non-vacuity would conclude the counter proves the TILED arm ran, which the counter cannot distinguish: a stream whose palette chroma blocks are all single-unit would still produce hits >= 1 and pass the reachability assert. Fix the comment to say 'units handed a windowed slice (all palette chroma units on the 32-capped walk; the window is a no-op when nw*nh==1)' and let the MIN_WINDOWED_UNITS floor plus the byte compare carry the tiled-arm claim, or gate the hit! on bigger (nw*nh > 1) if the tiled arm is what it is meant to witness. | 22 | The doc comment on CHROMA_PALETTE_WINDOW_HITS (decode.rs:2721-2731, added by eb73ef89) says it counts 'units that are NOT the block's top-left corner', but the hit! sits unconditionally next to set_palette_pred(palette_window(...)) on both fixed lines, so it also fires for nw*nh==1 blocks where the window is a pure re-stride copy of the whole buffer — the exact units the comment says it excludes. Measured on the pinned fixture the two coincide (all 4 hits are nw=1, nh=2), so nothing is mis-gated today, but a reader auditing non-vacuity would conclude the counter proves the TILED arm ran, which the counter cannot distinguish: a stream whose palette chroma blocks are all single-unit would still produce hits >= 1 and pass the reachability assert. Fix the comment to say 'units handed a windowed slice (all palette chroma units on the 32-capped walk; the window is a no-op when nw*nh==1)' and let the MIN_WINDOWED_UNITS floor plus the byte compare carry the tiled-arm claim, or gate the hit! on bigger (nw*nh > 1) if the tiled arm is what it is meant to witness. |
| 23 | 23 | ||
| 24 | + | ||
| 25 | +--- | ||
| 26 | + | ||
| 27 | +## Addendum (lane-av1444palw): the counter floor of 4 was never a census | ||
| 28 | + | ||
| 29 | +`a_444_lossy_palette_chroma_unit_window_is_byte_exact_at_352x242_10bit` asserts | ||
| 30 | +`MIN_WINDOWED_UNITS = 4`, documented there as "measured 4 on this stream". That | ||
| 31 | +is a floor from ONE stream and stays correct as a floor, but it must not be read | ||
| 32 | +as "this walk runs 4 units". Re-measured per stream across every committed | ||
| 33 | +palette-chroma stream (`EC_PALWALK=1`, the rung added in | ||
| 34 | +`decode_block_rect64` by lane-av1444palw): | ||
| 35 | + | ||
| 36 | +| stream | windowed units | of which `nw >= 2` | | ||
| 37 | +| --- | --- | --- | | ||
| 38 | +| `444_lossy_palette_chroma_352x242_10b.obu` | 4 | 0 | | ||
| 39 | +| `444_palette_chroma_hstrip_640x480_10b.obu` (new, lane-av1444palw) | 8 | 4 | | ||
| 40 | +| `444_palette_chroma_hstrip_640x480_12b.obu` (new, lane-av1444palw) | 4 | 4 | | ||
| 41 | + | ||
| 42 | +Totals: 16 units, 8 on the horizontal arm. See `lanes/av1444palw.report.md`. | ||