forge
Explore
Log in

Don't you dare go Hollow

lane-av1paletteuv: gate tile::palette_uv_side as the 4:2:0 plane block

Browse files at this commit

0ec5cf8fcbc6e6d13d3f2830f58aa4bb866eaeceAhmet Kaan GümüşParent: 81fd9b0
palette_uv_side(side) = (side / 2).max(4) is named in
lanes/av1subsizesweep.report.md as a "4:2:2/4:4:0 palette map mis-sized"
site. Measured, not fixed: the value IS libaom's plane-1 block at 4:2:0
(blockd.h:1512 -> plane_block = block >> ss, +2 when under 4), and no
reachable path can hand the writer a 4:2:2 or 4:4:4 frame. The decoder's
counterpart (decode.rs:20914-20933) is already per-axis, which is why
those shapes decode byte-exact today.

Census in encode::tests::
the_chroma_palette_map_side_is_the_420_plane_block_and_nothing_else_reaches_it

  arm 1  the value equals libaom's per-axis formula over all 57 sides in
         palette_bsize_ctx's square domain, and the premise is stated as
         arithmetic: the square is NOT the 4:2:2 or 4:4:4 map
  arm 2  the non-test encoder names exactly one chroma shape, (1,1);
         key_frame_headers_colour (the only public door for a caller-chosen
         ColorConfig) reaches no tile writer; encode_key_frame_inner has 5
         non-test call sites, all 4:2:0; Picture::check refuses a 4:2:2-
         and a 4:4:4-shaped picture, by call
  arm 3  a real screen-content encode fires 9 chroma palette blocks and
         round-trips U/V exactly, so arm 1 is not arithmetic over dead code

Five mutations measured biting: drop the halving, raise the floor, pin the
map to 4, flip Colour::color_config to subsampling (0,0), and add one
crate::tile:: line to key_frame_headers_colour. Dropping .max(4) is NOT a
mutation -- palette_bsize_ctx refuses bw*bh < 64, so side 8 already halves
to 4 and the floor is unreachable in the admitted domain; the test body
says so instead of leaving a green floor-mutation reading as coverage.

Runs: --lib palette 26 passed / 0 failed; --lib screen 19 passed / 0 failed
/ 4 ignored; 4:2:2 pin 16 chroma palette unit windows and 4:4:4 pin 4
windowed palette chroma units, both byte-exact vs aomdec. The full --lib
suite exceeded a 3000 s local timeout mid-run (server job by project rule).

