From 2fa693f8c0013b8c848d8737212d159d7c9c0cb2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ahmet=20Kaan=20G=C3=BCm=C3=BC=C5=9F?= Date: Mon, 28 Sep 2026 21:08:38 +0300 Subject: [PATCH] test(av1formatsweep): the red-before proof the odd-dimension gate was missing Flooring the mode-info grid's ceil -- ec-av1-syntax's `h.mi_cols = 2 * ((h.frame_width + 7) >> 3)` to `2 * (h.frame_width >> 3)` -- turns a_real_aomenc_odd_coded_dimension_streams_decode_pixel_exact red on its first arm (decode-order frame 0, byte 128: ours 74 vs oracle 170, 11538 bytes differ) and green on revert. Recorded in the gate's doc comment. Also records why the nearer mutation is not evidence: flooring decode::round_ss leaves the gate green because aomenc rounds a 4:2:0 frame's coded size DOWN to even, so this recipe cannot produce a stream with an odd luma dimension at all (a testsrc2 131x131 y4m encodes as max_frame=130x130, and this decoder decodes that frame correctly; the ffmpeg reference padding to 131x131 is the artifact). The sweep's odd-dimension cell is therefore 'even, not a multiple of 8'. --- crates/ec-av1/src/stream.rs | 24 ++++++++++++++++++++++++ lanes/av1formatsweep.report.md | 32 ++++++++++++++++++++++++-------- 2 files changed, 48 insertions(+), 8 deletions(-) diff --git a/crates/ec-av1/src/stream.rs b/crates/ec-av1/src/stream.rs index fc5fd7ee..d00b18ff 100644 --- a/crates/ec-av1/src/stream.rs +++ b/crates/ec-av1/src/stream.rs @@ -42066,6 +42066,30 @@ pub(crate) mod tests { /// makes aomenc set `allow_screen_content_tools`, which this decoder /// refuses BY NAME at 12 bits (see `a_12bit_screen_content_stream_is_ /// refused_by_name`). + /// + /// NON-VACUITY, RED-BEFORE PROVEN: the mode-info grid's ceil is the + /// arithmetic this cell depends on, and mutating it turns every arm red + /// -- `ec-av1-syntax`'s `h.mi_cols = 2 * ((h.frame_width + 7) >> 3)` + /// floored to `2 * (h.frame_width >> 3)` makes the first arm fail at + /// decode-order frame 0, byte 128 (ours 74 vs oracle 170, 11538 bytes + /// differ); reverted, the gate is green again. A NEARER mutation, + /// flooring `decode::round_ss` from libaom's `ROUND_POWER_OF_TWO`, + /// leaves this gate GREEN and is not evidence either way: aomenc rounds + /// a 4:2:0 frame's coded size DOWN to even, so no stream this recipe can + /// produce codes an odd luma dimension, and the chroma-extent ceil only + /// differs from its floor when the luma dimension is itself odd. + /// + /// Also asserted, so a recipe that silently became even-dimensioned can + /// not pass as this cell: the header's `ss (1,1)` and bit depth, the + /// partial mode-info grid (`mi*8 > dim`), every frame's chroma plane + /// being `ceil(w/2)*ceil(h/2)`, and + /// `decode::inter_edge_strip_hits()` non-zero after a per-arm reset -- + /// measured per arm: `[0,6,0,4,48,12]`, `[0,0,0,4,0,6]`, + /// `[0,4,0,10,0,10]`, `[0,4,0,8,0,12]`, `[0,4,0,8,0,8]`, + /// `[0,0,0,12,0,14]`, where the even-size control (128x96) reads all + /// zeros. Without the counter a decoder that dropped the partial column + /// entirely would still pass the pixel compare (class + /// `gate-blind-to-feature`). #[test] fn a_real_aomenc_odd_coded_dimension_streams_decode_pixel_exact() { const NAME: &str = "a_real_aomenc_odd_coded_dimension_streams_decode_pixel_exact"; diff --git a/lanes/av1formatsweep.report.md b/lanes/av1formatsweep.report.md index 0b2b1cc5..7d1bd4bc 100644 --- a/lanes/av1formatsweep.report.md +++ b/lanes/av1formatsweep.report.md @@ -135,14 +135,30 @@ Shared helpers added: `odd_dim_stream` / `chroma_format_stream` (ffmpeg y4m → aomenc pipe, deadline from `run_with_stdin`), `odd_dim_header_mi_grid`, `assert_444_header`. -**Honest gap in the proof:** the odd-dimensions gate's counter and geometry -assertions are in place, but its red-before (mutation) proof is NOT -complete. Forcing `decode::round_ss` from libaom's `ROUND_POWER_OF_TWO` to a -floor division left the gate GREEN — the odd-dimension extents are computed -from the mode-info grid (`mi_cols*4 >> ss`), not through `round_ss`. A -mutation inside that extent computation is the outstanding proof. Gates B and -C inherit the same `aomdec` byte-compare proof as the 180 existing gates, and -no mutation proof either. +**Red-before proof for gate A (done).** The mutation that bites is the +mode-info grid's ceil: `ec-av1-syntax`'s +`h.mi_cols = 2 * ((h.frame_width + 7) >> 3)` floored to +`2 * (h.frame_width >> 3)` turns the gate red on the first arm — decode-order +frame 0, byte 128, ours 74 vs oracle 170, 11538 bytes differ — and green again +on revert. + +**Why the nearer mutation was the wrong one.** Flooring `decode::round_ss` +(libaom's `ROUND_POWER_OF_TWO`) leaves the gate GREEN, and that is not a gap +in the gate: aomenc rounds a 4:2:0 frame's coded size DOWN to even, so no +stream this recipe can produce codes an odd luma dimension, and the +chroma-extent ceil only differs from its floor when the luma dimension is +itself odd. Verified directly: a `testsrc2 131x131` yuv420p y4m (ffmpeg +accepts it) comes out of aomenc as a stream whose sequence header says +`max_frame=130x130` — and this decoder decodes that 130x130 frame correctly. +The ffmpeg reference for the same file comes back 131x131 (25873 samples +against our 25350), which is ffmpeg padding to the y4m header, not a decoder +defect. **Consequence for the matrix:** the "luma dimension itself odd" cell +is not producible through the aomenc + lavfi recipe, so it can be neither +gated nor refuted from here; the sweep's odd-dimension cell is "even, not a +multiple of 8". + +**Still unproven:** gates B and C carry no mutation proof — they inherit the +`aomdec` byte-compare proof the 180 existing gates run on. ## 3. Divergences, localized