Palette gates pixel-compare every decoded attempt, and sub-16 leaves clear their own palette neighbour state
Browse files at this commit588a554a463ddc6fec9d3b2e7d51fdef13772ad3Parent: 16850fe- fix
- palette gates pixel-compare every decoded attempt, and sub-16 leaves clear their own palette neighbour state
4 changed files +182 -19
- crates/ec-av1/src/decode.rs +63 -4
- crates/ec-av1/src/stream.rs +32 -13
- lanes/palette2-r7.report.md +5 -2
- lanes/palette2-r8.report.md +82 -0
crates/ec-av1/src/decode.rsmodified+63 -4
| @@ -1992,11 +1992,20 @@ impl Neighbours { | ||
| 1992 | 1992 | colors: [u16; 8], |
| 1993 | 1993 | ) { |
| 1994 | 1994 | let (r, c) = at; |
| 1995 | - for cell in 0..w / SUB { | |
| 1995 | + // `.max(1)`: a below-16px span covers no whole SUB cell, so the plain | |
| 1996 | + // `w / SUB` loop was a NO-OP for every 16x8/8x16/8x8/4x4 leaf and the | |
| 1997 | + // next block read a long-dead palette out of the above/left arrays | |
| 1998 | + // (class [[cdf-row-held-constant]], lane-palette2 r8). libaom keeps | |
| 1999 | + // `palette_size` per 4px mi cell; corner-cut: our grid is 16px, so a | |
| 2000 | + // sub-16 leaf stamps its whole containing cell -- safe today because | |
| 2001 | + // every sub-16 leaf path refuses palette outright (so it can only | |
| 2002 | + // ever stamp `size == 0`, and its cell holds no palette sibling). | |
| 2003 | + // Upgrade path: widen the palette arrays to mi granularity. | |
| 2004 | + for cell in 0..(w / SUB).max(1) { | |
| 1996 | 2005 | self.above_palette_size[c + cell] = size; |
| 1997 | 2006 | self.above_palette_colors[c + cell] = colors; |
| 1998 | 2007 | } |
| 1999 | - for cell in 0..h / SUB { | |
| 2008 | + for cell in 0..(h / SUB).max(1) { | |
| 2000 | 2009 | self.left_palette_size[r + cell] = size; |
| 2001 | 2010 | self.left_palette_colors[r + cell] = colors; |
| 2002 | 2011 | } |
| @@ -2083,11 +2092,12 @@ impl Neighbours { | ||
| 2083 | 2092 | colors: [u16; 8], |
| 2084 | 2093 | ) { |
| 2085 | 2094 | let (r, c) = at; |
| 2086 | - for cell in 0..w / SUB { | |
| 2095 | + // See [`Self::record_palette_y_rect`] for the `.max(1)`. | |
| 2096 | + for cell in 0..(w / SUB).max(1) { | |
| 2087 | 2097 | self.above_palette_uv_size[c + cell] = size; |
| 2088 | 2098 | self.above_palette_uv_colors[c + cell] = colors; |
| 2089 | 2099 | } |
| 2090 | - for cell in 0..h / SUB { | |
| 2100 | + for cell in 0..(h / SUB).max(1) { | |
| 2091 | 2101 | self.left_palette_uv_size[r + cell] = size; |
| 2092 | 2102 | self.left_palette_uv_colors[r + cell] = colors; |
| 2093 | 2103 | } |
| @@ -3788,6 +3798,12 @@ fn decode_leaf_rect( | ||
| 3788 | 3798 | ); |
| 3789 | 3799 | neighbours.fill_skip_grid_rect(leaf_mi, mi_w, mi_h, skip); |
| 3790 | 3800 | neighbours.fill_lf_grid_rect(leaf_mi, mi_w, mi_h, bw as u8, bh as u8, 0); |
| 3801 | + // This leaf is necessarily non-palette (a palette one refused above), so | |
| 3802 | + // it must CLEAR the above/left palette state over its own span -- without | |
| 3803 | + // this the next block's `palette_y_mode` ctx and colour cache were read | |
| 3804 | + // off whatever block last covered the cell (lane-palette2 r8). | |
| 3805 | + neighbours.record_palette_y_rect(pal_at, bw, bh, 0, [0u16; 8]); | |
| 3806 | + neighbours.record_palette_uv_rect(pal_at, bw, bh, 0, [0u16; 8]); | |
| 3791 | 3807 | Ok(mode) |
| 3792 | 3808 | } |
| 3793 | 3809 | |
| @@ -5684,11 +5700,27 @@ fn decode_leaf8( | ||
| 5684 | 5700 | neighbours.above[leaf_mi.1 + cell][2] = v_state; |
| 5685 | 5701 | } |
| 5686 | 5702 | } |
| 5703 | + // Non-palette 8x8 leaf (this path never reads a palette): clear the | |
| 5704 | + // above/left palette state over its own cell so the next block's ctx and | |
| 5705 | + // colour cache do not read a previous block's palette (lane-palette2 r8). | |
| 5706 | + { | |
| 5707 | + let pal_at = (leaf_mi.0 / (SUB / MI), leaf_mi.1 / (SUB / MI)); | |
| 5708 | + neighbours.record_palette_y_rect(pal_at, 8, 8, 0, [0u16; 8]); | |
| 5709 | + neighbours.record_palette_uv_rect(pal_at, 8, 8, 0, [0u16; 8]); | |
| 5710 | + } | |
| 5687 | 5711 | neighbours.fill_skip_grid(leaf_mi, 2, skip); |
| 5688 | 5712 | neighbours.fill_lf_grid(leaf_mi, 2, 4, 0); |
| 5689 | 5713 | return Ok(mode); |
| 5690 | 5714 | } |
| 5691 | 5715 | neighbours.record_mi(leaf_mi, 8, &[luma_grid, u_grid, v_grid]); |
| 5716 | + // Non-palette 8x8 leaf (this path never reads a palette): clear the | |
| 5717 | + // above/left palette state over its own cell so the next block's ctx and | |
| 5718 | + // colour cache do not read a previous block's palette (lane-palette2 r8). | |
| 5719 | + { | |
| 5720 | + let pal_at = (leaf_mi.0 / (SUB / MI), leaf_mi.1 / (SUB / MI)); | |
| 5721 | + neighbours.record_palette_y_rect(pal_at, 8, 8, 0, [0u16; 8]); | |
| 5722 | + neighbours.record_palette_uv_rect(pal_at, 8, 8, 0, [0u16; 8]); | |
| 5723 | + } | |
| 5692 | 5724 | neighbours.fill_skip_grid(leaf_mi, 2, skip); |
| 5693 | 5725 | neighbours.fill_lf_grid(leaf_mi, 2, 8, 0); |
| 5694 | 5726 | Ok(mode) |
| @@ -13673,6 +13705,33 @@ mod tests { | ||
| 13673 | 13705 | assert!(!is_uni_comp_ref(LAST_FRAME, n.above_ref1[0].unwrap())); |
| 13674 | 13706 | } |
| 13675 | 13707 | |
| 13708 | + /// A below-16px leaf must clear the palette neighbour state over its own | |
| 13709 | + /// cell: before lane-palette2 r8 `record_palette_y_rect`'s `w / SUB` loops | |
| 13710 | + /// ran zero times for any sub-16 span, so `decode_leaf_rect` / | |
| 13711 | + /// `decode_leaf8` left a previous block's palette size and colours in the | |
| 13712 | + /// above/left arrays and the NEXT block read `palette_y_mode` off the | |
| 13713 | + /// wrong CDF row with a stale colour cache (class | |
| 13714 | + /// [[cdf-row-held-constant]]). | |
| 13715 | + #[test] | |
| 13716 | + fn a_sub16_leaf_after_a_palette_block_yields_palette_ctx_zero() { | |
| 13717 | + let mut n = Neighbours::new(4, 4, 16, 16); | |
| 13718 | + // A real 16x16 palette block covering SUB cell (1, 1). | |
| 13719 | + n.record_palette_y_rect((1, 1), 16, 16, 2, [7, 9, 0, 0, 0, 0, 0, 0]); | |
| 13720 | + let (ctx, cache) = n.palette_ctx_and_cache((1, 1)); | |
| 13721 | + assert_eq!(ctx, 2, "the palette block itself must be visible"); | |
| 13722 | + assert_eq!(cache, vec![7, 9]); | |
| 13723 | + // An 8x8 non-palette leaf in that same cell. | |
| 13724 | + n.record_palette_y_rect((1, 1), 8, 8, 0, [0u16; 8]); | |
| 13725 | + let (ctx, cache) = n.palette_ctx_and_cache((1, 1)); | |
| 13726 | + assert_eq!(ctx, 0, "a sub-16 non-palette leaf must clear its own cell"); | |
| 13727 | + assert!(cache.is_empty(), "and its stale colour cache with it"); | |
| 13728 | + // Same for the chroma half. | |
| 13729 | + n.record_palette_uv_rect((1, 1), 16, 16, 2, [1, 2, 0, 0, 0, 0, 0, 0]); | |
| 13730 | + assert_eq!(n.palette_uv_cache((1, 1)), vec![1, 2]); | |
| 13731 | + n.record_palette_uv_rect((1, 1), 8, 8, 0, [0u16; 8]); | |
| 13732 | + assert!(n.palette_uv_cache((1, 1)).is_empty()); | |
| 13733 | + } | |
| 13734 | + | |
| 13676 | 13735 | /// [`cdf::COMPOUND_MODE_CTX_MAP`] folded by hand against libaom's |
| 13677 | 13736 | /// `av1_mode_context_analyzer` compound branch (`mvref_common.h`): |
| 13678 | 13737 | /// `comp_ctx = compound_mode_ctx_map[refmv_ctx >> 1][min(newmv_ctx, 4)]` |
crates/ec-av1/src/stream.rsmodified+32 -13
| @@ -2090,6 +2090,7 @@ mod tests { | ||
| 2090 | 2090 | return; |
| 2091 | 2091 | } |
| 2092 | 2092 | let mut matched = 0u32; |
| 2093 | + let mut uncounted_exact = 0u32; | |
| 2093 | 2094 | let mut named_refusals = 0u32; |
| 2094 | 2095 | let mut attempts = 0u32; |
| 2095 | 2096 | let sizes = [(64, 128), (128, 64), (128, 128), (128, 192), (192, 192)]; |
| @@ -2166,13 +2167,19 @@ mod tests { | ||
| 2166 | 2167 | } |
| 2167 | 2168 | Ok(frames) => frames, |
| 2168 | 2169 | }; |
| 2169 | - let after = crate::decode::palette_rect_hits(); | |
| 2170 | - if after == before { | |
| 2170 | + // A successful decode is ALWAYS pixel-compared; the hit | |
| 2171 | + // counter only decides whether the attempt counts toward | |
| 2172 | + // the hit-asserting total (class | |
| 2173 | + // [[gate-skips-on-its-own-failure]]: the old `continue` | |
| 2174 | + // here let 16/70 decoded attempts past without any pixel | |
| 2175 | + // check at all). | |
| 2176 | + let counted = crate::decode::palette_rect_hits() != before; | |
| 2177 | + if !counted { | |
| 2171 | 2178 | eprintln!( |
| 2172 | 2179 | "{NAME}: {source} cq={cq} decoded without ever landing a rect \ |
| 2173 | - palette block (palette_rect_hits unchanged) -- not counted" | |
| 2180 | + palette block (palette_rect_hits unchanged) -- pixel-compared, \ | |
| 2181 | + not counted toward the hit assertion" | |
| 2174 | 2182 | ); |
| 2175 | - continue; | |
| 2176 | 2183 | } |
| 2177 | 2184 | let frame_count = frames.len(); |
| 2178 | 2185 | let ffmpeg_frames = ffmpeg_decode_sequence(&stream, width, height, frame_count); |
| @@ -2199,7 +2206,11 @@ mod tests { | ||
| 2199 | 2206 | "{NAME}: {source} cq={cq} frame {i} V vs ffmpeg" |
| 2200 | 2207 | ); |
| 2201 | 2208 | } |
| 2202 | - matched += 1; | |
| 2209 | + if counted { | |
| 2210 | + matched += 1; | |
| 2211 | + } else { | |
| 2212 | + uncounted_exact += 1; | |
| 2213 | + } | |
| 2203 | 2214 | } |
| 2204 | 2215 | } |
| 2205 | 2216 | } |
| @@ -2210,7 +2221,8 @@ mod tests { | ||
| 2210 | 2221 | pixel-exact" |
| 2211 | 2222 | ); |
| 2212 | 2223 | eprintln!( |
| 2213 | - "{NAME}: {matched}/{attempts} attempts matched pixel-exact, {named_refusals} \ | |
| 2224 | + "{NAME}: {matched}/{attempts} attempts matched pixel-exact, \ | |
| 2225 | + {uncounted_exact} decoded-and-pixel-exact but uncounted, {named_refusals} \ | |
| 2214 | 2226 | named refusals, palette_rect_hits={}", |
| 2215 | 2227 | crate::decode::palette_rect_hits() |
| 2216 | 2228 | ); |
| @@ -2246,6 +2258,7 @@ mod tests { | ||
| 2246 | 2258 | // luma transform (lane-palette2 r7's lifted refusal): the same |
| 2247 | 2259 | // screen-content streams exercise it, so this gate proves both. |
| 2248 | 2260 | let mut split_palette_matched = 0u32; |
| 2261 | + let mut uncounted_exact = 0u32; | |
| 2249 | 2262 | let mut named_refusals = 0u32; |
| 2250 | 2263 | let mut attempts = 0u32; |
| 2251 | 2264 | let sizes = [(64, 128), (128, 64), (128, 128), (128, 192), (192, 192)]; |
| @@ -2323,14 +2336,15 @@ mod tests { | ||
| 2323 | 2336 | } |
| 2324 | 2337 | Ok(frames) => frames, |
| 2325 | 2338 | }; |
| 2326 | - let after = crate::decode::rect_screen_content_hits(); | |
| 2327 | - if after == before { | |
| 2339 | + // Same integrity rule as the palette gate above: decoded | |
| 2340 | + // means pixel-compared, counter or no counter. | |
| 2341 | + let counted = crate::decode::rect_screen_content_hits() != before; | |
| 2342 | + if !counted { | |
| 2328 | 2343 | eprintln!( |
| 2329 | 2344 | "{NAME}: {source} cq={cq} decoded without ever running the rect \ |
| 2330 | - screen-content path (rect_screen_content_hits unchanged) -- not \ | |
| 2331 | - counted" | |
| 2345 | + screen-content path (rect_screen_content_hits unchanged) -- \ | |
| 2346 | + pixel-compared, not counted toward the hit assertion" | |
| 2332 | 2347 | ); |
| 2333 | - continue; | |
| 2334 | 2348 | } |
| 2335 | 2349 | let frame_count = frames.len(); |
| 2336 | 2350 | let ffmpeg_frames = ffmpeg_decode_sequence(&stream, width, height, frame_count); |
| @@ -2357,8 +2371,12 @@ mod tests { | ||
| 2357 | 2371 | "{NAME}: {source} cq={cq} frame {i} V vs ffmpeg" |
| 2358 | 2372 | ); |
| 2359 | 2373 | } |
| 2360 | - matched += 1; | |
| 2361 | - if crate::decode::palette_split_tx_hits() > split_before { | |
| 2374 | + if counted { | |
| 2375 | + matched += 1; | |
| 2376 | + } else { | |
| 2377 | + uncounted_exact += 1; | |
| 2378 | + } | |
| 2379 | + if counted && crate::decode::palette_split_tx_hits() > split_before { | |
| 2362 | 2380 | split_palette_matched += 1; |
| 2363 | 2381 | } |
| 2364 | 2382 | } |
| @@ -2378,6 +2396,7 @@ mod tests { | ||
| 2378 | 2396 | eprintln!( |
| 2379 | 2397 | "{NAME}: {matched}/{attempts} attempts matched pixel-exact \ |
| 2380 | 2398 | ({split_palette_matched} of them through a split-transform palette block), \ |
| 2399 | + {uncounted_exact} decoded-and-pixel-exact but uncounted, \ | |
| 2381 | 2400 | {named_refusals} named refusals, rect_screen_content_hits={}, \ |
| 2382 | 2401 | palette_split_tx_hits={}", |
| 2383 | 2402 | crate::decode::rect_screen_content_hits(), |
lanes/palette2-r7.report.mdmodified+5 -2
| @@ -47,8 +47,11 @@ Command (worktree, `CARGO_TARGET_DIR=$HOME/.cache/cargo-target-palette2`, `EC_AV | ||
| 47 | 47 | refusal_inventory gate_coverage |
| 48 | 48 | # test result: ok. 7 passed; 0 failed; 0 ignored |
| 49 | 49 | |
| 50 | -aomenc line in both: `--tune-content=screen --enable-palette=1 --enable-rect-partitions=1 | |
| 51 | ---min-partition-size=16 --max-partition-size=64 --sb-size=64 --passes=1 --threads=1 --row-mt=0`, | |
| 50 | +aomenc line in both (CORRECTED r8 -- r7 wrote `--tune-content=screen | |
| 51 | +--enable-rect-partitions=1`, which the code at stream.rs ~2118-2135 / ~2274-2291 passes | |
| 52 | +NEITHER of; the actual argv is): `--codec=av1 --passes=1 --end-usage=q --cq-level=<cq> | |
| 53 | +--cpu-used=4 --threads=1 --row-mt=0 --sb-size=64 --enable-palette=1 --min-partition-size=16 | |
| 54 | +--max-partition-size=64 --obu -o - -`, | |
| 52 | 55 | 70 attempts (5 sizes x 7 cq x smptebars/rgbtestsrc), pixel-compared against ffmpeg's decode. |
| 53 | 56 | |
| 54 | 57 | EVIDENCE: /tmp/claude-1000/-home-user-Documents-Code-Rust-edith-codecs/b6d8a07f-96a4-4bbb-b378-af9ae25cf7c9/scratchpad/palette2-r7-gates.txt | 70 real-aomenc screen-content encodes decoded and pixel-compared vs ffmpeg | a_real_aomenc_stream_with_rect_screen_content: 14/70 pixel-exact, 13 of them through a split-transform palette block, rect_screen_content_hits=169, palette_split_tx_hits=356 |
lanes/palette2-r8.report.mdadded+82 -0
| @@ -0,0 +1,82 @@ | ||
| 1 | +# lane-palette2 r8 — verifier findings closed; both gates now RED on a real defect they used to hide | |
| 2 | + | |
| 3 | +VERDICT: RED (honest). The two gate-integrity fixes the verifier asked for turned 2 previously | |
| 4 | +"green" gates red: 16/70 attempts per gate decoded successfully and were never pixel-compared, | |
| 5 | +and one of them (`rgbtestsrc=size=128x128:rate=25 cq=55`) mismatches ffmpeg on chroma. That | |
| 6 | +mismatch is PRE-EXISTING, not caused by this round's decoder change (proved by stashing the | |
| 7 | +decode.rs diff and re-running: same panic, same attempt, same plane). | |
| 8 | + | |
| 9 | +## What changed | |
| 10 | +- `crates/ec-av1/src/stream.rs` ~2170-2210 (`a_real_aomenc_stream_with_rect_palette_decodes_pixel_exact`) | |
| 11 | + and ~2335-2375 (`a_real_aomenc_stream_with_rect_screen_content_decodes_pixel_exact`) — the | |
| 12 | + hit-counter check no longer `continue`s past the pixel comparison. Every successfully decoded | |
| 13 | + attempt is compared and a mismatch panics; the counter now only decides whether the attempt | |
| 14 | + counts toward the hit-asserting total (`matched` vs new `uncounted_exact`). Class | |
| 15 | + [[gate-skips-on-its-own-failure]]. | |
| 16 | +- `crates/ec-av1/src/decode.rs` ~1986-2010 / ~2084-2105 (`record_palette_y_rect`, | |
| 17 | + `record_palette_uv_rect`) — `for cell in 0..(w / SUB).max(1)` (both axes). The plain | |
| 18 | + `w / SUB` loop was a NO-OP for every sub-16px span, so a sub-16 leaf could not clear the | |
| 19 | + above/left palette state at all. Corner-cut comment names the ceiling: our grid is 16px | |
| 20 | + where libaom keeps `palette_size` per 4px mi cell; safe today because every sub-16 leaf | |
| 21 | + path refuses palette outright, so it can only ever stamp `size == 0`. Upgrade path: | |
| 22 | + widen the palette arrays to mi granularity. | |
| 23 | +- `crates/ec-av1/src/decode.rs` ~3803-3810 (`decode_leaf_rect`, before `Ok(mode)`) and | |
| 24 | + ~5703/~5721 (`decode_leaf8`, both exits) — each sub-16 leaf now records its own palette | |
| 25 | + state (size 0, since both paths refuse palette) over its own cell, so the next block's | |
| 26 | + `palette_y_mode` ctx and colour cache no longer read a previous block's palette. Class | |
| 27 | + [[cdf-row-held-constant]]. | |
| 28 | +- `crates/ec-av1/src/decode.rs` (tests) — new unit test | |
| 29 | + `a_sub16_leaf_after_a_palette_block_yields_palette_ctx_zero`: a 16x16 palette block gives | |
| 30 | + ctx 2 + cache [7,9]; an 8x8 non-palette leaf in the same cell must take it to ctx 0 and an | |
| 31 | + empty cache (Y and UV halves). Fails before this round's fix, passes after. | |
| 32 | +- `lanes/palette2-r7.report.md` line 50 — CORRECTED. r7 claimed the aomenc line carried | |
| 33 | + `--tune-content=screen --enable-rect-partitions=1`; the code passes NEITHER. Real argv: | |
| 34 | + `--codec=av1 --passes=1 --end-usage=q --cq-level=<cq> --cpu-used=4 --threads=1 --row-mt=0 | |
| 35 | + --sb-size=64 --enable-palette=1 --min-partition-size=16 --max-partition-size=64 --obu -o - -`. | |
| 36 | + The recipe itself is unchanged. | |
| 37 | + | |
| 38 | +## Gate results (EC_AV1_REQUIRE_AOMENC=1) | |
| 39 | +``` | |
| 40 | +cd <worktree>; export CARGO_TARGET_DIR=$HOME/.cache/cargo-target-palette2 EC_AV1_REQUIRE_AOMENC=1 | |
| 41 | +cargo test -p ec-av1 --lib -j3 -- --test-threads=1 --nocapture \ | |
| 42 | + a_real_aomenc_stream_with_rect_palette_decodes_pixel_exact \ | |
| 43 | + a_real_aomenc_stream_with_rect_screen_content_decodes_pixel_exact | |
| 44 | +``` | |
| 45 | +Buckets over the same 70-attempt sweep (5 sizes x 7 cq x smptebars/rgbtestsrc), per gate: | |
| 46 | +- named refusal: 54/70 (32x32 partition value=4..7, filter-intra-on-strip, split-transform strip) | |
| 47 | +- decoded, counter fired, pixel-compared: was 14/70 in r7 — not re-reached this round, the run | |
| 48 | + aborts at the first mismatch, which is an uncounted attempt earlier in the sweep. | |
| 49 | +- decoded, counter did NOT fire, now pixel-compared (r7 skipped these entirely): 2 reached | |
| 50 | + before the abort — `rgbtestsrc 128x64 cq=63` (exact) and `rgbtestsrc 128x128 cq=55` (MISMATCH). | |
| 51 | +`refusal_inventory` (3 tests) + `gate_coverage` (2 tests): 5 passed, 0 failed. | |
| 52 | + | |
| 53 | +## The defect the integrity fix exposed | |
| 54 | +`rgbtestsrc=size=128x128:rate=25 cq=55`, single key frame: luma bit-exact, V exact, **U plane | |
| 55 | +30 pixels wrong by +-1 / +-2**, all inside chroma rows 38-50 x cols 28-50 (luma 76-100 x 56-100). | |
| 56 | +Shape matches the open residual chroma-only defect already noted on main (`1a89ed9` "residual | |
| 57 | +chroma-only defect open") and memory `[[lane-tiny r4]]`: chroma-only +-1 with luma exact is a | |
| 58 | +post-recon (filter) defect — dump prefilt/postdeblock stages first, do NOT open a symbol trace. | |
| 59 | +Pinned stream (118 bytes, sha256 | |
| 60 | +`807e5d434b035e626548d0ec3dc166b959622ed64b59dfa049a16d0e5a35c297`): | |
| 61 | +`/tmp/claude-1000/-home-user-Documents-Code-Rust-edith-codecs/b6d8a07f-96a4-4bbb-b378-af9ae25cf7c9/scratchpad/palette2-r8-mismatch.obu` | |
| 62 | +(not committed: `crates/ec-av1/fixtures` is under `.gitignore:2 fixtures`; regenerate with | |
| 63 | +`EC_AV1_GATE_DUMP=<path>` on either gate). | |
| 64 | + | |
| 65 | +## EVIDENCE | |
| 66 | +EVIDENCE: /tmp/claude-1000/-home-user-Documents-Code-Rust-edith-codecs/b6d8a07f-96a4-4bbb-b378-af9ae25cf7c9/scratchpad/palette2-r8-mismatch.obu | both palette gates re-run under EC_AV1_REQUIRE_AOMENC=1 with the counter-`continue` removed | 2 previously-unchecked decoded attempts now compared; 1 exact, 1 mismatching (U plane, 30 px, max |d| = 2) | |
| 67 | +EVIDENCE: stash-and-rerun of the decode.rs diff (`git stash push crates/ec-av1/src/decode.rs`, gate re-run, `git stash pop`) | same gate, r8 stream.rs only | identical panic at stream.rs:2200, same attempt, same plane -- the chroma defect is pre-existing, not this round's regression | |
| 68 | +EVIDENCE: cargo test -p ec-av1 --lib -j3 (EC_AV1_REQUIRE_AOMENC=1) | whole ec-av1 lib | 268 passed, 2 failed (the two palette gates above), 23 ignored, 514.71s | |
| 69 | +EVIDENCE: cargo test -p ec-av1 --lib -j3 a_sub16_leaf_after_a_palette_block | new unit test | 1 passed | |
| 70 | + | |
| 71 | +## Residue | |
| 72 | +- fix-now(next round, blocks merge): the chroma-only U mismatch above. Both gates stay RED until | |
| 73 | + it is fixed or its stream is proven to hit a legal named refusal instead. | |
| 74 | +- deferred(concurrent lanes own these gates): 8 sibling sites in stream.rs carry the SAME shape -- | |
| 75 | + a successful decode whose hit counter did not move `continue`s/`never_fired += 1` before any | |
| 76 | + pixel compare: lines ~2662 (`tx_depth_hits`), ~3781 (`non_last_ref_hits`), ~3959 | |
| 77 | + (`ref_hits(target_ref)`), ~4159 (`comp_mode_hits`), ~4354 (`skip_mode_hits`), ~4530 | |
| 78 | + (`obmc_hits`), ~7222 (`tmv_hits`), ~7495 (`tx_class1_hits`). Same one-line transform applies | |
| 79 | + (compare pixels, then decide whether to count). NOT changed here: they belong to lanes running | |
| 80 | + concurrently in this batch on the same file (merge-conflict cost), and each needs its own | |
| 81 | + aomenc sweep to validate. Unblocked by: this batch's merge, then one mechanical sweep round. | |
| 82 | +- accepted: the 16px palette-neighbour grid (corner-cut comment in `record_palette_y_rect`). |