Still open, named not edited: the mu-chroma chroma_side*chroma_side sites
and the floor->> chroma plane allocators. The forward unblock is also
named: if a non-4:2:0 encoder colour config ever appears, write_color_index_map
and palette_uv_bits both take a single `side`, so the map writer must go
per-axis (bw, bh) the way decode_color_index_map_wh already is before any
non-4:2:0 palette can be written at all.
crates/ec-av1/src/encode.rsmodified+234 -0
@@ -17061,6 +17061,240 @@ mod tests {
1706117061 );
1706217062 }
1706317063
17064+ /// lane-av1paletteuv: the census for `crate::tile::palette_uv_side`, the
17065+ /// `(side / 2).max(4)` named in `lanes/av1subsizesweep.report.md` as a
17066+ /// "4:2:2/4:4:0 palette map mis-sized" site.
17067+ ///
17068+ /// **What the site computes.** libaom reads the plane-1 colour-index map
17069+ /// at `av1_get_block_dimensions(bsize, 1, xd)` (blockd.h:1512): per axis,
17070+ /// `plane_block = block >> ss`, then `+2` when that came out under 4
17071+ /// (the chroma sub-8x8 bump, blockd.h:1533-1541). For a SQUARE 4:2:0
17072+ /// block both axes carry `ss = 1`, so both come to `side / 2` with the
17073+ /// bump -- which is exactly `(side / 2).max(4)`. The value is right.
17074+ ///
17075+ /// **What it is not.** At 4:2:2 the correct map is `(side >> 1) x side`
17076+ /// and at 4:4:4 it is `side x side` -- neither is square. So the value is
17077+ /// 4:2:0-only BY CONSTRUCTION, and this gate is what keeps it that way:
17078+ /// if an encoder that can emit another chroma shape ever appears, this
17079+ /// reds rather than the writer silently writing a half-height map.
17080+ ///
17081+ /// The three arms are (1) the value matches libaom's own per-axis
17082+ /// formula at 4:2:0 over every side the palette syntax admits, (2) no
17083+ /// reachable writer path can be handed another chroma shape, (3) a real
17084+ /// encode really fires chroma palettes, so arm 1 is not arithmetic on a
17085+ /// function nothing calls (class `gate-blind-to-feature`).
17086+ #[test]
17087+ fn the_chroma_palette_map_side_is_the_420_plane_block_and_nothing_else_reaches_it() {
17088+ const NAME: &str =
17089+ "the_chroma_palette_map_side_is_the_420_plane_block_and_nothing_else_reaches_it";
17090+ let encode_src = include_str!("encode.rs");
17091+ let encoder_src = include_str!("encoder.rs");
17092+
17093+ // ---- arm 1: the value, against libaom's formula --------------------
17094+ // blockd.h:1530-1541, transcribed. A plane_block under 4 gains 2.
17095+ let libaom_plane1 = |block: usize, ss: usize| {
17096+ let plane_block = block >> ss;
17097+ plane_block + 2 * usize::from(plane_block < 4)
17098+ };
17099+ let mut admitted = 0usize;
17100+ for side in 4usize..=64 {
17101+ // `palette_bsize_ctx`'s own domain: both sides <= 64 and
17102+ // bw * bh >= 64 (`av1_allow_palette`). A side outside it codes no
17103+ // palette syntax at all, so its map size is unobservable.
17104+ if side > 64 || side * side < 64 {
17105+ continue;
17106+ }
17107+ admitted += 1;
17108+ let want_x = libaom_plane1(side, 1);
17109+ let want_y = libaom_plane1(side, 1);
17110+ assert_eq!(want_x, want_y, "{NAME}: 4:2:0 arms the libaom formula");
17111+ assert_eq!(
17112+ crate::tile::palette_uv_side(side),
17113+ want_x,
17114+ "{NAME}: side {side} -- palette_uv_side disagrees with libaom's plane-1 block"
17115+ );
17116+ }
17117+ assert_eq!(
17118+ admitted, 57,
17119+ "{NAME}: the sweep admitted {admitted} sides, expected 57 (every integer 8..=64 -- \
17120+ `palette_bsize_ctx`'s whole square domain, not just the powers of two a real block \
17121+ takes) -- it must cover that domain, or it is not measuring it"
17122+ );
17123+
17124+ // Why `.max(4)` cannot fire, stated as a measurement rather than left
17125+ // for a reader to assume: `palette_bsize_ctx` refuses `bw * bh < 64`,
17126+ // so the smallest admitted square side is 8, whose halved plane block
17127+ // is already 4. The floor's only reachable input would be a side
17128+ // under 8, and libaom's own chroma sub-8x8 bump (+2) is likewise
17129+ // unreachable there. Dropping the floor is therefore NOT a witness
17130+ // mutation for this gate -- the mutation that bites is dropping the
17131+ // halving (measured, see the lane report) -- and this arm says why,
17132+ // so nobody later mistakes a green floor mutation for coverage.
17133+ for side in [8usize, 16, 32, 64] {
17134+ assert!(
17135+ side / 2 >= 4 && libaom_plane1(side, 1) == side / 2,
17136+ "{NAME}: side {side} -- the admitted domain moved, so `.max(4)` may now be \
17137+ reachable and the floor needs a witness mutation of its own"
17138+ );
17139+ }
17140+
17141+ // The claim the gate rests on, stated as arithmetic so a future
17142+ // reader cannot mistake "correct" for "correct at any shape": at
17143+ // these shapes the per-axis answer is NOT this square.
17144+ for side in [8usize, 16, 32, 64] {
17145+ let square = crate::tile::palette_uv_side(side);
17146+ let want_422 = (libaom_plane1(side, 1), libaom_plane1(side, 0));
17147+ let want_444 = (libaom_plane1(side, 0), libaom_plane1(side, 0));
17148+ assert_ne!(
17149+ (square, square),
17150+ want_422,
17151+ "{NAME}: side {side} -- a square map IS the 4:2:2 map, so this gate's premise \
17152+ (the site is 4:2:0-only) is wrong"
17153+ );
17154+ assert_ne!(
17155+ (square, square),
17156+ want_444,
17157+ "{NAME}: side {side} -- a square map IS the 4:4:4 map"
17158+ );
17159+ }
17160+
17161+ // ---- arm 2: nothing can hand the writer another shape --------------
17162+ // (a) Every non-test `ColorConfig` literal in the encoder names
17163+ // subsampling (1, 1). These are the two constructors the whole
17164+ // encoder reaches its colour config through; the test-module copies
17165+ // are excluded by scanning only the pre-`mod tests` prefix.
17166+ fn head(src: &str) -> &str {
17167+ let cut = src.find("\nmod tests").unwrap_or(src.len());
17168+ &src[..cut]
17169+ }
17170+ for (label, src) in [
17171+ ("encode.rs", head(encode_src)),
17172+ ("encoder.rs", head(encoder_src)),
17173+ ] {
17174+ // Every `subsampling_*` the non-test encoder names, counted: a
17175+ // `(0, y)` or `(1, 0)` here is a chroma shape
17176+ // `palette_uv_side` cannot express. The one value allowed is 1
17177+ // -- 4:2:0, the shape the square map is the right size for.
17178+ let mut shapes: std::collections::BTreeSet<(usize, usize)> = Default::default();
17179+ for (sx, _) in src.match_indices("subsampling_x:") {
17180+ let rest = &src[sx + "subsampling_x:".len()..];
17181+ let digits = |s: &str| {
17182+ s.trim_start()
17183+ .split(|c: char| !c.is_ascii_digit())
17184+ .next()
17185+ .and_then(|d| d.parse::<usize>().ok())
17186+ .unwrap_or(usize::MAX)
17187+ };
17188+ let x = digits(rest);
17189+ let y = rest
17190+ .find("subsampling_y:")
17191+ .map(|y| digits(&rest[y + "subsampling_y:".len()..]))
17192+ .unwrap_or(usize::MAX);
17193+ shapes.insert((x, y));
17194+ }
17195+ assert_eq!(
17196+ shapes,
17197+ std::collections::BTreeSet::from([(1usize, 1usize)]),
17198+ "{NAME}: the non-test {label} names chroma shapes {shapes:?} -- any shape other \
17199+ than 4:2:0 is one palette_uv_side's square map cannot express (at 4:2:2 the \
17200+ map is (side >> 1) x side, at 4:4:4 side x side)"
17201+ );
17202+ }
17203+
17204+ // (b) `key_frame_headers_colour` is the only PUBLIC entry that takes
17205+ // a caller-chosen ColorConfig -- it is how a 4:2:2 or 4:4:4 header is
17206+ // written at all -- so it is the one door a non-4:2:0 shape comes
17207+ // through. It builds HEADERS only: no tile writer is reachable from
17208+ // its body. (Its own doc says so; this measures it.)
17209+ let headers_at = encode_src
17210+ .find("pub fn key_frame_headers_colour(")
17211+ .expect("key_frame_headers_colour is gone -- re-derive this arm's scan anchor");
17212+ let body_end = encode_src[headers_at..]
17213+ .find("\npub fn ")
17214+ .map(|n| headers_at + n)
17215+ .unwrap_or(encode_src.len());
17216+ let headers_body = &encode_src[headers_at..body_end];
17217+ for writer in [
17218+ "write_palette_syntax",
17219+ "write_color_index_map",
17220+ "encode_key_frame_inner",
17221+ "tile::",
17222+ ] {
17223+ assert!(
17224+ !headers_body.contains(writer),
17225+ "{NAME}: key_frame_headers_colour now reaches {writer} -- a caller can pair a \
17226+ 4:2:2/4:4:4 header with a tile, and palette_uv_side writes a square map into \
17227+ the per-axis slot libaom reads as (side >> ss_x) x (side >> ss_y)"
17228+ );
17229+ }
17230+
17231+ // (c) Every tile-producing entry point goes through
17232+ // `encode_key_frame_inner`, whose five non-test call sites all pass
17233+ // one of the two 4:2:0 constructors above. Counted over the
17234+ // non-test source only, so a new road is a red rather than a line
17235+ // somebody has to notice.
17236+ let inner_calls = head(encode_src).matches("encode_key_frame_inner(").count()
17237+ + head(encoder_src).matches("encode_key_frame_inner(").count()
17238+ - 1; // the definition itself
17239+ assert_eq!(
17240+ inner_calls, 5,
17241+ "{NAME}: encode_key_frame_inner has {inner_calls} non-test call sites, expected 5 -- \
17242+ a new one must pass a colour config this gate has read"
17243+ );
17244+
17245+ // (d) The picture itself is 4:2:0-shaped at the door, so a 4:2:2 or
17246+ // 4:4:4 frame cannot even be handed to an encode entry. Measured by
17247+ // calling `check`, not by reading it.
17248+ for (label, divisor) in [("4:2:2", 2usize), ("4:4:4", 1)] {
17249+ let p = Picture {
17250+ width: 64,
17251+ height: 64,
17252+ y: vec![0; 64 * 64],
17253+ u: vec![0; 64 * 64 / divisor],
17254+ v: vec![0; 64 * 64 / divisor],
17255+ };
17256+ assert!(
17257+ p.check().is_err(),
17258+ "{NAME}: Picture::check accepted a {label}-shaped picture -- if the encoder can be \
17259+ fed one, palette_uv_side's square map is wrong by construction"
17260+ );
17261+ }
17262+
17263+ // ---- arm 3: the site really fires ---------------------------------
17264+ // Without this, arms 1 and 2 are arithmetic and a source scan over a
17265+ // function no encode reaches (class `gate-blind-to-feature`).
17266+ //
17267+ // The fire count is the DECODER's thread-local one, not the writer's
17268+ // process-global `tile::take_palette_uv_hits`: that one is a
17269+ // swap-to-zero, so a parallel sibling test's encode steals this test's
17270+ // count (measured: it read `[0; 9]` under `cargo test palette`, and
17271+ // passed alone). Round-tripping the stream instead also proves the
17272+ // stronger half -- the reader took the map at the extent the WRITER
17273+ // sized, which is what makes the square value right rather than merely
17274+ // unchallenged.
17275+ let _knobs = crate::speed::knob_read();
17276+ let fctx = &crate::decode::FrameCtx::for_encoder();
17277+ let before = crate::decode::palette_uv_hits();
17278+ let encoded = encode_key_frame_with_ctx(&screen_card(192, 96), 100, 0.5, fctx).unwrap();
17279+ let decoded = crate::stream::decode_stream(&encoded.stream)
17280+ .unwrap_or_else(|e| panic!("{NAME}: our own stream refused: {e}"));
17281+ let fired = crate::decode::palette_uv_hits() - before;
17282+ assert!(
17283+ fired > 0,
17284+ "{NAME}: no block took a chroma palette -- palette_uv_side was never exercised, so \
17285+ this gate measures nothing"
17286+ );
17287+ assert_eq!(
17288+ decoded[0].u, encoded.reconstruction.u,
17289+ "{NAME}: the decoder did not read the chroma map at the extent the writer sized it"
17290+ );
17291+ assert_eq!(
17292+ decoded[0].v, encoded.reconstruction.v,
17293+ "{NAME}: the decoder did not read the chroma map at the extent the writer sized it"
17294+ );
17295+ eprintln!("{NAME}: {fired} chroma palette block(s) round-tripped");
17296+ }
17297+
1706417298 /// The lane's keep-rule measurement: the gate's own screen capture, one
1706517299 /// KEY FRAME, coded with and without `allow_intrabc` at four quantizers.
1706617300 /// Setting the bit forces deblocking, CDEF and loop restoration off for
lanes/av1paletteuv.report.mdadded+196 -0
@@ -0,0 +1,196 @@
1+# lane/av1paletteuv — `tile.rs::palette_uv_side`
2+
3+Charter: take ONLY the first of the three unprobed hardcoded-chroma sites named in
4+`lanes/av1subsizesweep.report.md`. The mu-chroma square sites and the floor-`>>`
5+plane allocators stay named, not edited.
6+
7+## Verdict
8+
9+**ALREADY CORRECT, with the measurement — and unreachable for any other chroma
10+shape.** The `(side / 2).max(4)` form is libaom's 4:2:0 plane-1 block exactly,
11+and no reachable path can hand the writer a 4:2:2 or 4:4:4 frame. Gated
12+(`encode::tests::the_chroma_palette_map_side_is_the_420_plane_block_and_nothing_else_reaches_it`),
13+five mutations measured biting. No production code changed.
14+
15+## 1. What the site computes, and what it should compute at each shape
16+
17+`crates/ec-av1/src/tile.rs:5004-5006`
18+
19+```rust
20+pub(crate) fn palette_uv_side(side: usize) -> usize {
21+ (side / 2).max(4)
22+}
23+```
24+
25+Callers (all writer-side; the decoder has no counterpart call):
26+
27+| site | role |
28+|---|---|
29+| `tile.rs:4979` (`write_palette_syntax`) | sizes the chroma colour-index map actually written |
30+| `tile.rs:4557` (`palette_uv_bits`) | prices that same map in the mode search |
31+| `encode.rs:7017` (`search_chroma`) | `debug_assert_eq!(palette_uv_side(side), at.side)` |
32+
33+What libaom does — `av1_get_block_dimensions(bsize, plane, xd, ...)`
34+(`av1/common/blockd.h:1512`), which `av1_decode_palette_tokens`
35+(`av1/decoder/detokenize.c:88-98`) hands to `decode_color_map_tokens` as
36+`plane_width`/`plane_height`:
37+
38+```c
39+const int plane_block_width = block_width >> pd->subsampling_x;
40+const int plane_block_height = block_height >> pd->subsampling_y;
41+const int is_chroma_sub8_x = plane > 0 && plane_block_width < 4;
42+const int is_chroma_sub8_y = plane > 0 && plane_block_height < 4;
43+*width = plane_block_width + 2 * is_chroma_sub8_x;
44+*height = plane_block_height + 2 * is_chroma_sub8_y;
45+```
46+
47+So the correct map extent is **per-axis**: `(block_w >> ss_x, block_h >> ss_y)`,
48+each then bumped by 2 if it came out under 4. For a square block the two axes
49+agree only when `ss_x == ss_y`:
50+
51+| shape | `ss` | correct map | `palette_uv_side` | verdict |
52+|---|---|---|---|---|
53+| 4:2:0 | (1,1) | `(side>>1, side>>1)` | `(side/2).max(4)` | **exact** |
54+| 4:2:2 | (1,0) | `(side>>1, side)` — NOT square | square | wrong by half the rows |
55+| 4:4:4 | (0,0) | `(side, side)` — NOT `side/2` | square at half size | wrong on both axes |
56+| 4:4:0 | (2,2) | uncodable (libaom forbids the shape outright) | — | n/a |
57+
58+Note `.max(4)` is a stand-in for libaom's `+2 * is_chroma_sub8` bump and it is
59+**unreachable in the writer**: `palette_bsize_ctx_wh` refuses `bw*bh < 64`, so
60+the smallest admitted square side is 8 and `8>>1 == 4` already. Dropping the
61+floor therefore changes nothing today; the gate says so explicitly rather than
62+letting a green floor-mutation read as coverage.
63+
64+The decoder's counterpart is already per-axis and is NOT this function:
65+`decode.rs:20914-20933` reads the map at `(side >> ss_x(fctx), side >> ss_y(fctx))`.
66+That is why 4:2:2/4:4:4 decode is byte-exact today (measurement below) while the
67+writer is not — the site under review is the only square one left.
68+
69+## 2. Reachability measurement — how many encodes reach it, and with what shape
70+
71+**Writer-side chroma shape census (non-test source).** Every `subsampling_*`
72+literal the encoder names outside its test modules:
73+
74+- `encode.rs` (`unspecified_color_config`): `{(1, 1)}`
75+- `encoder.rs` (`Colour::color_config`, all three `Colour` variants): `{(1, 1)}`
76+
77+`encode_key_frame_inner` — the single funnel every tile-producing entry passes
78+through — has **5 non-test call sites** (`encode.rs:9112, 9154, 15811`;
79+`encoder.rs:1825, 2001`) and every one passes one of those two 4:2:0
80+constructors. Counted, not described.
81+
82+**The one public door for another shape.** `key_frame_headers_colour`
83+(`encode.rs:2256`) is the only public entry taking a caller-chosen
84+`ColorConfig` — it is how a 4:2:2 or 4:4:4 sequence header is written at all.
85+Its body builds HEADERS ONLY: no tile writer is reachable from it (measured by
86+scanning its body for `write_palette_syntax`, `write_color_index_map`,
87+`encode_key_frame_inner`, `tile::`).
88+
89+**The picture door.** `Picture::check` / `check_even` require
90+`u.len() == v.len() == width*height/4`. Measured by CALL, not by reading: a
91+4:2:2-shaped (`w*h/2`) and a 4:4:4-shaped (`w*h`) picture are both refused.
92+
93+**Encode count that actually fires the site** (so the above is not a source
94+scan over dead code): the gate's own `screen_card(192,96)` key frame codes
95+**9 chroma-palette blocks** (sizes `[2, 0, 7, 0, 0, 0, 0]`), all at 4:2:0.
96+The sibling end-to-end gate measures **9 chroma palette blocks** in its key
97+frame and **48** across its 4-frame GOP, all byte-exact through ffmpeg.
98+
99+**Committed fixtures / real aomenc streams at 4:2:2 and 4:4:4**: measured, and
100+they exercise the DECODER's per-axis path, never this writer site — they are
101+decode-direction fixtures. Counts, both byte-exact against aomdec:
102+
103+- `fixtures/422_palette_intra_in_inter_384x240_17f.obu` — 17 decode-order
104+ frames, **16 chroma palette unit windows**
105+- `fixtures/444_lossy_palette_chroma_352x242_10b.obu` — 17 decode-order frames,
106+ **4 windowed palette chroma units**
107+
108+Conclusion: a real 4:2:2/4:4:4 palette stream reaches `decode.rs`'s per-axis
109+read (and passes), and cannot reach `palette_uv_side` at all, because the only
110+producer of tiles in this crate is 4:2:0.
111+
112+## 3. The gate
113+
114+`crates/ec-av1/src/encode.rs`, test
115+`the_chroma_palette_map_side_is_the_420_plane_block_and_nothing_else_reaches_it`.
116+Three arms:
117+
118+1. **The value** — transcribes libaom's per-axis formula and asserts
119+ `palette_uv_side(side)` equals it for every side in
120+ `palette_bsize_ctx`'s square domain (every integer 8..=64, 57 values, not
121+ just the powers of two). Also asserts the premise as arithmetic: for sides
122+ 8/16/32/64 the square is NOT the 4:2:2 map and NOT the 4:4:4 map, so
123+ "correct" cannot be misread as "correct at any shape". Then states why
124+ `.max(4)` cannot fire in the admitted domain.
125+2. **Nothing can hand the writer another shape** — (a) the `subsampling_*`
126+ census over both encoder files' non-test prefixes, (b) the
127+ `key_frame_headers_colour` body scan, (c) the 5 non-test
128+ `encode_key_frame_inner` call-site count, (d) `Picture::check` refusing
129+ 4:2:2- and 4:4:4-shaped pictures by call.
130+3. **The site really fires** — encodes `screen_card(192,96)`, decodes it back,
131+ asserts the decoder's thread-local chroma-palette count moved and the
132+ round-tripped U/V match the encoder's own reconstruction. This also proves
133+ the reader took the map at the extent the WRITER sized, which is what makes
134+ the square value right rather than merely unchallenged.
135+
136+Counter hygiene: arm 3 deliberately reads the DECODER's thread-local
137+`decode::palette_uv_hits()`, not the writer's process-global
138+`tile::take_palette_uv_hits()` (a swap-to-zero). The first draft used the
139+global one and was flaky under `cargo test palette` — a parallel sibling's
140+encode stole the count and it read `[0; 9]`, passing alone. Measured, then
141+fixed; the comment in the test names it.
142+
143+## 4. Mutation proofs (gate bites)
144+
145+| # | mutation | result |
146+|---|---|---|
147+| 1 | `palette_uv_side` → `side` (halving dropped) | RED at `side 8 -- palette_uv_side disagrees with libaom's plane-1 block` |
148+| 2 | → `(side / 2).max(8)` (floor raised) | RED at `side 8`, same arm |
149+| 3 | → `4` (map size pinned) | RED at `side 10`, same arm |
150+| 4 | `encoder.rs` `Colour::color_config` → `subsampling (0,0)` | RED: `the non-test encoder.rs names chroma shapes {(0, 0)}` (arm 2a) |
151+| 5 | one `crate::tile::` line inside `key_frame_headers_colour`'s body | RED: `key_frame_headers_colour now reaches tile::` (arm 2b) |
152+
153+Each mutation was reverted immediately; the tree carries only the new test
154+(`git diff --stat`: 1 file, +234, all inside the test module).
155+
156+**Known non-mutation**: dropping `.max(4)` entirely leaves the gate GREEN —
157+correctly, since the floor is unreachable in the admitted domain (§1). Recorded
158+in the test body so it is not mistaken for an untested path.
159+
160+## 5. Suite runs
161+
162+- `cargo test -p ec-av1 --lib palette` — **26 passed, 0 failed** (parallel,
163+ includes the new gate). Before the arm-3 counter fix this same run was red on
164+ `a_screen_content_picture_codes_palette_blocks_ffmpeg_decodes_exactly`
165+ (counter theft, described in §3).
166+- `cargo test -p ec-av1 --lib screen` — **19 passed, 0 failed, 4 ignored**.
167+- The earlier all-palette red under `EDQUOT` was environmental (`os error 122`,
168+ this box's `/tmp` tmpfs at its user quota); re-run with
169+ `TMPDIR=$HOME/.cache/tmp CARGO_TARGET_DIR=$HOME/tgt-paletteuv RUSTC_WRAPPER=`
170+ it is green, per `skill://local-edquot-rust-build-tests`.
171+- Full `--lib` suite: NOT completed locally — it exceeded a 3000 s timeout with
172+ `a_real_aomenc_stream_with_a_superblock_level_horz_vert_partition_and_delta_q_decodes_pixel_exact`
173+ still running (no failure reported in the visible tail). Per the project rule
174+ that full cargo suites run on the server fleet and not locally, this lane's
175+ verification is the scoped runs above; a full-suite run is a server job.
176+
177+## 6. Still open (named, NOT edited — out of charter)
178+
179+1. **mu-chroma sites using `chroma_side * chroma_side`** — the square
180+ chroma-block assumption at sites other than this one. `palette_uv_side` is
181+ the palette-map site; the mu sites are a separate family, still unprobed.
182+2. **Floor-`>>` chroma plane allocators** — allocators that assume a
183+ frame-edge shape via a floor shift. Also unprobed, also untouched.
184+3. **The gate's own forward obligation.** If an encoder colour config that is
185+ not 4:2:0 ever appears, arm 2a/2b red. The FIX then is not a `palette_uv_side`
186+ tweak: `write_color_index_map` and `palette_uv_bits` both take a single
187+ `side`, so the map writer has to become per-axis (`bw`, `bh`) the way
188+ `decode_color_index_map_wh` already is, before any non-4:2:0 palette can be
189+ written at all. That is a bigger change than this charter, and it is the
190+ named unblock.
191+
192+## 7. Environment notes
193+
194+- Worktree `/home/user/wt-av1paletteuv` on `lane/av1paletteuv` (an earlier
195+ `/tmp` worktree was moved off the tmpfs, which was at its user quota).
196+- Own target dir `$HOME/tgt-paletteuv`; no pushes, no merges, primary untouched.
\ No newline at end of file