forge
Explore
Log in

Don't you dare go Hollow

merge main 170a5a3 into lane-superres

Browse files at this commit

00d13c3bdd2261e76433446dfd5de320ea8a90a9Ahmet Kaan GümüşParent: 0f2fce10bdb5a0
crates/ec-av1/src/decode.rsmodified+1 -1
@@ -5831,7 +5831,7 @@ pub(crate) fn decode_key_frame_tile_with_cdfs(
5831 }5831 }
5832 if part16 != PARTITION_SPLIT {5832 if part16 != PARTITION_SPLIT {
5833 return Err(unsupported(5833 return Err(unsupported(
5834- "a partition below 16x16 other than a clean split (this encoder never writes one)",5834+ "a partition below 16x16 other than a clean split (this decoder codes only the square arms below 16x16)",
5835 ));5835 ));
5836 }5836 }
5837 // A real (non-straddle) SPLIT of a5837 // A real (non-straddle) SPLIT of a
crates/ec-av1/src/refusal_inventory.rsmodified+1 -1
@@ -27,7 +27,7 @@ const CAPABILITY_CLAIMS: &[&str] = &[
27 "a non-2D tx class on a rectangular transform (never expected at this size)",27 "a non-2D tx class on a rectangular transform (never expected at this size)",
28 "a non-DC chroma mode on an 8x8 inter-frame leaf (this encoder never writes one)",28 "a non-DC chroma mode on an 8x8 inter-frame leaf (this encoder never writes one)",
29 "a nonzero angle delta (this encoder never writes one)",29 "a nonzero angle delta (this encoder never writes one)",
30- "a partition below 16x16 other than a clean split (this encoder never writes one)",30+ "a partition below 16x16 other than a clean split (this decoder codes only the square arms below 16x16)",
31 "a partition below 8x8 (this encoder never writes one)",31 "a partition below 8x8 (this encoder never writes one)",
32 "a tx_type symbol on a rectangular transform (never expected at this size)",32 "a tx_type symbol on a rectangular transform (never expected at this size)",
33 ];33 ];
crates/ec-av1/src/stream.rsmodified+392 -3
@@ -16,7 +16,8 @@
16 //! an implementation detail of how this crate happens to build it).16 //! an implementation detail of how this crate happens to build it).
17 17
18 use ec_av1_syntax::{18 use ec_av1_syntax::{
19- Av1Parser, FrameType, NUM_REF_FRAMES, ObuKind, PRIMARY_REF_NONE, TxMode, WarpModel,19+ Av1Parser, FrameHeader, FrameType, NUM_REF_FRAMES, ObuKind, PRIMARY_REF_NONE, Tile, TxMode,
20+ WarpModel,
20 };21 };
21 use ec_core::{Error, Result};22 use ec_core::{Error, Result};
22 23
@@ -75,12 +76,32 @@ pub fn decode_stream(data: &[u8]) -> Result<Vec<Picture>> {
75 let mut cdf_slots: [Option<Cdfs>; NUM_REF_FRAMES] = std::array::from_fn(|_| None);76 let mut cdf_slots: [Option<Cdfs>; NUM_REF_FRAMES] = std::array::from_fn(|_| None);
76 77
77 let mut pos = 0usize;78 let mut pos = 0usize;
79+ // A frame whose tiles are split across several `OBU_TILE_GROUP`s (spec
80+ // 5.11.1, aomenc's `--num-tile-groups`) sends a standalone
81+ // `OBU_FRAME_HEADER` first, with `show_existing_frame == false` and no
82+ // tile payload of its own -- `OBU_FRAME` (the `ObuKind::Frame` arm below)
83+ // only ever folds ONE tile group into the header's own OBU. Stash the
84+ // header here and accumulate tiles from each `OBU_TILE_GROUP` that
85+ // follows until every tile of the frame has arrived.
86+ let mut pending_header: Option<Box<FrameHeader>> = None;
87+ let mut pending_tiles: Vec<Tile> = Vec::new();
78 while pos < data.len() {88 while pos < data.len() {
79 let obu = parser.parse_obu(&data[pos..])?;89 let obu = parser.parse_obu(&data[pos..])?;
80 let obu_offset = pos;90 let obu_offset = pos;
81 pos += obu.total_size;91 pos += obu.total_size;
82 92
83 if let ObuKind::FrameHeader(header) = &obu.kind {93 if let ObuKind::FrameHeader(header) = &obu.kind {
94+ if !header.show_existing_frame {
95+ // Before this fix, this branch fired unconditionally for
96+ // EVERY `FrameHeader` OBU (including this one), so a
97+ // standalone header always fell into the `show_existing_frame`
98+ // slot lookup below and misreported "a show_existing_frame
99+ // header naming an empty reference slot" for a frame that was
100+ // never a show_existing_frame header at all.
101+ pending_header = Some(header.clone());
102+ pending_tiles = Vec::new();
103+ continue;
104+ }
84 // `show_existing_frame` (spec 7.21/5.9.2): no tile payload, this105 // `show_existing_frame` (spec 7.21/5.9.2): no tile payload, this
85 // OBU only names a DPB slot to output again -- the coded-frame106 // OBU only names a DPB slot to output again -- the coded-frame
86 // count and the shown-picture count are different things (a107 // count and the shown-picture count are different things (a
@@ -117,8 +138,34 @@ pub fn decode_stream(data: &[u8]) -> Result<Vec<Picture>> {
117 pictures.push(output);138 pictures.push(output);
118 continue;139 continue;
119 }140 }
120- let ObuKind::Frame(header, tiles) = obu.kind else {141+ // `tiles_base_offset` is added to every `Tile::offset` below to reach
142+ // an absolute position in `data`. `OBU_FRAME`'s tiles are relative to
143+ // this OBU's own `obu_offset`; an accumulated run of `OBU_TILE_GROUP`s
144+ // may span several different OBUs (each at a different offset in
145+ // `data`), so those tiles are normalised to an absolute offset the
146+ // moment they are appended to `pending_tiles`, and `tiles_base_offset`
147+ // is 0 for that case.
148+ let (header, tiles, tiles_base_offset): (Box<FrameHeader>, Vec<Tile>, usize) =
149+ match obu.kind {
150+ ObuKind::Frame(header, tiles) => (header, tiles, obu_offset),
151+ ObuKind::TileGroup(new_tiles) => {
152+ let header = pending_header.clone().ok_or_else(|| {
153+ Error::corrupt(
154+ "AV1 decode_stream: a tile group OBU with no preceding frame header",
155+ )
156+ })?;
157+ let expected = header.tile_info.cols * header.tile_info.rows;
158+ pending_tiles.extend(new_tiles.into_iter().map(|mut t| {
159+ t.offset += obu_offset;
160+ t
161+ }));
162+ if (pending_tiles.len() as u32) < expected {
121 continue;163 continue;
164+ }
165+ pending_header = None;
166+ (header, std::mem::take(&mut pending_tiles), 0)
167+ }
168+ _ => continue,
122 };169 };
123 // Every tile is decoded below through `tile_bufs`; this only rejects a170 // Every tile is decoded below through `tile_bufs`; this only rejects a
124 // frame OBU that carries no tile group at all.171 // frame OBU that carries no tile group at all.
@@ -353,7 +400,7 @@ pub fn decode_stream(data: &[u8]) -> Result<Vec<Picture>> {
353 let tile_bufs: Vec<&[u8]> = tiles400 let tile_bufs: Vec<&[u8]> = tiles
354 .iter()401 .iter()
355 .map(|t| {402 .map(|t| {
356- data.get(obu_offset + t.offset..obu_offset + t.offset + t.size)403+ data.get(tiles_base_offset + t.offset..tiles_base_offset + t.offset + t.size)
357 .ok_or(Error::NeedMore)404 .ok_or(Error::NeedMore)
358 })405 })
359 .collect::<Result<_>>()?;406 .collect::<Result<_>>()?;
@@ -8048,4 +8095,346 @@ mod tests {
8048 "{NAME}: {matched} pixel-exact matches, {named_refusals} named refusals out of 20"8095 "{NAME}: {matched} pixel-exact matches, {named_refusals} named refusals out of 20"
8049 );8096 );
8050 }8097 }
8098+
8099+ /// lane-tiles r9: `--num-tile-groups` makes aomenc split one frame's
8100+ /// tiles across several `OBU_TILE_GROUP`s instead of folding them into
8101+ /// the single `OBU_FRAME` every other gate in this file relies on --
8102+ /// verified live (`scratch_probe_num_tile_groups`, this round) to emit a
8103+ /// standalone `OBU_FRAME_HEADER` (`show_existing_frame == false`)
8104+ /// followed by two `OBU_TILE_GROUP` OBUs, one tile each. Before this
8105+ /// round `decode_stream` had no arm for `ObuKind::TileGroup` at all (it
8106+ /// fell through the catch-all `continue`, silently dropping the frame),
8107+ /// and its `ObuKind::FrameHeader` arm matched *every* frame header
8108+ /// unconditionally, so a standalone header was misrouted into the
8109+ /// `show_existing_frame` slot lookup and returned the wrong named error
8110+ /// ("a show_existing_frame header naming an empty reference slot") for a
8111+ /// frame that was never a show_existing_frame header. Both are fixed
8112+ /// above: the `FrameHeader` arm now checks `show_existing_frame`, and a
8113+ /// `pending_header`/`pending_tiles` accumulator collects tile groups
8114+ /// until the frame's `cols * rows` tiles have all arrived.
8115+ #[test]
8116+ fn a_real_aomenc_stream_with_several_tile_group_obus_decodes_pixel_exact() {
8117+ const NAME: &str = "a_real_aomenc_stream_with_several_tile_group_obus_decodes_pixel_exact";
8118+ if !have_ffmpeg() {
8119+ eprintln!("SKIP {NAME}: no ffmpeg");
8120+ return;
8121+ }
8122+ if !have_aomenc() {
8123+ eprintln!("SKIP {NAME}: no aomenc at {}", aomenc_path().display());
8124+ return;
8125+ }
8126+ let (width, height) = (64usize, 128usize);
8127+ let mut matched = 0u32;
8128+ let mut named_refusals = 0u32;
8129+ let mut saw_multiple_tile_group_obus = false;
8130+ for attempt in 0..20u32 {
8131+ let seed = 42 + attempt;
8132+ let source = gradients_source(seed, width, height, "duration=0.04:rate=25");
8133+ let y4m = Command::new("ffmpeg")
8134+ .args([
8135+ "-v", "error", "-f", "lavfi", "-i", &source, "-pix_fmt", "yuv420p", "-f",
8136+ "yuv4mpegpipe", "-",
8137+ ])
8138+ .stdin(Stdio::null())
8139+ .stdout(Stdio::piped())
8140+ .stderr(Stdio::piped())
8141+ .output()
8142+ .expect("ffmpeg failed to run");
8143+ assert!(
8144+ y4m.status.success(),
8145+ "ffmpeg fixture: {}",
8146+ String::from_utf8_lossy(&y4m.stderr)
8147+ );
8148+ let mut child = Command::new(aomenc_path())
8149+ .args([
8150+ "--codec=av1",
8151+ "--passes=1",
8152+ "--end-usage=q",
8153+ "--cq-level=45",
8154+ "--cpu-used=0",
8155+ "--limit=1",
8156+ "--kf-max-dist=1000",
8157+ "--threads=1",
8158+ "--row-mt=0",
8159+ "--tile-columns=0",
8160+ "--tile-rows=1",
8161+ "--sb-size=64",
8162+ "--num-tile-groups=4",
8163+ "--loopfilter-control=0",
8164+ "--enable-rect-partitions=0",
8165+ "--enable-ab-partitions=0",
8166+ "--enable-1to4-partitions=0",
8167+ "--enable-filter-intra=0",
8168+ "--enable-smooth-intra=0",
8169+ "--enable-paeth-intra=0",
8170+ "--enable-directional-intra=0",
8171+ "--enable-angle-delta=0",
8172+ "--enable-tx-size-search=0",
8173+ "--enable-cdef=0",
8174+ "--enable-restoration=0",
8175+ "--max-partition-size=32",
8176+ "--min-partition-size=32",
8177+ "--enable-palette=0",
8178+ "--enable-intrabc=0",
8179+ "--enable-cfl-intra=0",
8180+ "--obu",
8181+ "-o",
8182+ "-",
8183+ "-",
8184+ ])
8185+ .stdin(Stdio::piped())
8186+ .stdout(Stdio::piped())
8187+ .stderr(Stdio::piped())
8188+ .spawn()
8189+ .expect("aomenc failed to start");
8190+ child
8191+ .stdin
8192+ .take()
8193+ .expect("aomenc stdin")
8194+ .write_all(&y4m.stdout)
8195+ .expect("writing y4m to aomenc");
8196+ let out = child.wait_with_output().expect("aomenc failed to run");
8197+ assert!(
8198+ out.status.success(),
8199+ "aomenc refused the fixture: {}",
8200+ String::from_utf8_lossy(&out.stderr)
8201+ );
8202+ let stream = out.stdout;
8203+
8204+ let mut probe = Av1Parser::new();
8205+ let mut pos = 0usize;
8206+ let mut tile_group_obus = 0u32;
8207+ while pos < stream.len() {
8208+ let obu = probe.parse_obu(&stream[pos..]).unwrap();
8209+ pos += obu.total_size;
8210+ if matches!(obu.kind, ObuKind::TileGroup(_)) {
8211+ tile_group_obus += 1;
8212+ }
8213+ }
8214+ if tile_group_obus > 1 {
8215+ saw_multiple_tile_group_obus = true;
8216+ }
8217+
8218+ let before = crate::decode::tile_hits();
8219+ let pictures = match decode_stream(&stream) {
8220+ Err(e) => {
8221+ let msg = e.to_string();
8222+ assert!(
8223+ msg.contains("unsupported"),
8224+ "{NAME} failed outright, not a named refusal (seed {seed}): {msg}"
8225+ );
8226+ named_refusals += 1;
8227+ eprintln!("seed {seed} refusal: {msg}");
8228+ continue;
8229+ }
8230+ Ok(pictures) => pictures,
8231+ };
8232+ let hits = crate::decode::tile_hits() - before;
8233+ assert!(
8234+ hits > 0,
8235+ "{NAME}: tile_hits delta was {hits}, expected >0 (seed {seed})"
8236+ );
8237+ assert_eq!(pictures.len(), 1, "{NAME}: expected exactly 1 picture (seed {seed})");
8238+
8239+ let ffmpeg_frames = ffmpeg_decode_sequence(&stream, width, height, 1);
8240+ assert_eq!(pictures[0].y, ffmpeg_frames[0].y, "{NAME}: luma vs ffmpeg (seed {seed})");
8241+ assert_eq!(pictures[0].u, ffmpeg_frames[0].u, "{NAME}: U vs ffmpeg (seed {seed})");
8242+ assert_eq!(pictures[0].v, ffmpeg_frames[0].v, "{NAME}: V vs ffmpeg (seed {seed})");
8243+ matched += 1;
8244+ }
8245+ assert!(
8246+ matched > 0,
8247+ "{NAME}: every attempt refused ({named_refusals} refusals); decode_stream never \
8248+ decoded a several-tile-group-OBUs stream"
8249+ );
8250+ assert!(
8251+ saw_multiple_tile_group_obus,
8252+ "{NAME}: no attempt actually split into more than one OBU_TILE_GROUP -- this sweep \
8253+ proves nothing about the multi-tile-group case (aomenc's --num-tile-groups is \
8254+ RD/heuristic-driven, same as tile sizing)"
8255+ );
8256+ eprintln!(
8257+ "{NAME}: {matched} pixel-exact matches, {named_refusals} named refusals out of 20"
8258+ );
8259+ }
8260+
8261+ /// lane-tiles r10: non-uniform tile spacing (`uniform_spacing_flag == 0`,
8262+ /// spec 5.9.15). aomenc never sets this from `--tile-columns`/
8263+ /// `--tile-rows` (those always take the `uniform_spacing = 1` branch in
8264+ /// `set_tile_info`, libaom `encoder.c`), and `--auto-tiles` only takes
8265+ /// the non-uniform balancing path when `g_threads >= 2` -- this charter's
8266+ /// `--threads=1` rules that out. The only CLI surface that reaches
8267+ /// libaom's `else { tiles->uniform_spacing = 0; ... }` arm is the
8268+ /// explicit per-tile size lists `--tile-width=<sb-list>`/
8269+ /// `--tile-height=<sb-list>` (`av1_cx_iface.c` `set_tile_info`, argument
8270+ /// parsing at `arg_defs.c`'s `.tile_width`/`.tile_height` -- present in
8271+ /// the binary, just not printed by `--help`). Probed live with
8272+ /// `aomenc --tile-width=1,3 --tile-height=1 --sb-size=64` on a 256x64
8273+ /// source (4 SB columns, 1 SB row): confirmed by hand this round to
8274+ /// produce a real OBU stream aomdec/ffmpeg both decode.
8275+ ///
8276+ /// `decode.rs`'s tile loop was already generic over spacing before this
8277+ /// gate existed -- it walks `tile_info.mi_col_starts`/`mi_row_starts`
8278+ /// (populated identically by `read_tile_info` for both the uniform and
8279+ /// non-uniform branches, spec 5.9.15) and never recomputes tile bounds
8280+ /// from `cols_log2`/`rows_log2`. The only place in this crate that ever
8281+ /// refused non-uniform spacing is `frame.rs`'s OBU *writer*
8282+ /// (`"non-uniform tile spacing is not written"`), an unrelated encode
8283+ /// path this gate does not touch. So this is a staleness check, not new
8284+ /// machinery: prove the already-generic decode path live and pin it.
8285+ #[test]
8286+ fn a_real_aomenc_stream_with_non_uniform_tile_spacing_decodes_pixel_exact() {
8287+ const NAME: &str = "a_real_aomenc_stream_with_non_uniform_tile_spacing_decodes_pixel_exact";
8288+ if !have_ffmpeg() {
8289+ eprintln!("SKIP {NAME}: no ffmpeg");
8290+ return;
8291+ }
8292+ if !have_aomenc() {
8293+ eprintln!("SKIP {NAME}: no aomenc at {}", aomenc_path().display());
8294+ return;
8295+ }
8296+ let (width, height) = (256usize, 64usize);
8297+ let mut matched = 0u32;
8298+ let mut named_refusals = 0u32;
8299+ let mut saw_non_uniform_spacing = false;
8300+ for attempt in 0..20u32 {
8301+ let seed = 42 + attempt;
8302+ let source = gradients_source(seed, width, height, "duration=0.04:rate=25");
8303+ let y4m = Command::new("ffmpeg")
8304+ .args([
8305+ "-v", "error", "-f", "lavfi", "-i", &source, "-pix_fmt", "yuv420p", "-f",
8306+ "yuv4mpegpipe", "-",
8307+ ])
8308+ .stdin(Stdio::null())
8309+ .stdout(Stdio::piped())
8310+ .stderr(Stdio::piped())
8311+ .output()
8312+ .expect("ffmpeg failed to run");
8313+ assert!(
8314+ y4m.status.success(),
8315+ "ffmpeg fixture: {}",
8316+ String::from_utf8_lossy(&y4m.stderr)
8317+ );
8318+ let mut child = Command::new(aomenc_path())
8319+ .args([
8320+ "--codec=av1",
8321+ "--passes=1",
8322+ "--end-usage=q",
8323+ "--cq-level=45",
8324+ "--cpu-used=0",
8325+ "--limit=1",
8326+ "--kf-max-dist=1000",
8327+ "--threads=1",
8328+ "--row-mt=0",
8329+ "--sb-size=64",
8330+ "--tile-width=1,3",
8331+ "--tile-height=1",
8332+ "--loopfilter-control=0",
8333+ "--enable-rect-partitions=0",
8334+ "--enable-ab-partitions=0",
8335+ "--enable-1to4-partitions=0",
8336+ "--enable-filter-intra=0",
8337+ "--enable-smooth-intra=0",
8338+ "--enable-paeth-intra=0",
8339+ "--enable-directional-intra=0",
8340+ "--enable-angle-delta=0",
8341+ "--enable-tx-size-search=0",
8342+ "--enable-cdef=0",
8343+ "--enable-restoration=0",
8344+ "--max-partition-size=32",
8345+ "--min-partition-size=32",
8346+ "--enable-palette=0",
8347+ "--enable-intrabc=0",
8348+ "--enable-cfl-intra=0",
8349+ "--obu",
8350+ "-o",
8351+ "-",
8352+ "-",
8353+ ])
8354+ .stdin(Stdio::piped())
8355+ .stdout(Stdio::piped())
8356+ .stderr(Stdio::piped())
8357+ .spawn()
8358+ .expect("aomenc failed to start");
8359+ child
8360+ .stdin
8361+ .take()
8362+ .expect("aomenc stdin")
8363+ .write_all(&y4m.stdout)
8364+ .expect("writing y4m to aomenc");
8365+ let out = child.wait_with_output().expect("aomenc failed to run");
8366+ assert!(
8367+ out.status.success(),
8368+ "aomenc refused the fixture: {}",
8369+ String::from_utf8_lossy(&out.stderr)
8370+ );
8371+ let stream = out.stdout;
8372+
8373+ let mut probe = Av1Parser::new();
8374+ let mut pos = 0usize;
8375+ while pos < stream.len() {
8376+ let obu = probe.parse_obu(&stream[pos..]).unwrap();
8377+ pos += obu.total_size;
8378+ let tile_info = match &obu.kind {
8379+ ObuKind::Frame(header, _) => Some(&header.tile_info),
8380+ ObuKind::FrameHeader(header) if !header.show_existing_frame => {
8381+ Some(&header.tile_info)
8382+ }
8383+ _ => None,
8384+ };
8385+ if let Some(info) = tile_info {
8386+ if !info.uniform_spacing {
8387+ saw_non_uniform_spacing = true;
8388+ }
8389+ assert!(
8390+ info.cols > 1 || info.rows > 1,
8391+ "{NAME}: --tile-width=1,3 --tile-height=1 produced only 1 tile \
8392+ (cols={} rows={}, seed {seed}) -- fixture stopped exercising the case",
8393+ info.cols,
8394+ info.rows
8395+ );
8396+ }
8397+ }
8398+
8399+ let before = crate::decode::tile_hits();
8400+ let pictures = match decode_stream(&stream) {
8401+ Err(e) => {
8402+ let msg = e.to_string();
8403+ assert!(
8404+ msg.contains("unsupported"),
8405+ "{NAME} failed outright, not a named refusal (seed {seed}): {msg}"
8406+ );
8407+ named_refusals += 1;
8408+ eprintln!("seed {seed} refusal: {msg}");
8409+ continue;
8410+ }
8411+ Ok(pictures) => pictures,
8412+ };
8413+ let hits = crate::decode::tile_hits() - before;
8414+ assert!(
8415+ hits > 0,
8416+ "{NAME}: tile_hits delta was {hits}, expected >0 (seed {seed})"
8417+ );
8418+ assert_eq!(pictures.len(), 1, "{NAME}: expected exactly 1 picture (seed {seed})");
8419+
8420+ let ffmpeg_frames = ffmpeg_decode_sequence(&stream, width, height, 1);
8421+ assert_eq!(pictures[0].y, ffmpeg_frames[0].y, "{NAME}: luma vs ffmpeg (seed {seed})");
8422+ assert_eq!(pictures[0].u, ffmpeg_frames[0].u, "{NAME}: U vs ffmpeg (seed {seed})");
8423+ assert_eq!(pictures[0].v, ffmpeg_frames[0].v, "{NAME}: V vs ffmpeg (seed {seed})");
8424+ matched += 1;
8425+ }
8426+ assert!(
8427+ matched > 0,
8428+ "{NAME}: every attempt refused ({named_refusals} refusals); decode_stream never \
8429+ decoded a non-uniform-tile-spacing stream"
8430+ );
8431+ assert!(
8432+ saw_non_uniform_spacing,
8433+ "{NAME}: no attempt actually set uniform_spacing_flag == 0 -- this sweep proves \
8434+ nothing about the non-uniform case"
8435+ );
8436+ eprintln!(
8437+ "{NAME}: {matched} pixel-exact matches, {named_refusals} named refusals out of 20"
8438+ );
8439+ }
8051 }8440 }
lanes/tiles-r10.charter.mdadded+35 -0
@@ -0,0 +1,35 @@
1+# lane-tiles r10 — finish r9's tile-group gate
2+
3+At 5524499. Read `lanes/tiles-r9.charter.md` (still your charter — r9 never
4+reported) and `lanes/tiles-r8.report.md`.
5+
6+r9 merged main cleanly (8d08ef0, its own commit) and then died mid-edit while
7+replacing a tile-group test function. I committed its in-flight `stream.rs` edit
8+verbatim; **it may not even compile.** Check that first, and fix or revert that
9+one edit before anything else.
10+
11+Then the r9 charter's job, unchanged: several tile-group OBUs per frame, and
12+non-uniform tile spacing (`uniform_tile_spacing_flag == 0`), each STALENESS-
13+CHECKED before any new code. r8's finding is the method — it found
14+`context_update_tile_id != 0` already worked, guarded only by a stale comment
15+claiming a refusal that existed nowhere in the crate, and closed it with a live
16+proof rather than new machinery. Grep for the refusal, prove the capability is
17+genuinely absent, and only then build. If a capability is missing: gate below
18+`decode_stream` first, then lift, updating `refusal_inventory.rs` in the same
19+commit. If aomenc cannot be made to emit a case, say so with the commands you
20+tried rather than substituting a hand-built fixture as equivalent
21+([[fixture-proves-symbol-not-signal]]).
22+
23+## Budget discipline (I am serious about this)
24+You have 75 turns and they do NOT reset if you are resumed. At roughly turn 55,
25+STOP starting new work: commit what is green, and write your report. Five rounds
26+in the last batch died mid-edit with nothing reported, and each cost a whole
27+round to recover. A round that ends with an honest report beats one that ends
28+five turns deeper into an edit.
29+
30+Hard rules: `CARGO_TARGET_DIR=$HOME/.cache/cargo-target-tiles`; foreground
31+`nice -n 19 cargo ... -j4`; every `cargo test` a timeout >= 600000 ms; fixtures
32+through `gradients_source(seed, w, h, tail)`; ffmpeg generates bounded with `-t`;
33+`EC_AV1_REQUIRE_AOMENC=1`; aomenc `--threads=1 --row-mt=0 --sb-size=64`. Sibling
34+worktrees have live agents — never build in or edit them. Never push, never merge
35+into main. End with `lanes/tiles-r10.report.md`, VERDICT on line 1.
lanes/tiles-r10.report.mdadded+32 -0
@@ -0,0 +1,32 @@
1+VERDICT: PASS -- r9's committed WIP compiles and is correct (verified, no code change needed); both charter items (several tile-group OBUs, non-uniform tile spacing) were staleness-checked and found already-working decode capabilities, each closed with a real-aomenc gate rather than new decode machinery.
2+
3+## Stage 0 -- check r9's in-flight edit (5524499)
4+`cargo check -p ec-av1 --tests` was clean (warnings only, no errors). r9's edit adds a `pending_header`/`pending_tiles` accumulator to `decode_stream` keyed off a standalone `OBU_FRAME_HEADER` (`show_existing_frame == false`), collecting `OBU_TILE_GROUP` payloads (normalising each `Tile::offset` to absolute via `tiles_base_offset`) until `cols * rows` tiles have arrived. It also fixed a real bug the old code had: the `FrameHeader` arm fired unconditionally for every header, so a standalone frame header used to be misrouted into the `show_existing_frame` DPB-slot lookup. Ran the gate the edit added
5+(`a_real_aomenc_stream_with_several_tile_group_obus_decodes_pixel_exact`, `--num-tile-groups=4`, 20 seeds): 20/20 pixel-exact, 0 refusals, `saw_multiple_tile_group_obus` asserted true (real aomenc streams do split into >1 `OBU_TILE_GROUP`). Nothing to fix or revert -- item 1 was already fully done by r9, just unverified. No commit needed here (working tree was already clean after the check).
6+
7+## Item 2 -- non-uniform tile spacing (`uniform_spacing_flag == 0`, spec 5.9.15)
8+Staleness-checked first, per charter. `decode.rs`'s tile loop (`decode_key_frame_tile_with_cdfs` / the inter-frame equivalent) already walks `tile_info.mi_col_starts`/`mi_row_starts` generically -- these arrays are populated identically by `read_tile_info` (`ec-av1-syntax/src/frame.rs`) for both the uniform and non-uniform branches, and nothing in `decode.rs` recomputes tile bounds from `cols_log2`/`rows_log2` (which would assume uniform spacing). Grepped the whole crate: the only "non-uniform tile spacing is not written" refusal is `frame.rs`'s OBU *writer* (`crates/ec-av1/src/frame.rs:79-82`), an unrelated encode/round-trip path this charter item does not touch. No decode-side refusal exists at all -- same shape as r8's `context_update_tile_id` finding.
9+
10+**Making aomenc emit it was the actual work this round.** `--tile-columns`/`--tile-rows` always take libaom's `uniform_spacing = 1` branch (`av1/encoder/encoder.c` `set_tile_info`); `--auto-tiles` only reaches the non-uniform balancing path when `g_threads >= 2` (`av1_cx_iface.c` `set_auto_tiles`), which this charter's mandatory `--threads=1` rules out. Read `av1_cx_iface.c`'s `set_tile_info` (lines ~370-430) and found the one CLI surface that reaches the `else { tiles->uniform_spacing = 0; ... }` arm: `--tile-width=<sb-list>`/`--tile-height=<sb-list>` (`arg_defs.c` `.tile_width`/`.tile_height` -- registered as real flags, just not printed by `aomenc --help`). Hand-verified live before writing the gate: `aomenc --tile-width=1,3 --tile-height=1 --sb-size=64 --threads=1` on a 256x64 source produced a real 430-byte OBU stream.
11+
12+New gate `a_real_aomenc_stream_with_non_uniform_tile_spacing_decodes_pixel_exact` (`crates/ec-av1/src/stream.rs`): probes the parsed `FrameHeader`/`Frame` OBU's `tile_info.uniform_spacing` directly via `Av1Parser` and hard-asserts it's false at least once (`saw_non_uniform_spacing`), plus asserts `cols > 1 || rows > 1` so the fixture is proven to actually exercise more than one tile. 20/20 pixel-exact vs ffmpeg, 0 named refusals. Committed 490ddb3.
13+
14+## Verification
15+- `cargo check -p ec-av1 --tests`: clean (warnings only).
16+- Scoped suite (`tile`, `mvstack`, `refusal_inventory`, `gate_coverage`, `EC_AV1_REQUIRE_AOMENC=1`): 51+29+3+2 = 85/0 after the non-uniform-spacing commit.
17+- Full `stream::` module (`cargo test -p ec-av1 --lib stream::`, `EC_AV1_REQUIRE_AOMENC=1`): 52 passed, 6 pre-existing ignored (pinned-fixture tests that read paths outside the repo, untouched by this round), 0 failed.
18+- `refusal_inventory.rs`'s `the_decode_path_refuses_exactly_the_listed_cases` and `capability_claims_are_declared_not_scattered` both pass unmodified -- the one new error string r9's edit introduced (`"AV1 decode_stream: a tile group OBU with no preceding frame header"`) uses `Error::corrupt(...)`, not `unsupported(...)`, so it is correctly out of that inventory's scope (a malformed-stream error, not an unimplemented-capability refusal) and needed no pinning.
19+
20+## Fallback inventory (r9 charter's "if both turn out to be closed already" item)
21+Both items closed this round with real gates, not by discovering them pre-closed, so the fallback sweep is only a light note, not the deliverable:
22+- **MV stack / neighbour context**: already tile-boundary-aware -- `neighbours.start_tile(mi_row0, mi_col0, mi_col1)` is called per-tile at both the key-frame (`decode.rs:5549`) and inter-frame (`decode.rs:10512`) tile loop entry, resetting neighbour state at each tile's own edge (spec 5.11.2's per-tile `clear_left_context`/`clear_above_context` shape). Proven live by every multi-tile gate in this file (two/four tile rows/cols, this round's two new gates) being pixel-exact.
23+- **Loop-restoration stripe boundaries**: not a live tile gap -- loop restoration is refused unconditionally today (`"a frame with loop restoration enabled (this decoder never reads the per-unit lr symbols)"`, pinned in `refusal_inventory.rs`), so stripe-boundary tile interaction is unreachable code, not an untested tile assumption.
24+No further tile-shaped gaps found worth naming this round.
25+
26+## Files changed
27+- `crates/ec-av1/src/stream.rs` -- new gate `a_real_aomenc_stream_with_non_uniform_tile_spacing_decodes_pixel_exact` (180 lines). r9's earlier several-tile-group-OBUs edit (5524499) verified correct, unchanged.
28+
29+## Commits
30+- 490ddb3 test(av1): non-uniform tile spacing gate -- decode already generic, staleness-checked
31+
32+Never pushed, never merged, never touched main or sibling worktrees. `CARGO_TARGET_DIR=$HOME/.cache/cargo-target-tiles` used for every build/test. Both charter items are CLOSED; no deferred work.
lanes/tiles-r9.charter.mdadded+43 -0
@@ -0,0 +1,43 @@
1+# lane-tiles r9 — the last two tile refusals, staleness-checked first
2+
3+At 5255492, MERGED into main (9a632d7). Tile rows are closed, and so is
4+`context_update_tile_id != 0` — which r8 found already worked, guarded only by a
5+stale comment claiming a refusal that existed nowhere in the crate. Read
6+`lanes/tiles-r8.report.md`.
7+
8+Start with `git merge main` (a8724cb — delta_q/delta_lf, key-frame superres,
9+palette-Y, a `bit_depth != 8` refusal), resolve, suite green, commit.
10+
11+## The round: two capabilities, each staleness-checked BEFORE any new code
12+r8's own finding sets the method: **grep for the refusal first and prove the
13+capability is genuinely absent before building machinery for it.** A user-visible
14+"not supported" is a claim, and a claim with no test behind it is a bug either
15+way — either the code is missing or the message is a lie.
16+
17+1. **Several tile-group OBUs per frame.** Check whether `decode_stream` and the
18+ OBU walk actually assume one tile group. If a refusal exists, gate then lift;
19+ if it does not, prove the capability live with a real aomenc stream that emits
20+ more than one tile group and hard-assert it, exactly as r8 did for
21+ `context_update_tile_id`.
22+2. **Non-uniform tile spacing** (`uniform_tile_spacing_flag == 0`). Same
23+ treatment. Note aomenc may not emit it at all from the CLI — if you cannot
24+ make a real encoder produce one, say so with the commands you tried, and do
25+ not paper over it with a hand-built fixture presented as equivalent
26+ ([[fixture-proves-symbol-not-signal]]).
27+
28+A branch that lifts a refusal without a gate does not merge to main.
29+
30+## If both turn out to be closed already
31+Then the next tile-shaped gap is worth naming rather than inventing work: sweep
32+`decode.rs` and `stream.rs` for every remaining assumption that the frame is one
33+tile — tile-boundary MV stack bounds, CDF context selection, loop-restoration
34+stripe boundaries — and report which are proven by a gate today versus which
35+merely have not been contradicted. That inventory is the deliverable.
36+
37+Hard rules: `CARGO_TARGET_DIR=$HOME/.cache/cargo-target-tiles`; foreground
38+`nice -n 19 cargo ... -j4`; every `cargo test` a timeout >= 600000 ms; fixtures
39+through `gradients_source(seed, w, h, tail)`; ffmpeg generates bounded with `-t`;
40+`EC_AV1_REQUIRE_AOMENC=1`; aomenc `--threads=1 --row-mt=0 --sb-size=64`. Sibling
41+worktrees have live agents — never build in or edit them. Never push, never merge
42+into main. 75-turn cap, does not reset: COMMIT AT EVERY GREEN STEP. End with
43+`lanes/tiles-r9.report.md`, VERDICT on line 1.