forge
Explore
Log in

Don't you dare go Hollow

Merge lane-av1superpin @ 9646f74d — superres den=9 + mode-2 pins, shared helper, report corrections

Browse files at this commit

c1b1e89b22dc679055d1e78b7cd82c5376bbe9a5Ahmet Kaan GümüşParent: ec131f68fbb8ab
- crates/ec-av1/fixtures/:
  444_lossy_rect4_odd_130x122.obu (8945 B), 444_lossy_rect4_wide_256x128.obu
  (15239 B), 444_lossy_superres_256x128_d9.obu (17437 B),
  444_lossy_superres_256x128_d12.obu (14808 B),
  444_lossy_superres_mode2_256x128.obu (16620 B) and the shared
  a_444_superres_arm helper.
- crates/ec-av1/src/stream.rs: a_444_lossy_superres_stream_decodes_pixel_exact,
  a_444_lossy_superres_mode1_den9_stream_decodes_pixel_exact,
  a_444_lossy_superres_mode2_random_denom_stream_decodes_pixel_exact,
  a_444_lossy_rect4_strip_stream_decodes_pixel_exact_at_odd_and_wide_geometries
  and the flag-ignoring control arm.
- crates/ec-av1/src/decode.rs, lanes/av1444edge.report.md,
  lanes/av1superpin.report.md, lanes/av1formatsweep.report.md.
- crates/ec-av1/src/gate_coverage.rs: the wave-wide retirement reconciliation
  (below).
- lanes/merge-wave-2.report.md: the wave's merge table, every conflict
  resolution, and the two post-merge fix tasks.

