forge
Explore
Log in

Don't you dare go Hollow

Merge branch 'lane-sbrect10' (9f1f108) into lane-sqdrift: 64-axis intra blocks read the no-CFL uv_mode alphabet

Browse files at this commit

3cff0d9578ba5da724ba68f8637fdeb3d6e9ffacAhmet Kaan GümüşParent: 4fb276c0ecdfcb
crates/ec-av1/src/decode.rsmodified+57 -5
@@ -1849,6 +1849,20 @@ pub(crate) fn wii_hits() -> usize {
18491849 WII_HITS.with(|c| c.get())
18501850 }
18511851
1852+// lane-sbrect10 r1: how many INTRA blocks read `uv_mode` off the 13-symbol
1853+// NO-CFL alphabet *because their size excludes CFL* (libaom `is_cfl_allowed`:
1854+// wide <= 32 && high <= 32). The witness that a gate stream really carries a
1855+// 64-axis intra block -- the shape whose 14-symbol read desynced every inter
1856+// frame carrying one.
1857+thread_local! {
1858+ static NOCFL_UV_MODE_HITS: std::cell::Cell<usize> = const { std::cell::Cell::new(0) };
1859+}
1860+
1861+/// Current value of [`NOCFL_UV_MODE_HITS`].
1862+pub(crate) fn nocfl_uv_mode_hits() -> usize {
1863+ NOCFL_UV_MODE_HITS.with(|c| c.get())
1864+}
1865+
18521866 // lane-inter4 r4: how many 16x8/8x16 INTER LEAVES actually ran the OBMC
18531867 // blend -- the gate's proof that `--enable-obmc=1` reached this shape (the
18541868 // r3 refusal's replacement: prefilt frames are bit-exact vs an instrumented
@@ -5476,6 +5490,17 @@ fn read_intra_mode_rect(
54765490 }
54775491 };
54785492 }
5493+ // lane-sbrect10 r1: libaom `is_cfl_allowed` (blockd.h) is
5494+ // `block_size_wide <= 32 && block_size_high <= 32` -- enforce it HERE, at
5495+ // the one point every rect caller routes through, so no call site can
5496+ // offer the 14-symbol CFL alphabet on a 64-axis block (class
5497+ // wrong-alphabet-same-value: same value, wrong interval, silent desync).
5498+ let cfl = if cfl && bw.max(bh) > 32 {
5499+ NOCFL_UV_MODE_HITS.with(|c| c.set(c.get() + 1));
5500+ false
5501+ } else {
5502+ cfl
5503+ };
54795504 // Same `intra_segment_id` placement as the square reader above.
54805505 let (seg_w_mi, seg_h_mi) = (bw / 4, bh / 4);
54815506 if seg_id_pre_skip() {
@@ -8411,6 +8436,14 @@ fn read_intra_mode(
84118436 }
84128437 };
84138438 }
8439+ // lane-sbrect10 r1: `is_cfl_allowed`'s <=32 bound, enforced at the single
8440+ // point every square caller routes through (see `read_intra_mode_rect`).
8441+ let cfl = if cfl && side > 32 {
8442+ NOCFL_UV_MODE_HITS.with(|c| c.set(c.get() + 1));
8443+ false
8444+ } else {
8445+ cfl
8446+ };
84148447 // spec 5.11.6 `intra_frame_mode_info`: `intra_segment_id` is read BEFORE
84158448 // `skip` when `SegIdPreSkip`, and after it otherwise.
84168449 let (seg_w_mi, seg_h_mi) = (side / 4, side / 4);
@@ -8754,8 +8787,13 @@ fn cfl_scaled(alpha_q3: i32, ac_q3: i32) -> i32 {
87548787 /// matches aomdec's own `ec_dump16` rung byte for byte (crop dims, u16 LE).
87558788 fn dump_stage16(var: &str, y: &PlaneBuf, u: &PlaneBuf, v: &PlaneBuf, fw: usize, fh: usize) {
87568789 use std::io::Write;
8790+ // lane-sbrect10 r2: index the dump by decode-order picture like
8791+ // EC_AV1_PREFILT_DUMP already does -- a fixed `.f0` name kept only the
8792+ // LAST frame, so a mid-sequence divergence could not be read out at all.
8793+ static STAGE16_IDX: std::sync::atomic::AtomicUsize = std::sync::atomic::AtomicUsize::new(0);
87578794 if let Ok(path) = std::env::var(var)
8758- && let Ok(mut f) = std::fs::File::create(format!("{path}.f0"))
8795+ && let idx = STAGE16_IDX.fetch_add(1, std::sync::atomic::Ordering::SeqCst)
8796+ && let Ok(mut f) = std::fs::File::create(format!("{path}.f{idx}"))
87598797 {
87608798 for (p, w, h) in [(y, fw, fh), (u, fw.div_ceil(2), fh.div_ceil(2)), (v, fw.div_ceil(2), fh.div_ceil(2))] {
87618799 for row in 0..h {
@@ -18498,13 +18536,27 @@ fn decode_inter_block(
1849818536 // directional intra-in-inter block was refused above.
1849918537 let (nb_above_mode, nb_left_mode) = neighbours.modes_above_left(r, c);
1850018538 let smooth_neighbor = is_smooth_mode(nb_above_mode) || is_smooth_mode(nb_left_mode);
18501- let uv_mode = dec.symbol(&mut cdfs.uv_mode_cfl[mode]);
18539+ // lane-sbrect10 r1 (class wrong-alphabet-same-value, second instance
18540+ // after lane-sbpart r3's rect strips): `is_cfl_allowed` (libaom
18541+ // `blockd.h` -- `block_size_wide[bsize] <= 32 && block_size_high[bsize]
18542+ // <= 32`, spec 5.11.5) caps CFL at 32x32, so a 64x64 intra block inside
18543+ // an INTER frame reads the 13-symbol `uv_mode_no_cfl` alphabet. Reading
18544+ // the 14-symbol CFL one gave the same DC_PRED VALUE but narrowed the
18545+ // arithmetic coder by the wrong interval, desyncing the tile from this
18546+ // block on.
18547+ let cfl_allowed = write_w.max(write_h) <= 32;
18548+ if !cfl_allowed {
18549+ NOCFL_UV_MODE_HITS.with(|c| c.set(c.get() + 1));
18550+ }
18551+ let uv_mode = if cfl_allowed {
18552+ dec.symbol(&mut cdfs.uv_mode_cfl[mode])
18553+ } else {
18554+ dec.symbol(&mut cdfs.uv_mode_no_cfl[mode])
18555+ };
1850218556 if (9..=12).contains(&uv_mode) {
1850318557 SMOOTH_UV_HITS.with(|c| c.set(c.get() + 1));
1850418558 }
18505- let alpha = if uv_mode == DC_PRED {
18506- None
18507- } else if uv_mode == UV_CFL_PRED {
18559+ let alpha = if cfl_allowed && uv_mode == UV_CFL_PRED {
1850818560 Some(read_cfl_alphas(dec, cdfs))
1850918561 } else {
1851018562 None
crates/ec-av1/src/motion_field.rsmodified+9 -0
@@ -442,6 +442,15 @@ pub fn setup_motion_field(
442442 );
443443 }
444444
445+ if std::env::var_os("EC_TRACE_TPL").is_some() {
446+ eprintln!("EC_TPL_FIELD oh={cur_order_hint} rows={rows} cols={cols}");
447+ for r in 0..rows {
448+ let row: String = (0..cols)
449+ .map(|c| if cells[r * cols + c].is_some() { '#' } else { '.' })
450+ .collect();
451+ eprintln!("EC_TPL_FIELD r{r} {row}");
452+ }
453+ }
445454 TplField { cols, rows, cells }
446455 }
447456
crates/ec-av1/src/stream.rsmodified+181 -7
@@ -6563,13 +6563,16 @@ mod tests {
65636563 // refusal it names is GONE (this round codes a 64-px transform axis as
65646564 // its truncated low-32 corner), and a 10-bit sweep of this exact
65656565 // recipe now reaches the arm -- 2 pixel-exact attempts, 2 64x32 and 2
6566- // 32x64 strips, 2 of them carrying a coded 64-axis residual. It stays
6567- // 8-bit here for a DIFFERENT, newly exposed reason: 10-bit attempt 14
6568- // (cq 61, horizontal split, motion step 12) mismatches ffmpeg while
6569- // decoding ZERO superblock-level rect strips and zero 64-axis
6570- // residual units, i.e. a defect of some other shape that this gate
6571- // must not absorb. See lanes/r14-r2.report.md.
6572- for bit_depth in [8u32] {
6566+ // 32x64 strips, 2 of them carrying a coded 64-axis residual.
6567+ // lane-sbrect10 r1 closed the newly exposed 10-bit defect r14 r2
6568+ // parked this arm on (10-bit attempt 14, cq 61, horizontal split,
6569+ // motion step 12 -- it mismatched ffmpeg while decoding ZERO rect
6570+ // strips): a 64x64 INTRA block inside an inter frame read `uv_mode`
6571+ // off the 14-symbol CFL-allowed alphabet, which libaom's
6572+ // `is_cfl_allowed` caps at 32x32 -- same DC_PRED value, wrong
6573+ // interval narrowing, tile desynced from that block on. Both depths
6574+ // run now.
6575+ for bit_depth in [8u32, 10u32] {
65736576 let (mut named_refusals, mut matched, mut out_of_scope, mut oos_mismatch) =
65746577 (0u32, 0u32, 0u32, 0u32);
65756578 let (mut horz_proved, mut vert_proved) = (0usize, 0usize);
@@ -6724,6 +6727,177 @@ mod tests {
67246727 }
67256728 }
67266729
6730+ /// lane-sbrect10 r1: a 64x64 INTRA block inside an INTER frame, whose
6731+ /// `uv_mode` alphabet libaom's `is_cfl_allowed` (`blockd.h`: `wide <= 32
6732+ /// && high <= 32`) narrows to the 13-symbol NO-CFL table. Reading the
6733+ /// 14-symbol CFL one produced the same `DC_PRED` value with the wrong
6734+ /// interval narrowing, so the tile desynced from that block on and the
6735+ /// frame decoded silently wrong (class `wrong-alphabet-same-value`; found
6736+ /// as the "another shape" mismatch the superblock rect gate above had to
6737+ /// park its 10-bit arm on).
6738+ ///
6739+ /// The counter `nocfl_uv_mode_hits` proves the shape fired in EVERY
6740+ /// compared attempt, and every decode-order frame is compared against
6741+ /// ffmpeg -- an attempt that mismatches fails, it never SKIPs.
6742+ ///
6743+ /// lane-sbrect10 r2: with the half-random source below this gate also
6744+ /// covers a SECOND defect it exposed at 10-bit cq 58/61 -- the compound
6745+ /// MV stack's extension pass zero-filled the `comp_list` tail slots
6746+ /// libaom fills with each side's GLOBAL MOTION vector
6747+ /// (`combine_compound_candidates`, mvref_common.c:723-729). A compound
6748+ /// block with no usable neighbour pair (frame top row, intra block to
6749+ /// its left, empty temporal field) then took a `(0, 0)` predictor
6750+ /// instead of the frame's translation: 32890/39907 wrong luma samples
6751+ /// on decode-order frame 2 with the entropy stream still in sync.
6752+ #[test]
6753+ fn a_real_aomenc_inter_frame_with_a_64x64_intra_block_reads_the_no_cfl_uv_alphabet() {
6754+ const NAME: &str =
6755+ "a_real_aomenc_inter_frame_with_a_64x64_intra_block_reads_the_no_cfl_uv_alphabet";
6756+ let _gate_lock = lock_gate_counters();
6757+ if !have_ffmpeg() {
6758+ eprintln!("SKIP {NAME}: no ffmpeg");
6759+ return;
6760+ }
6761+ if !have_aomenc() {
6762+ eprintln!("SKIP {NAME}: no aomenc at {}", aomenc_path().display());
6763+ return;
6764+ }
6765+ let (width, height, frame_count) = (192usize, 128usize, 6usize);
6766+ for bit_depth in [8u32, 10u32] {
6767+ let (mut named_refusals, mut matched, mut carried_none) = (0u32, 0u32, 0u32);
6768+ let mut total_hits = 0usize;
6769+ for attempt in 0..16u32 {
6770+ // The sibling superblock-rect gate's own grid (its 10-bit
6771+ // attempt 14 -- cq 61, horizontal split, motion step 12 -- is
6772+ // the stream that exposed the defect); which superblock the RD
6773+ // hands an intra 64x64 block moves with the quantiser and the
6774+ // depth, so both orientations x four quantisers x two motion
6775+ // steps run here too.
6776+ let vertical_split = attempt % 2 == 1;
6777+ let cq = [58, 52, 45, 61][(attempt / 2 % 4) as usize];
6778+ let sp = 8 + (attempt / 8) * 4;
6779+ // Half ramp, half deterministic pseudo-noise: the flat "200"
6780+ // half of r1's source made aomenc code the right-hand
6781+ // superblocks skip, so at 8 bit no >32 intra block ever
6782+ // appeared (probed cq 45/52/58/61/63 = 0 hits). The textured
6783+ // half forces intra above 32x32 in an inter frame at BOTH
6784+ // depths, so both arms carry the shape.
6785+ let geq = if vertical_split {
6786+ format!(
6787+ "if(lt(Y,64), 40+mod(floor((X+N*{sp})/32)*90,200), mod((X*7+Y*13+N*97)*31,256))"
6788+ )
6789+ } else {
6790+ format!(
6791+ "if(lt(X,128), 40+mod(floor((Y+N*{sp})/32)*90,200), mod((X*7+Y*13+N*97)*31,256))"
6792+ )
6793+ };
6794+ let duration = frame_count as f64 / 25.0;
6795+ let source = format!(
6796+ "color=c=gray:s={width}x{height}:d={duration}:r=25,format=gray,\
6797+ geq=lum='{geq}',format=yuv420p"
6798+ );
6799+ let pix_fmt = if bit_depth == 10 { "yuv420p10le" } else { "yuv420p" };
6800+ let y4m = Command::new("ffmpeg")
6801+ .args([
6802+ "-v", "error", "-f", "lavfi", "-i", &source, "-t", &duration.to_string(),
6803+ "-pix_fmt", pix_fmt, "-strict", "-1", "-f", "yuv4mpegpipe", "-",
6804+ ])
6805+ .stdin(Stdio::null())
6806+ .stdout(Stdio::piped())
6807+ .stderr(Stdio::piped())
6808+ .output()
6809+ .expect("ffmpeg failed to run");
6810+ assert!(
6811+ y4m.status.success(),
6812+ "{NAME}: ffmpeg refused the {bit_depth}-bit fixture: {}",
6813+ String::from_utf8_lossy(&y4m.stderr)
6814+ );
6815+ let cq_arg = format!("--cq-level={cq}");
6816+ let depth_arg = format!("--bit-depth={bit_depth}");
6817+ let input_depth_arg = format!("--input-bit-depth={bit_depth}");
6818+ let args: Vec<&str> = vec![
6819+ "--codec=av1", "--passes=1", "--end-usage=q", &cq_arg, "--cpu-used=0",
6820+ "--threads=1", "--row-mt=0", "--sb-size=64", &depth_arg, &input_depth_arg,
6821+ "--enable-restoration=0", "--enable-palette=0", "--deltaq-mode=0",
6822+ "--enable-filter-intra=0", "--enable-cfl-intra=0", "--enable-intrabc=0",
6823+ "--enable-tx-size-search=0", "--lag-in-frames=0",
6824+ "--enable-rect-partitions=1", "--enable-ab-partitions=0",
6825+ "--enable-1to4-partitions=1", "--min-partition-size=32",
6826+ "--max-partition-size=64",
6827+ "--obu", "-o", "-", "-",
6828+ ];
6829+ let mut child = Command::new(aomenc_path())
6830+ .args(&args)
6831+ .stdin(Stdio::piped())
6832+ .stdout(Stdio::piped())
6833+ .stderr(Stdio::piped())
6834+ .spawn()
6835+ .expect("aomenc failed to start");
6836+ child
6837+ .stdin
6838+ .take()
6839+ .expect("aomenc stdin")
6840+ .write_all(&y4m.stdout)
6841+ .expect("writing y4m to aomenc");
6842+ let out = child.wait_with_output().expect("aomenc failed to run");
6843+ assert!(
6844+ out.status.success(),
6845+ "aomenc refused the fixture: {}",
6846+ String::from_utf8_lossy(&out.stderr)
6847+ );
6848+ let stream = out.stdout;
6849+ let before = crate::decode::nocfl_uv_mode_hits();
6850+ let frames = match decode_stream(&stream) {
6851+ Err(e) => {
6852+ let msg = e.to_string();
6853+ assert!(
6854+ msg.contains("unsupported"),
6855+ "{NAME} failed outright, not a named refusal ({bit_depth}-bit, \
6856+ attempt {attempt}): {msg}"
6857+ );
6858+ named_refusals += 1;
6859+ eprintln!("{bit_depth}-bit attempt {attempt} refusal: {msg}");
6860+ continue;
6861+ }
6862+ Ok(frames) => frames,
6863+ };
6864+ let hits = crate::decode::nocfl_uv_mode_hits() - before;
6865+ let ffmpeg_frames = if bit_depth == 10 {
6866+ ffmpeg_decode_sequence_10bit(&stream, width, height, frame_count)
6867+ } else {
6868+ ffmpeg_decode_sequence(&stream, width, height, frame_count)
6869+ };
6870+ assert_eq!(frames.len(), frame_count);
6871+ if hits == 0 {
6872+ // No 64-axis intra block in this stream: still compared
6873+ // (a mismatch here is a defect, never a pass), just not
6874+ // proof of this gate's shape.
6875+ carried_none += 1;
6876+ }
6877+ for (i, (got, want)) in frames.iter().zip(&ffmpeg_frames).enumerate() {
6878+ assert_eq!(got.y, want.y, "{NAME} frame {i} luma vs ffmpeg (attempt {attempt}, {bit_depth}-bit, hits={hits})");
6879+ assert_eq!(got.u, want.u, "{NAME} frame {i} U vs ffmpeg (attempt {attempt}, {bit_depth}-bit, hits={hits})");
6880+ assert_eq!(got.v, want.v, "{NAME} frame {i} V vs ffmpeg (attempt {attempt}, {bit_depth}-bit, hits={hits})");
6881+ }
6882+ if hits > 0 {
6883+ matched += 1;
6884+ total_hits += hits;
6885+ }
6886+ }
6887+ eprintln!(
6888+ "{NAME} ({bit_depth}-bit): {named_refusals} named refusals, {matched} pixel-exact \
6889+ attempts carrying a >32 intra block ({total_hits} no-CFL uv_mode reads), \
6890+ {carried_none} attempts carried none"
6891+ );
6892+ assert!(
6893+ matched > 0 && total_hits > 0,
6894+ "{NAME} ({bit_depth}-bit): no attempt decoded an intra block above 32x32, so the \
6895+ no-CFL uv_mode alphabet was never exercised -- gate proved nothing \
6896+ ({named_refusals} refusals, {carried_none} attempts carried none)"
6897+ );
6898+ }
6899+ }
6900+
67276901 /// lane-inter4 r2: the 32x32-level inter `PARTITION_HORZ`/`PARTITION_VERT`
67286902 /// strips (32x16 / 16x32) carrying a REAL residual -- the capability r1
67296903 /// found missing ("a non-skip rectangular (HORZ/VERT/HORZ_B) strip needs
lanes/sbrect10-r1.handoff.mdadded+81 -0
@@ -0,0 +1,81 @@
1+# lane-sbrect10 r1 handoff (turn cap)
2+
3+Branch `lane-sbrect10` (worktree `/home/user/Documents/Code/Rust/edith_codecs-sbrect10`),
4+based on lane-r14 a2e2e29 with `main` (7a47fc1) merged in cleanly (merge commit in history).
5+
6+## STATUS: root cause FOUND and FIXED; sibling gate GREEN both depths; the new dedicated gate
7+## still needs an 8-bit fixture (its 8-bit arm currently FAILS "gate proved nothing").
8+
9+## Pinned stream
10+`$HOME/.cache/sbrect10/a14.obu`, sha256 (hashed twice, identical)
11+`e85d3b84180de05cd7af769daa7b4f0662389fe0cbf5f0dc8119e4a036b6cf44`.
12+Regenerate: `bash $HOME/.cache/sbrect10/gen.sh <out>` (192x128, 6 frames, cq 61, 10-bit,
13+horizontal split geq, motion step 12 = the sibling gate's 10-bit attempt 14).
14+
15+## First mismatch (before the fix)
16+decode-order frame 2 (display == decode order, `--lag-in-frames=0`), plane Y, 15973/24576 luma
17+samples + 874 V; frames 0 and 1 exact. Per-64x64-SB wrong-pixel map row0 = [128, 332, 3931],
18+row1 = [3912, 3728, 3942]; SB(0,0)'s 128 are rows 62-63 only (deblock bleed from below).
19+
20+## Range ladder (EC_TRACE_MODE / EC_TRACE_MODE_STEP / EC_TRACE_COEFF / EC_AV1_TELL vs
21+## instrumented aomdec `~/.cache/aom-oracle/build/aomdec`)
22+- Partition symbols: 40/40 identical (values + positions) -> no rect strips anywhere, every
23+ inter SB is PARTITION_NONE 64x64. Confirms the sibling gate's "zero rect strips" note.
24+- Our `TELL label=post_interp_filter range=` equals aomdec's `EC_MODE_VAL ... rng=` for every
25+ inter block up to the divergence (frame 2 block mi(0,16): both 61730). Mode info in sync.
26+- First diverging element: frame 2, block mi_row=0 mi_col=32 (SB(0,2), x=128..191), which BOTH
27+ decoders read as INTRA inside an inter frame (`is_inter=false`, our TELL post_is_inter
28+ range=42400). aomdec then reads its luma TU with entry rng=38192 and all_zero=1; ours reached
29+ all_zero=0 at rng=63221 with eob=56 -> desync inside that block's intra mode syntax.
30+- Root cause: `uv_mode` was read off the 14-symbol CFL-allowed CDF (`cdfs.uv_mode_cfl`) on a
31+ 64x64 block. libaom `is_cfl_allowed` (blockd.h, spec 5.11.5) = `block_size_wide <= 32 &&
32+ block_size_high <= 32`, so the real alphabet is the 13-symbol `uv_mode_no_cfl`. Same DC_PRED
33+ VALUE, wrong interval narrowing -> silent desync (class `wrong-alphabet-same-value`, second
34+ instance after lane-sbpart r3).
35+
36+## Fix (committed)
37+- `crates/ec-av1/src/decode.rs` intra-in-inter block path: `cfl_allowed = write_w.max(write_h)
38+ <= 32`, picks `uv_mode_no_cfl`, and gates the `cfl_alphas` read.
39+- Same rule enforced ONCE at the head of `read_intra_mode_rect` and `read_intra_mode`
40+ (`let cfl = cfl && bw.max(bh) <= 32` / `side <= 32`), so no caller can offer CFL above 32.
41+- New counter `NOCFL_UV_MODE_HITS` / `decode::nocfl_uv_mode_hits()` fires exactly when the
42+ size rule removed CFL.
43+- Result on the pinned stream: all 6 frames byte-identical to `ffmpeg -pix_fmt yuv420p10le`
44+ (was [0,0,16847,23688,19028,17491] wrong samples).
45+
46+## Gates
47+- `a_real_aomenc_inter_sequence_with_a_superblock_level_rect_partition_decodes_pixel_exact`
48+ flipped to `[8u32, 10u32]` and is GREEN: 8-bit 2 refusals / 4 pixel-exact carrying the arm /
49+ 64x32=4 / 32x64=4 / 64-axis TUs=2 / 10 out-of-scope with 0 mismatches; 10-bit 2 refusals /
50+ 2 carrying / 64x32=2 / 32x64=2 / 64-axis TUs=2 / 12 out-of-scope with 0 mismatches.
51+- NEW dedicated gate `a_real_aomenc_inter_frame_with_a_64x64_intra_block_reads_the_no_cfl_uv_alphabet`
52+ (stream.rs, just above the lane-inter4 32x32 rect gate): 16-attempt grid, both depths, every
53+ decode-order frame compared, asserts `nocfl_uv_mode_hits` moved. 10-bit arm passes; the
54+ **8-bit arm FAILS** ("no attempt decoded an intra block above 32x32") -- with the smooth
55+ translating source aomenc never picks a >32 intra block in an inter frame at 8 bit
56+ (probed cq 45/52/58/61/63, with and without `noise=all_seed=7:alls=30`: 0 hits every time).
57+
58+## Exact next step (measured, ready to paste)
59+Replace the gate's source with the half-random fixture, which DOES produce the shape at 8 bit:
60+`geq=lum='if(lt(X,128), 40+mod(floor((Y+N*12)/32)*90,200), mod((X*7+Y*13+N*97)*31,256))'`
61+Probe results (`$HOME/.cache/sbrect10/probe.sh <geq> <cq> <depth> <extra>`, counts >32
62+intra-in-inter blocks and pixel diffs vs ffmpeg):
63+ 8-bit cq52: 4 hits but DECODE-ERR (named refusal) | cq58: 2 hits, 0 pixel diffs |
64+ cq61: 3 hits, 0 pixel diffs
65+ 10-bit cq52: 6 hits, 0 diffs | cq58: 7 hits, **32890 diffs** | cq61: 7 hits, **39907 diffs**
66+So: use cq 58/61 for the 8-bit arm, cq 52 for the 10-bit arm, OR (better) treat the 10-bit
67+cq58/cq61 half-random mismatch as the NEXT defect of this lane -- it is a real, reproducible
68+10-bit failure on a stream this decoder does not refuse, and it is NOT the CFL bug (that one is
69+fixed). Triage it with the same ladder (EC_AV1_TELL post_interp_filter vs aomdec EC_MODE_VAL,
70+then EC_TRACE_COEFF entry ranges).
71+Then: full suite via
72+`systemd-run --user --unit=sbrect10-suite-$(date +%s) -p MemoryMax=10G --same-dir bash -lc 'EC_NOMEMGUARD=1 EC_AV1_REQUIRE_AOMENC=1 CARGO_TARGET_DIR=$HOME/.cache/cargo-target-sbrect10 nice -n 10 cargo test -p ec-av1 --lib -j3 > $HOME/.cache/sbrect10-suite-r1.log 2>&1'`
73+(NOT run yet this round), then `lanes/sbrect10-r1.report.md`.
74+
75+## Ruled out
76+- Rect partitions / 64-axis residual: zero of both in the failing stream (partition trace 40/40
77+ identical), so the sibling gate's "another shape" note was correct.
78+- MV stack, motion_mode alphabet, interp filter, interintra: all exonerated by the
79+ post_motion_mode / post_interp_filter range equality with aomdec on every block up to the
80+ diverging one.
81+- Encoder-recipe doubt: stream hashes identical across two generations.
lanes/sbrect10-r2.handoff.mdadded+175 -0
@@ -0,0 +1,175 @@
1+# lane-sbrect10 r2 handoff
2+
3+Branch `lane-sbrect10`, tip `2b9709c` (worktree
4+`/home/user/Documents/Code/Rust/edith_codecs-sbrect10`).
5+Commits this round: `3a9e83e` (merge main 18bf7dc) + `2b9709c` (the fix + gate + instrumentation).
6+
7+## STATUS: root cause FOUND and FIXED; pinned stream now byte-exact on all 6 probe arms.
8+## Only thing outstanding: the full suite result (armed, was at 340 tests / 0 failures).
9+
10+## 1. Merge state (done, clean)
11+`git merge --no-commit main` (main = 18bf7dc: r14 a2e2e29 + sb128 5ea5ec8) auto-merged
12+decode.rs + stream.rs with no conflicts. Verified before committing:
13+- `git diff main -- crates/ec-av1/src/cdf.rs` EMPTY and `... refusal_inventory.rs` EMPTY, so the
14+ NZ_MAP / FILTER_INTRA rows and the refusal list are byte-identical to main.
15+- The only lines the merged tree removes vs main are the lane's own r1 hunks (4 `uv_mode_cfl`
16+ lines in decode.rs, the `[8u32]` arm + its comment in stream.rs). Main's deletions all kept.
17+
18+## 2. Gate fixture state (done)
19+`a_real_aomenc_inter_frame_with_a_64x64_intra_block_reads_the_no_cfl_uv_alphabet` (stream.rs)
20+now uses the half-random source in BOTH orientations:
21+
22+ horizontal: if(lt(X,128), 40+mod(floor((Y+N*sp)/32)*90,200), mod((X*7+Y*13+N*97)*31,256))
23+ vertical: if(lt(Y,64), 40+mod(floor((X+N*sp)/32)*90,200), mod((X*7+Y*13+N*97)*31,256))
24+
25+r1's flat `200` half made aomenc code the right-hand superblocks skip, so the 8-bit arm saw 0
26+intra-above-32x32 blocks (probed cq 45/52/58/61/63). Grid `[58, 52, 45, 61]` x 2 orientations x
27+2 motion steps x 2 depths unchanged; counters are read on decoded+compared attempts only, every
28+decode-order frame is compared on Y/U/V, a mismatch fails and never SKIPs.
29+
30+## 3. The 10-bit defect: root cause, libaom line, fix
31+Pinned stream `$HOME/.cache/sbrect10/b58.obu`, sha256 hashed TWICE identical
32+`00b9253b308201118e27f348c67932a0006e3077ba7a9a401854c2ee7eb1dcd2`
33+(192x128, 6 frames, 10-bit cq58, `--sb-size=64 --min-partition-size=32 --max-partition-size=64
34+--enable-rect-partitions=1 --enable-1to4-partitions=1 --lag-in-frames=0 --cpu-used=0`;
35+regenerate with `bash $HOME/.cache/sbrect10/probe.sh "<geq>" 58 10`).
36+
37+How it was localised (each step ruled a layer out):
38+- First mismatch DECODE-ORDER frame 2, plane Y only (U/V exact), 8252 samples; per-64x64-SB map
39+ row0 `[0,0,4092]`, row1 `[0,64,4096]` = the whole RIGHT superblock column + deblock bleed.
40+- NOT an entropy desync: our `EC_TRACE_COEFF` all_zero ladder vs instrumented aomdec's is
41+ identical for all 180 TUs of the whole stream (`diff` empty), and blocks decoded AFTER the
42+ wrong ones (mi(16,0)) are pixel-exact.
43+- NOT a clamp: an `EC_DBG_CLAMP` probe on the dequant clamp `+-(1 << (7 + bd))` and on every
44+ `clamp_range` in transform.rs fired ZERO times on this stream.
45+- `EC_TRACE_MODE` mv diff, decode-order frame 2: aomdec mi(0,32) mode=24 ref0=1 ref1=4
46+ mv0=(128,-16) / ours (-1,2); mi(0,40), mi(8,32), mi(8,40), mi(16,40) all (128,-16) vs (-1,2);
47+ mi(16,32) (-176,256) vs (-241,264); mi(24,32) (-128,56) vs (-193,64). The
48+ NEAREST_NEARESTMV blocks take stack[0] directly, so libaom's stack[0].this_mv is (128,-16)
49+ where ours is (0,0), and the NEWMV blocks are off by the same predictor delta.
50+- Our stack for mi(0,32) = two entries `this=(0,0) comp=(0,0) w=2` -- the signature of the
51+ compound EXTENSION pass appending comp_list[0] and comp_list[1] into an empty stack.
52+- Frame 2's temporal field really is empty and that is CORRECT (new `EC_TPL_FIELD` occupancy
53+ dump under EC_TRACE_TPL: oh=1,2 all `.`, oh=3,4,5 all `#`; frame 2's LAST projection is
54+ suppressed by `is_lst_overlay` and its LAST2 is the key frame). So the candidate is spatial.
55+
56+ROOT CAUSE: `combine_compound_candidates` (crates/ec-av1/src/mvstack.rs:1482) filled the
57+`comp_list` tail slots -- the ones left after `ref_id` then `ref_diff` -- with `(0, 0)`.
58+libaom fills them with that side's GLOBAL MOTION vector, `setup_ref_mv_list`,
59+`av1/common/mvref_common.c:729`:
60+
61+ for (; comp_idx < MAX_MV_REF_CANDIDATES; ++comp_idx)
62+ comp_list[comp_idx][idx] = gm_mv_candidates[idx];
63+
64+Zero-filling was right only under IDENTITY global motion (the module doc's original reduction);
65+aomenc has `--enable-global-motion` ON by default. A compound block with no usable neighbour
66+pair (frame top row -> no above, 64x64 INTRA block to its left, empty temporal field) therefore
67+took a `(0,0)` predictor where libaom took the frame's translation.
68+
69+FIX: `combine_compound_candidates` takes `gm_mv_candidates: [(i32,i32); 2]` and uses it as the
70+per-side fill; the call site passes `[gm_mv(gm, ref_frame.0), gm_mv(gm, ref_frame.1)]`.
71+
72+SIBLING SWEEP (same shape): every `gm_mv_candidates` use in mvref_common.c was walked. The
73+single-ref tail fill (`:787-788`) is already ported as `gm_fallback` at mvstack.rs:1099-1100;
74+the `is_gm_block` substitutions (`:92`, `:117`) already take `gm` through `scan_*_compound`; the
75+add_tpl_ref_mv GLOBALMV_OFFSET compares (`:379-410`) already use `gm_mv(gm, ...)` on both sides.
76+This was the only zero-filled site in the crate.
77+
78+## 4. Is the pinned stream exact now? YES
79+`probe.sh "<half-random geq>" <cq> <depth>` after the fix, pixel diffs vs
80+`ffmpeg -pix_fmt yuv420p10le` / `yuv420p`, and `>32` intra-in-inter hit counts:
81+
82+| depth | cq 52 | cq 58 | cq 61 |
83+|---|---|---|---|
84+| 8-bit | 5 hits, 0 diffs | 2 hits, 0 diffs | 3 hits, 0 diffs |
85+| 10-bit | 6 hits, 0 diffs | 7 hits, 0 diffs | 7 hits, 0 diffs |
86+
87+Before the fix the 10-bit arms were 32890 (cq58) and 39907 (cq61) wrong samples.
88+
89+## 5. NEXT STEP (the only thing left)
90+Read `$HOME/.cache/sbrect10-suite-r2.log` -- the suite is armed as a user systemd unit
91+(`sbrect10-suite-r2-1788325070.service`, MemoryMax=10G, `cargo test -p ec-av1 --lib -j3`,
92+EC_AV1_REQUIRE_AOMENC=1, CARGO_TARGET_DIR=$HOME/.cache/cargo-target-sbrect10). At handoff it had
93+reached 340 tests with no FAILED line. Check with a single
94+`grep -E "^test result|FAILED" $HOME/.cache/sbrect10-suite-r2.log`; if a gate is red, re-run that
95+gate alone before touching code (another lane rebuilding the shared aomdec shows up as
96+"Os code 13 PermissionDenied"). Then fill the N/0 totals into `lanes/sbrect10-r2.report.md`
97+(section 4 is otherwise complete) and the lane is done.
98+
99+Nothing else is in flight; the worktree is clean at 2b9709c.
100+
101+## 5b. CORRECTION at handoff time -- THE SUITE IS RED (3 gates), details not yet printed
102+The suite unit was still running when this handoff was written; at 343 tests it had THREE
103+FAILED lines (cargo buffers the panic bodies to the end of the run, so no message text yet):
104+
105+ stream::tests::a_real_aomenc_inter_frame_with_a_64x64_intra_block_reads_the_no_cfl_uv_alphabet ... FAILED
106+ stream::tests::a_real_aomenc_inter_sequence_with_a_superblock_level_rect_partition_decodes_pixel_exact ... FAILED
107+ stream::tests::a_real_aomenc_stream_with_film_grain_decodes_pixel_exact ... FAILED
108+
109+So the lane is RED, not green. Do NOT treat section 4's probe table as a suite result: it proves
110+only the 6 probed (geq, cq, depth) points, not the gates' own 16-attempt grids.
111+
112+Triage order for the next round:
113+1. `grep -A 30 "^failures:" $HOME/.cache/sbrect10-suite-r2.log` for the three panic bodies.
114+2. `a_real_aomenc_stream_with_film_grain_decodes_pixel_exact` is the loudest signal: it touches
115+ NEITHER the CFL alphabet nor the compound stack's fixture, so if it is a pixel mismatch it is
116+ most likely a REGRESSION from this round's `combine_compound_candidates` gm-fill (a compound
117+ block that previously got (0,0) and now gets a global-motion vector). Check it first, alone:
118+ `CARGO_TARGET_DIR=$HOME/.cache/cargo-target-sbrect10 cargo test -p ec-av1 --lib
119+ a_real_aomenc_stream_with_film_grain_decodes_pixel_exact -- --nocapture`
120+ and if it is red, re-run it at `3a9e83e` (the merge commit, fix not yet in) in a DETACHED
121+ worktree to separate "regression from the gm-fill" from "already red after the merge".
122+ Note the merge itself was never suite-tested -- r1 never ran a suite either (its handoff says
123+ so), so an inherited red from main's sb128/r14 merge is equally possible.
124+3. The other two are this lane's own gates; the rect-partition sibling gate shares the compound
125+ stack path, so it is the expected place for a gm-fill regression to show.
126+4. Only after the three are green: fill the N/0 totals into `lanes/sbrect10-r2.report.md`.
127+
128+## 5c. SUITE FINISHED -- final result and per-failure triage (supersedes 5b)
129+`test result: FAILED. 368 passed; 3 failed; 32 ignored; finished in 1049.95s`
130+(`$HOME/.cache/sbrect10-suite-r2.log`).
131+
132+### (a) `a_real_aomenc_stream_with_film_grain_decodes_pixel_exact` -- FLAKE, not a defect. CLOSED.
133+Panic was `Result::unwrap()` on `Err(Os { code: 2, NotFound })` at stream.rs:15680, i.e. the
134+`concat!(CARGO_MANIFEST_DIR, "/../../fixtures/golden6-mismatch.obu")` READ failed -- the shared
135+`fixtures` symlink (`-> /home/user/Documents/Code/Rust/edith_codecs/fixtures`) was transiently
136+gone mid-run, the known concurrent-lane merge hazard. The file is present now and the gate passes
137+on its own:
138+`cargo test -p ec-av1 --lib a_real_aomenc_stream_with_film_grain_decodes_pixel_exact`
139+-> `test result: ok. 1 passed; 0 failed`. Nothing to fix here; it is NOT a gm-fill regression.
140+
141+### (b) `a_real_aomenc_inter_frame_with_a_64x64_intra_block_reads_the_no_cfl_uv_alphabet` -- REAL, MINE, OPEN.
142+ 8-bit: 2 named refusals, 0 pixel-exact attempts carrying a >32 intra block
143+ (0 no-CFL uv_mode reads), 14 attempts carried none
144+ (the two refusals are "an inter SB-level AB partition" and "a split intra strip whose
145+ transform unit is 32x64" -- both other lanes' gaps, correctly named, not mismatches)
146+10-bit arm passes. **My step-2 claim that the half-random fixture makes the 8-bit arm carry the
147+shape is DISPROVEN by the gate itself.** The probe (`probe.sh`) counted a DIFFERENT quantity than
148+the gate: it greps `EC_AV1_TELL` for `post_is_inter is_inter=false` with `side>32`, whereas the
149+gate asserts `crate::decode::nocfl_uv_mode_hits()` moved. On the very same stream (8-bit cq58,
150+horizontal, sp=12 == gate attempt 8) the probe reports 2 and the counter reports 0, so those
151+8-bit >32 intra-in-inter blocks reach a decode path that never touches the counter.
152+NEXT: the three `NOCFL_UV_MODE_HITS` increment sites are `decode.rs:5499`, `decode.rs:8442`,
153+`decode.rs:18544`; instrument which intra-in-inter path an 8-bit 64x64 block actually takes
154+(the 10-bit ones clearly hit one of the three), then either fix the missing counter site or, if
155+the 8-bit path genuinely never offers CFL, narrow the gate's 8-bit assertion and say so.
156+No pixel mismatch is involved -- every decoded attempt compared exact.
157+
158+### (c) `a_real_aomenc_inter_sequence_with_a_superblock_level_rect_partition_decodes_pixel_exact` -- REAL, OPEN, UNATTRIBUTED.
159+ 8-bit: 4 named refusals, 3 carrying, 64x32=8, 32x64=2, 64-axis residual TUs=1, 9 none (0 mismatched)
160+ 10-bit: 0 named refusals, 1 carrying, 64x32=2, 32x64=0, 64-axis residual TUs=0, 15 none (0 mismatched)
161+ panic at stream.rs:6725: "(10-bit): no superblock-level rect strip carried a coded 64-axis
162+ residual transform unit inside a pixel-exact attempt (horz=2, vert=0)"
163+This is a VACUOUS-ARM assert, NOT a pixel mismatch (`0 of them mismatched` on both depths). r1
164+recorded this same gate GREEN with 10-bit `64-axis TUs=2` and `2 carrying`; it is now `0` and `1`.
165+Two candidate causes, NOT separated this round: (i) the `main` 18bf7dc merge (sb128 + r14 changed
166+partition/var-tx handling and neither r1 nor this lane ever suite-tested the merge), or (ii) this
167+round's gm-fill changing which attempts come out pixel-exact (only pixel-exact attempts count
168+toward the arm). Separate them by running this gate alone at `3a9e83e` (merge, pre-fix) in a
169+DETACHED worktree with its own CARGO_TARGET_DIR, then at `2b9709c`.
170+
171+### Corrected disposition
172+- fix-now next round: (b) the 8-bit no-CFL counter, (c) the 10-bit 64-axis vacuous arm.
173+- accepted/closed: (a) film_grain fixture flake.
174+- The gm-fill fix itself is NOT contradicted by anything in this suite: no gate reported a pixel
175+ mismatch, and the pinned stream `b58.obu` plus all 6 probe arms are byte-exact vs ffmpeg.
lanes/sbrect10-r2.report.mdadded+124 -0
@@ -0,0 +1,124 @@
1+# lane-sbrect10 r2 report
2+
3+Branch `lane-sbrect10`, worktree `/home/user/Documents/Code/Rust/edith_codecs-sbrect10`.
4+Base: r1 tip 6fba6a6 + `main` 18bf7dc (sb128 5ea5ec8 + r14 a2e2e29) merged.
5+
6+## 1. Merge (step 1)
7+`git merge --no-commit main` -> clean auto-merge (decode.rs, stream.rs), commit `3a9e83e`.
8+- Diffstat 12 files, +1392/-147 (all of it main's; the lane contributed nothing to those files
9+ beyond its own r1 hunks).
10+- `git diff main -- crates/ec-av1/src/cdf.rs` and `... refusal_inventory.rs` are BOTH EMPTY, so
11+ the NZ_MAP / FILTER_INTRA tables and the refusal list are byte-identical to main -- nothing to
12+ reconcile.
13+- The only lines the merged tree removes relative to main are the lane's own 4 r1 CFL lines in
14+ `decode.rs` (`cdfs.uv_mode_cfl[mode]` + its `cfl_alphas` arm) and the r1 comment/`[8u32]` arm in
15+ `stream.rs`. Main's deletions are all kept.
16+
17+## 2. Gate source swapped to the half-random fixture (step 2)
18+`crates/ec-av1/src/stream.rs` (gate
19+`a_real_aomenc_inter_frame_with_a_64x64_intra_block_reads_the_no_cfl_uv_alphabet`): the flat
20+`200` half of r1's source made aomenc code the right-hand superblocks skip, so at 8 bit no
21+`>32` intra-in-inter block ever appeared. Both orientations now carry a deterministic
22+pseudo-noise half:
23+
24+ horizontal: if(lt(X,128), 40+mod(floor((Y+N*sp)/32)*90,200), mod((X*7+Y*13+N*97)*31,256))
25+ vertical: if(lt(Y,64), 40+mod(floor((X+N*sp)/32)*90,200), mod((X*7+Y*13+N*97)*31,256))
26+
27+Probe grid, `$HOME/.cache/sbrect10/probe.sh` (counts `>32` intra-in-inter blocks via
28+`EC_AV1_TELL`, and pixel diffs vs `ffmpeg -pix_fmt yuv420p10le`/`yuv420p`), AFTER the r2 fix:
29+
30+| depth | cq 52 | cq 58 | cq 61 |
31+|---|---|---|---|
32+| 8-bit | 5 hits, 0 diffs | 2 hits, 0 diffs | 3 hits, 0 diffs |
33+| 10-bit | 6 hits, 0 diffs | 7 hits, 0 diffs | 7 hits, 0 diffs |
34+
35+Both depth arms therefore carry >=1 no-CFL intra hit per compared attempt; per-attempt counters
36+are read on decoded+compared attempts only, every decode-order frame is compared on Y/U/V, and a
37+mismatch fails (never SKIPs).
38+
39+## 3. The SECOND defect this fixture exposed -- root cause and fix (step 3)
40+
41+### Pinned stream
42+`$HOME/.cache/sbrect10/b58.obu` (192x128, 6 frames, 10-bit, cq 58, `--sb-size=64
43+--min-partition-size=32 --max-partition-size=64 --enable-rect-partitions=1
44+--enable-1to4-partitions=1 --lag-in-frames=0 --cpu-used=0`), sha256 hashed twice, identical:
45+`00b9253b308201118e27f348c67932a0006e3077ba7a9a401854c2ee7eb1dcd2`.
46+
47+### Localisation
48+- First mismatching frame: DECODE-ORDER 2 (display == decode order), plane Y only, 8252 samples;
49+ U and V exact; frames 0 and 1 exact. Per-64x64-SB wrong-pixel map: row0 `[0, 0, 4092]`,
50+ row1 `[0, 64, 4096]` -- i.e. the whole right superblock column, plus 64 deblock-bleed pixels.
51+- NOT an entropy desync: the 180-TU `all_zero` range ladder is IDENTICAL between our
52+ `EC_TRACE_COEFF` and instrumented `aomdec`'s (`diff a.az o.az` empty over the WHOLE stream),
53+ and blocks decoded AFTER the wrong ones (mi(16,0)) are pixel-exact.
54+- NOT a clamp: an `EC_DBG_CLAMP` probe on both the dequant clamp
55+ (`+-(1 << (7 + bd))`) and every `clamp_range` in `transform.rs` fired ZERO times on this stream.
56+- The divergence is in the MV VALUES. `EC_TRACE_MODE` diff, decode-order frame 2:
57+
58+ aomdec mi(0,32) mode=24 ref0=1 ref1=4 mv0=(128,-16) ours mv0=(-1,2)
59+ aomdec mi(0,40) mode=17 ref0=1 ref1=4 mv0=(128,-16) ours mv0=(-1,2)
60+ aomdec mi(8,32) / mi(8,40) / mi(16,40): same (128,-16) vs (-1,2)
61+ aomdec mi(16,32) mode=24 mv0=(-176,256) ours (-241,264)
62+ aomdec mi(24,32) mode=16 mv0=(-128,56) ours (-193,64)
63+
64+ The NEAREST_NEARESTMV blocks take stack[0] directly, so libaom's stack[0].this_mv is
65+ `(128,-16)` where ours is `(0,0)`; the NEWMV/NEW_NEWMV blocks are off by exactly the same
66+ predictor delta.
67+- Our stack for mi(0,32): two entries, `this=(0,0) comp=(0,0) w=2` -- the signature of libaom's
68+ compound EXTENSION pass appending `comp_list[0]` and `comp_list[1]` into an empty stack.
69+- The temporal field is genuinely empty for that frame and this is CORRECT: a new
70+ `EC_TRACE_TPL` field dump (`EC_TPL_FIELD`) shows oh=1 and oh=2 all-`.` and oh=3 onward all-`#`;
71+ frame 2's LAST projection is suppressed by `is_lst_overlay` and its LAST2 is the key frame.
72+
73+### Root cause
74+`crates/ec-av1/src/mvstack.rs:1482` `combine_compound_candidates` filled the `comp_list` tail
75+slots (the ones left over after `ref_id` then `ref_diff`) with `(0, 0)`. libaom fills them with
76+that side's GLOBAL MOTION vector -- `setup_ref_mv_list`, `av1/common/mvref_common.c:729`:
77+
78+ for (; comp_idx < MAX_MV_REF_CANDIDATES; ++comp_idx)
79+ comp_list[comp_idx][idx] = gm_mv_candidates[idx];
80+
81+The zero fill was only right under IDENTITY global motion, which the module's original reduction
82+assumed; aomenc has `--enable-global-motion` ON by default. A compound block with no usable
83+neighbour pair (frame top row -> no above, 64x64 INTRA block to its left, empty temporal field)
84+therefore took a `(0, 0)` predictor where libaom took the frame's translation.
85+
86+Class: `parsed then discarded` / reduction-assumption -- global motion is parsed and used by the
87+single-ref path (`gm_fallback`, mvstack.rs:1099-1100) but was dropped on the compound tail.
88+
89+### Fix
90+`crates/ec-av1/src/mvstack.rs`: `combine_compound_candidates` now takes
91+`gm_mv_candidates: [(i32,i32); 2]` and uses it as the per-side fill; the call site passes
92+`[gm_mv(gm, ref_frame.0), gm_mv(gm, ref_frame.1)]`.
93+
94+### Sibling sweep (same shape, whole crate)
95+Every `gm_mv_candidates` use in `mvref_common.c` was walked. The single-reference tail fill
96+(`mvref_common.c:787-788`, `mv_ref_list[idx] = gm_mv_candidates[0]`) is already ported
97+(`mvstack.rs:1099-1100` `gm_fallback`); the scan-row/col/corner `is_gm_block` substitutions
98+(`:92`, `:117`) already take `gm` through `scan_*_compound`; the `add_tpl_ref_mv`
99+`GLOBALMV_OFFSET` compares (`:379-410`) already use `gm_mv(gm, ...)` on both sides. This was the
100+only zero-filled site.
101+
102+## 4. Other change
103+`crates/ec-av1/src/decode.rs` `dump_stage16`: the `EC_AV1_PREFILT_DUMP16` dump wrote a fixed
104+`<prefix>.f0` every frame, so only the LAST frame survived and a mid-sequence divergence could
105+not be read out at all. It is now indexed by decode-order picture like `EC_AV1_PREFILT_DUMP`.
106+`crates/ec-av1/src/motion_field.rs`: `setup_motion_field` prints an `EC_TPL_FIELD` occupancy map
107+under the existing `EC_TRACE_TPL` rung (this is what proved frame 2's empty temporal field).
108+
109+## 5. Refusals
110+None lifted this round (r1 lifted none either; this lane's work is two silent-miscode fixes).
111+`refusal_inventory.rs` is byte-identical to main.
112+
113+## Suite (step 4) -- RED
114+`test result: FAILED. 368 passed; 3 failed; 32 ignored; finished in 1049.95s`
115+(`$HOME/.cache/sbrect10-suite-r2.log`). film_grain is a shared-`fixtures`-symlink flake and
116+passes alone; the other two are open and triaged in `lanes/sbrect10-r2.handoff.md` section 5c.
117+Section 2's probe table proves only the 6 probed points -- it does NOT prove the gate's own
118+counter, which still reads 0 on the 8-bit arm.
119+
120+## EVIDENCE
121+EVIDENCE: $HOME/.cache/sbrect10/b58.obu (sha256 00b9253b...dcd2, hashed twice) | probe.sh half-random geq, 6 arms (8/10-bit x cq 52/58/61), decode + compare vs ffmpeg | pixel diffs 0/0/0/0/0/0 (was 0/32890/39907 on the 10-bit arms), >32 intra-in-inter hits 5/2/3 (8-bit) and 6/7/7 (10-bit)
122+EVIDENCE: $HOME/.cache/sbrect10/{a.az,o.az} | EC_TRACE_COEFF all_zero ladder, instrumented aomdec vs ours, whole stream | 180 TUs, `diff` empty -> entropy in sync, defect is reconstruction-side
123+EVIDENCE: $HOME/.cache/sbrect10/{a.mode,o.mode} | EC_TRACE_MODE mv0 diff, decode-order frame 2 | aomdec mi(0,32) mv0=(128,-16), ours (-1,2); 6 blocks diverge, all in the right superblock column
124+EVIDENCE: $HOME/.cache/sbrect10/o.tplf | EC_TPL_FIELD occupancy dump, all 5 inter frames | oh=1,2 empty / oh=3,4,5 full -> the empty temporal field at oh=2 is correct, not the defect
lanes/sbrect10-r3.report.mdadded+98 -0
@@ -0,0 +1,98 @@
1+# lane-sbrect10 r3 report
2+
3+Branch `lane-sbrect10`. Round input: r2 tip `1866bd5`, suite RED with 3 failed gates.
4+Round output: all three root-caused and green; merged main `85887c7` (which now carries
5+lane-mvtwin `2e2a225`), mvstack.rs resolved to main's copy byte-for-byte.
6+
7+## 1. `a_real_aomenc_stream_with_film_grain_decodes_pixel_exact` -- ENVIRONMENT, not code
8+
9+Panic body (r2 log had none: the unit was still running when the handoff was written, my first
10+`systemctl --user is-active sbrect10-suite-r2` used the un-timestamped unit name and read back
11+`inactive` wrongly). Run alone off the r2 binary:
12+
13+ stream.rs:15680: called `Result::unwrap()` on an `Err` value:
14+ Os { code: 2, kind: NotFound, message: "No such file or directory" }
15+
16+The worktree had **no top-level `fixtures` symlink** (`fixtures` is gitignored and per-worktree).
17+`fixtures/golden6-mismatch.obu` was simply absent. Not a temp-path collision: this gate writes no
18+temp file at all -- `ffmpeg_decode_sequence` (stream.rs:1316) pipes the stream through ffmpeg's
19+stdin/stdout, and the two helpers that DO make scratch dirs already key them on
20+`{test name}-{std::process::id()}` (stream.rs:2000, 15735), which is unique per process and per test.
21+Same failure at the same wall-clock in lane-sb128c's suite = the same missing symlink there, not a
22+race. Fixed with `ln -s .../edith_codecs/fixtures fixtures`.
23+
24+SWEEP: all three `../../fixtures/*.obu` reads in `crates/ec-av1/src` (golden6-mismatch.obu,
25+golden7-forwarding-mismatch.obu, lr-sgr-r7.obu) now resolve.
26+
27+EVIDENCE: $HOME/.cache/sbrect10-suite-r2.log + rerun | ln -s fixtures; ec_av1 binary --exact
28+a_real_aomenc_stream_with_film_grain_decodes_pixel_exact | FAILED (NotFound) -> ok, 0.31s
29+
30+## 2. The other two reds: ONE cause -- r2's fixture swap landed in the sibling gate
31+
32+Neither red was a pixel mismatch; both were vacuity asserts, and both counters read 0 for the
33+same reason. r2's half-random lavfi source
34+
35+ horizontal: if(lt(X,128), 40+mod(floor((Y+N*sp)/32)*90,200), mod((X*7+Y*13+N*97)*31,256))
36+ vertical: if(lt(Y,64), 40+mod(floor((X+N*sp)/32)*90,200), mod((X*7+Y*13+N*97)*31,256))
37+
38+was written into `a_real_aomenc_inter_sequence_with_a_superblock_level_rect_partition_decodes_pixel_exact`
39+(stream.rs:6592) instead of `a_real_aomenc_inter_frame_with_a_64x64_intra_block_reads_the_no_cfl_uv_alphabet`
40+(stream.rs:6791) -- the rationale comment travelled with it, so the code read consistent. Effect:
41+
42+- CFL gate kept r1's flat `200` source, whose right-hand superblocks aomenc codes skip ->
43+ 8-bit arm decoded 0 intra blocks above 32x32: *"no attempt decoded an intra block above 32x32
44+ ... gate proved nothing (2 refusals, 14 attempts carried none)"*.
45+- rect gate got the textured source, which changed the RD's residual decisions -> its 10-bit arm
46+ lost the coded 64-axis transform unit lane-r14 r2 had measured on the flat source
47+ (8-bit residual TUs=1, 10-bit=0): *"no superblock-level rect strip carried a coded 64-axis
48+ residual transform unit ... (horz=2, vert=0)"*.
49+
50+FIX (`e2d9e9e`): sources swapped back so each gate runs the source it was measured on. No assert
51+weakened, no grid changed, no decoder code touched.
52+
53+Result of the two gates alone at the merged tree (`--test-threads=1 --exact`):
54+
55+| gate | 8-bit | 10-bit |
56+|---|---|---|
57+| no_cfl_uv_alphabet | 4 refusals, 4 exact attempts, **15** no-CFL uv_mode reads | 0 refusals, 8 exact attempts, **43** reads |
58+| superblock_level_rect_partition | 2 refusals, 4 exact, 64x32=4 32x64=4, **64-axis residual TUs=2** | 2 refusals, 2 exact, 64x32=2 32x64=2, **residual TUs=2** |
59+
60+0 out-of-scope mismatches in either depth of either gate, so r2's `combine_compound_candidates`
61+global-motion tail fill is NOT a regression source -- every attempt that decoded compared exact.
62+
63+EVIDENCE: $HOME/.cache/sbrect10-g2-a_real_aomenc_inter_frame_with_a_64x64_intra_block_reads_the_no_cfl_uv_alphabet.log,
64+$HOME/.cache/sbrect10-g2-a_real_aomenc_inter_sequence_with_a_superblock_level_rect_partition_decodes_pixel_exact.log |
65+swap the two gates' geq sources, rebuild, run each gate alone under systemd-run MemoryMax=6G |
66+both `test result: ok`, counters 15/43 no-CFL reads and 2/2 64-axis residual TUs
67+
68+## 3. Merge
69+
70+`git merge --no-commit main` twice: first main `4eff3a1` (`de045b7`, clean auto-merge), then main
71+`85887c7` after it took lane-mvtwin mid-round. Only conflict: `crates/ec-av1/src/mvstack.rs`,
72+resolved to MAIN's copy byte-for-byte (`git diff main -- crates/ec-av1/src/mvstack.rs` EMPTY) --
73+main carries this lane's own comp_list global-motion tail fill plus mvtwin's insertion-time
74+candidate cap and tile-origin clamp. `cdf.rs`, `cdf_state.rs`, `refusal_inventory.rs` all
75+byte-identical to main. Lines this branch drops vs main are only its own hunks (uv_mode_cfl
76+narrowing, indexed `dump_stage16` prefix, gate fixtures). The merge commit was recorded by the
77+coordinator as `10e25e3` (parents `e2d9e9e` + `85887c7`) while this round was mid-flight.
78+
79+## 4. Suite
80+
81+`EC_AV1_REQUIRE_AOMENC=1 cargo test -p ec-av1 --lib -j3` under user unit
82+`sbrect10-suite-r3-1788326330.service`, log `$HOME/.cache/sbrect10-suite-r3.log`.
83+r2 for comparison: 368 passed / 3 failed / 32 ignored (the three above).
84+
85+**GREEN: 378 passed / 0 failed / 33 ignored / 0 measured, 1229.56s.**
86+
87+EVIDENCE: $HOME/.cache/sbrect10-suite-r3.log | systemd-run --user --unit=sbrect10-suite-r3-1788326330
88+-p MemoryMax=10G cargo test -p ec-av1 --lib -j3, EC_AV1_REQUIRE_AOMENC=1 |
89+`test result: ok. 378 passed; 0 failed; 33 ignored` (r2 was 368/3/32)
90+
91+## 5. Residue
92+
93+- accepted: the no-CFL gate's 8-bit arm still takes named refusals on other shapes
94+ (SB-level AB partition, 32x64/64x32 split intra strips) -- other lanes' scope, and 4 attempts
95+ decode + prove the shape regardless.
96+- accepted: r2's `probe.sh` counted intra-in-inter blocks through an `EC_AV1_TELL` trace grep,
97+ not through `nocfl_uv_mode_hits`; the gate itself asserts the real counter, so the proxy is only
98+ a probe convenience. Not worth a rewrite.