SPLICE from lane-park-av1444edge @ a02a2511 (that branch is NOT merged): the
§6.2 `130x122` row of lanes/av1formatsweep.report.md carries av1444edge's
CORRECTION — the cell is EXACT 4/4 (8945 B, sha c87ac65b…), the same H1
1:4-inter-strip chroma class, closed by lane-av1444rect's f92776ba (an ancestor
of main) and gated by
a_444_lossy_rect4_strip_stream_decodes_pixel_exact_at_odd_and_wide_geometries.
The original measurement text is KEPT inside the row ("was DIVERGENT from f3,
11521 samples, first (f3, s2208) = Y(128,16); now EXACT 4/4"), not deleted.
Nothing else from a02a2511 is taken: its r4 gates are content-equivalent
duplicates of superpin's a_444_superres_arm, and its two other fixtures are
byte-identical blobs under different names.

Conflicts resolved:
* decode.rs (2 hunks, both @ours): one comment-only hunk where MAIN's text is
  more informative (it states what the counter is NOT evidence for), and one
  where theirs has no counterpart — INTRABC_RECT4_OWN_CHROMA444_HITS is a
  main-only addition from an earlier lane that superpin's older base predates.
* stream.rs: add/add at the end of `mod tests` producing INTERLEAVED hunks
  that split ours' last gate mid-statement, so marker surgery does not apply.
  Resolved by construction: this branch's stream.rs delta against its merge
  base is 933 added lines at a single hunk, so merged = HEAD verbatim + that
  block. That block re-adds a_444_lossy_rect4_inter_stream_decodes_pixel_exact,
  byte-IDENTICAL (5905 B, extracted and compared) to the copy main already has
  from lane-av1444rect e10a3b25, which superpin also carries; the appended
  copy is DELETED here. All six of this branch's gates are present exactly once
  afterwards.
* lanes/av1formatsweep.report.md (add/add): superpin's version with the spliced
  130x122 row, as above.

gate_coverage.rs — the union of the wave's retirements, so
never_exercised_{8,10}bit_matches_the_gate_recipes is green on derived
evidence rather than on an edit:
  enable-dist-wtd-comp (8b)  a_distance_weighted_compound_stream_decodes_pixel_exact
  enable-dual-filter   (8b)  a_real_aomenc_dual_filter_obmc_8x8_inter_sequence_decodes_pixel_exact
  enable-dual-filter   (10b) a_real_aomenc_10bit_dual_filter_obmc_8x8_inter_sequence_decodes_pixel_exact
  enable-flip-idtx     (8b)  a_real_aomenc_stream_with_a_1d_tx_class_on_a_rect_transform_…
  enable-rect-tx  (8b and 10b) a_real_aomenc_{8,10}bit_stream_with_a_rect_transform_decodes_pixel_exact
Both lists are now empty; the census derives EMPTY (0 of 26 tools) at both
depths across 255 real-aomenc gate bodies. TOOL_UNIVERSE keeps all 26 tools,
enable-rect-tx included. The test was NOT weakened: it was red with
"the 8-bit list still names [\"enable-rect-tx\"] …" and
"the 10-bit list still names [\"enable-dual-filter\", \"enable-rect-tx\"] …"
immediately before this edit, and the retirement evidence is preserved as
comments above each emptied list.

Duplicate fixtures: measured after this merge, crates/ec-av1/fixtures/ holds
63 files with 63 DISTINCT sha256 prefixes — zero duplicates, so no blob is
carried twice under two names and no file was deleted for that reason.
crates/ec-av1/fixtures/444_lossy_rect4_odd_130x122.obuadded+0 -0

Binary file changed

crates/ec-av1/fixtures/444_lossy_rect4_wide_256x128.obuadded+0 -0

Binary file changed

crates/ec-av1/fixtures/444_lossy_superres_256x128_d12.obuadded+0 -0

Binary file changed

crates/ec-av1/fixtures/444_lossy_superres_256x128_d9.obuadded+0 -0

Binary file changed

crates/ec-av1/fixtures/444_lossy_superres_mode2_256x128.obuadded+0 -0

Binary file changed

crates/ec-av1/src/decode.rsmodified+49 -21
@@ -19731,6 +19731,48 @@ fn dump_stage(var: &str, y: &PlaneBuf<'_>, u: &PlaneBuf<'_>, v: &PlaneBuf<'_>) {
19731 }19731 }
19732 }19732 }
19733 19733
19734+/// `EC_AV1_PREFILT_WIDE_DUMP=<prefix>` -> `<prefix>.f<N>`, the pre-loop-filter
19735+/// reconstruction cropped to each plane's mi-ALIGNED true extent, byte for
19736+/// byte the shape aomdec's own rung 7 writes (`y_width`/`y_height`,
19737+/// `uv_width`/`uv_height`), so the two can be diffed directly.
19738+///
19739+/// lane-av1444edge: this used to be an inline block in the KEY-frame tile path
19740+/// only, with a FUNCTION-LOCAL `static IDX2` as its counter. Both facts were
19741+/// measurement traps, and the second one is why the first went unnoticed:
19742+/// the inter-frame path (`decode_inter_frame_tile_with_cdfs`) had no wide
19743+/// prefilter dump at all, so every 4:4:4 lossy divergence localized to an
19744+/// inter frame had no pre-filter rung to compare against and got attributed to
19745+/// reconstruction when the oracle could not see it. The `static` also restarted
19746+/// per monomorphisation, so every frame after the first overwrote `.f0` -- a
19747+/// per-frame bisection silently compared the LAST decoded frame. The counter
19748+/// is now the shared per-var [`dump_stage_idx`] map, and the call also sits on
19749+/// the inter path (skipped when the filter pipeline is active, which has
19750+/// already deblocked by the time the tile tail runs -- same condition
19751+/// `capture_filter_replay` guards itself with).
19752+fn dump_prefilter_wide(y: &PlaneBuf<'_>, u: &PlaneBuf<'_>, v: &PlaneBuf<'_>) {
19753+ let Ok(path) = crate::envflags::var("EC_AV1_PREFILT_WIDE_DUMP") else {
19754+ return;
19755+ };
19756+ use std::io::Write;
19757+ let idx = dump_stage_idx("EC_AV1_PREFILT_WIDE_DUMP");
19758+ let crop = |plane: &PlaneBuf<'_>| -> Vec<u8> {
19759+ let mut out = Vec::with_capacity(plane.true_width * plane.true_height);
19760+ for row in 0..plane.true_height {
19761+ out.extend(
19762+ plane.data[row * plane.width..][..plane.true_width]
19763+ .iter()
19764+ .map(|&s| s as u8),
19765+ );
19766+ }
19767+ out
19768+ };
19769+ if let Ok(mut f) = std::fs::File::create(format!("{path}.f{idx}")) {
19770+ let _ = f.write_all(&crop(y));
19771+ let _ = f.write_all(&crop(u));
19772+ let _ = f.write_all(&crop(v));
19773+ }
19774+}
19775+
19734 /// The value [`fresh_plane`] fills with under `EC_AV1_PLANE_SENTINEL`: no19776 /// The value [`fresh_plane`] fills with under `EC_AV1_PLANE_SENTINEL`: no
19735 /// legal sample can equal it (reconstruction clamps to `(1 << bit_depth) - 1`,19777 /// legal sample can equal it (reconstruction clamps to `(1 << bit_depth) - 1`,
19736 /// at most 4095), so a decode that hashes identically under the flag proves19778 /// at most 4095), so a decode that hashes identically under the flag proves
@@ -35230,27 +35272,7 @@ pub(crate) fn decode_key_frame_tile_with_cdfs(
35230 } else {35272 } else {
35231 PREFILT_PICTURE_IDX.fetch_add(1, std::sync::atomic::Ordering::SeqCst);35273 PREFILT_PICTURE_IDX.fetch_add(1, std::sync::atomic::Ordering::SeqCst);
35232 }35274 }
35233- if let Ok(path) = crate::envflags::var("EC_AV1_PREFILT_WIDE_DUMP") {35275+ dump_prefilter_wide(&y, &u, &v);
35234- use std::io::Write;
35235- static IDX2: std::sync::atomic::AtomicUsize = std::sync::atomic::AtomicUsize::new(0);
35236- let idx = IDX2.fetch_add(1, std::sync::atomic::Ordering::SeqCst);
35237- let crop_wide = |plane: &PlaneBuf<'_>| -> Vec<u8> {
35238- let mut out = Vec::with_capacity(plane.true_width * plane.true_height);
35239- for row in 0..plane.true_height {
35240- out.extend(
35241- plane.data[row * plane.width..][..plane.true_width]
35242- .iter()
35243- .map(|&s| s as u8),
35244- );
35245- }
35246- out
35247- };
35248- if let Ok(mut f) = std::fs::File::create(format!("{path}.f{idx}")) {
35249- let _ = f.write_all(&crop_wide(&y));
35250- let _ = f.write_all(&crop_wide(&u));
35251- let _ = f.write_all(&crop_wide(&v));
35252- }
35253- }
35254 // lane-av1fwd: the encoder's filter search re-decodes this same key35276 // lane-av1fwd: the encoder's filter search re-decodes this same key
35255 // frame tile per candidate -- capture it once (see [`FilterReplay`]),35277 // frame tile per candidate -- capture it once (see [`FilterReplay`]),
35256 // on the shape whose tail is the two filter calls and nothing else.35278 // on the shape whose tail is the two filter calls and nothing else.
@@ -53020,6 +53042,12 @@ pub(crate) fn decode_inter_frame_tile_with_cdfs(
53020 } else {53042 } else {
53021 PREFILT_PICTURE_IDX.fetch_add(1, std::sync::atomic::Ordering::SeqCst);53043 PREFILT_PICTURE_IDX.fetch_add(1, std::sync::atomic::Ordering::SeqCst);
53022 }53044 }
53045+ // lane-av1444edge: the inter-frame path's mi-aligned pre-loop-filter
53046+ // dump, the rung the key-frame path has always had (see
53047+ // `dump_prefilter_wide`). Placed beside the padded `EC_AV1_PREFILT_DUMP`
53048+ // above, i.e. before the filter pipeline is released, so the two agree on
53049+ // the point in the sequence they sample.
53050+ dump_prefilter_wide(&y, &u, &v);
53023 // lane-pipefilt: release the rows still pending and wait the pipeline53051 // lane-pipefilt: release the rows still pending and wait the pipeline
53024 // out; from here the picture is deblocked and CDEF-filtered exactly as53052 // out; from here the picture is deblocked and CDEF-filtered exactly as
53025 // the whole-frame path leaves it.53053 // the whole-frame path leaves it.
crates/ec-av1/src/gate_coverage.rsmodified+33 -9
@@ -310,10 +310,24 @@ const NEVER_EXERCISED_8BIT: &[(&str, &str)] = &[
310 // therefore never prove this tool by naming the flag, only by proving a310 // therefore never prove this tool by naming the flag, only by proving a
311 // rect transform unit fired (`rect_partition_hits` /311 // rect transform unit fired (`rect_partition_hits` /
312 // `rect_coeff_tu_hits`, which lane-rect1d's gate does assert).312 // `rect_coeff_tu_hits`, which lane-rect1d's gate does assert).
313- (313+ // `enable-rect-tx` LEFT this list on 2026-09-29 (merge wave 2,
314- "enable-rect-tx",314+ // lane-av1toolgates). Both halves of the reason recorded above still hold
315- "never spelled; rect transforms reach the decoder only through partition shape, never through a gate that names the tool",315+ // as statements about the FLAG, and the second is exactly why the closing
316- ),316+ // evidence is a parsed shape and not a spelling: `enable_rect_tx` has no
317+ // sequence-header bit, so a decoder path can never be proven by naming the
318+ // flag -- only by proving a rect transform unit fired.
319+ // `a_real_aomenc_8bit_stream_with_a_rect_transform_decodes_pixel_exact`
320+ // (and its 10-bit twin) now spell `--enable-rect-tx=1` in their OWN test
321+ // bodies -- inline on purpose, because a helper-owned recipe collapses
322+ // both gates into one helper segment that `is_ten_bit` files 10-bit, and
323+ // the 8-bit hole would stay open -- and prove the tool on the PARSED
324+ // shape: `rect_partition_hits()` and `rect_coeff_tu_hits()` are both
325+ // asserted > 0 over arms that decoded AND pixel-compared, and each
326+ // counter is mutation-proven red on its own message.
327+ // Census on the merged tree (`print_never_exercised_per_bit_depth`):
328+ // 255 real-aomenc gate bodies, NEVER_EXERCISED derived EMPTY at 8 bits
329+ // and at 10 bits -- 0 of 26 tools -- so this list is empty on the same
330+ // evidence, not by deletion of a claim.
317 ];331 ];
318 332
319 #[cfg(test)]333 #[cfg(test)]
@@ -371,10 +385,13 @@ const NEVER_EXERCISED_10BIT: &[(&str, &str)] = &[
371 // compared attempts, 10 of them 1D). The gate also hard-asserts385 // compared attempts, 10 of them 1D). The gate also hard-asserts
372 // `compared_class1 > 0`, so its "passes =1 at both depths" is backed by an386 // `compared_class1 > 0`, so its "passes =1 at both depths" is backed by an
373 // arrival assert, not just a spelling.387 // arrival assert, not just a spelling.
374- (388+ // `enable-dual-filter` LEFT this list on 2026-09-29 (merge wave 2,
375- "enable-dual-filter",389+ // lane-av1dualfilter10), by exactly the 10-bit arm the note above names.
376- "exercised at 8 bits only, by a_real_aomenc_dual_filter_obmc_8x8_inter_sequence_decodes_pixel_exact (=1, asserts dual_filter_diff_hits moved); no 10-bit gate spells =1 -- that gate calls inter_sb_none_gate with ten_bit=false. Retire by adding its 10-bit arm",390+ // `a_real_aomenc_10bit_dual_filter_obmc_8x8_inter_sequence_decodes_pixel_exact`
377- ),391+ // spells `--enable-dual-filter=1` in its own body and hard-asserts the
392+ // arrival counter `decode::dual_filter_diff_hits()` moved at 10 BITS, so
393+ // the entry is closed at the depth it was held open at, not by a spelling
394+ // alone.
378 // `enable-flip-idtx` LEFT this list on 2026-09-02 (lane-rect1d r1):395 // `enable-flip-idtx` LEFT this list on 2026-09-02 (lane-rect1d r1):
379 // `a_real_aomenc_stream_with_a_1d_tx_class_on_a_rect_transform_decodes_pixel_exact`396 // `a_real_aomenc_stream_with_a_1d_tx_class_on_a_rect_transform_decodes_pixel_exact`
380 // passes `=1` at both depths and pixel-compares six 10-bit decodes, so the397 // passes `=1` at both depths and pixel-compares six 10-bit decodes, so the
@@ -392,7 +409,14 @@ const NEVER_EXERCISED_10BIT: &[(&str, &str)] = &[
392 // screen recipes run at 10 bits and hard-assert a decoded intrabc block409 // screen recipes run at 10 bits and hard-assert a decoded intrabc block
393 // per depth (4-6 per arm), every frame pixel-compared against ffmpeg's own410 // per depth (4-6 per arm), every frame pixel-compared against ffmpeg's own
394 // 10-bit decode.411 // 10-bit decode.
395- ("enable-rect-tx", "hole at both depths, see the 8-bit list"),412+ // `enable-rect-tx` LEFT this list on 2026-09-29 (merge wave 2,
413+ // lane-av1toolgates), together with its 8-bit twin, by
414+ // `a_real_aomenc_10bit_stream_with_a_rect_transform_decodes_pixel_exact`:
415+ // the depth is spelled in the test's OWN body, which is what files it in
416+ // the 10-bit bucket, and the witness is the parsed shape
417+ // (`rect_partition_hits()` / `rect_coeff_tu_hits()` > 0 over arms that
418+ // decoded AND pixel-compared). See the 8-bit list for why the flag alone
419+ // could never have been the evidence.
396 ];420 ];
397 421
398 /// [`DEFAULT_ON_TOOLS`] entries no 8-bit gate spells on, with the reason.422 /// [`DEFAULT_ON_TOOLS`] entries no 8-bit gate spells on, with the reason.
crates/ec-av1/src/stream.rsmodified+752 -0
@@ -46238,4 +46238,756 @@ pub(crate) mod tests {
46238 -- the tail is the OPEN r3 defect, not an assertion"46238 -- the tail is the OPEN r3 defect, not an assertion"
46239 );46239 );
46240 }46240 }
46241+
46242+ /// lane-av1444edge: the two 4:4:4 lossy cells the chroma-format sweep
46243+ /// (§6.2) left as "unassigned, neither reduces to a known class". They
46244+ /// are one class, and it is the sibling gate's: a 1:4 (HORZ_4 / VERT_4)
46245+ /// inter strip's chroma coefficient context gathered at the 4:2:0 PAIR
46246+ /// extent at ss (0,0), where `is_chroma_reference`
46247+ /// (av1_common_int.h:1454) makes every block its own chroma reference so
46248+ /// no pair exists. What these two add is the geometry and the depth the
46249+ /// sibling's 128x96 gate does not reach.
46250+ ///
46251+ /// **Arm A -- partial-frame right edge, 130x122.** Neither dimension is a
46252+ /// multiple of 8 (the sweep's own odd-dimension gate covers 4:2:0 only, so
46253+ /// the 4:4:4 partial-column walk had no exactness evidence), and 66x66 is
46254+ /// EXACT at the same settings, so the walk is right at one odd geometry
46255+ /// and wrong at another. Arm B -- 256x128, 4 frames, with CDEF and loop
46256+ /// restoration both live on the last two frames.
46257+ ///
46258+ /// **The recipes** (the sweep's, byte-reproduced -- the truncated sha256
46259+ /// prefixes it recorded, `c87ac65b…` and `06621606…`, match):
46260+ /// ```text
46261+ /// ffmpeg -f lavfi -i "testsrc2=size=<W>x<H>:rate=25" -frames:v 4 \
46262+ /// -pix_fmt yuv444p -strict -1 -f yuv4mpegpipe - | \
46263+ /// aomenc --codec=av1 --passes=1 --end-usage=q --cq-level=20 --cpu-used=2 \
46264+ /// --threads=1 --row-mt=0 --lag-in-frames=0 --kf-max-dist=100 \
46265+ /// --limit=4 --obu -o - -
46266+ /// ```
46267+ /// (`rate=25` is load-bearing for the same reason as the sibling gate:
46268+ /// `testsrc2`'s pattern is time-parameterised.)
46269+ ///
46270+ /// Red before the fix, both arms: arm A frame 3, 11521 samples, first at
46271+ /// Y(128,16) (ours 134, oracle 170); arm B frame 2, 25296 samples, first
46272+ /// at Y(192,0) (ours 92, oracle 106), frame 3 51108 more. The
46273+ /// pre-loop-filter reconstruction already carries the identical first
46274+ /// wrong sample on both, so no filter is involved; in arm B the first
46275+ /// wrong superblock in DECODE order is SBcol2/SBrow0 (first wrong pixel
46276+ /// (128,48) = mi(12,32), whose mode/ref/mv are identical on both sides),
46277+ /// and the arithmetic fork lands on the very next block, mi(13,32), where
46278+ /// the oracle reads ref0 = LAST and we read GOLDEN.
46279+ ///
46280+ /// Non-vacuity, three ways per arm: the pinned bytes (length + FNV-1a);
46281+ /// the decoded chroma planes are full resolution, which is the ss (0,0)
46282+ /// shape claim; and `decode::rect4_inter_own_chroma444_hits()` must be
46283+ /// non-zero AND `inter16_rect4_counters()` must report 1:4 inter strips,
46284+ /// so the corrected route is known to have run rather than the gate
46285+ /// passing on a stream that never reached it.
46286+ #[test]
46287+ fn a_444_lossy_rect4_strip_stream_decodes_pixel_exact_at_odd_and_wide_geometries() {
46288+ const NAME: &str =
46289+ "a_444_lossy_rect4_strip_stream_decodes_pixel_exact_at_odd_and_wide_geometries";
46290+ // (fixture, len, fnv1a64, width, height, strips HORZ_4 + VERT_4)
46291+ const ARMS: [(&str, usize, u64, usize, usize, usize); 2] = [
46292+ (
46293+ "fixtures/444_lossy_rect4_odd_130x122.obu",
46294+ 8945,
46295+ 0x5125_0554_751c_bf12,
46296+ 130,
46297+ 122,
46298+ 28, // measured 8 HORZ_4 + 20 VERT_4
46299+ ),
46300+ (
46301+ "fixtures/444_lossy_rect4_wide_256x128.obu",
46302+ 15239,
46303+ 0xf94a_0218_bb34_4f9e,
46304+ 256,
46305+ 128,
46306+ 76, // measured 60 HORZ_4 + 16 VERT_4
46307+ ),
46308+ ];
46309+ let _guard = lock_gate_counters();
46310+ for (fixture, len, fnv, w, h, min_strips) in ARMS {
46311+ let obu = std::path::PathBuf::from(env!("CARGO_MANIFEST_DIR")).join(fixture);
46312+ let stream = std::fs::read(&obu).unwrap_or_else(|e| {
46313+ panic!(
46314+ "{NAME}: pinned fixture {} is missing ({e}) -- the gate cannot \
46315+ run, which is a failure, not a skip",
46316+ obu.display()
46317+ )
46318+ });
46319+ assert_eq!(stream.len(), len, "{NAME}: {fixture} length moved");
46320+ assert_eq!(fnv1a64(&stream), fnv, "{NAME}: {fixture} bytes moved");
46321+
46322+ // The 1:4-strip counters are process-wide with no reset, so read
46323+ // them as a DELTA: a full-suite run has already put 1:4 strips
46324+ // through the decoder by the time this test starts, and an
46325+ // absolute count would be a non-vacuity assertion that passes on
46326+ // residue from another stream.
46327+ let before_strips = {
46328+ let (h, v, _, _) = crate::decode::inter16_rect4_counters();
46329+ h + v
46330+ };
46331+ crate::decode::reset_rect4_inter_own_chroma444_hits();
46332+ let frames = decode_stream(&stream).unwrap_or_else(|e| {
46333+ panic!("{NAME}: {fixture} no longer decodes cleanly: {e}")
46334+ });
46335+ let own_chroma = crate::decode::rect4_inter_own_chroma444_hits();
46336+ let strips = {
46337+ let (h, v, _, _) = crate::decode::inter16_rect4_counters();
46338+ h + v - before_strips
46339+ };
46340+ assert!(
46341+ strips >= min_strips,
46342+ "{NAME}: {fixture} coded only {strips} 1:4 inter strips \
46343+ (HORZ_4 + VERT_4), expected about {min_strips} -- the stream \
46344+ moved, and the route this gate witnesses may no longer be on it"
46345+ );
46346+ assert!(
46347+ own_chroma > 0,
46348+ "{NAME}: {fixture} ran no 1:4 inter strip over its own chroma \
46349+ extent -- the corrected route never ran (class \
46350+ gate-blind-to-feature)"
46351+ );
46352+ assert_eq!(frames.len(), 4, "{NAME}: {fixture} frame count");
46353+ for (i, f) in frames.iter().enumerate() {
46354+ assert_eq!(
46355+ (f.width, f.height),
46356+ (w, h),
46357+ "{NAME}: {fixture} frame {i} dimensions"
46358+ );
46359+ // At 4:4:4 the chroma planes are full resolution; a decoder
46360+ // that kept the 4:2:0 extent would hand quarter-size chroma
46361+ // planes to the byte compare, which cannot pass. Say it here
46362+ // rather than let the compare stand in for the shape claim.
46363+ assert_eq!(
46364+ f.u.len(),
46365+ w * h,
46366+ "{NAME}: {fixture} frame {i} chroma plane is {} samples; at \
46367+ 4:4:4 it must be full resolution ({w}x{h})",
46368+ f.u.len()
46369+ );
46370+ }
46371+ if aomdec_path().is_file() {
46372+ let (decoded, hidden) = decode_all_frames_vs_oracle(&stream, NAME);
46373+ eprintln!(
46374+ "{NAME}: {fixture} {decoded} decode-order frame(s) \
46375+ ({hidden} hidden) byte-exact vs aomdec, {own_chroma} own-extent \
46376+ 1:4 chroma gather(s), {strips} 1:4 inter strip(s)"
46377+ );
46378+ } else {
46379+ eprintln!("{NAME}: {fixture}: no oracle aomdec, pixel arm skipped");
46380+ }
46381+ }
46382+ }
46383+
46384+ /// lane-av1444edge r3: the FIRST 4:4:4 superres cell in the crate, and
46385+ /// the cell the chroma-format sweep's "4:4:4 superres" row was supposed
46386+ /// to be.
46387+ ///
46388+ /// **Why this gate exists at all.** §6.2 of
46389+ /// `lanes/av1formatsweep.report.md` recorded that cell as DIVERGENT from
46390+ /// frame 2 with a first wrong sample of Y(192,0). It was never a superres
46391+ /// cell: the recipe passed `--superres-mode=1` and no denominator, so
46392+ /// libaom's `get_superres_denom_for_qindex`
46393+ /// (`av1/encoder/superres_scale.c:143`) chose 8, and all four frame
46394+ /// headers of that stream read `use_superres=false denom=8`. Nothing was
46395+ /// ever scaled; it was a plain 4:4:4 lossy cq-20 stream, and its
46396+ /// divergence was the same H1 class as the 130x122 cell beside it (see
46397+ /// `lanes/av1444edge.report.md` §2). That is the trap this gate is built
46398+ /// to make impossible to repeat: it asserts the scaled geometry from the
46399+ /// PARSED HEADERS, so a future flag or heuristic change that silently
46400+ /// unsizes the stream makes the gate red on a header assertion instead of
46401+ /// turning into a differently-shaped exactness claim.
46402+ ///
46403+ /// **This is the only 4:4:4 superres coverage here.** All eight
46404+ /// pre-existing superres gates are 4:2:0, checked rather than assumed:
46405+ /// the two pinned fixtures parse `ss (1,1)` from their own sequence
46406+ /// headers (`superres_kf_cdef_lr_64x64.obu` 8-bit,
46407+ /// `superres_alltools_sb128_320x180.obu` 10-bit) and the six live-aomenc
46408+ /// gates all feed a `yuv420p` / `yuv420p10le` source. So this cell's
46409+ /// claim is scoped honestly: it is the FIRST 4:4:4 superres stream, not
46410+ /// a broadening of an existing family.
46411+ ///
46412+ /// **The recipe** (sha256
46413+ /// `450caa3e31526a8973b9f64d5030a2f11b87bd60fac07aef121cb62af9bf85ff`,
46414+ /// 14808 bytes, 4 frames, `testsrc2 256x128 rate=25` yuv444p):
46415+ /// ```text
46416+ /// ffmpeg -f lavfi -i "testsrc2=size=256x128:rate=25" -frames:v 4 \
46417+ /// -pix_fmt yuv444p -strict -1 -f yuv4mpegpipe - | \
46418+ /// aomenc --codec=av1 --passes=1 --end-usage=q --cq-level=20 --cpu-used=2 \
46419+ /// --threads=1 --row-mt=0 --lag-in-frames=0 --kf-max-dist=100 \
46420+ /// --limit=4 --superres-mode=1 --superres-denominator=12 \
46421+ /// --superres-kf-denominator=12 --obu -o - -
46422+ /// ```
46423+ /// The two denominator flags are the whole point: without them the cell
46424+ /// does not exist. Verified byte-reproducible — re-encoding this recipe
46425+ /// reproduces the pinned 14808 bytes exactly.
46426+ ///
46427+ /// **What the cell exercises.** Coded 171x128 upscaled to 256x128 at
46428+ /// `denom = 12`, so a 4:4:4 chroma plane is upscaled at FULL resolution
46429+ /// (a 4:2:0 stream halves it first, and libaom's `av1_superres_upscale`
46430+ /// takes a different path per chroma format). Measured `superres_hits` 4
46431+ /// and `mc::predict_scaled_hits` 2130 — the upscaler and scaled inter
46432+ /// prediction both run, so the cell is not passing on an unscaled
46433+ /// stream.
46434+ ///
46435+ /// Non-vacuity, four ways: the pinned bytes (length + FNV-1a); the parsed
46436+ /// headers really are `use_superres` at `denom 12` with the SCALED coded
46437+ /// size, and the coded width is re-derived from `UpscaledWidth` and the
46438+ /// denominator rather than only compared to a literal, so a re-pinned
46439+ /// fixture cannot drift past the assertion; both counters are asserted as
46440+ /// DELTAS; and every decode-order frame is compared byte-for-byte
46441+ /// through `decode_all_frames_vs_oracle`, which is what makes the
46442+ /// upscaled width on both sides a real check.
46443+ #[test]
46444+ fn a_444_lossy_superres_stream_decodes_pixel_exact() {
46445+ const NAME: &str = "a_444_lossy_superres_stream_decodes_pixel_exact";
46446+ const FIXTURE: &str = "fixtures/444_lossy_superres_256x128_d12.obu";
46447+ const FIXTURE_LEN: usize = 14808;
46448+ const FIXTURE_FNV: u64 = 0x44e0_d12f_1155_0e09;
46449+ /// Quoted so a re-pin has to be deliberate; the FNV above is what the
46450+ /// gate actually compares, this is what a human reads.
46451+ const FIXTURE_SHA256: &str =
46452+ "450caa3e31526a8973b9f64d5030a2f11b87bd60fac07aef121cb62af9bf85ff";
46453+ const UPSCALED: (usize, usize) = (256, 128);
46454+ const CODED: (usize, usize) = (171, 128);
46455+ const DENOM: u8 = 12;
46456+ const FRAMES: usize = 4;
46457+ let obu = std::path::PathBuf::from(env!("CARGO_MANIFEST_DIR")).join(FIXTURE);
46458+ let stream = std::fs::read(&obu).unwrap_or_else(|e| {
46459+ panic!(
46460+ "{NAME}: pinned fixture {} is missing ({e}) -- the gate cannot run, \
46461+ which is a failure, not a skip",
46462+ obu.display()
46463+ )
46464+ });
46465+ assert_eq!(stream.len(), FIXTURE_LEN, "{NAME}: fixture length moved");
46466+ assert_eq!(fnv1a64(&stream), FIXTURE_FNV, "{NAME}: fixture bytes moved");
46467+
46468+ // --- the header facts the CELL depends on, parsed not assumed ------
46469+ let mut parser = Av1Parser::new();
46470+ let mut pos = 0usize;
46471+ let mut seq = None;
46472+ let mut heads: Vec<FrameHeader> = Vec::new();
46473+ while pos < stream.len() {
46474+ let obu = parser
46475+ .parse_obu(&stream[pos..])
46476+ .unwrap_or_else(|e| panic!("{NAME}: aomenc OBU does not parse: {e:?}"));
46477+ if obu.total_size == 0 {
46478+ break;
46479+ }
46480+ pos += obu.total_size;
46481+ match obu.kind {
46482+ ObuKind::SequenceHeader(s) => seq = Some(s),
46483+ ObuKind::FrameHeader(h) => heads.push(*h),
46484+ ObuKind::Frame(h, _) => heads.push(*h),
46485+ _ => {}
46486+ }
46487+ }
46488+ let seq = seq.unwrap_or_else(|| panic!("{NAME}: the stream carries no sequence header"));
46489+ assert_eq!(
46490+ (
46491+ seq.color_config.subsampling_x,
46492+ seq.color_config.subsampling_y
46493+ ),
46494+ (0, 0),
46495+ "{NAME}: the stream is not 4:4:4 (ss = ({}, {}))",
46496+ seq.color_config.subsampling_x,
46497+ seq.color_config.subsampling_y
46498+ );
46499+ assert_eq!(
46500+ seq.color_config.bit_depth, 8,
46501+ "{NAME}: not the 8-bit cell this gate names"
46502+ );
46503+ assert!(
46504+ seq.enable_superres,
46505+ "{NAME}: the sequence header does not enable superres at all"
46506+ );
46507+ assert_eq!(
46508+ heads.len(),
46509+ FRAMES,
46510+ "{NAME}: {} frame headers, expected {FRAMES}",
46511+ heads.len()
46512+ );
46513+ for (i, h) in heads.iter().enumerate() {
46514+ // The assertion the phantom cell failed. Without the denominator
46515+ // flags aomenc picks 8 and this is false while the stream still
46516+ // decodes, which is how a whole sweep cell ends up mislabelled.
46517+ assert!(
46518+ h.use_superres,
46519+ "{NAME}: frame {i} has use_superres = false -- this is an UNSCALED \
46520+ stream and the gate would be measuring something other than the \
46521+ cell it names (class gate-blind-to-feature)"
46522+ );
46523+ assert_eq!(
46524+ h.superres_denom, DENOM,
46525+ "{NAME}: frame {i} denominator moved from {DENOM}"
46526+ );
46527+ assert_eq!(
46528+ (h.upscaled_width as usize, h.frame_height as usize),
46529+ (UPSCALED.0, UPSCALED.1),
46530+ "{NAME}: frame {i} upscaled size moved"
46531+ );
46532+ assert_eq!(
46533+ (h.frame_width as usize, h.frame_height as usize),
46534+ (CODED.0, CODED.1),
46535+ "{NAME}: frame {i} CODED size moved -- this is the scaled half of \
46536+ the cell and the part an unsized stream gets wrong"
46537+ );
46538+ // Re-derive rather than only compare literals, so a re-pinned
46539+ // fixture cannot satisfy the numbers above while the scaled-size
46540+ // arithmetic has moved under them.
46541+ assert_eq!(
46542+ (h.upscaled_width * 8 + u32::from(DENOM) / 2) / u32::from(DENOM),
46543+ h.frame_width,
46544+ "{NAME}: frame {i}: FrameWidth is not (UpscaledWidth*8 + denom/2)/denom -- \
46545+ the scaled size the cell rests on is not the spec's"
46546+ );
46547+ }
46548+
46549+ // --- the pixels -----------------------------------------------------
46550+ let _guard = lock_gate_counters();
46551+ let before_sr = crate::superres::superres_hits();
46552+ let before_scaled = crate::mc::predict_scaled_hits();
46553+ let frames = decode_stream(&stream).unwrap_or_else(|e| {
46554+ panic!("{NAME}: the pinned 4:4:4 superres stream was refused: {e}")
46555+ });
46556+ let scaled_up = crate::superres::superres_hits() - before_sr;
46557+ let scaled_mc = crate::mc::predict_scaled_hits() - before_scaled;
46558+ assert!(
46559+ scaled_up > 0,
46560+ "{NAME}: zero superres_hits -- the upscaler never ran (class \
46561+ gate-blind-to-feature)"
46562+ );
46563+ assert!(
46564+ scaled_mc > 0,
46565+ "{NAME}: zero predict_scaled_hits -- no inter block read a scaled reference, \
46566+ so the scaled-PREDICTION half of the cell is unexercised (class \
46567+ gate-blind-to-feature)"
46568+ );
46569+ assert_eq!(frames.len(), FRAMES, "{NAME}: decoded frame count");
46570+ for (i, f) in frames.iter().enumerate() {
46571+ // The upscale must have REPLACED the frame: a decoder that
46572+ // returned the 171-wide coded picture fails here, and without
46573+ // this check the chroma-shape assertion below could be satisfied
46574+ // by quarter-size planes.
46575+ assert_eq!(
46576+ (f.width, f.height),
46577+ UPSCALED,
46578+ "{NAME}: frame {i} came back {}x{}, not the UPSCALED {}x{}",
46579+ f.width,
46580+ f.height,
46581+ UPSCALED.0,
46582+ UPSCALED.1
46583+ );
46584+ assert_eq!(
46585+ f.u.len(),
46586+ UPSCALED.0 * UPSCALED.1,
46587+ "{NAME}: frame {i} chroma plane is {} samples; at 4:4:4 upscaled it must \
46588+ be full resolution ({}x{})",
46589+ f.u.len(),
46590+ UPSCALED.0,
46591+ UPSCALED.1
46592+ );
46593+ assert_eq!(
46594+ f.v.len(),
46595+ UPSCALED.0 * UPSCALED.1,
46596+ "{NAME}: frame {i} V plane is {} samples, expected full resolution",
46597+ f.v.len()
46598+ );
46599+ }
46600+ if aomdec_path().is_file() {
46601+ let (decoded, hidden) = decode_all_frames_vs_oracle(&stream, NAME);
46602+ eprintln!(
46603+ "{NAME}: {decoded} decode-order frame(s) ({hidden} hidden) byte-exact vs \
46604+ aomdec at {UPSCALED:?} upscaled from {CODED:?} denom {DENOM}, \
46605+ {scaled_up} upscale(s), {scaled_mc} scaled MC block(s); fixture sha256 \
46606+ {FIXTURE_SHA256}"
46607+ );
46608+ } else {
46609+ eprintln!("{NAME}: no oracle aomdec, pixel arm skipped");
46610+ }
46611+ }
46612+
46613+ /// Shared body for the lane-av1superpin 4:4:4 superres arms. It is the
46614+ /// body of [`a_444_lossy_superres_stream_decodes_pixel_exact`] with the
46615+ /// single `(denominator, coded_width)` constant generalised to a PER-FRAME
46616+ /// table, which is what the mode-2 cell needs: libaom picks a different
46617+ /// denominator for each frame there, so a single constant would either
46618+ /// describe frame 0 only or be a literal the arithmetic below could not
46619+ /// hold.
46620+ ///
46621+ /// Everything that makes the den=12 cell non-vacuous is here, unchanged:
46622+ /// the pinned bytes (length + FNV-1a), 4:4:4 / 8-bit / superres-enabled
46623+ /// from the sequence header, `use_superres` on every parsed frame header,
46624+ /// the per-frame parsed denominator and coded size, and the coded width
46625+ /// RE-DERIVED as `(UpscaledWidth*8 + denom/2)/denom` from that frame's OWN
46626+ /// parsed denominator rather than compared to a literal alone -- so a
46627+ /// re-pinned fixture cannot satisfy the literals while the scaled-size
46628+ /// arithmetic moves under them. Then `superres_hits` and
46629+ /// `predict_scaled_hits` as DELTAS (both counters are process-wide with no
46630+ /// reset, so absolute values would pass on residue from another stream),
46631+ /// the returned frames at the UPSCALED width with full-resolution 4:4:4
46632+ /// chroma planes, and every decode-order frame byte-exact against the
46633+ /// instrumented aomdec.
46634+ #[allow(clippy::too_many_arguments)]
46635+ fn a_444_superres_arm(
46636+ name: &str,
46637+ fixture: &str,
46638+ fixture_len: usize,
46639+ fixture_fnv: u64,
46640+ fixture_sha: &str,
46641+ upscaled: (usize, usize),
46642+ // `(denominator, coded_width)` per DECODE-ORDER frame.
46643+ per_frame: &[(u8, usize)],
46644+ ) -> Vec<ec_av1_syntax::FrameHeader> {
46645+ let obu = std::path::PathBuf::from(env!("CARGO_MANIFEST_DIR")).join(fixture);
46646+ let stream = std::fs::read(&obu).unwrap_or_else(|e| {
46647+ panic!(
46648+ "{name}: pinned fixture {} is missing ({e}) -- the gate cannot run, \
46649+ which is a failure, not a skip",
46650+ obu.display()
46651+ )
46652+ });
46653+ assert_eq!(stream.len(), fixture_len, "{name}: fixture length moved");
46654+ assert_eq!(fnv1a64(&stream), fixture_fnv, "{name}: fixture bytes moved");
46655+
46656+ // --- the header facts the CELL depends on, parsed not assumed ------
46657+ let mut parser = Av1Parser::new();
46658+ let mut pos = 0usize;
46659+ let mut seq = None;
46660+ let mut heads: Vec<FrameHeader> = Vec::new();
46661+ while pos < stream.len() {
46662+ let obu = parser
46663+ .parse_obu(&stream[pos..])
46664+ .unwrap_or_else(|e| panic!("{name}: aomenc OBU does not parse: {e:?}"));
46665+ if obu.total_size == 0 {
46666+ break;
46667+ }
46668+ pos += obu.total_size;
46669+ match obu.kind {
46670+ ObuKind::SequenceHeader(s) => seq = Some(s),
46671+ ObuKind::FrameHeader(h) => heads.push(*h),
46672+ ObuKind::Frame(h, _) => heads.push(*h),
46673+ _ => {}
46674+ }
46675+ }
46676+ let seq = seq.unwrap_or_else(|| panic!("{name}: the stream carries no sequence header"));
46677+ assert_eq!(
46678+ (
46679+ seq.color_config.subsampling_x,
46680+ seq.color_config.subsampling_y
46681+ ),
46682+ (0, 0),
46683+ "{name}: the stream is not 4:4:4 (ss = ({}, {}))",
46684+ seq.color_config.subsampling_x,
46685+ seq.color_config.subsampling_y
46686+ );
46687+ assert_eq!(
46688+ seq.color_config.bit_depth, 8,
46689+ "{name}: not the 8-bit cell this gate names"
46690+ );
46691+ assert!(
46692+ seq.enable_superres,
46693+ "{name}: the sequence header does not enable superres at all"
46694+ );
46695+ assert_eq!(
46696+ heads.len(),
46697+ per_frame.len(),
46698+ "{name}: {} frame headers, expected {}",
46699+ heads.len(),
46700+ per_frame.len()
46701+ );
46702+ for (i, (h, (denom, coded))) in heads.iter().zip(per_frame).enumerate() {
46703+ // The assertion the phantom cell failed. Without a denominator
46704+ // flag aomenc picks 8 and this is false while the stream still
46705+ // decodes, which is how a whole sweep cell ends up mislabelled.
46706+ assert!(
46707+ h.use_superres,
46708+ "{name}: frame {i} has use_superres = false -- this is an UNSCALED \
46709+ stream and the gate would be measuring something other than the \
46710+ cell it names (class gate-blind-to-feature)"
46711+ );
46712+ assert_eq!(
46713+ h.superres_denom, *denom,
46714+ "{name}: frame {i} PARSED denominator moved from {denom} -- read the \
46715+ header, never the encoder flag (mode 2 chooses its own)"
46716+ );
46717+ assert_eq!(
46718+ (h.upscaled_width as usize, h.frame_height as usize),
46719+ upscaled,
46720+ "{name}: frame {i} upscaled size moved"
46721+ );
46722+ assert_eq!(
46723+ (h.frame_width as usize, h.frame_height as usize),
46724+ (*coded, upscaled.1),
46725+ "{name}: frame {i} CODED size moved -- this is the scaled half of \
46726+ the cell and the part an unsized stream gets wrong"
46727+ );
46728+ // Re-derive rather than only compare literals, so a re-pinned
46729+ // fixture cannot satisfy the numbers above while the scaled-size
46730+ // arithmetic has moved under them. The denominator here is the
46731+ // one PARSED out of this frame, so the check cannot be satisfied by
46732+ // a literal that merely happens to agree.
46733+ let d = u32::from(*denom);
46734+ assert_eq!(
46735+ (h.upscaled_width * 8 + d / 2) / d,
46736+ h.frame_width,
46737+ "{name}: frame {i}: FrameWidth is not (UpscaledWidth*8 + denom/2)/denom -- \
46738+ the scaled size the cell rests on is not the spec's"
46739+ );
46740+ }
46741+
46742+ // --- the pixels -----------------------------------------------------
46743+ let _guard = lock_gate_counters();
46744+ let before_sr = crate::superres::superres_hits();
46745+ let before_scaled = crate::mc::predict_scaled_hits();
46746+ let frames = decode_stream(&stream)
46747+ .unwrap_or_else(|e| panic!("{name}: the pinned 4:4:4 superres stream was refused: {e}"));
46748+ let scaled_up = crate::superres::superres_hits() - before_sr;
46749+ let scaled_mc = crate::mc::predict_scaled_hits() - before_scaled;
46750+ assert!(
46751+ scaled_up > 0,
46752+ "{name}: zero superres_hits -- the upscaler never ran (class \
46753+ gate-blind-to-feature)"
46754+ );
46755+ assert!(
46756+ scaled_mc > 0,
46757+ "{name}: zero predict_scaled_hits -- no inter block read a scaled reference, \
46758+ so the scaled-PREDICTION half of the cell is unexercised (class \
46759+ gate-blind-to-feature)"
46760+ );
46761+ assert_eq!(frames.len(), per_frame.len(), "{name}: decoded frame count");
46762+ for (i, f) in frames.iter().enumerate() {
46763+ // The upscale must have REPLACED the frame: a decoder that returned
46764+ // the coded-width picture fails here, and without this check the
46765+ // chroma-shape assertion below could be satisfied by coded-size
46766+ // planes.
46767+ assert_eq!(
46768+ (f.width, f.height),
46769+ upscaled,
46770+ "{name}: frame {i} came back {}x{}, not the UPSCALED {}x{}",
46771+ f.width,
46772+ f.height,
46773+ upscaled.0,
46774+ upscaled.1
46775+ );
46776+ for (plane, len) in [("U", f.u.len()), ("V", f.v.len())] {
46777+ assert_eq!(
46778+ len,
46779+ upscaled.0 * upscaled.1,
46780+ "{name}: frame {i} {plane} plane is {len} samples; at 4:4:4 upscaled it \
46781+ must be full resolution ({}x{})",
46782+ upscaled.0,
46783+ upscaled.1
46784+ );
46785+ }
46786+ }
46787+ if aomdec_path().is_file() {
46788+ let (decoded, hidden) = decode_all_frames_vs_oracle(&stream, name);
46789+ eprintln!(
46790+ "{name}: {decoded} decode-order frame(s) ({hidden} hidden) byte-exact vs \
46791+ aomdec at {upscaled:?} upscaled from {per_frame:?} (denominator, coded \
46792+ width) per frame, {scaled_up} upscale(s), {scaled_mc} scaled MC block(s); \
46793+ fixture sha256 {fixture_sha}"
46794+ );
46795+ } else {
46796+ eprintln!("{name}: no oracle aomdec, pixel arm skipped");
46797+ }
46798+ heads
46799+ }
46800+
46801+ /// lane-av1superpin (a): `--superres-mode=1 --superres-denominator=9`, the
46802+ /// WIDEST frame-edge margin this 256x128 geometry allows -- coded 228x128
46803+ /// upscaled to 256x128, `denom = 9`, on all four frames.
46804+ ///
46805+ /// **Why 9 and not 12.** The den=12 cell beside it (coded 171x128) is the
46806+ /// one the chroma-format sweep's matrix row ended up pointing at, and
46807+ /// denom 16 (coded 128x128) is the degenerate one where the coded width
46808+ /// equals the superblock grid exactly. Nine is the largest denominator
46809+ /// libaom's own `SUPERRES_NUM` ladder accepts here and still scales, and
46810+ /// it is the member that leaves the most coded samples at the frame's
46811+ /// right edge: `228 * 8 / 256` of the frame is a 28-column upscale margin,
46812+ /// against 12's 85 columns. A wide margin is where a round-trip is most
46813+ /// likely to read past the coded picture, so it is the member worth
46814+ /// pinning next to the den=12 one.
46815+ ///
46816+ /// **The recipe** (sha256
46817+ /// `3d619ee0fda3d9bb9cf8ff0541ba00ea5d83ae38cd8eec1322f8dbbbe6a5ec96`,
46818+ /// 17437 bytes, 4 frames, `testsrc2 256x128 rate=25` yuv444p):
46819+ /// ```text
46820+ /// ffmpeg -f lavfi -i "testsrc2=size=256x128:rate=25" -frames:v 4 \
46821+ /// -pix_fmt yuv444p -strict -1 -f yuv4mpegpipe - | \
46822+ /// aomenc --codec=av1 --passes=1 --end-usage=q --cq-level=20 --cpu-used=2 \
46823+ /// --threads=1 --row-mt=0 --lag-in-frames=0 --kf-max-dist=100 \
46824+ /// --limit=4 --superres-mode=1 --superres-denominator=9 \
46825+ /// --superres-kf-denominator=9 --obu -o - -
46826+ /// ```
46827+ /// Byte-reproducible: re-encoding this recipe reproduces the pinned 17437
46828+ /// bytes exactly, and the PARSED headers of that re-encode were read
46829+ /// (`frame=228x128 upscaled=256 use_superres=true denom=9` on all four) --
46830+ /// which is where the numbers below come from, not from the flags.
46831+ #[test]
46832+ fn a_444_lossy_superres_mode1_den9_stream_decodes_pixel_exact() {
46833+ a_444_superres_arm(
46834+ "a_444_lossy_superres_mode1_den9_stream_decodes_pixel_exact",
46835+ "fixtures/444_lossy_superres_256x128_d9.obu",
46836+ 17437,
46837+ 0x1ff2_fb84_528f_aa05,
46838+ "3d619ee0fda3d9bb9cf8ff0541ba00ea5d83ae38cd8eec1322f8dbbbe6a5ec96",
46839+ (256, 128),
46840+ &[(9, 228); 4],
46841+ );
46842+ }
46843+
46844+ /// lane-av1superpin (b): `--superres-mode=2` (random denominator), coded
46845+ /// 186x128 on the first frame and a DIFFERENT denominator on each frame
46846+ /// after it.
46847+ ///
46848+ /// **This is the cell that makes the flag-vs-header distinction
46849+ /// unavoidable.** Measured on the pinned bytes by parsing every frame
46850+ /// header, `--superres-mode=2` does not honour `--superres-denominator`
46851+ /// at all -- encoding the recipe four times (no denominator, then 9, 12,
46852+ /// 16) produced ONE stream, sha256
46853+ /// `c18496cf3b7db0feca9aa904024cec2115be80b5b94f87c848ac52f9b32ffd97`
46854+ /// (16620 bytes), byte-identical every time -- and the parsed headers of
46855+ /// that stream are:
46856+ ///
46857+ /// ```text
46858+ /// FH0 frame=186x128 upscaled=256 use_superres=true denom=11
46859+ /// FH1 frame=146x128 upscaled=256 use_superres=true denom=14
46860+ /// FH2 frame=137x128 upscaled=256 use_superres=true denom=15
46861+ /// FH3 frame=228x128 upscaled=256 use_superres=true denom=9
46862+ /// ```
46863+ ///
46864+ /// So a gate written against this cell that read the flag instead of the
46865+ /// header would assert `denom == 9` (or 12, or 16) and be wrong on three
46866+ /// of four frames -- or, worse, pass while printing numbers the stream does
46867+ /// not carry. Three of the four parsed denominators (11, 14, 15) are values
46868+ /// no flag on the command line ever named, which is the property the arm
46869+ /// below asserts directly.
46870+ ///
46871+ /// **Why it is worth a gate of its own** beyond the flag-ignoring point:
46872+ /// the den=12 and den=9 cells both scale every frame at one denominator,
46873+ /// so `av1_superres_upscale` is only ever handed one coded-to-upscaled
46874+ /// ratio. This stream hands it four (256->186, 256->146, 256->137,
46875+ /// 256->228) in one decode, and libaom's upscaler picks its filter taps
46876+ /// from `denom` per frame. That is the case a single-denominator gate
46877+ /// cannot reach.
46878+ ///
46879+ /// **The recipe**:
46880+ /// ```text
46881+ /// ffmpeg -f lavfi -i "testsrc2=size=256x128:rate=25" -frames:v 4 \
46882+ /// -pix_fmt yuv444p -strict -1 -f yuv4mpegpipe - | \
46883+ /// aomenc --codec=av1 --passes=1 --end-usage=q --cq-level=20 --cpu-used=2 \
46884+ /// --threads=1 --row-mt=0 --lag-in-frames=0 --kf-max-dist=100 \
46885+ /// --limit=4 --superres-mode=2 --obu -o - -
46886+ /// ```
46887+ #[test]
46888+ fn a_444_lossy_superres_mode2_random_denom_stream_decodes_pixel_exact() {
46889+ const NAME: &str = "a_444_lossy_superres_mode2_random_denom_stream_decodes_pixel_exact";
46890+ let heads = a_444_superres_arm(
46891+ NAME,
46892+ "fixtures/444_lossy_superres_mode2_256x128.obu",
46893+ 16620,
46894+ 0x8cbb_36b2_5e0f_07ab,
46895+ "c18496cf3b7db0feca9aa904024cec2115be80b5b94f87c848ac52f9b32ffd97",
46896+ (256, 128),
46897+ &[(11, 186), (14, 146), (15, 137), (9, 228)],
46898+ );
46899+
46900+ // The flag-ignoring arm. Every denominator libaom accepted on the
46901+ // command line, plus the recipe's own "no denominator at all", must
46902+ // land on the SAME bytes as the pinned fixture. If a future libaom
46903+ // starts honouring the flag under mode 2 this goes red -- and that is
46904+ // the point: the gate above is pinned to parsed denominators, so the
46905+ // day the flag starts mattering the pin has to be re-derived from the
46906+ // stream, not from the recipe.
46907+ if !have_ffmpeg() || !have_aomenc() {
46908+ eprintln!("{NAME}: flag-ignoring arm skipped (no ffmpeg/aomenc)");
46909+ return;
46910+ }
46911+ let y4m = Command::new("ffmpeg")
46912+ .args([
46913+ "-v", "error", "-f", "lavfi", "-i", "testsrc2=size=256x128:rate=25",
46914+ "-frames:v", "4", "-pix_fmt", "yuv444p", "-strict", "-1", "-f",
46915+ "yuv4mpegpipe", "-",
46916+ ])
46917+ .stdin(Stdio::null())
46918+ .stdout(Stdio::piped())
46919+ .stderr(Stdio::piped())
46920+ .output()
46921+ .expect("ffmpeg failed to run");
46922+ assert!(
46923+ y4m.status.success(),
46924+ "{NAME}: ffmpeg refused to generate the y4m source: {}",
46925+ String::from_utf8_lossy(&y4m.stderr)
46926+ );
46927+ let pinned =
46928+ std::fs::read(std::path::PathBuf::from(env!("CARGO_MANIFEST_DIR"))
46929+ .join("fixtures/444_lossy_superres_mode2_256x128.obu"))
46930+ .expect("pinned fixture disappeared between the two reads");
46931+ for extra in [
46932+ vec![],
46933+ vec!["--superres-denominator=9"],
46934+ vec!["--superres-denominator=12"],
46935+ vec!["--superres-denominator=16"],
46936+ ] {
46937+ let mut args: Vec<&str> = vec![
46938+ "--codec=av1",
46939+ "--passes=1",
46940+ "--end-usage=q",
46941+ "--cq-level=20",
46942+ "--cpu-used=2",
46943+ "--threads=1",
46944+ "--row-mt=0",
46945+ "--lag-in-frames=0",
46946+ "--kf-max-dist=100",
46947+ "--limit=4",
46948+ "--superres-mode=2",
46949+ ];
46950+ args.extend(extra.iter().copied());
46951+ args.extend(["--obu", "-o", "-", "-"]);
46952+ let out = run_with_stdin(Command::new(aomenc_path()).args(&args), &y4m.stdout);
46953+ assert!(
46954+ out.status.success(),
46955+ "{NAME}: aomenc refused the recipe with {extra:?}: {}",
46956+ String::from_utf8_lossy(&out.stderr)
46957+ );
46958+ assert_eq!(
46959+ out.stdout.len(),
46960+ pinned.len(),
46961+ "{NAME}: --superres-mode=2 {extra:?} produced {} bytes, pinned is {} -- \
46962+ mode 2 now honours --superres-denominator (or stopped scaling), and this \
46963+ gate's per-frame denominators are pinned to the PARSED headers, not to \
46964+ the recipe",
46965+ out.stdout.len(),
46966+ pinned.len()
46967+ );
46968+ assert_eq!(
46969+ fnv1a64(&out.stdout),
46970+ fnv1a64(&pinned),
46971+ "{NAME}: --superres-mode=2 {extra:?} does NOT reproduce the pinned bytes"
46972+ );
46973+ }
46974+ // And the denominators the stream carries must include values no flag
46975+ // on the command line ever named -- the property that makes "read the
46976+ // parsed header" the only correct source for the table above.
46977+ let flagged = [9u8, 12, 16];
46978+ assert!(
46979+ heads
46980+ .iter()
46981+ .any(|h| h.superres_denom > 0 && !flagged.contains(&h.superres_denom)),
46982+ "{NAME}: every parsed denominator is one of the flags {flagged:?} -- if libaom \
46983+ ever starts honouring --superres-denominator under mode 2 this cell stops being \
46984+ the flag-ignoring one and the pin has to be re-derived"
46985+ );
46986+ eprintln!(
46987+ "{NAME}: --superres-mode=2 with no/9/12/16 denominator flags all reproduce the \
46988+ pinned {} bytes; parsed denominators {:?} (flag values {flagged:?} ignored)",
46989+ pinned.len(),
46990+ heads.iter().map(|h| h.superres_denom).collect::<Vec<_>>()
46991+ );
46992+ }
46241 }46993 }
lanes/av1444edge.report.mdadded+608 -0
@@ -0,0 +1,608 @@
1+# lane-av1444edge — the two 4:4:4 cells the chroma-format sweep handed over
2+
3+**Base** `4155c7c7`. **Branch** three commits on top of it, in this order:
4+
5+| commit | what | owner |
6+|---|---|---|
7+| `dc35d607` | the inter-frame pre-filter rung (`EC_AV1_PREFILT_WIDE_DUMP`) did not exist, and its counter restarted — **measurement only, no decode-path edit, merges independently of everything else here** | this lane |
8+| `e10a3b25` | cherry-pick `-x` of `f92776ba`, lane-av1444rect's H1 fix — **not mine**; see §5 | Agent04-2 |
9+| `a9e5034e` | the gate + the two pinned fixtures | this lane |
10+
11+Both cells the sweep handed over are **one class, and the fix already
12+existed on another lane's branch**. The work here is the discriminator
13+run the sweep said it did not have, plus the rung defect that made the
14+discriminator run necessary, plus the matrix correction in §6.
15+
16+---
17+
18+## 1. The two cells, pinned
19+
20+Both are the sweep's own §6.2 recipes, byte-reproduced. The truncated
21+sha256 prefixes the sweep recorded (`c87ac65b…`, `06621606…`) both
22+match, so these are the same bytes it measured.
23+
24+| cell | fixture | bytes | sha256 |
25+|---|---|---|---|
26+| 4:4:4 odd coded dims 130x122 | `fixtures/444_lossy_rect4_odd_130x122.obu` | 8945 | `c87ac65b77579afd2938669b0cbe3ec44c3abf775c0223cacb9d14b8c2eee27c` |
27+| "4:4:4 superres" 256x128 | `fixtures/444_lossy_rect4_wide_256x128.obu` | 15239 | `06621606c11ae805f784a1c9736db6301a925a4fa3154e2fc38db1df7ad9b826` |
28+
29+Recipe (both arms; `W`/`H` = 130/122 and 256/128):
30+
31+```text
32+ffmpeg -f lavfi -i "testsrc2=size=<W>x<H>:rate=25" -frames:v 4 \
33+ -pix_fmt yuv444p -strict -1 -f yuv4mpegpipe - | \
34+aomenc --codec=av1 --passes=1 --end-usage=q --cq-level=20 --cpu-used=2 \
35+ --threads=1 --row-mt=0 --lag-in-frames=0 --kf-max-dist=100 \
36+ --limit=4 --obu -o - -
37+```
38+
39+`rate=25` is load-bearing (`testsrc2`'s pattern is time-parameterised).
40+Both streams: 4 decode-order frames, 0 hidden, single tile, ss (0,0),
41+8-bit, profile 1, `use_superres=false` on all four frames (see §6).
42+
43+Measured against the instrumented aomdec (`EC_AV1_FINAL_DUMP`, decode
44+order), asserting equal frame COUNTS and equal per-frame byte LENGTHS
45+before any sample is read:
46+
47+| | 130x122 | 256x128 |
48+|---|---|---|
49+| base `4155c7c7` | frames 0-2 **EXACT**, frame 3 11521 samples, first (f3, s2208) = **Y(128,16)** ours 134 / oracle 170 | frames 0-1 **EXACT**, frame 2 25296 first **Y(192,0)** ours 92 / oracle 106, frame 3 51108 first Y(0,0) |
50+
51+Both numbers are the sweep's, exactly.
52+
53+---
54+
55+## 2. The class, and how it was separated from the other candidate
56+
57+Two candidate fixes were on the table and the two cells are evidence for
58+exactly one of them.
59+
60+| arm (each `git reset --hard 4155c7c7` + a verified rebuild) | 130x122 | 256x128 |
61+|---|---|---|
62+| base | DIVERGENT f3 11521 | DIVERGENT f2 25296 + f3 51108 |
63+| base + rung + `4e151813` | DIVERGENT f3 11521 — **byte-identical to base** | DIVERGENT f2 25296 + f3 51108 — **byte-identical** |
64+| base + rung + `f92776ba` | **EXACT 4/4** | **EXACT 4/4** |
65+| base + rung + both | EXACT 4/4 | EXACT 4/4 |
66+
67+**The class is H1, `f92776ba` (lane-av1444rect).** `4e151813` is inert
68+here, and the code says why rather than leaving it to the numbers: it
69+patches only the two `tu_reach` call sites in `decode_rect4_16_strip`,
70+and both sit inside that function's `if lossless_pair {` arm. The lossy
71+path is the `} else if skip {` at `decode.rs:17579`. These two cells are
72+4:4:4 **lossy** cq-20, so they are structurally out of its reach.
73+
74+**Class statement.** `decode_inter_block`'s `around_c` gathered a 1:4
75+(HORZ_4 / VERT_4) inter strip's chroma coefficient context at the 4:2:0
76+PAIR extent — `(16, 8)` HORZ / `(8, 16)` VERT — with no `ss` gate. At
77+4:4:4 `is_chroma_reference` (`av1_common_int.h:1454`) reduces both parity
78+clauses to `!subsampling_y` / `!subsampling_x`, so every block is its own
79+chroma reference and no pair exists: the strip codes its own 16x4 chroma
80+over its own context. The gather read one extra luma mi row of LEFT
81+chroma context, the U unit's `get_txb_ctx` saw a neighbour libaom does
82+not have, and the arithmetic coder forked.
83+
84+What the two new geometries add over the existing H1 gate (128x96): a
85+partial-frame right edge (130x122 — neither dimension a multiple of 8,
86+and the sweep's own odd-dimension gate is 4:2:0 only, so the 4:4:4
87+partial-column walk had no exactness evidence anywhere), and 256x128 with
88+CDEF and loop restoration both live on the last two frames. 66x66 is
89+EXACT at the same settings, which is what made the sweep call the
90+partial-frame walk "right at one odd geometry and wrong at another" — it
91+is not the geometry, it is whether the stream codes a 1:4 inter strip.
92+
93+### 2a. A retraction inside this lane
94+
95+An earlier version of the table above said `4e151813` alone was
96+sufficient. **It was not, and the arm never ran.** The tree was reset
97+with `git checkout -- <files>`, which restores from the INDEX — and after
98+`git cherry-pick -n` the index still held the second pick, so the arm
99+re-measured the both-commits tree, and cargo saw byte-identical sources
100+so it did not even relink. The wrong table was sent to two peers, one of
101+whom had already written it into their report; both were told within the
102+hour and the retracted version is recorded in their report as retracted.
103+The table above is the re-run. Kept here because the failure is the
104+lesson: **the dangerous measurement is the one that returns a number.**
105+Two agents hit the same class independently the same session (mine via a
106+stale index, Agent13-2's via a "fix" worktree that was itself a merge of
107+two commits).
108+
109+---
110+
111+## 3. Localizing, because the discriminator is the reusable part
112+
113+**The pre-loop-filter reconstruction already diverges at the identical
114+first sample as the final output**, on both cells (130x122 frame 3 at
115+Y(128,16); 256x128 frame 2 at Y(192,0)). No filter is involved, so the
116+deblock/CDEF/LR ladder is not where this lives — and that verdict was
117+only reachable because of the rung fix in §4. Before it, the nearest
118+usable rungs were unreadable: `EC_AV1_POSTDEBLOCK_DUMP` /
119+`EC_AV1_POSTCDEF_DUMP` came out 61440 B against the oracle's 52224 B
120+(our 160x128 padded surface vs its 136x128 aligned buffer), and the
121+oracle's POSTDEBLOCK wrote 3 files for a 4-frame stream.
122+
123+**Order the wrong superblocks by DECODE order, not raster.** Raster order
124+puts the first wrong sample at Y(192,0) (SBcol3/SBrow0). Decode order
125+puts it in **SBcol2/SBrow0**, first wrong pixel **(128,48) = mi(12,32)**,
126+with **zero** wrong pixels in any superblock decoded before it.
127+
128+**And the block at mi(12,32) has IDENTICAL mode, ref0 and mv0 on both
129+sides.** The `EC_MODE` ladder (compared per decode-order frame, ours
130+split by `EC_PICT`, the oracle's by `aomdec --limit`) agrees through its
131+first 175 entries of frame 2 and then forks on the very next block,
132+mi(13,32):
133+
134+```text
135+AOM mi_row=12 mi_col=32 mode=13 ref0=1 mv0=(-32,0) stack=1
136+OUR mi_row=12 mi_col=32 mode=13 ref0=1 mv0=(-32,0) stack=1 <- same
137+AOM mi_row=13 mi_col=32 mode=13 ref0=1 mv0=(-32,0) stack=2
138+OUR mi_row=13 mi_col=32 mode=13 ref0=4 mv0=(-32,0) stack=2 <- ref0 LAST vs GOLDEN
139+```
140+
141+After the fork the ladder is garbage: 226 entries against the oracle's
142+299 in frame 2, 40 against 361 in frame 3.
143+
144+**A wrong pixel cannot cause a mode fork.** Mode context is built from
145+mode info, not from reconstructed samples. So one bsize/footprint error
146+has to feed both symptoms, and it is upstream of the pixels rather than a
147+consequence of them. That argument is what rules out "the reconstruction
148+diverged, therefore the chroma context followed".
149+
150+**What the ladder could not have told me:** `EC_MODE`'s print carries no
151+`bsize`, so a partition or block-size fork is invisible to it by
152+construction. Nor is its `rng` field a cross-decoder invariant here
153+(libaom's 16-bit `ec.rng` against a 15-bit `log2` range) — only the
154+semantic fields compare. The oracle's `EC_PART` rung prints 4x4 mi while
155+ours prints 16x16-PIXEL units at the sub-node levels, so positions do not
156+compare either; the read-VALUE sequences do, and over the key frames they
157+agree. Our `EC_PART` rung is also key-frame-path only, so it says nothing
158+about these inter frames at all.
159+
160+---
161+
162+## 4. The rung fix (`dc35d607`, measurement only)
163+
164+`EC_AV1_PREFILT_WIDE_DUMP` is the only rung that writes the
165+pre-loop-filter reconstruction cropped to each plane's mi-ALIGNED extent
166+— the shape aomdec's rung 7 writes (`y_width`/`y_height`) — so it is the
167+rung that separates "already wrong in reconstruction" from "introduced by
168+a loop filter". Two defects, both reporting success:
169+
170+1. **It was inlined in the key-frame tile path only.** The inter-frame
171+ path had no wide prefilter dump at all.
172+2. **Its counter was a function-local `static IDX2`.** Rust gives each
173+ monomorphisation its own copy, so the index restarted and every frame
174+ after the first overwrote `.f0` — a per-frame bisection silently
175+ compared the LAST decoded frame and reported it as frame 0. Measured
176+ directly: before the change the rung wrote exactly one file for a
177+ four-frame stream.
178+
179+Now: a shared `dump_prefilter_wide` called from both tile paths, beside
180+each path's existing padded `EC_AV1_PREFILT_DUMP` so the two agree on the
181+point they sample, indexed by the process-global per-var `dump_stage_idx`
182+map. After the change both cells produce 4 files at exactly the oracle's
183+byte count. No decode-path behaviour changes: every write stays inside the
184+existing `if let Ok(path) = crate::envflags::var(...)` arm, which is off
185+unless the env var is set.
186+
187+Agent04-2 has flagged this to Main as standalone and mergeable
188+independently. It should not wait on the rest of this lane.
189+
190+---
191+
192+## 5. Ownership — this is a handback, not a new fix
193+
194+The fix is `f92776ba`, cherry-picked here with `-x` so the merge is
195+idempotent and the branch is green. **Agent04-2 owns it.** What this lane
196+contributes beyond the cherry-pick:
197+
198+- the discriminator run the sweep said it did not have, and the ablation
199+ that separates H1 from the other candidate;
200+- two geometries H1 did not cover, with red-before on both, so the class
201+ is no longer a single-geometry claim;
202+- the rung fix, which is what made the discriminator run possible;
203+- the matrix correction in §6.
204+
205+The fixtures deliberately sit **next to the gate that fixes them**, not
206+next to a gate that does not (Agent13-2's explicit preference, and the
207+right call: they invite exactly the misattribution §2a records).
208+
209+---
210+
211+## 6. Matrix correction: "4:4:4 superres" is not a superres cell
212+
213+**`--superres-mode=1` without `--superres-denominator` scales nothing.**
214+The sweep's recipe omitted the denominator, so it was left to the
215+encoder's energy heuristic — `get_superres_denom_for_qindex`
216+(`av1/encoder/superres_scale.c:143`) returns `SCALE_NUMERATOR` unless
217+the frame is a KF/ARF update and the horizontal-energy test passes, and
218+on a smooth `testsrc2` source it chose 8. Parsed from the stream, all
219+four frame headers of `444_lossy_rect4_wide_256x128.obu` carry:
220+
221+```text
222+FH0 frame=256x128 upscaled=256 use_superres=false denom=8
223+```
224+
225+(through `FH3`). The cell was a plain 4:4:4 lossy cq-20 stream wearing a
226+superres label — the same family as the sweep's own §6.0 trap 2, which
227+caught `--tile-rows=1` being a no-op at 256x128.
228+
229+With an explicit denominator the cell is real and **byte-exact 4/4**:
230+
231+```text
232+ffmpeg -f lavfi -i "testsrc2=size=256x128:rate=25" -frames:v 4 \
233+ -pix_fmt yuv444p -strict -1 -f yuv4mpegpipe - | \
234+aomenc --codec=av1 --passes=1 --end-usage=q --cq-level=20 --cpu-used=2 \
235+ --threads=1 --row-mt=0 --lag-in-frames=0 --kf-max-dist=100 \
236+ --limit=4 --superres-mode=1 --superres-denominator=12 \
237+ --superres-kf-denominator=12 --obu -o - -
238+```
239+
240+14808 B, sha256 `450caa3e31526a8973b9f64d5030a2f11b87bd60fac07aef121cb62af9bf85ff`;
241+all four headers `frame=171x128 upscaled=256 use_superres=true denom=12`;
242+`predict_scaled_hits=2130`, `scaled leaf8=83 sub8=372`, so scaled MC
243+really ran. Verdict: **4/4 decode-order frames byte-exact vs aomdec**,
244+measured on `a9e5034e`'s parent (`dc35d607` + `f92776ba`) with no
245+4:4:4-specific fix involved beyond H1.
246+
247+So the sweep's §1 matrix row `4:4:4 / superres / 8-bit` should read
248+**exact, not D**, and the cell needed a denominator to be a cell at all.
249+A 36-point sweep over {testsrc2, noise, smptebars} x cq {0,10,20,30} x
250+denominator {9,12,16} found a scaled 4:4:4 stream in every combination
251+once the denominator is given.
252+
253+Not gated: the recipe is a hand-quoted flag set with no pinned fixture
254+here, and the eight committed superres gates are 4:2:0. Recorded as the
255+open item rather than closed with a gate I have not mutation-proved.
256+
257+---
258+
259+## 7. Gate and its red-before
260+
261+`a_444_lossy_rect4_strip_stream_decodes_pixel_exact_at_odd_and_wide_geometries`
262+(`crates/ec-av1/src/stream.rs`). Per arm it asserts:
263+
264+- the pinned bytes — length and FNV-1a-64 (my FNV implementation was
265+ validated against the sibling gate's published pair, 6441 B /
266+ `0x4368_8b2d_2e91_72b0`, before being used on new bytes);
267+- a non-zero **DELTA** of 1:4 inter strips. `inter16_rect4_counters()` is
268+ process-wide with no reset, so an absolute count would be a
269+ non-vacuity assertion that passes on residue from another stream in a
270+ full-suite run. Measured deltas: 28 and 76.
271+- `decode::rect4_inter_own_chroma444_hits() > 0` — the corrected route
272+ demonstrably ran. Measured: 12 and 24.
273+- the 4:4:4 full-resolution chroma shape (`f.u.len() == w * h`), so the
274+ compare cannot stand in for the shape claim;
275+- 4 frames, the claimed dimensions, and every decode-order frame
276+ byte-exact through `decode_all_frames_vs_oracle`.
277+
278+**Green** (`--nocapture`, `EC_AV1_REQUIRE_AOMENC=1`, no SKIP line):
279+
280+```text
281+a_444_lossy_rect4_strip_stream_decodes_pixel_exact_at_odd_and_wide_geometries:
282+ fixtures/444_lossy_rect4_odd_130x122.obu 4 decode-order frame(s) (0 hidden)
283+ byte-exact vs aomdec, 12 own-extent 1:4 chroma gather(s), 28 1:4 inter strip(s)
284+ fixtures/444_lossy_rect4_wide_256x128.obu 4 decode-order frame(s) (0 hidden)
285+ byte-exact vs aomdec, 24 own-extent 1:4 chroma gather(s), 76 1:4 inter strip(s)
286+test result: ok. 1 passed; 0 failed; 0 ignored; 0 measured; 704 filtered out
287+```
288+
289+**Red before, by mutation on this gate's own arms.** The `ss_x == 0`
290+own-extent arm was pointed back at the 4:2:0 `(16, 8)` pair extent, with
291+the counter left firing so the run goes red on the PIXEL compare and not
292+on a "counter is zero" assertion:
293+
294+```text
295+panicked at crates/ec-av1/src/stream.rs:8469:
296+a_444_lossy_rect4_strip_stream_decodes_pixel_exact_at_odd_and_wide_geometries:
297+ decode-order frame 3 of 4 (4 shown, 0 hidden) differs from the oracle at
298+ byte 4260 (ours 0 vs 38), 9203 bytes differ
299+test result: FAILED. 0 passed; 1 failed
300+```
301+
302+The same mutation measured by hand on both arms: 256x128 goes to 76404
303+samples with first wrong Y(192,0) — the sweep's exact number — and
304+130x122 to 9203 with first wrong Y(100,32). Note the mutation changes
305+the first wrong sample on 130x122, so the base defect and the mutated
306+defect are not the same fork; the gate is red either way, which is what a
307+mutation is for.
308+
309+---
310+
311+## 8. Identity
312+
313+All on `a9e5034e`, `--nocapture`, single-threaded.
314+
315+| family | gates that RAN | result |
316+|---|---|---|
317+| `a_444*` (both H1 gates among them) | 4 | ok |
318+| `a_lossless_444*` + `a_real_aomenc_lossless_444*` + screen-key-frame | 5 ran, 1 SKIP | ok |
319+| superres (`a_superres*`, `a_real_aomenc_*superres*`) | 7 | ok |
320+| rect-strip (`a_real_aomenc_*rect_strip*`, intra-rect-strip, skipped-lossless-intrabc) | 5 | ok |
321+| the sweep's three chroma-format gates (cherry-picked `aeb696da` into a throwaway worktree at `a9e5034e`) | 3 | ok |
322+
323+25 gates ran, 1 skipped. The SKIP is why the counts are split by family
324+instead of folded into one total: for the lossless+superres filter cargo
325+reported `13 passed; 0 failed` while one of the thirteen printed its SKIP
326+line, so that run line on its own reads as thirteen real gates. The 13
327+is 12 real + 1 skip, split above as 5 + 1 and 7.
328+
329+The three sweep gates, quoted:
330+
331+```text
332+a_real_aomenc_odd_coded_dimension_streams_decode_pixel_exact: 6 arms, 4 frames
333+ byte-exact each, frame-edge walks [0,6,0,4,48,12] [0,0,0,4,0,6] [0,4,0,10,0,10]
334+ [0,4,0,8,0,12] [0,4,0,8,0,8] [0,0,0,12,0,14]
335+a_lossless_444_10bit_inter_stream_decodes_pixel_exact: 6 frames byte-exact vs aomdec at 10-bit 4:4:4
336+a_444_12bit_inter_sequence_decodes_pixel_exact: 6 frames byte-exact vs aomdec at 12-bit 4:4:4
337+test result: ok. 3 passed; 0 failed; 0 ignored; 0 measured; 705 filtered out
338+```
339+
340+**One SKIP, pre-existing and not mine:**
341+`a_real_aomenc_lossless_444_key_frame_decodes_sample_exact` prints "no
342+pinned bytes at `fixtures/ll444-lossless-key.obu`". That file has no
343+entry in `git log` for the path — it was never committed, so the gate has
344+always skipped on this base.
345+
346+No suite run beyond the named gates: full validation is Main's, once
347+after all subagents land.
348+
349+---
350+
351+## 9. Handed on
352+
353+- **Agent04-2** — `f92776ba` is the fix, cherry-picked here with `-x`;
354+ it now has two more geometries and a red-before on each. The
355+ retraction in §2a is recorded in their report.
356+- **Agent13-2** — `4e151813` is confirmed lossless-only by a structural
357+ argument (`lossless_pair` arm) and by byte-identical divergence counts.
358+ Independently reached the same conclusion, by a different contaminated
359+ A/B.
360+- **Main** — `dc35d607` is standalone, measurement-only, and mergeable
361+ now. The matrix row `4:4:4 / superres / 8-bit` should read exact (§6).
362+ Open item: the real 4:4:4 superres cell is exact but ungated.
363+
364+---
365+
366+## 10. Appendix — the mode fork re-verified, and the per-arm commands
367+
368+### 10a. The `mi(13,32)` ref0 fork does NOT survive the H1 fix
369+
370+§3 reported a mode fork at `mi(13,32)` — the oracle reads
371+`ref0 = LAST (1)`, we read `GOLDEN (4)` — landing on the block right
372+after the first wrong pixel, and flagged it as residue worth a lane of
373+its own if it survived. Re-measured on a clean two-arm pair, one commit
374+apart, with `4e151813` provably absent from both:
375+
376+| decode-order frame | oracle entries | arm A (base + rung) | arm B (base + rung + `f92776ba`) |
377+|---|---|---|---|
378+| 1 | 279 | 279 | 279 |
379+| 2 | 299 | **226** | **299** |
380+| 3 | 361 | **40** | **361** |
381+
382+| arm | semantic ladder diffs (mi, ref0, ref1, mv0), frames 1 / 2 / 3 | `mi(13,32)` idx175 |
383+|---|---|---|
384+| A — base + rung | 0 / **51** / **40** | AOM `ref0=1 mv0=(-32,0)` vs OUR `ref0=4 mv0=(-32,0)` — DIFF |
385+| B — base + rung + `f92776ba` | 0 / **0** / **0** | AOM `ref0=1 mv0=(-32,0)` vs OUR `ref0=1 mv0=(-32,0)` — **SAME** |
386+
387+**The fork is gone, and it is the same defect.** Zero semantic ladder
388+diffs in all three frames, and the entry counts now equal the oracle's
389+exactly (arm A lost 73 entries in frame 2 and 321 in frame 3; arm B
390+loses none). This is §3's causality argument confirmed rather than
391+asserted: a wrong pixel cannot cause a mode fork, so one bsize/footprint
392+error had to feed both symptoms — and if that is right, one fix must
393+remove both. It does. A residual fork here would have refuted the
394+argument and pointed at a second defect; there is none. **Dropped, no
395+separate lane.**
396+
397+**The one residual ladder difference is a print asymmetry, not a fork.**
398+Arm B still shows 2 (frame 2) and 12 (frame 3) entries where the
399+`stack` field differs. Every one is a compound block (`ref1` set, e.g.
400+`ref0=1 ref1=4`, `ref0=4 ref1=7`) whose OUR line prints no `stack=`
401+field at all — the compound arm's `EC_MODE_VAL` format omits it. All
402+semantic fields, and on most entries `rng`, match. Same family as
403+`compare-range-not-tell`: a field that is not a cross-decoder invariant
404+must not be compared as one.
405+
406+### 10b. The ancestry guard is wrong for a cherry-picked commit
407+
408+The guard I ran in 10a, `git merge-base --is-ancestor f92776ba HEAD`,
409+returns **False on an arm that has the fix**, because a cherry-pick
410+mints a new sha. Had I trusted it as a presence check it would have
411+reported arm B as "fix absent" — a third check in this session that
412+returns a plausible number instead of the fact, and the second inside
413+this lane alone. The correct guard over cherry-picks is **patch-id
414+equivalence**:
415+
416+```text
417+f92776ba: is-ancestor=False patch-id=bcead47eb734ca4f local equivalent: 38b34494 PRESENT
418+4e151813: is-ancestor=False patch-id=5c19bac8add27bbb local equivalent: None absent
419+dc35d607: is-ancestor=False patch-id=285286bb3506199b local equivalent: e362bfda PRESENT
420+```
421+
422+`is-ancestor` remains a valid EXCLUDE check for a commit that is a true
423+ancestor; it is not a valid INCLUDE check after a cherry-pick. The
424+`rust-oracle-gate-verification` entry was corrected.
425+
426+### 10c. The per-arm commands, verbatim
427+
428+Throw-away worktree, one `CARGO_TARGET_DIR` per arm, arms exactly one
429+commit apart. A reviewer can paste this and get the same numbers.
430+
431+```bash
432+WT=~/.cache/wt/av1444fork
433+cd /home/user/Documents/Code/Rust/edith_codecs
434+git worktree add -f --detach "$WT" 4155c7c7
435+
436+arm () { # arm <label> <tag> <commit>...
437+ tag=$1; shift
438+ git -C "$WT" reset --hard 4155c7c7 # per-arm reset, never `checkout --`
439+ git -C "$WT" clean -fdq
440+ for c in "$@"; do git -C "$WT" cherry-pick -x "$c"; done
441+ git -C "$WT" log --oneline -1
442+ for c in f92776ba 4e151813; do # presence/absence by PATCH-ID
443+ p=$(git -C "$WT" show "$c" | git patch-id --stable | cut -d' ' -f1)
444+ hit=$(git -C "$WT" log --format=%H | while read -r h; do
445+ q=$(git -C "$WT" show "$h" | git patch-id --stable | cut -d' ' -f1)
446+ [ "$q" = "$p" ] && { echo "$h"; break; }; done)
447+ echo "$c present=${hit:-no}"
448+ done
449+ td=~/.cache/cargo-target-$tag
450+ ( cd "$WT" && CARGO_TARGET_DIR="$td" \
451+ cargo build -p ec-av1 --example decode_probe --features gate-counters )
452+ stat -c '%y' "$td/debug/examples/decode_probe" # the 0.0s-build tell
453+ ( cd "$WT" && EC_TRACE_MODE=1 EC_AV1_FINAL_DUMP=/tmp/$tag \
454+ "$td/debug/examples/decode_probe" ~/.cache/av1444edge/sr444.obu 2>/tmp/$tag.our )
455+ for k in 1 2 3 4; do # oracle, per frame
456+ EC_TRACE_MODE=1 ~/.cache/aom-oracle/build/aomdec --codec=av1 --limit=$k -o /dev/null ~/.cache/av1444edge/sr444.obu 2>/tmp/$tag.aom$k
457+ done
458+}
459+
460+arm A_base_plus_rung A dc35d607
461+arm B_base_plus_rung_plus_f92776ba B dc35d607 f92776ba
462+```
463+
464+Compare by splitting OUR's `EC_MODE_VAL` lines on the `EC_PICT idx=`
465+markers (one per decode-order frame, printed before that frame's dump),
466+the ORACLE's on cumulative `aomdec --limit=k` counts, then field by
467+field per entry. Observed:
468+
469+```text
470+arm A entries oracle/ours 1,2,3: 279/279 299/226 361/40
471+arm A SEMANTIC diffs (mi/ref0/ref1/mv0) frame 2 = 51, frame 3 = 40
472+arm B entries oracle/ours 1,2,3: 279/279 299/299 361/361
473+arm B SEMANTIC diffs frame 2 = 0, frame 3 = 0
474+arm B residual stack-field diffs: frame 2 = 2, frame 3 = 12; every one a
475+ compound block whose OUR line omits the field
476+```
477+
478+Pixel cross-check on the same two arms, so the ladder verdict is not
479+taken on trust: arm B is 4/4 decode-order frames byte-exact vs aomdec on
480+both fixtures (§7); arm A is 11521 and 76404 samples off (§1).
481+
482+Cleanup: `git worktree remove --force ~/.cache/wt/av1444fork` and
483+`rm -rf ~/.cache/cargo-target-forkA ~/.cache/cargo-target-forkB`.
484+
485+---
486+
487+## 11. Appendix r3 — the 4:4:4 superres cell is REAL, and how to tell
488+
489+Main relayed a measurement from lane-av1gates444 that 256x128 is
490+byte-identical with and without `--superres-mode=1`, and asked whether ANY
491+aomenc recipe on this build can produce a stream whose PARSED header
492+carries superres. Both are right, about different recipes, and the
493+distinction is the deliverable.
494+
495+### 11a. The flag sweep: attempted flags -> PARSED denom
496+
497+Build: `~/.cache/aom-oracle/build/aomenc`, libaom `v3.13.3-7-g9bb526a`
498+(oracle snapshot; `--version` is not an accepted flag on this build, so the
499+version comes from the source tree the binary is built from). Common
500+recipe, 256x128 yuv444p `testsrc2=size=256x128:rate=25 -frames:v 4`, with
501+`--profile=1 --passes=1 --end-usage=q --cq-level=20 --cpu-used=2
502+--threads=1 --row-mt=0 --lag-in-frames=0 --kf-max-dist=100 --limit=4`.
503+Every row's verdict is read from the stream's OWN parsed frame header, not
504+from the flag.
505+
506+```text
507+verdict | flags | parsed FH0 | sha256
508+no-op | (none, control) | frame=256x128 upscaled=256 use_superres=false denom=8 | 06621606
509+no-op | superres-mode=1 (no denom) | frame=256x128 upscaled=256 use_superres=false denom=8 | 06621606
510+SCALED | superres-mode=1 den=9 | frame=228x128 upscaled=256 use_superres=true denom=9 | 3d619ee0
511+SCALED | superres-mode=1 den=12 | frame=171x128 upscaled=256 use_superres=true denom=12 | 450caa3e
512+SCALED | superres-mode=1 den=16 | frame=128x128 upscaled=256 use_superres=true denom=16 | 194450c4
513+SCALED | superres-mode=2 (no denom) | frame=186x128 upscaled=256 use_superres=true denom=11 | c18496cf
514+SCALED | superres-mode=2 den=9/12/16 | frame=186x128 upscaled=256 use_superres=true denom=11 | c18496cf
515+no-op | superres-mode=3, all den | frame=256x128 upscaled=256 use_superres=false denom=8 | 8dafaf38
516+no-op | superres-mode=4, all den | frame=256x128 upscaled=256 use_superres=false denom=8 | 8dafaf38
517+no-op | resize-mode=1,2,3 any den | frame=256x128 upscaled=256 use_superres=false denom=8 | 06621606
518+```
519+
520+**7 of 29 combinations produce a real scaled stream.** Three findings
521+behind that:
522+
523+1. **The reported no-op is real and is exactly the sweep's recipe.**
524+ `--superres-mode=1` with NO denominator gives sha256 `06621606…`, which
525+ is byte-identical to the no-flag control — so lane-av1gates444's
526+ measurement is correct, and the sweep's `sr444` bytes are that
527+ no-op stream. libaom picks the denominator itself
528+ (`get_superres_denom_for_qindex`, `av1/encoder/superres_scale.c:143`):
529+ it returns `SCALE_NUMERATOR` unless the frame is a KF/ARF update AND the
530+ horizontal-energy test passes, and on a smooth `testsrc2` source it
531+ returns 8.
532+2. **Adding `--superres-denominator` is what makes the cell exist.** Mode 1
533+ with an explicit denominator is scaled on every frame, and the parsed
534+ `denom` equals the flag. This is the route the r3 gate pins.
535+3. **Mode 2 (random) scales with no denominator at all** — and IGNORES
536+ `--superres-denominator`: all four denominator values produce the same
537+ stream (`186x128 denom=11`, sha `c18496cf…`). So "set the denominator"
538+ is not the only working route, and a gate that asserted the flag value
539+ rather than the parsed value would pass on mode 2 while the numbers it
540+ printed were fiction.
541+
542+`--resize-mode` is a different feature and is never a superres witness: it
543+downsizes the FRAME (`frame=171x85 upscaled=171`), whereas superres keeps
544+`frame_width < upscaled_width`. Worth separating explicitly, because
545+"denominator" appears in both flag families.
546+
547+Modes 3 (qthresh) and 4 (auto) are no-ops at every denominator tried,
548+which is consistent with the committed census gate's own recorded finding
549+that auto "picked denominator 8, so those two arms carry no scaling at
550+all and prove nothing".
551+
552+### 11b. Our decoder on all four real scaled streams
553+
554+Every SCALED row above, compared against the instrumented aomdec in decode
555+order with equal frame counts and equal per-frame byte lengths asserted
556+first:
557+
558+```text
559+mode=1 den=9 3d619ee0fda3 upscaled 228x128 f0 EXACT f1 EXACT f2 EXACT f3 EXACT
560+mode=1 den=12 450caa3e3152 upscaled 171x128 f0 EXACT f1 EXACT f2 EXACT f3 EXACT
561+mode=1 den=16 194450c4bf19 upscaled 128x128 f0 EXACT f1 EXACT f2 EXACT f3 EXACT
562+mode=2 c18496cf3b7d upscaled 186x128 f0 EXACT f1 EXACT f2 EXACT f3 EXACT
563+```
564+
565+So the 4:4:4 superres class is byte-exact across denominators 9, 11, 12
566+and 16 and coded widths 128, 171, 186 and 228 at 256x128 — not one
567+geometry. The gate pins the den=12 member and asserts its PARSED
568+`use_superres` / `denom` / coded size, so a stream that stops being scaled
569+goes red on a header assertion rather than becoming a differently-shaped
570+exactness claim. `denom=9` (coded 228, the widest margin the frame
571+allows) and `mode=2`'s `denom=11` are the obvious next pins and are not
572+gated; recorded rather than quietly dropped.
573+
574+### 11c. The sweep claims that need correcting (NOT edited here)
575+
576+`lanes/av1formatsweep.report.md` is the sweep lane's file; these are the
577+lines to fix, named rather than touched:
578+
579+- **line 438** — the `sr444` row: "4:4:4 **superres** 256x128
580+ (`--superres-mode=1`) … **DIVERGENT** from f2, 76404 samples". Two
581+ errors: the stream carries `use_superres=false denom=8` (§11a), and its
582+ divergence is the H1 rect4-strip class, already localised and gated in
583+ `a_444_lossy_rect4_strip_stream_decodes_pixel_exact_at_odd_and_wide_geometries`
584+ (whose second arm is these exact 15239 bytes). The row should say the
585+ recipe was a no-op and name the class.
586+- **line 83** — the §1 matrix row `| superres | – | – | – |` for 4:4:4.
587+ Should become `Y` at 8-bit: gated by
588+ `a_444_lossy_superres_stream_decodes_pixel_exact`.
589+- **line 485** — "Matrix changes (§1): 4:4:4 row gains … `superres → D`".
590+ Should be `superres → Y` at 8-bit.
591+- **line 442** — "Note the aomenc flag is `--superres-mode=1`; there is no
592+ `--enable-superres` in this build". True but incomplete, and it is the
593+ note that let the no-op recipe stand as a cell: the flag needs
594+ `--superres-denominator` (or mode 2) to do anything, and the verdict
595+ must come from the parsed header.
596+- **line 492** — "Still not measured … 4:4:4 superres at 10/12 bits" is
597+ still true and still open; only the 8-bit cell is closed here.
598+
599+### 11d. Overlap to be aware of when merging
600+
601+lane-av1gates444's `a_444_lossy_256x128_stream_decodes_pixel_exact` already
602+pins the plain 256x128 lossy geometry. My r1 gate's second arm uses the
603+same 15239 bytes but claims something different — that the 4:4:4 1:4
604+inter-strip route fired (76 strips, 24 own-extent chroma gathers) and that
605+the H1 fork is gone there — so it is not redundant with a geometry gate.
606+The two fixtures are the same bytes, so whichever lands second should reuse
607+the pin rather than add a second copy. Flagging it rather than resolving
608+it: both claims are load-bearing and the merge order is Main's call.
lanes/av1formatsweep.report.mdmodified+64 -12
@@ -80,7 +80,7 @@ walk had no exactness evidence. Measured exact, and gated.
80 | **lossy** | **D (H1, H2)** | **D (H1)** | **y → gate C** |80 | **lossy** | **D (H1, H2)** | **D (H1)** | **y → gate C** |
81 | tile columns (2) | **D (H3)** | – | – |81 | tile columns (2) | **D (H3)** | – | – |
82 | tile rows (2) | **D (H4)** | – | – |82 | tile rows (2) | **D (H4)** | – | – |
83-| superres | – | – | – |83+| superres | Y (`a_444_lossy_superres_stream_decodes_pixel_exact`, plus `…_mode1_den9_…` and `…_mode2_random_denom_…`) | – | – |
84 | odd coded dims | – | – | – |84 | odd coded dims | – | – | – |
85 85
86 ¹ 12-bit 4:4:4 is reachable only from a source smooth enough that aomenc86 ¹ 12-bit 4:4:4 is reachable only from a source smooth enough that aomenc
@@ -335,9 +335,11 @@ screen-tools refusal and call it a 4:4:4 result.
335 335
336 ## 4. Not measured (budget), stated so nobody reads silence as coverage336 ## 4. Not measured (budget), stated so nobody reads silence as coverage
337 337
338-12-bit tiles at 4:2:0; 12-bit superres; 4:4:4 superres; 4:4:4 odd coded338+12-bit tiles at 4:2:0; 12-bit superres; 4:4:4 superres **(closed since, at
339-dimensions; 4:4:4 at 10/12-bit with tiles; 12-bit 4:4:4 lossless; 4:4:0339+8-bit only — lane-av1superpin, see the correction in §6.5; 10/12-bit still
340-(`ss 0,1`) at any depth. Suite staging and the full-suite run are Main's.340+open)**; 4:4:4 odd coded dimensions; 4:4:4 at 10/12-bit with tiles; 12-bit
341+4:4:4 lossless; 4:4:0 (`ss 0,1`) at any depth. Suite staging and the
342+full-suite run are Main's.
341 343
342 ## 5. Handoffs, in the order a follow-up lane should take them344 ## 5. Handoffs, in the order a follow-up lane should take them
343 345
@@ -435,12 +437,42 @@ H2's stream is entropy-clean) or to H2 (lossy, tx-search-gated).
435 437
436 | cell | stream | bytes | sha256 | verdict vs aomdec |438 | cell | stream | bytes | sha256 | verdict vs aomdec |
437 |---|---|---|---|---|439 |---|---|---|---|---|
438-| 4:4:4 **superres** 256x128 (`--superres-mode=1`) | `sr444` | 15239 | `06621606…` | **DIVERGENT** from f2, 76404 samples, first (f2, s192) = Y(192,0) |440+| 4:4:4 **superres** 256x128 (`--superres-mode=1`, **no denominator flag**) | `sr444` | 15239 | `06621606…` | **NOT A SUPERRES CELL.** This is the sweep's own bytes (15239 B, sha256 `06621606…`), and every one of its four PARSED frame headers reads `use_superres=false denom=8` — `--superres-mode=1` without `--superres-denominator` is a **no-op**, byte-identical to the no-flag control. The DIVERGENT verdict itself stands (from f2, 76404 samples, first (f2, s192) = Y(192,0)) but it is **H1, the 1:4 inter-strip own-extent class**, not a superres defect — the same class as the 130x122 row below and gated by `a_444_lossy_rect4_strip_stream_decodes_pixel_exact_at_odd_and_wide_geometries` (second arm is these exact 15239 bytes). The real 4:4:4 superres cells need a denominator; they are byte-exact 4/4 and gated — see `lanes/av1superpin.report.md`. |
439 | 4:4:4 **odd coded dims 66x66** | `odd444_66x66` | 5938 | `973eddf4…` | **EXACT 4/4** — new exact cell |441 | 4:4:4 **odd coded dims 66x66** | `odd444_66x66` | 5938 | `973eddf4…` | **EXACT 4/4** — new exact cell |
440-| 4:4:4 **odd coded dims 130x122** | `odd444_130x122` | 8945 | `c87ac65b…` | **DIVERGENT** from f3, 11521 samples, first (f3, s2208) = Y(128,16) |442+| 4:4:4 **odd coded dims 130x122** | `odd444_130x122` | 8945 | `c87ac65b…` | **CORRECTED: was "DIVERGENT from f3, 11521 samples, first (f3, s2208) = Y(128,16)"; now EXACT 4/4** — the same H1 1:4-inter-strip chroma class, gated by `a_444_lossy_rect4_strip_stream_decodes_pixel_exact_at_odd_and_wide_geometries` (first arm = these exact 8945 bytes). Localised in `lanes/av1444edge.report.md` §2-§3: the pre-filter reconstruction already carries the identical first wrong sample, and the one-commit fix is lane-av1444rect's `f92776ba` |
441-443+
442-Note the aomenc flag is `--superres-mode=1`; there is no `--enable-superres`444+Note the aomenc flag is `--superres-mode=1` and there is no
443-in this build (`aomenc --help | grep -i superres`).445+`--enable-superres` in this build (`aomenc --help | grep -i superres`) —
446+but **that flag alone does nothing**, which is what made the row above a
447+phantom cell. Read on:
448+
449+**Correction (lane-av1superpin): the flag above does nothing on its own.**
450+There is indeed no `--enable-superres` in this build, and
451+`--superres-mode=1` is accepted — but libaom picks the denominator itself
452+(`get_superres_denom_for_qindex`, `av1/encoder/superres_scale.c:143`), which
453+returns `SCALE_NUMERATOR` (8) unless the frame is a KF/ARF update AND the
454+horizontal-energy test passes. On a smooth `testsrc2` source it returns 8,
455+so the flag is a no-op and the stream is byte-identical to the no-flag
456+control. Three routes actually produce a scaled stream (measured on this
457+oracle, libaom `v3.13.3-7-g9bb526a`; the version comes from the source tree
458+`scripts/build-aom-oracle.sh` builds, because `--version` is not an accepted
459+flag on that build):
460+
461+1. `--superres-mode=1 --superres-denominator=<9..16>` — the denominator is
462+ honoured and appears verbatim in the parsed header.
463+2. `--superres-mode=2` (random) — scales with **no** denominator flag, and
464+ **ignores** `--superres-denominator` entirely: denominators 9, 12 and 16
465+ all produce the same stream. Its denominator is chosen **per frame** (at
466+ 256x128: 11, 14, 15, 9 across the four frames), so a single-denominator
467+ reading of a mode-2 stream is wrong by construction.
468+3. `--superres-mode=3` and `=4` are no-ops at every denominator tried, at
469+ every bit depth — consistent with the committed census gate's own finding.
470+
471+**Always read the verdict out of the stream's own parsed frame header**
472+(`use_superres`, `superres_denom`, `upscaled_width`, coded `frame_width`),
473+never out of the flag. `--resize-mode` is a different feature and is never a
474+superres witness: it downsizes the FRAME (`frame=171x85 upscaled=171`),
475+whereas superres keeps `frame_width < upscaled_width`.
444 476
445 The 130x122 stream is the interesting one: 66x66 is exact at the same477 The 130x122 stream is the interesting one: 66x66 is exact at the same
446 settings, so the 4:4:4 partial-frame walk is right at one odd geometry and478 settings, so the 4:4:4 partial-frame walk is right at one odd geometry and
@@ -482,12 +514,21 @@ that is ever hand-built.
482 ### 6.5 Matrix deltas and the honest "not measured" list514 ### 6.5 Matrix deltas and the honest "not measured" list
483 515
484 Matrix changes (§1): 4:4:4 row gains `odd dims 66x66 → y` (exact this lane),516 Matrix changes (§1): 4:4:4 row gains `odd dims 66x66 → y` (exact this lane),
485-`superres → D`, `10/12-bit tiles → D`, `12-bit lossless → D`; 4:2:0 row gains517+`10/12-bit tiles → D`, `12-bit lossless → D`; 4:2:0 row gains
486 `12-bit tiles + superres → y`. The tile-ROWS cells for 4:4:4 stay as they518 `12-bit tiles + superres → y`. The tile-ROWS cells for 4:4:4 stay as they
487 are — the 8-bit one is now Agent13's EXACT (tile rows genuinely enabled at519 are — the 8-bit one is now Agent13's EXACT (tile rows genuinely enabled at
488 geometries with a second SB row), and the 10/12-bit ones are the untiled520 geometries with a second SB row), and the 10/12-bit ones are the untiled
489 control above.521 control above.
490 522
523+**Correction (lane-av1superpin): the 4:4:4 row's superres cell reads `Y` at
524+8-bit, not `D`.** This lane's `superres → D` was written from a stream that
525+never scaled (§6.2: `--superres-mode=1` with no denominator is a no-op, and
526+the divergence recorded against it is H1, now fixed and gated). With an
527+explicit denominator — or `--superres-mode=2`, which chooses its own — the
528+4:4:4 superres class is byte-exact 4/4 at coded widths 128, 171, 186 and 228,
529+gated at `denom 12`, `denom 9` and mode 2. See `lanes/av1superpin.report.md`.
530+10/12-bit stays `–`: still not measured.
531+
491 Still not measured after this round: 4:4:4 at 10/12 bits with **tile rows532 Still not measured after this round: 4:4:4 at 10/12 bits with **tile rows
492 actually enabled** (needs a >= 256-high geometry — trap 2); 4:4:4 superres at533 actually enabled** (needs a >= 256-high geometry — trap 2); 4:4:4 superres at
493 10/12 bits; 4:4:4 odd dims at 10/12 bits and at dimensions other than 66x66 /534 10/12 bits; 4:4:4 odd dims at 10/12 bits and at dimensions other than 66x66 /
@@ -495,6 +536,11 @@ actually enabled** (needs a >= 256-high geometry — trap 2); 4:4:4 superres at
495 witness; 4:4:0 at any depth (unproducible, §6.4); 4:2:2 (ss 1,0) beyond the536 witness; 4:4:0 at any depth (unproducible, §6.4); 4:2:2 (ss 1,0) beyond the
496 existing probe-bypass row.537 existing probe-bypass row.
497 538
539+Re-checked and **unchanged** by lane-av1superpin: "4:4:4 superres at 10/12
540+bits" is still open. That lane measured 8-bit only — every fixture it pinned
541+parses `bit_depth = 8` from its own sequence header — so this entry stands as
542+written.
543+
498 ### 6.6 Handed to other lanes544 ### 6.6 Handed to other lanes
499 545
500 - The 4:4:4 **lossless chroma** divergences at 8/10/12 bits with and without546 - The 4:4:4 **lossless chroma** divergences at 8/10/12 bits with and without
@@ -502,8 +548,14 @@ existing probe-bypass row.
502 **Agent24-2** with H3 — same format, same unit family, and this round shows the548 **Agent24-2** with H3 — same format, same unit family, and this round shows the
503 class is not tile-specific and not depth-specific, which narrows it.549 class is not tile-specific and not depth-specific, which narrows it.
504 - The 4:4:4 **130x122** odd-dimension divergence and the 4:4:4 **superres**550 - The 4:4:4 **130x122** odd-dimension divergence and the 4:4:4 **superres**
505- divergence are unassigned; neither reduces to a known class on the evidence551+ divergence were unassigned here. Both are now closed by
506- here, and neither has a discriminator run.552+ lane-av1444edge: they are **one class — H1**, the 1:4 inter-strip own-chroma-
553+ extent gather at `ss (0,0)`, discriminator-run and fixed by `f92776ba`
554+ (lane-av1444rect), and gated by
555+ `a_444_lossy_rect4_strip_stream_decodes_pixel_exact_at_odd_and_wide_geometries`
556+ — whose second arm is these exact 15239 bytes. The "superres" name in the
557+ row was a mislabel; the stream never scaled. Real 4:4:4 superres coverage
558+ is separate and lives in lane-av1superpin.
507 - Recorded from Agent13-2 and folded into the matrix above: a hardcoded 4:2:0559 - Recorded from Agent13-2 and folded into the matrix above: a hardcoded 4:2:0
508 luma footprint at the lossless 16x4/4x16 chroma-pair walk560 luma footprint at the lossless 16x4/4x16 chroma-pair walk
509 (`Reach::of_tu` mis-answering at `ss 0,0`), same shape class as the wave's561 (`Reach::of_tu` mis-answering at `ss 0,0`), same shape class as the wave's
lanes/av1superpin.report.mdadded+301 -0
@@ -0,0 +1,301 @@
1+# lane-av1superpin — the last two measured-exact 4:4:4 superres members, and the correction of a cell that measured a no-op
2+
3+**Base** `4c973b94` (lane-av1444edge r3 tip). **Branch** `lane-av1superpin`,
4+worktree `~/.cache/wt/v444pin`. Two commits:
5+
6+| commit | what |
7+|---|---|
8+| `e47d8f60` | the two gates + the two pinned fixtures |
9+| (this file) | the `lanes/av1formatsweep.report.md` corrections |
10+
11+**Oracle** `~/.cache/aom-oracle/build/{aomenc,aomdec}`, built from the
12+`scripts/build-aom-oracle.sh` source tree at libaom
13+**`v3.13.3-7-g9bb526a`** (`git describe` in `~/.cache/aom-oracle/src`, HEAD
14+`9bb526a`). **Not** established via `aomenc --version`: that build does not
15+accept `--version` as a flag, so the revision is read off the source tree the
16+binary was compiled from. All measurements below: `CARGO_TARGET_DIR=$HOME/.cache/cargo-target`,
17+`EC_NOMEMGUARD=1 EC_AV1_REQUIRE_AOMENC=1`, `--test-threads=1`,
18+`--nocapture`.
19+
20+**Inherited, not re-derived.** The flag sweep in
21+`lanes/av1444edge.report.md` §11 and the "byte-exact 4/4 on all four scaled
22+streams" claim are that lane's measurements and are cited as inherited. What
23+this lane re-verified itself is stated as such in §2: the two streams it
24+encodes were re-encoded from the recipes and their frame headers re-parsed
25+here.
26+
27+---
28+
29+## 1. The flag-vs-parsed-header table
30+
31+Flags as issued on the command line vs what the stream's OWN parsed frame
32+header says. Every row below was produced by encoding the recipe on this
33+oracle and parsing the result; the verdict column is never the flag.
34+
35+Source: `testsrc2=size=256x128:rate=25 -frames:v 4 -pix_fmt yuv444p`,
36+common encode flags `--codec=av1 --passes=1 --end-usage=q --cq-level=20
37+--cpu-used=2 --threads=1 --row-mt=0 --lag-in-frames=0 --kf-max-dist=100
38+--limit=4 --obu`.
39+
40+| verdict | flags | parsed FH0 | sha256 | source |
41+|---|---|---|---|---|
42+| no-op | (none, control) | `frame=256x128 upscaled=256 use_superres=false denom=8` | `06621606…` | inherited |
43+| no-op | `--superres-mode=1` (no denom) | `frame=256x128 upscaled=256 use_superres=false denom=8` | `06621606…` | inherited — **this is the sweep's `sr444` cell** |
44+| SCALED | `mode=1 den=9` | `frame=228x128 upscaled=256 use_superres=true denom=9` | `3d619ee0…` | inherited; **re-verified here** (§2) |
45+| SCALED | `mode=1 den=12` | `frame=171x128 upscaled=256 use_superres=true denom=12` | `450caa3e…` | inherited (already gated by `a_444_lossy_superres_stream_decodes_pixel_exact`) |
46+| SCALED | `mode=1 den=16` | `frame=128x128 upscaled=256 use_superres=true denom=16` | `194450c4…` | inherited |
47+| SCALED | `mode=2` (random) | **`frame=186x128 denom=11`, then `146x128 denom=14`, `137x128 denom=15`, `228x128 denom=9`** | `c18496cf…` | inherited; **the per-frame denominators re-verified here** (§2) |
48+| SCALED | `mode=2` + `den=9` / `12` / `16` | identical to the row above, all three | `c18496cf…` (all three) | inherited; **re-verified here** (§3, in-gate) |
49+| no-op | `mode=3`, all denominators | `frame=256x128 use_superres=false denom=8` | `8dafaf38…` | inherited |
50+| no-op | `mode=4`, all denominators | `frame=256x128 use_superres=false denom=8` | `8dafaf38…` | inherited |
51+| no-op | `resize-mode=1,2,3`, any denominator | `frame=256x128 use_superres=false denom=8` | `06621606…` | inherited |
52+
53+**7 of 29 attempted combinations produce a real scaled stream.**
54+
55+Two facts the table exists to make impossible to get wrong again:
56+
57+1. **`--superres-mode=1` alone is a no-op.** libaom picks the denominator
58+ itself (`get_superres_denom_for_qindex`, `av1/encoder/superres_scale.c:143`),
59+ which returns `SCALE_NUMERATOR` (8) unless the frame is a KF/ARF update AND
60+ the horizontal-energy test passes. On a smooth `testsrc2` source it returns
61+ 8, and the result is byte-identical to the no-flag control. The chroma-format
62+ sweep's `sr444` cell is exactly this stream (15239 B, sha `06621606…`), which
63+ is why a whole sweep cell could sit in the matrix labelled "superres" while
64+ measuring nothing about superres.
65+2. **Mode 2 ignores `--superres-denominator` entirely**, and chooses a
66+ **different denominator per frame**. Three of its four parsed denominators
67+ (11, 14, 15) are values no flag on the command line ever named. A gate that
68+ read the flag instead of the header would be wrong on three of four frames
69+ here — which is why §3 makes the flag-ignoring property an assertion rather
70+ than a comment.
71+
72+---
73+
74+## 2. The two gates: fixtures, recipes, parsed headers
75+
76+Both recipes are byte-reproducible on this oracle. The parsed headers below
77+were read from the streams **this lane encoded**, not copied from the previous
78+run.
79+
80+### 2a. `a_444_lossy_superres_mode1_den9_stream_decodes_pixel_exact`
81+
82+`fixtures/444_lossy_superres_256x128_d9.obu`, 17437 bytes,
83+sha256 `3d619ee0fda3d9bb9cf8ff0541ba00ea5d83ae38cd8eec1322f8dbbbe6a5ec96`,
84+FNV-1a-64 `0x1ff2_fb84_528f_aa05`.
85+
86+```text
87+ffmpeg -f lavfi -i "testsrc2=size=256x128:rate=25" -frames:v 4 \
88+ -pix_fmt yuv444p -strict -1 -f yuv4mpegpipe - | \
89+aomenc --codec=av1 --passes=1 --end-usage=q --cq-level=20 --cpu-used=2 \
90+ --threads=1 --row-mt=0 --lag-in-frames=0 --kf-max-dist=100 \
91+ --limit=4 --superres-mode=1 --superres-denominator=9 \
92+ --superres-kf-denominator=9 --obu -o - -
93+```
94+
95+Parsed, per frame (all four identical):
96+
97+```text
98+SEQ ss=(0,0) bd=8 enable_superres=true profile=1
99+FH frame=228x128 upscaled=256 use_superres=true denom=9 (x4)
100+```
101+
102+**Why this member.** 9 is the widest frame-edge margin this 256x128 geometry
103+allows among the denominators libaom's `SUPERRES_NUM` ladder accepts and still
104+scales: `228 * 8 / 256` leaves a 28-column upscale margin against den=12's 85
105+columns, and den=16 (coded 128x128) is degenerate — the coded width equals the
106+superblock grid exactly. A wide margin is where a round-trip is most likely to
107+read past the coded picture.
108+
109+Measured on the gate: 4 upscales, **2568** scaled-MC blocks, 4 decode-order
110+frames byte-exact vs the instrumented aomdec.
111+
112+### 2b. `a_444_lossy_superres_mode2_random_denom_stream_decodes_pixel_exact`
113+
114+`fixtures/444_lossy_superres_mode2_256x128.obu`, 16620 bytes,
115+sha256 `c18496cf3b7db0feca9aa904024cec2115be80b5b94f87c848ac52f9b32ffd97`,
116+FNV-1a-64 `0x8cbb_36b2_5e0f_07ab`.
117+
118+```text
119+ffmpeg -f lavfi -i "testsrc2=size=256x128:rate=25" -frames:v 4 \
120+ -pix_fmt yuv444p -strict -1 -f yuv4mpegpipe - | \
121+aomenc --codec=av1 --passes=1 --end-usage=q --cq-level=20 --cpu-used=2 \
122+ --threads=1 --row-mt=0 --lag-in-frames=0 --kf-max-dist=100 \
123+ --limit=4 --superres-mode=2 --obu -o - -
124+```
125+
126+Parsed, **per frame — and the four differ**:
127+
128+```text
129+SEQ ss=(0,0) bd=8 enable_superres=true profile=1
130+FH0 frame=186x128 upscaled=256 use_superres=true denom=11
131+FH1 frame=146x128 upscaled=256 use_superres=true denom=14
132+FH2 frame=137x128 upscaled=256 use_superres=true denom=15
133+FH3 frame=228x128 upscaled=256 use_superres=true denom=9
134+```
135+
136+**Why this member is not redundant with den=12 / den=9.** Both of those scale
137+every frame at a single denominator, so `av1_superres_upscale` is only ever
138+handed one coded-to-upscaled ratio. This stream hands it four (256→186,
139+256→146, 256→137, 256→228) in one decode, and libaom picks the filter taps
140+from `denom` per frame. That is a case a single-denominator gate cannot reach.
141+
142+Measured on the gate: 4 upscales, **2265** scaled-MC blocks, 4 decode-order
143+frames byte-exact vs aomdec.
144+
145+### 2c. Shape, and what is asserted from the PARSED header
146+
147+Both gates call one shared body (`a_444_superres_arm`) — the body of the
148+existing den=12 gate with the single `(denominator, coded_width)` constant
149+generalised to a per-frame table, which is what mode 2 requires. Per arm:
150+
151+- pinned bytes: length + FNV-1a-64;
152+- from the **sequence header**: `ss (0,0)` (4:4:4), `bit_depth 8`,
153+ `enable_superres`;
154+- from **every parsed frame header**: `use_superres` true, the per-frame
155+ `superres_denom`, `upscaled_width`/height, and the CODED `frame_width`/height;
156+- `FrameWidth == (UpscaledWidth * 8 + denom / 2) / denom`, re-derived from
157+ **that frame's own parsed denominator** rather than compared to a literal
158+ alone — so a re-pinned fixture cannot satisfy the literals while the scaled
159+ arithmetic moves under them;
160+- `superres_hits` and `predict_scaled_hits` as **deltas** (both counters are
161+ process-wide with no reset, so absolute values would pass on residue from
162+ another stream in a full-suite run);
163+- every decoded frame at the **UPSCALED** width with full-resolution 4:4:4 U and
164+ V planes;
165+- every decode-order frame byte-exact through `decode_all_frames_vs_oracle`.
166+
167+My FNV-1a-64 implementation was validated against the sibling gate's published
168+pair before being used on new bytes: `444_lossy_rect4_inter_witness.obu`, 6441
169+bytes → `0x4368_8b2d_2e91_72b0`. Match.
170+
171+---
172+
173+## 3. The flag-ignoring assertion (mode-2 gate, second half)
174+
175+The pin above is only trustworthy if mode 2 really does ignore the flag. That
176+is asserted, not assumed. The gate re-encodes the recipe four ways — no
177+denominator, then `--superres-denominator=9`, `=12`, `=16` — and requires each
178+to reproduce the pinned 16620 bytes exactly (length + FNV compared to the pin,
179+not to each other). It then asserts that at least one **parsed** denominator
180+is a value none of those flags named, so the per-frame table cannot be
181+satisfied by echoing the command line back.
182+
183+Green output:
184+
185+```text
186+a_444_lossy_superres_mode2_random_denom_stream_decodes_pixel_exact:
187+ --superres-mode=2 with no/9/12/16 denominator flags all reproduce the pinned
188+ 16620 bytes; parsed denominators [11, 14, 15, 9] (flag values [9, 12, 16] ignored)
189+```
190+
191+If a future libaom starts honouring `--superres-denominator` under mode 2, both
192+the byte compare and that last assertion go red — which is the intended
193+behaviour: the pin is to the **parsed** denominators, so the day the flag
194+starts mattering the cell has to be re-derived from the stream, not from the
195+recipe.
196+
197+---
198+
199+## 4. Green, and red-before
200+
201+**Green** (`--nocapture`, `EC_AV1_REQUIRE_AOMENC=1`, `--test-threads=1`, no
202+SKIP line anywhere):
203+
204+```text
205+a_444_lossy_superres_mode1_den9_stream_decodes_pixel_exact:
206+ 4 decode-order frame(s) (0 hidden) byte-exact vs aomdec at (256, 128) upscaled
207+ from [(9, 228), (9, 228), (9, 228), (9, 228)] (denominator, coded width) per
208+ frame, 4 upscale(s), 2568 scaled MC block(s); fixture sha256 3d619ee0…
209+a_444_lossy_superres_mode2_random_denom_stream_decodes_pixel_exact:
210+ 4 decode-order frame(s) (0 hidden) byte-exact vs aomdec at (256, 128) upscaled
211+ from [(11, 186), (14, 146), (15, 137), (9, 228)] (denominator, coded width) per
212+ frame, 4 upscale(s), 2265 scaled MC block(s); fixture sha256 c18496cf…
213+ --superres-mode=2 with no/9/12/16 denominator flags all reproduce the pinned
214+ 16620 bytes; parsed denominators [11, 14, 15, 9] (flag values [9, 12, 16] ignored)
215+a_444_lossy_superres_stream_decodes_pixel_exact: (pre-existing, den=12)
216+ 4 decode-order frame(s) (0 hidden) byte-exact … 4 upscale(s), 2130 scaled MC block(s)
217+test result: ok. 3 passed; 0 failed; 0 ignored; 0 measured; 705 filtered out
218+```
219+
220+### Red-before
221+
222+Committed **before** mutating (`e47d8f60`), so no `git checkout --` could
223+restore the gate away. Three mutations, each reverted immediately and each
224+verified reverted (`git diff --stat` empty, tree clean) before the next.
225+
226+| # | mutation | site | `mode1_den9` | `mode2` | `…_stream_…` (pre-existing) |
227+|---|---|---|---|---|---|
228+| 1 | upscale-filter tap alignment: `base = pad - 4` → `pad - 4 + 1` | `superres.rs:133` | **RED, pixel** — `decode-order frame 0 of 4 differs from the oracle at byte 5 (ours 73 vs 74), 33668 bytes differ` | **RED, pixel** — `frame 0 … byte 6 (ours 76 vs 74), 36196 bytes differ` | **RED, pixel** — `frame 0 … byte 5 (ours 76 vs 74), 37726 bytes differ` |
229+| 2 | `set_superres` handed the **coded** width (`upscaled_width` → `frame_width`) | `stream.rs:1851` | **RED, counter** — `zero predict_scaled_hits -- no inter block read a scaled reference …` | **RED, shape** — `frame 0 came back 186x128, not the UPSCALED 256x128` | **RED, counter** — `zero predict_scaled_hits` |
230+| 3 | upscale step derived from `out_width`: `upscale_convolve_step(in_width, out_width)` → `(out_width, in_width)` | `superres.rs:106` | **RED, panic** — index out of bounds at `superres.rs:142` | **RED, panic** — index out of bounds at `superres.rs:142` | **RED, panic** — index out of bounds at `superres.rs:142` |
231+
232+Every mutation run reported `test result: FAILED. 0 passed; 3 failed; 0
233+ignored; 0 measured; 705 filtered out`. **That is the fake-green signature to
234+watch for and it did not appear**: a line reading `0 passed … 705 filtered out`
235+with no `3 failed` is what a `git checkout --`-eaten gate looks like. Here the
236+filter always selected 3 tests and all 3 went red.
237+
238+Mutation 1 is the one this lane prefers — a pixel diff is a stronger red than
239+an index panic, because it names the wrong value rather than only the wrong
240+address, and it cannot be mistaken for a bounds bug in the mutation itself.
241+Both gates go red on it independently.
242+
243+Mutation 3 is the weakest of the three as a gate discriminator (it panics
244+inside the upscaler before any gate assertion runs) but it is retained because
245+it is the mutation that proves the per-frame coded width actually feeds the
246+upscaler's step, rather than being validated at the header assert alone.
247+
248+---
249+
250+## 5. Report corrections (diff-shaped)
251+
252+All in `lanes/av1formatsweep.report.md` — that lane merged, so this is a
253+follow-up commit editing its file rather than a note in my own report.
254+
255+| line (pre-edit) | before | after |
256+|---|---|---|
257+| 83 | `\| superres \| – \| – \| – \|` (4:4:4 matrix, all depths unmeasured) | `\| superres \| Y (\`a_444_lossy_superres_stream_decodes_pixel_exact\`, plus \`…_mode1_den9_…\` and \`…_mode2_random_denom_…\`) \| – \| – \|` — `Y` at 8-bit only |
258+| 438 | `\| 4:4:4 **superres** 256x128 (\`--superres-mode=1\`) \| \`sr444\` \| 15239 \| \`06621606…\` \| **DIVERGENT** from f2, 76404 samples, first (f2, s192) = Y(192,0) \|` | Row retitled `(\`--superres-mode=1\`, **no denominator flag**)`. Verdict cell now: **NOT A SUPERRES CELL** — the bytes are the sweep's own (15239 B, sha `06621606…`), all four parsed headers read `use_superres=false denom=8`. The DIVERGENT numbers are **kept verbatim** but re-attributed: **H1, the 1:4 inter-strip own-extent class**, already gated by `a_444_lossy_rect4_strip_stream_decodes_pixel_exact_at_odd_and_wide_geometries` (second arm is these exact 15239 bytes). Real 4:4:4 superres is byte-exact and gated — cross-ref to this report. |
259+| 442 | `Note the aomenc flag is \`--superres-mode=1\`; there is no \`--enable-superres\` in this build.` | Same fact kept, plus **"but that flag alone does nothing, which is what made the row above a phantom cell"**, followed by a 3-route correction: (1) mode 1 needs an explicit `--superres-denominator`; (2) **mode 2 scales with no denominator flag and ignores `--superres-denominator` entirely** — 9/12/16 all give the same stream — and picks its denominator **per frame** (11, 14, 15, 9 at 256x128), so a single-denominator reading is wrong by construction; (3) modes 3 and 4 are no-ops at every denominator. Cites libaom `v3.13.3-7-g9bb526a` and states how it was established (source tree of `scripts/build-aom-oracle.sh`, **not** `--version`). Ends with "always read the verdict out of the stream's own parsed frame header, never out of the flag", and that `--resize-mode` is a different feature, never a superres witness. |
260+| 485 | ``Matrix changes (§1): 4:4:4 row gains … `superres → D`, `10/12-bit tiles → D` …`` | `superres → D` **removed** from the list, followed by a correction paragraph: the 4:4:4 row's superres cell reads **`Y` at 8-bit, not `D`**, because this lane's `D` was written from a stream that never scaled; with an explicit denominator or mode 2 the class is byte-exact 4/4 at coded widths 128/171/186/228, gated at denom 12, denom 9 and mode 2. 10/12-bit stays `–`. |
261+| 492 | `Still not measured after this round: … 4:4:4 superres at 10/12 bits; …` | **Left as written, checked.** A paragraph is added immediately after stating that lane-av1superpin re-checked it and it is **still open**: every fixture this lane pinned parses `bit_depth = 8` from its own sequence header, so nothing here measures 10/12-bit. |
262+
263+Two further lines in the same file were corrected because leaving them would
264+have contradicted the five above:
265+
266+| line (pre-edit) | before | after |
267+|---|---|---|
268+| 338 (§4 "Not measured") | `…; 12-bit superres; 4:4:4 superres; 4:4:4 odd coded dimensions; …` | `…; 12-bit superres; 4:4:4 superres **(closed since, at 8-bit only — lane-av1superpin, see the correction in §6.5; 10/12-bit still open)**; …` — the list is stated so nobody reads silence as coverage, so a stale entry there is itself a defect |
269+| 504 (§6.6 handoff) | `The 4:4:4 **130x122** odd-dimension divergence and the 4:4:4 **superres** divergence are unassigned; neither reduces to a known class on the evidence here, and neither has a discriminator run.` | Both are **closed by lane-av1444edge**: one class (H1, the 1:4 inter-strip own-chroma-extent gather at `ss (0,0)`), discriminator-run and fixed by `f92776ba` (lane-av1444rect), gated by `a_444_lossy_rect4_strip_stream_decodes_pixel_exact_at_odd_and_wide_geometries`. Adds that the "superres" name in the row was a mislabel — the stream never scaled — and that real 4:4:4 superres coverage is separate and lives here. |
270+
271+---
272+
273+## 6. Scope, and what this lane did not do
274+
275+- **No `decode.rs` edit.** This lane is gates plus one markdown file; the six
276+ other lanes' regions of `decode.rs` are untouched. `git diff 4c973b94..HEAD`
277+ touches only `crates/ec-av1/src/stream.rs` (additive, two new tests and one
278+ shared helper), two new fixtures, and `lanes/`.
279+- **The pre-existing `a_444_lossy_superres_stream_decodes_pixel_exact` (den=12)
280+ is unchanged** and was only used as the shape to copy. All three superres
281+ gates went red under all three mutations and green after revert, which is
282+ also how I know my two new gates are not duplicating an existing claim in a
283+ way that only one of them would notice.
284+- **10/12-bit 4:4:4 superres remains unmeasured** (§5, line 492). Encoding it
285+ needs a 12-bit 4:4:4 source smooth enough to avoid the screen-tools refusal
286+ (H6) and a denominator that survives it — a separate lane.
287+- **den=16 (coded 128x128) remains ungated.** It is measured byte-exact
288+ (inherited) but degenerate — coded width equals the SB grid — so it is the
289+ weakest of the four as an exactness claim. Recorded, not dropped.
290+- No suite run beyond the three named gates. Full validation is Main's, once,
291+ after all subagents land.
292+
293+## 7. Handed on
294+
295+- **Main** — the five line-level corrections in §5 plus the two consistency
296+ fixes; `e47d8f60` is additive and merges independently of any decode-path
297+ work. Merge-order note: this branch is cut from `4c973b94`, which does **not**
298+ contain the `lanes/av1formatsweep.report.md` that landed on `main` via
299+ `f566862a`, so the report file was taken from `main` into this branch and
300+ edited here. Expect a content conflict on that one file at merge time; the
301+ intent is that this branch's version wins for the corrected lines.
lanes/merge-wave-2.report.mdadded+204 -0
@@ -0,0 +1,204 @@
1+# Merge wave 2 — 13 lanes into `main`
2+
3+Base `main` = `298f75c4` (= `origin/main` at open). Every lane is merged
4+`--no-ff` as its own commit, in the order the review pass fixed. Nothing was
5+pushed. `CARGO_TARGET_DIR=$HOME/.cache/cargo-target`, `TMPDIR=$HOME/.cache/tmp`.
6+
7+## Result
8+
9+| # | branch | tip merged | conflicts resolved how | files touched |
10+|---|--------|-----------|------------------------|---------------|
11+| 1 | `lane-av1chrtx` | `ea97eb0c` → `e443a86e` | none (auto-merged; `cargo check` clean) | `decode.rs` +310/-11, `stream.rs` +239, `fixtures/444_rect_strip_leaf_tx_type.obu` (26839 B), `lanes/av1chrtx.report.md`, `lanes/av1readcensus.report.md` |
12+| 2 | `lane-av1skipfix` | `960be978` → `5e9c7715` | none | `refusal_inventory.rs`, `stream.rs` (902 chg), `ec-flac/tests/xiph_vectors.rs`, `ec-h264/tests/conformance.rs`, `ec-opus/tests/conformance.rs`, `scripts/link-fixtures.sh`, `lanes/av1skipfix.report.md`, `lanes/COMMON-20260901.md` |
13+| 3 | `lane-av1gates444` | `555c83f3` → `0eb19c11` | none | `stream.rs` +230, `lanes/av1gates444.report.md` |
14+| 4 | `lane-av1mutproof` | `ffd8d138` → `10db0dc2` | none — report-only lane | `lanes/av1mutproof.report.md` |
15+| 5 | `lane-av1toolgates` | `4c4bd3e2` → `962945ce` | none | `stream.rs` +332 |
16+| 6 | `lane-av1tilemeasure` | `df1370dd` → `b4c45166` | none | `stream.rs` +492, `lanes/av1tilemeasure.report.md` |
17+| 7 | `lane-av1superhbd` | `a2da03e4` → `e96de012` | none | 5 new pins (`…_d12_10bit` 15803 B, `_d12_12bit` 11023 B, `_d9_12bit` 13015 B, `…_mode2_…_10bit` 17776 B, `_12bit` 14656 B), `stream.rs` +409, `lanes/av1superhbd.report.md` |
18+| 8 | `lane-av1pins` | `44a05b40` → `7f8817cb` | **1 competing edit** in `stream.rs` — see below | 3 new pins (`golden3-pin.obu` 159 B, `ll444-lossless-key.obu` 7845 B, `sbpart-pin.obu` 238 B), `stream.rs` +243/-84, `lanes/av1pins.report.md` |
19+| 9 | `lane-av1distwtd` | `1aaf7e0b` → `a5867794` | **add/add at the tail of `mod tests`** — both sides kept, one closing brace re-inserted. Plus a **foreign worktree leak** caught mid-merge. | `decode.rs` +34, `gate_coverage.rs` +390/-40, `stream.rs` +226, `lanes/av1distwtd.report.md` |
20+| 10 | `lane-av1dualfilter10` | `c2b969c8` → `764ba257` | none (contains `1aaf7e0b`, so only its own delta lands) | `stream.rs` +92/-3, `lanes/av1dualfilter10.report.md` |
21+| 11 | `lane-av1lm444loss` | `9249442f` → `9a9e3674` | none — `decode.rs` regions are disjoint from `chrtx` and `distwtd` | `decode.rs` +81/-6, `stream.rs` +122, `lanes/av1lm444loss.report.md` |
22+| 12 | `lane-whtshape` | `f541d062` → `afa13bcf` | **2 interleaved add/add hunks** — resolved by construction, see below | `fixtures/ll444_sb64_1to4_lossless.obu` (51107 B), `decode.rs` +256/-45, `stream.rs` +200, `transform.rs` +223/-?, `lanes/whtshape.report.md` |
23+| 13 | `lane-av1superpin` | `9646f74d` → tip (see note) | **2 comment/add hunks in `decode.rs` (main's text kept), interleaved add/add in `stream.rs` (reconstructed), add/add in `lanes/av1formatsweep.report.md` (superpin + spliced row), one byte-identical duplicate gate deleted** — see below | 5 new pins, `decode.rs`, `stream.rs` +932 net, `lanes/av1444edge.report.md`, `lanes/av1formatsweep.report.md`, `lanes/av1superpin.report.md`, `gate_coverage.rs` (retirement reconciliation), `lanes/merge-wave-2.report.md` |
24+
25+Row 13's merge commit cannot name its own hash inside itself; the authoritative
26+chain is `git log --first-parent 298f75c4..HEAD` and row 13 is the tip.
27+
28+## Conflict resolutions, in detail
29+
30+### 8 — `lane-av1pins` vs `lane-av1skipfix`: competing edits, not add/add
31+
32+Both lanes rewrote the same arm of
33+`a_real_aomenc_lossless_444_key_frame_decodes_sample_exact`.
34+
35+* ours (`skipfix`): read the pin from the **gitignored root** `fixtures/`
36+ through `pin_dir()`, with an opt-in `EC_REQUIRE_FIXTURES` /
37+ `EC_AV1_REQUIRE_AOMENC` hard fail.
38+* theirs (`pins`): read the pin that **this same merge commits**, through the
39+ new `crate_pin()`, but with a bare `SKIP` — i.e. exactly the
40+ report-green-having-decoded-nothing defect `skipfix` exists to close.
41+
42+Resolution: **theirs' committed-pin path and provenance comment, plus ours'
43+no-silent-green intent made unconditional.** The committed pin is read through
44+`CARGO_MANIFEST_DIR` and a missing file panics with the regeneration recipe.
45+That is strictly stronger than the opt-in env fail — there is no environment
46+left to escape — and it is what `lane-av1skipfix`'s own later commit
47+`f385963f` independently concluded. Not `@both`: the two sides are the same
48+statement.
49+
50+Marker surgery alone was not enough here: the hoisted shared `};` left an
51+orphan after the replacement, which surfaced as
52+`unexpected closing delimiter … 45608` (the marker-free-corruption shape).
53+Removed explicitly.
54+
55+### 9 — `lane-av1distwtd`: add/add at the tail, plus a foreign leak
56+
57+`stream.rs`: both lanes append `#[test]` fns at the end of `mod tests`, so this
58+is the classic add/add — **both sides kept**. Git hoisted the shared trailing
59+` }` / `}` out of the hunk, so ours' last test needed its closing ` }`
60+re-inserted between the two blocks.
61+
62+A **foreign uncommitted edit** appeared in the primary checkout while this merge
63+was in flight: 465 lines added to `gate_coverage.rs` carrying
64+`lane-av1txsearch`'s `bound_values` / `spelling_values` / `resolved_on_state` /
65+`is_ident_byte` — four functions this merge had just added, so the file
66+silently compiled to a **duplicated** set and failed with four borrow/type
67+errors and no conflict marker anywhere. It was preserved (byte copy below),
68+the merge result restored from the index, and `cargo check --all-targets`
69+re-run. Also present: an untracked `lanes/av1mergecheck.report.md` from a
70+sibling read-only review pass, which was swept out of this merge's tree
71+after an `--amend` and left untracked for its owner.
72+
73+### 12 — `lane-whtshape`: two interleaved hunks
74+
75+Both lanes append at the same tail anchor and git produced two conflict regions
76+that split **ours' last gate mid-statement** — the `<<<<<<<`/`=======` surgery
77+does not apply. Resolved by construction instead: this lane's `stream.rs`
78+delta against its merge base is a **single 199-line block appended at the
79+tail** (`@@ -43597,4 +43597,203 @@`, 199 added lines, 0 removed), so the merged
80+file is HEAD's `stream.rs` verbatim (its closing brace kept) + that block + the
81+module's closing brace. A first attempt stripped one brace too many and
82+produced an extra `}` at EOF; caught by `cargo check`, fixed.
83+
84+### 13 — `lane-av1superpin`
85+
86+* `decode.rs` (2 hunks, both `@ours`): one comment-only hunk where main's text
87+ is the more informative, and one where theirs simply has no counter —
88+ `INTRABC_RECT4_OWN_CHROMA444_HITS` is a main-only addition from an earlier
89+ lane that superpin's older base predates.
90+* `stream.rs`: same interleaved tail shape as #12. Superpin's delta against its
91+ merge base is 933 added lines at one hunk (plus **one** deleted blank line,
92+ cosmetic), so merged = HEAD verbatim + that block. That block re-adds
93+ `a_444_lossy_rect4_inter_stream_decodes_pixel_exact`, which superpin already
94+ carried from `e10a3b25` (`lane-av1444rect`) and main also has — a
95+ **byte-identical duplicate** (5905 B, extracted and compared, `IDENTICAL`).
96+ The appended copy was deleted; the gate is defined once. All six of
97+ superpin's new gates are present exactly once afterwards.
98+* `lanes/av1formatsweep.report.md` (add/add): **superpin's version**, with the
99+ **§6.2 `130x122` row spliced from `lane-park-av1444edge` @ `a02a2511`** — the
100+ correction that the cell is EXACT 4/4 (bytes 8945, sha `c87ac65b…`), the same
101+ H1 1:4-inter-strip class, closed by `lane-av1444rect`'s `f92776ba`, which is
102+ an ancestor of main. The original measurement text is **kept inside** the row
103+ (`was "DIVERGENT from f3, 11521 samples, first (f3, s2208) = Y(128,16)"; now
104+ EXACT 4/4`), not deleted. The rest of `a02a2511` was **not** merged.
105+* `gate_coverage.rs`: the wave-wide retirement reconciliation — see below.
106+
107+### `gate_coverage.rs` — the union of retirements
108+
109+Resolution applied across the wave, and the two lists are now **empty**, which
110+is what the census derives:
111+
112+| entry | retired by | depth |
113+|-------|-----------|-------|
114+| `enable-dist-wtd-comp` | `a_distance_weighted_compound_stream_decodes_pixel_exact` (asserts the parsed `enable_jnt_comp`, and `dist_wtd_comp_hits() > 0`) | 8-bit |
115+| `enable-dual-filter` | `a_real_aomenc_dual_filter_obmc_8x8_inter_sequence_decodes_pixel_exact` + `dual_filter_diff_hits()` arrival assert | 8-bit |
116+| `enable-dual-filter` | `a_real_aomenc_10bit_dual_filter_obmc_8x8_inter_sequence_decodes_pixel_exact` (`lane-av1dualfilter10`) | 10-bit |
117+| `enable-flip-idtx` | `a_real_aomenc_stream_with_a_1d_tx_class_on_a_rect_transform_…` (`compared_class1 > 0`); detector fix — `covers_both_depths` now recognises the pair-of-pixel-formats marker | 8-bit |
118+| `enable-rect-tx` | `a_real_aomenc_{8,10}bit_stream_with_a_rect_transform_decodes_pixel_exact` (`lane-av1toolgates`); witness is the parsed shape (`rect_partition_hits` / `rect_coeff_tu_hits`), not the flag — the flag has no sequence-header bit | 8- and 10-bit |
119+
120+`TOOL_UNIVERSE` keeps all 26 tools, `enable-rect-tx` included. The test was
121+**not** weakened. Measured before the edit (the real red, not an assumed one):
122+
123+```
124+the 8-bit list still names ["enable-rect-tx"], but a 8-bit gate now passes `=1` for them
125+the 10-bit list still names ["enable-dual-filter", "enable-rect-tx"], …
126+```
127+
128+After: `print_never_exercised_per_bit_depth` reports **255 real-aomenc gate
129+bodies, NEVER_EXERCISED derived EMPTY at 8 bits and at 10 bits (0 of 26)**.
130+
131+> A stale-binary trap worth naming: the first census run in this wave reported
132+> `145 gates / 4 of 26 / 2 of 26` and `gate_coverage` **passed 9/9**. That was a
133+> test binary built from a mid-reconstruction `stream.rs`, not the merged tree.
134+> `include_str!("stream.rs")` is compile-time, so a `cargo check` does not
135+> refresh it — only a real `cargo test` rebuild does. Re-running after
136+> `touch crates/ec-av1/src/gate_coverage.rs` gave 255 gates and the two genuine
137+> failures above.
138+
139+## Duplicate fixtures
140+
141+Measured after merge 13: `crates/ec-av1/fixtures/` holds **63 files, 63
142+distinct sha256 prefixes — zero duplicates**, so the deletion clause did not
143+fire. Checked in particular: superpin's `444_lossy_superres_256x128_d12.obu`
144+(14808 B, sha `450caa3e…`) versus `lane-park-av1444edge`'s rename target
145+`444_lossy_superres_random_256x128.obu` (sha `c18496cf…`) — different bytes,
146+and the rename lives only in the unmerged `a02a2511`, so nothing collides.
147+
148+## Verification actually run
149+
150+```
151+cargo check -p ec-av1 after EVERY merge → clean
152+cargo check -p ec-av1 --all-targets after EVERY merge → clean
153+bash /tmp/losscheck.sh <pre> <parentA> <parentB> → LOST empty at EVERY merge
154+cargo test -p ec-av1 --lib -- gate_coverage refusal_inventory
155+ → test result: ok. 25 passed; 0 failed; 0 ignored; 0 measured; 717 filtered out
156+```
157+
158+`losscheck.sh` diffs the `fn a_*` set of the merged `stream.rs` against the
159+union of both parents' sets, in **both** directions, after every merge. Final
160+state: `now=285 union=285`, LOST empty, ADDED empty.
161+
162+`gate_coverage` and `refusal_inventory` are both GREEN on the merged tree, and
163+the census is green because the entries were retired, not because the test was
164+touched. Both `never_exercised_*bit_matches_the_gate_recipes` failures quoted
165+above were observed as real reds immediately before the retirement edit.
166+
167+## Post-merge fix tasks (NOT fixed here)
168+
169+1. **`lane-av1gates444`'s three gates are green on a host with no oracle.**
170+ `a_444_lossy_odd_66x66_…`, `a_444_lossy_odd_130x122_…` and
171+ `a_444_lossy_256x128_…` share the arm
172+ `if !have_aomenc() { eprintln!("SKIP {name}: no aomenc oracle at {} …"); return Vec::new(); }`
173+ in the shared helper `encode_444_lossy_live`. On a host without
174+ `aomenc`/`aomdec` all three return `rc=0` having measured nothing — the
175+ class `gate-blind-to-feature` in its purest form. They need the
176+ `EC_AV1_REQUIRE_AOMENC` hard-fail shape the rest of the crate already uses.
177+2. **`refusal_inventory.rs`'s `gates_that_swallow_a_decode_error_are_declared`
178+ is blind to 354 of 397 arms.** It filters parsed gate names with
179+ `chars().all(|c| c.is_ascii_lowercase() || c.is_ascii_digit() || c == '_')`,
180+ so every arm that emits the interpolated `eprintln!("SKIP {NAME}: {e}")` is
181+ exempt while only the literal-lowercase arms are enforced. The guard must
182+ see the lanes' own new arm shape (the interpolated one), not just the 43
183+ literal spellings.
184+
185+## Left behind on purpose
186+
187+* Branch heads past the dispatched tips, **not merged** (state, not a
188+ recommendation): `lane-av1chrtx` `6cc9ea6f` (report/branch-name + gate-name
189+ fix), `lane-av1skipfix` `b696d485` (commits the 444 lossless key-frame pin at
190+ 7851 B and rewires that gate onto `CARGO_MANIFEST_DIR` — note this is a
191+ **different regeneration** from the 7845 B pin `lane-av1pins` committed, so
192+ merging both would put two same-recipe pins in the crate),
193+ `lane-av1lm444loss` `5519aaf8` (ss-aware chroma geometry + lossless TX_4X4
194+ raster — the follow-on lead (b) the report's appendix names as open).
195+* `lane-park-av1444edge` @ `a02a2511`: only the §6.2 row was taken. Its
196+ remaining r4 work (`84846129`'s `a_444_superres_arm` gates, superseded by
197+ superpin's; `bb44ddd0`'s sweep corrections) is **not** merged.
198+* Foreign files preserved, not committed:
199+ `~/.cache/merge-wave-2-keep/gate_coverage.rs.lane-av1txsearch-leak` and
200+ `~/.cache/merge-wave-2-keep/av1mergecheck.report.md.foreign`. The latter is
201+ still untracked in the worktree for its owner.
202+
203+**No push was performed.** `main` is ready to push from `298f75c4` + these 13
204+merge commits.