diff --git a/crates/ec-aac/tests/obs_real_content.rs b/crates/ec-aac/tests/obs_real_content.rs index 40c23550..58d4f2c7 100644 --- a/crates/ec-aac/tests/obs_real_content.rs +++ b/crates/ec-aac/tests/obs_real_content.rs @@ -28,11 +28,23 @@ fn ffmpeg_decode(path: &Path, channels: usize) -> Vec> { .args(["-v", "error", "-i"]) .arg(path) .args([ - "-map", "0:a:0", "-t", "10", "-f", "f32le", "-acodec", "pcm_f32le", "-", + "-map", + "0:a:0", + "-t", + "10", + "-f", + "f32le", + "-acodec", + "pcm_f32le", + "-", ]) .output() .expect("ffmpeg runs"); - assert!(out.status.success(), "{}", String::from_utf8_lossy(&out.stderr)); + assert!( + out.status.success(), + "{}", + String::from_utf8_lossy(&out.stderr) + ); let samples: Vec = out .stdout .chunks_exact(4) @@ -48,7 +60,10 @@ fn ffmpeg_decode(path: &Path, channels: usize) -> Vec> { fn extract_aac_track(path: &Path) -> Option<(Vec, Vec>)> { let f = File::open(path).ok()?; let mut d = Mp4Demuxer::new(BufReader::new(f)).ok()?; - let aac = d.streams().iter().find(|s| s.params.codec == CodecId::Aac)?; + let aac = d + .streams() + .iter() + .find(|s| s.params.codec == CodecId::Aac)?; let idx = aac.index; let asc = aac.params.extradata.as_ref()?.to_vec(); let mut aus = Vec::new(); @@ -90,11 +105,18 @@ fn our_decode(path: &Path) -> Option>> { } } eprintln!(" {failed}/{} AUs failed", aus.len()); - if planes.is_empty() { None } else { Some(planes) } + if planes.is_empty() { + None + } else { + Some(planes) + } } fn dot(a: &[f32], b: &[f32]) -> f64 { - a.iter().zip(b).map(|(x, y)| f64::from(*x) * f64::from(*y)).sum() + a.iter() + .zip(b) + .map(|(x, y)| f64::from(*x) * f64::from(*y)) + .sum() } fn correlation(a: &[f32], b: &[f32]) -> f64 { @@ -114,14 +136,28 @@ fn correlation(a: &[f32], b: &[f32]) -> f64 { fn best_lag_correlation(ours: &[f32], theirs: &[f32]) -> (i64, f64) { const COARSE: usize = 4_096; - let start = ours.len().min(theirs.len()).saturating_sub(WINDOW).min(ours.len() / 4); + let start = ours + .len() + .min(theirs.len()) + .saturating_sub(WINDOW) + .min(ours.len() / 4); let slice_at = |lag: i64, len: usize| -> Option<(usize, usize)> { - let (oa, ob) = if lag >= 0 { (start, start + lag as usize) } else { (start + (-lag) as usize, start) }; - if oa + len > ours.len() || ob + len > theirs.len() { None } else { Some((oa, ob)) } + let (oa, ob) = if lag >= 0 { + (start, start + lag as usize) + } else { + (start + (-lag) as usize, start) + }; + if oa + len > ours.len() || ob + len > theirs.len() { + None + } else { + Some((oa, ob)) + } }; let mut coarse_best = (0i64, -1.0f64, 0.0f64); for lag in -(LAG_MAX as i64)..=(LAG_MAX as i64) { - let Some((oa, ob)) = slice_at(lag, COARSE) else { continue }; + let Some((oa, ob)) = slice_at(lag, COARSE) else { + continue; + }; let c = correlation(&ours[oa..oa + COARSE], &theirs[ob..ob + COARSE]); if c.abs() > coarse_best.1 { coarse_best = (lag, c.abs(), c); @@ -129,7 +165,9 @@ fn best_lag_correlation(ours: &[f32], theirs: &[f32]) -> (i64, f64) { } let mut best = (coarse_best.0, -1.0f64, 0.0f64); for lag in (coarse_best.0 - 8)..=(coarse_best.0 + 8) { - let Some((oa, ob)) = slice_at(lag, WINDOW) else { continue }; + let Some((oa, ob)) = slice_at(lag, WINDOW) else { + continue; + }; let c = correlation(&ours[oa..oa + WINDOW], &theirs[ob..ob + WINDOW]); if c.abs() > best.1 { best = (lag, c.abs(), c); @@ -148,7 +186,13 @@ fn obs_content_table() { eprintln!("skip: no ffmpeg"); return; } - let dir = PathBuf::from(std::env::var("HOME").unwrap()).join("Videos/OBS"); + // lane-h264reallib: `unwrap_or_default()` rather than a bare `unwrap()`. + // A host with no HOME -- a fleet runner -- panicked here before reaching + // the `read_dir` guard one line down, which already reports an absent + // directory correctly. With an empty HOME the guard simply reports + // `skip: no ./Videos/OBS`, so the test degrades to the silent skip its + // own guard was written for instead of a red that says nothing about AAC. + let dir = PathBuf::from(std::env::var("HOME").unwrap_or_default()).join("Videos/OBS"); let Ok(rd) = std::fs::read_dir(&dir) else { eprintln!("skip: no {}", dir.display()); return; @@ -188,11 +232,21 @@ fn obs_content_table() { let rows = &all_rows[before..]; let (mut pns, mut is_, mut ms, mut tns, mut cpe) = (0usize, 0usize, 0usize, 0usize, 0usize); for r in rows { - if r.pns_bands > 0 { pns += 1; } - if r.is_bands > 0 { is_ += 1; } - if r.ms_bands > 0 { ms += 1; } - if r.tns_present { tns += 1; } - if r.is_cpe { cpe += 1; } + if r.pns_bands > 0 { + pns += 1; + } + if r.is_bands > 0 { + is_ += 1; + } + if r.ms_bands > 0 { + ms += 1; + } + if r.tns_present { + tns += 1; + } + if r.is_cpe { + cpe += 1; + } } eprintln!( " tools over {} AUs: cpe={cpe} pns_aus={pns} is_aus={is_} ms_aus={ms} tns_aus={tns}", diff --git a/crates/ec-aac/tests/oracle.rs b/crates/ec-aac/tests/oracle.rs index 7ddde830..79b3070f 100644 --- a/crates/ec-aac/tests/oracle.rs +++ b/crates/ec-aac/tests/oracle.rs @@ -676,6 +676,16 @@ fn esds_asc(mp4: &[u8]) -> Option> { /// AAC tracks from the machine's own library, not just generated fixtures: the /// elementary stream is copied out to ADTS and decoded both ways. +// lane-h264reallib: same shape as the ec-h264 `real_library_streams_match_ffmpeg` +// fix, same reason. The manifest is generated by `scripts/scan-real-library.sh` +// from `~/Videos ~/Downloads ~/Music` and is gitignored because it is +// machine-local. The guard below makes a host with NO manifest print green +// (nothing was checked), and a host that ran the scan but has since moved or +// deleted files falls through to `checked >= 3` and goes red for a reason that +// has nothing to do with the decoder. An ignore is visible in `--list` and +// cannot go green silently, which an env gate would. +// Run on the workstation: cargo test -p ec-aac --test oracle real_library_tracks_match_ffmpeg -- --ignored +#[ignore = "sweeps the PERSONAL media library (~/Videos, ~/Downloads, ~/Music) through the gitignored fixtures/real-library-manifest.tsv and asserts >= 3 tracks swept; a runner host has no such library, so it is either a silent green or a red for the wrong reason. Run it on the workstation with --ignored."] #[test] fn real_library_tracks_match_ffmpeg() { if !have_ffmpeg() { diff --git a/crates/ec-aac/tests/sbr_real_library.rs b/crates/ec-aac/tests/sbr_real_library.rs index 6c27cf9e..edc3dc85 100644 --- a/crates/ec-aac/tests/sbr_real_library.rs +++ b/crates/ec-aac/tests/sbr_real_library.rs @@ -437,7 +437,13 @@ fn exhaustive_lag_correlation(ours: &[f32], theirs: &[f32], lag_max: i64) -> (i6 } /// bucket (true if ITS coarse lag sat at the +/-`lag_max` search bound). -fn robust_lag_topk(ours: &[f32], theirs: &[f32], lag_max: i64, rate: u32, k: usize) -> (i64, f64, bool) { +fn robust_lag_topk( + ours: &[f32], + theirs: &[f32], + lag_max: i64, + rate: u32, + k: usize, +) -> (i64, f64, bool) { const COARSE: usize = 4_096; let start = ours .len() @@ -2111,7 +2117,10 @@ fn our_decode_core_only(path: &Path, stream_index: usize) -> Option<(Vec = frame.samples.iter().skip(c).step_by(ch).copied().collect(); - let rms = (plane.iter().map(|v| f64::from(*v) * f64::from(*v)).sum::() + let rms = (plane + .iter() + .map(|v| f64::from(*v) * f64::from(*v)) + .sum::() / plane.len().max(1) as f64) .sqrt(); eprintln!( @@ -2229,7 +2238,11 @@ fn core_only_matches_reference() { if at_edge { (lag, corr, at_edge) = exhaustive_lag_correlation(&ol, &tl, SEARCH_LAG_MAX); } - let edge = if at_edge { " (AT SEARCH BOUND -- noise, not a measurement)" } else { "" }; + let edge = if at_edge { + " (AT SEARCH BOUND -- noise, not a measurement)" + } else { + "" + }; println!(" ch{ch}: below {cutoff:.0}Hz lag {lag}, corr {corr:.6}{edge}"); } } @@ -2428,9 +2441,8 @@ fn synthetic_heaac_matrix() { eprintln!("SKIP: ffmpeg not on PATH"); return; } - let dir = std::env::var("EC_AAC_HEAAC_FIXTURES").unwrap_or_else(|_| { - format!("{}/../../.cache/heaac-fixtures", env!("CARGO_MANIFEST_DIR")) - }); + let dir = std::env::var("EC_AAC_HEAAC_FIXTURES") + .unwrap_or_else(|_| format!("{}/../../.cache/heaac-fixtures", env!("CARGO_MANIFEST_DIR"))); let dir = PathBuf::from(dir); if !dir.is_dir() { eprintln!( @@ -2444,8 +2456,21 @@ fn synthetic_heaac_matrix() { } println!( "{:>5} {:>6} {:>4} {:>4} {:>4} {:>8} {:>8} {:>8} {:>6} {:>11} {:>8} {:>10} {:>8} {:>9} {:>9}", - "rate", "kbps", "prof", "kx", "k2", "full", "below", "above", "lag", "ours_v_core", "ovc_lag", - "core_v_ref", "cvr_lag", "core_rate", "full_rate" + "rate", + "kbps", + "prof", + "kx", + "k2", + "full", + "below", + "above", + "lag", + "ours_v_core", + "ovc_lag", + "core_v_ref", + "cvr_lag", + "core_rate", + "full_rate" ); // Wide enough that the WIDE_LAG_MAX==LC's own decoder priming delay // (2048) plus a full SBR-chain worth of extra delay (a few thousand @@ -2479,8 +2504,7 @@ fn synthetic_heaac_matrix() { let o = &ours[0]; let t = &theirs[0]; const TOPK: usize = 5; - let (mut lag, mut full, edge) = - robust_lag_topk(o, t, WIDE_LAG_MAX, our_rate, TOPK); + let (mut lag, mut full, edge) = robust_lag_topk(o, t, WIDE_LAG_MAX, our_rate, TOPK); assert!( !edge, "{}: {profile} row's refined winning lag {lag} sits at the \ @@ -2504,8 +2528,11 @@ fn synthetic_heaac_matrix() { if profile == "HE" && ours.len() >= 2 && theirs.len() >= 2 { let mono_o: Vec = ours[0].iter().zip(&ours[1]).map(|(a, b)| a + b).collect(); - let mono_t: Vec = - theirs[0].iter().zip(&theirs[1]).map(|(a, b)| a + b).collect(); + let mono_t: Vec = theirs[0] + .iter() + .zip(&theirs[1]) + .map(|(a, b)| a + b) + .collect(); let (mono_lag, _, mono_edge) = robust_lag_topk(&mono_o, &mono_t, WIDE_LAG_MAX, our_rate, TOPK); assert!( @@ -2548,7 +2575,9 @@ fn synthetic_heaac_matrix() { } else { ((-lag) as usize, 0usize) }; - let n = WINDOW.min(o.len().saturating_sub(oa)).min(t.len().saturating_sub(ob)); + let n = WINDOW + .min(o.len().saturating_sub(oa)) + .min(t.len().saturating_sub(ob)); let above = if n >= 1024 { correlation( &highpass(&o[oa..oa + n], our_rate, crossover_hz), @@ -2886,8 +2915,14 @@ fn sbr_real_library_matches_reference() { let high = if n >= 1024 { let oh = highpass(&o[oa..oa + n], rate, c.crossover_hz); let th = highpass(&t[ob..ob + n], rate, c.crossover_hz); - let rms = |v: &[f32]| (v.iter().map(|x| f64::from(*x).powi(2)).sum::() / v.len().max(1) as f64).sqrt(); - println!(" ch{ch} above-crossover RMS ours/ref = {:.4}", rms(&oh) / rms(&th).max(1e-12)); + let rms = |v: &[f32]| { + (v.iter().map(|x| f64::from(*x).powi(2)).sum::() / v.len().max(1) as f64) + .sqrt() + }; + println!( + " ch{ch} above-crossover RMS ours/ref = {:.4}", + rms(&oh) / rms(&th).max(1e-12) + ); correlation(&oh, &th) } else { 0.0 @@ -3154,7 +3189,10 @@ fn sbr_real_library_matches_reference() { ci += c.im; } let coh = (cr * cr + ci * ci).sqrt() / (eo * et).sqrt().max(1e-30); - println!(" band{band:>3}: {:>7.2} dB coh {coh:.4}", 10.0 * (eo / et.max(1e-30)).log10()); + println!( + " band{band:>3}: {:>7.2} dB coh {coh:.4}", + 10.0 * (eo / et.max(1e-30)).log10() + ); } } let mean_in = |rows: &[(usize, f64)], lo: usize, hi: usize| { @@ -3559,7 +3597,10 @@ fn sbr_actual_noise_fraction() { // has nonzero entries for QMF bands up to `k2`). let band_hz = f64::from(rate) / 128.0; let kx_band = bookkept.iter().map(|(b, ..)| *b).min().unwrap_or(0); - println!(" (crossover: QMF band {kx_band}, {:.0} Hz -- rows below it are core-decoded and excluded from the total)", kx_band as f64 * band_hz); + println!( + " (crossover: QMF band {kx_band}, {:.0} Hz -- rows below it are core-decoded and excluded from the total)", + kx_band as f64 * band_hz + ); println!( " ACTUAL noise fraction (band_hz, energy_on, energy_off, actual_fraction, bookkept_fraction):" ); @@ -3712,9 +3753,8 @@ fn sbr_header_feature_table() { ffmpeg_stream: c.ffmpeg_stream, }) .collect(); - let fixtures = std::env::var("EC_AAC_HEAAC_FIXTURES").unwrap_or_else(|_| { - format!("{}/../../.cache/heaac-fixtures", env!("CARGO_MANIFEST_DIR")) - }); + let fixtures = std::env::var("EC_AAC_HEAAC_FIXTURES") + .unwrap_or_else(|_| format!("{}/../../.cache/heaac-fixtures", env!("CARGO_MANIFEST_DIR"))); let fixtures = PathBuf::from(fixtures); if fixtures.is_dir() { for rate in [48_000u32, 44_100] { @@ -3746,8 +3786,25 @@ fn sbr_header_feature_table() { const WIDE_LAG_MAX: i64 = 20_000; println!( "{:<20} {:>6} {:>4} {:>4} {:>4} {:>4} {:>4} {:>4} {:>4} {:>4} {:>4} {:>4} {:>5} {:>10} {:>10} {:>8} {:>8} {:>10} {:>6}", - "stream", "rate", "kx", "k2", "xovr", "sfrq", "efrq", "fscl", "ascl", "nbnd", "lbnd", "lgn", - "ifrq", "smooth", "envs", "invf", "harm", "df%", "corr" + "stream", + "rate", + "kx", + "k2", + "xovr", + "sfrq", + "efrq", + "fscl", + "ascl", + "nbnd", + "lbnd", + "lgn", + "ifrq", + "smooth", + "envs", + "invf", + "harm", + "df%", + "corr" ); for r in &rows { let before = ec_aac::sbr_sideinfo_log().len(); @@ -3760,7 +3817,11 @@ fn sbr_header_feature_table() { continue; } let log = ec_aac::sbr_sideinfo_log(); - let frames: Vec<_> = log[before..].iter().filter(|row| row.ch == 0).take(20).collect(); + let frames: Vec<_> = log[before..] + .iter() + .filter(|row| row.ch == 0) + .take(20) + .collect(); if frames.is_empty() { eprintln!("SKIP {}: no sideinfo rows captured", r.label); continue; @@ -3772,13 +3833,24 @@ fn sbr_header_feature_table() { let mut df_total = 0usize; let mut df_ones = 0usize; for row in &frames { - *env_counts.entry(row.t_env.len().saturating_sub(1)).or_default() += 1; + *env_counts + .entry(row.t_env.len().saturating_sub(1)) + .or_default() += 1; invf_seen.extend(&row.invf_mode); - if row.add_harmonic.as_ref().is_some_and(|h| h.iter().any(|&v| v != 0)) { + if row + .add_harmonic + .as_ref() + .is_some_and(|h| h.iter().any(|&v| v != 0)) + { any_harmonic = true; } df_total += row.df_env.len() + row.df_noise.len(); - df_ones += row.df_env.iter().chain(&row.df_noise).filter(|&&b| b != 0).count(); + df_ones += row + .df_env + .iter() + .chain(&row.df_noise) + .filter(|&&b| b != 0) + .count(); } let df_pct = if df_total > 0 { 100.0 * df_ones as f64 / df_total as f64 @@ -3790,20 +3862,36 @@ fn sbr_header_feature_table() { .map(|(k, v)| format!("{k}x{v}")) .collect::>() .join(","); - let invf_str: String = invf_seen.iter().map(|v| v.to_string()).collect::>().join(""); + let invf_str: String = invf_seen + .iter() + .map(|v| v.to_string()) + .collect::>() + .join(""); let theirs = ffmpeg_decode(&r.path, r.ffmpeg_stream, ours.len()); let (_, corr) = best_lag_correlation_wide(&ours[0], &theirs[0], WIDE_LAG_MAX); println!( "{:<20} {:>6} {:>4} {:>4} {:>4} {:>4} {:>4} {:>4} {:>4} {:>4} {:>4} {:>4} {:>5} {:>10} {:>10} {:>8} {:>8} {:>10.1} {:>6.3}", - r.label, our_rate, f0.kx, f0.k2, f0.xover_band, f0.start_freq, f0.stop_freq, - f0.freq_scale, f0.alter_scale, f0.noise_bands, f0.limiter_bands, f0.limiter_gains, - f0.interpol_freq, f0.smoothing_mode, envs_hist, invf_str, - any_harmonic, df_pct, corr - ); - println!( - " patches (frame0): {:?}", - f0.patch_lengths + r.label, + our_rate, + f0.kx, + f0.k2, + f0.xover_band, + f0.start_freq, + f0.stop_freq, + f0.freq_scale, + f0.alter_scale, + f0.noise_bands, + f0.limiter_bands, + f0.limiter_gains, + f0.interpol_freq, + f0.smoothing_mode, + envs_hist, + invf_str, + any_harmonic, + df_pct, + corr ); + println!(" patches (frame0): {:?}", f0.patch_lengths); } } @@ -3874,7 +3962,11 @@ fn per_au_low_band_probe(label: &str, path: &Path, aac_stream: usize) { } } if core_ch0.is_empty() || full_ch0.is_empty() { - eprintln!("SKIP {label}: empty decode (core {} full {})", core_ch0.len(), full_ch0.len()); + eprintln!( + "SKIP {label}: empty decode (core {} full {})", + core_ch0.len(), + full_ch0.len() + ); return; } @@ -3949,9 +4041,8 @@ fn per_au_low_band_divergence() { for c in &candidates() { per_au_low_band_probe(&c.path.display().to_string(), &c.path, c.aac_stream); } - let dir = std::env::var("EC_AAC_HEAAC_FIXTURES").unwrap_or_else(|_| { - format!("{}/../../.cache/heaac-fixtures", env!("CARGO_MANIFEST_DIR")) - }); + let dir = std::env::var("EC_AAC_HEAAC_FIXTURES") + .unwrap_or_else(|_| format!("{}/../../.cache/heaac-fixtures", env!("CARGO_MANIFEST_DIR"))); let failing = PathBuf::from(&dir).join("heaac_44100_48k.m4a"); if failing.exists() { per_au_low_band_probe("synthetic 44100 48k (failing)", &failing, 0); @@ -4097,7 +4188,9 @@ fn probe_explicit_config_and_wide_lag() { let theirs = ffmpeg_decode(&path, ffmpeg_stream, hand_planes.len()); if let (Some(o), Some(t)) = (hand_planes.first(), theirs.first()) { let (lag, corr) = best_lag_correlation_wide(o, t, 100_000); - println!(" hand-built explicit config: full-band vs reference: lag={lag} corr={corr:.6}"); + println!( + " hand-built explicit config: full-band vs reference: lag={lag} corr={corr:.6}" + ); } } @@ -4111,10 +4204,9 @@ fn probe_explicit_config_and_wide_lag() { "{home}/Downloads/reelp/reelp.mkv" )); if fmj.exists() { - if let (Some((core, core_rate)), Some((full, sbr, full_rate))) = ( - our_decode_core_only(&fmj, 1), - our_decode(&fmj, 1), - ) { + if let (Some((core, core_rate)), Some((full, sbr, full_rate))) = + (our_decode_core_only(&fmj, 1), our_decode(&fmj, 1)) + { if sbr == ec_aac::SbrSupport::V1 { let up: Vec = core[0].iter().flat_map(|&s| [s, s]).collect(); let cutoff = f64::from(core_rate) * 0.4; @@ -4239,9 +4331,8 @@ fn coupled_cpe_channel_swap_probe() { eprintln!("SKIP: ffmpeg not on PATH"); return; } - let dir = std::env::var("EC_AAC_HEAAC_FIXTURES").unwrap_or_else(|_| { - format!("{}/../../.cache/heaac-fixtures", env!("CARGO_MANIFEST_DIR")) - }); + let dir = std::env::var("EC_AAC_HEAAC_FIXTURES") + .unwrap_or_else(|_| format!("{}/../../.cache/heaac-fixtures", env!("CARGO_MANIFEST_DIR"))); let path = PathBuf::from(&dir).join("heaac_44100_48k.m4a"); if !path.exists() { eprintln!("SKIP: {} absent", path.display()); @@ -4256,7 +4347,10 @@ fn coupled_cpe_channel_swap_probe() { let ref_r = ffmpeg_decode_pan_channel(&path, 0, 1); { let n = ref_l.len().min(ref_r.len()).min(WINDOW); - println!("ref L vs ref R (no lag): corr={:.6}", correlation(&ref_l[..n], &ref_r[..n])); + println!( + "ref L vs ref R (no lag): corr={:.6}", + correlation(&ref_l[..n], &ref_r[..n]) + ); let (lag, corr) = best_lag_correlation_wide(&ref_l, &ref_r, SEARCH_LAG_MAX); println!("ref L vs ref R (best lag search): lag={lag} corr={corr:.6}"); } @@ -4329,11 +4423,17 @@ fn coupled_cpe_channel_swap_probe() { let (core_lag0, core_corr0) = best_lag_correlation_wide(&core_planes[0], &ref_core[0], SEARCH_LAG_MAX); let core_implied_lag = core_lag0 * 2; - println!("core ch0 vs ref L best lag={core_lag0} corr={core_corr0:.6} -> implied full-rate lag={core_implied_lag}"); + println!( + "core ch0 vs ref L best lag={core_lag0} corr={core_corr0:.6} -> implied full-rate lag={core_implied_lag}" + ); let mono_ours: Vec = ours[0].iter().zip(&ours[1]).map(|(a, b)| a + b).collect(); let mono_ref: Vec = { let n = ref_l.len().min(ref_r.len()); - ref_l[..n].iter().zip(&ref_r[..n]).map(|(a, b)| a + b).collect() + ref_l[..n] + .iter() + .zip(&ref_r[..n]) + .map(|(a, b)| a + b) + .collect() }; let (mono_lag, mono_corr) = best_lag_correlation_wide(&mono_ours, &mono_ref, SEARCH_LAG_MAX); println!("mono (ch0+ch1) vs ref (L+R) best lag={mono_lag} corr={mono_corr:.6}"); @@ -4349,7 +4449,15 @@ fn coupled_cpe_channel_swap_probe() { // corr=0.873 above). So the TRUE best lag among our 4 candidates is // whichever one actually maximizes the fixed-lag mono correlation, not // whatever `mono_lag` the free search reported. - let mut true_best = (mono_lag, "mono-best lag (free search)", 0.0f64, 0.0f64, 0.0f64, 0.0f64, mono_corr); + let mut true_best = ( + mono_lag, + "mono-best lag (free search)", + 0.0f64, + 0.0f64, + 0.0f64, + 0.0f64, + mono_corr, + ); for (lag, label) in fixed_lags { let c0l = correlation_at_lag(&ours[0], &ref_l, lag); let c0r = correlation_at_lag(&ours[0], &ref_r, lag); @@ -4398,7 +4506,9 @@ fn coupled_cpe_channel_swap_probe() { } let cl = correlation(&ours[0][oa..oa + step], &ref_l[ob..ob + step]); let cr = correlation(&ours[0][oa..oa + step], &ref_r[ob..ob + step]); - println!("subwindow t={w}s ch0 vs ref L/R @ lag {best_lag}: corr(L)={cl:.6} corr(R)={cr:.6}"); + println!( + "subwindow t={w}s ch0 vs ref L/R @ lag {best_lag}: corr(L)={cl:.6} corr(R)={cr:.6}" + ); w += 1; } } @@ -4569,9 +4679,8 @@ fn sbr441_family_sample_drift_probe() { eprintln!("SKIP: ffmpeg not on PATH"); return; } - let dir = std::env::var("EC_AAC_HEAAC_FIXTURES").unwrap_or_else(|_| { - format!("{}/../../.cache/heaac-fixtures", env!("CARGO_MANIFEST_DIR")) - }); + let dir = std::env::var("EC_AAC_HEAAC_FIXTURES") + .unwrap_or_else(|_| format!("{}/../../.cache/heaac-fixtures", env!("CARGO_MANIFEST_DIR"))); let home = std::env::var("HOME").unwrap_or_default(); let cases: [(&str, PathBuf, i64); 3] = [ ( @@ -4690,9 +4799,8 @@ fn sbr_hf_window_band_probe() { eprintln!("SKIP: ffmpeg not on PATH"); return; } - let dir = std::env::var("EC_AAC_HEAAC_FIXTURES").unwrap_or_else(|_| { - format!("{}/../../.cache/heaac-fixtures", env!("CARGO_MANIFEST_DIR")) - }); + let dir = std::env::var("EC_AAC_HEAAC_FIXTURES") + .unwrap_or_else(|_| format!("{}/../../.cache/heaac-fixtures", env!("CARGO_MANIFEST_DIR"))); let path = PathBuf::from(&dir).join("heaac_48000_64k.m4a"); if !path.exists() { eprintln!("SKIP: {} absent", path.display()); @@ -4748,7 +4856,10 @@ fn sbr_hf_window_band_probe() { let mean_t: f64 = mags_t.iter().sum::() / 8.0; println!( " band{band:>3}: |ours|dB mean={mean_o:>7.2} |ref|dB mean={mean_t:>7.2} dphase(deg)={:?}", - dphase_deg.iter().map(|d| format!("{d:.0}")).collect::>() + dphase_deg + .iter() + .map(|d| format!("{d:.0}")) + .collect::>() ); } } @@ -4794,7 +4905,13 @@ fn sbr_residual_locator() { if !have_ffmpeg() { return; } - let home = std::env::var("HOME").unwrap(); + // lane-h264reallib: `unwrap_or_default()`, the shape this file's five + // other HOME reads already use (:2710, :3426, :4109, :4182, :4575). A bare + // `unwrap()` panicked on any host with no HOME -- a fleet runner -- which + // is a red with no bearing on the decoder. The `path.exists()` guard below + // already handles the absent-file case, so an empty HOME just makes the + // fallback path relative-and-nonexistent and the test returns. + let home = std::env::var("HOME").unwrap_or_default(); // `EC_AAC_SBR_LOCATOR_FILE` points the same instrument at any other // HE-AAC file (e.g. a mono, uncoupled, noise-only probe encode). let path = std::env::var("EC_AAC_SBR_LOCATOR_FILE") @@ -4803,7 +4920,9 @@ fn sbr_residual_locator() { if !path.exists() { return; } - let Some((ours, _, rate)) = our_decode(&path, 0) else { return }; + let Some((ours, _, rate)) = our_decode(&path, 0) else { + return; + }; let theirs = ffmpeg_decode(&path, 0, ours.len()); const W: usize = 2048; const FFT_LEN: usize = 2048; @@ -4815,7 +4934,12 @@ fn sbr_residual_locator() { let n = ours[ch].len().min(theirs[ch].len()); let (o, t) = (&ours[ch][..n], &theirs[ch][..n]); let mut wins: Vec<(f64, usize)> = (0..n / W) - .map(|w| (correlation(&o[w * W..(w + 1) * W], &t[w * W..(w + 1) * W]), w)) + .map(|w| { + ( + correlation(&o[w * W..(w + 1) * W], &t[w * W..(w + 1) * W]), + w, + ) + }) .collect(); wins.sort_by(|a, b| a.0.partial_cmp(&b.0).unwrap()); println!("ch{ch} worst windows (corr, frame): {:?}", &wins[..12]); @@ -4865,7 +4989,9 @@ fn sbr_residual_locator() { } } // group into 250 Hz bands up to 8 kHz, then 1 kHz - let mut edges: Vec = (0..=32).map(|i| ((i as f64 * 250.0) / hz) as usize).collect(); + let mut edges: Vec = (0..=32) + .map(|i| ((i as f64 * 250.0) / hz) as usize) + .collect(); edges.extend((9..=22).map(|i| ((i as f64 * 1000.0) / hz) as usize)); for e in edges.windows(2) { let (mut c, mut po, mut pt) = (0.0, 0.0, 0.0); diff --git a/crates/ec-h264/tests/conformance.rs b/crates/ec-h264/tests/conformance.rs index 4d1a27ca..c366f846 100644 --- a/crates/ec-h264/tests/conformance.rs +++ b/crates/ec-h264/tests/conformance.rs @@ -1882,6 +1882,32 @@ fn compare_container_streamed( /// resolutions and GOP structures the fixtures never use, and they are the ones /// a user actually opens. Every file either decodes bit-exactly or is refused /// by name; a file that decodes to different pixels is a failure. +// lane-h264reallib: LOCAL-ONLY, and the reason lives in the attribute so it +// shows in `cargo test -- --list` instead of hiding in a skip print. +// +// The precondition is a PERSONAL MEDIA LIBRARY: the manifest is generated by +// `scripts/scan-real-library.sh`, which scans `~/Videos ~/Downloads ~/Music` +// by default and is gitignored precisely because it is machine-local. A +// runner host has none of those directories, so both of this test's possible +// behaviours there are wrong: +// +// - manifest absent -> the `SKIP: ... missing` early return, which prints +// green. That is the silent-skip class this batch is removing: a green +// that means "nothing was checked". +// - manifest present but its absolute paths unresolvable (a host that ran +// the scan script against an empty library) -> zero files swept and +// `decoded >= 3` fails. That is the red every fleet run currently eats, +// and it is red for a reason that has nothing to do with the decoder. +// +// Hence `#[ignore]` rather than an env gate: an env gate whose variable is +// absent on the runner prints the same green the missing manifest already +// prints, which is the defect rather than the fix. An ignore is visible in +// `--list`, cannot go green silently, and leaves the assertion itself intact +// -- "the sweep is the point" still holds on the machine that can run it. +// +// Run it on the workstation, where the library is: +// cargo test -p ec-h264 --test conformance real_library_streams_match_ffmpeg -- --ignored +#[ignore = "sweeps the PERSONAL media library (~/Videos, ~/Downloads, ~/Music) through the gitignored fixtures/real-library-manifest.tsv; MINUTES of wall time (measured past 840 s on the workstation), so workstation only -- budget an hour, it is not wedged. A runner host has no such library, so the test is either a silent green or a red for the wrong reason. Run it on the workstation with --ignored."] #[test] fn real_library_streams_match_ffmpeg() { if !have_ffmpeg() { diff --git a/crates/ec-matroska/tests/matroska.rs b/crates/ec-matroska/tests/matroska.rs index c7405411..1b37c3bb 100644 --- a/crates/ec-matroska/tests/matroska.rs +++ b/crates/ec-matroska/tests/matroska.rs @@ -32,7 +32,9 @@ fn aac_priming_round_trips_through_codec_delay() { let dst = work().join("aac-priming-round-trip.mkv"); let mut muxer = MatroskaMuxer::new(File::create(&dst).expect("output")); let stream = muxer.add_stream(info).expect("stream declared"); - muxer.set_track_delay(stream, 21_333_333).expect("declare delay"); // 1024/48000s + muxer + .set_track_delay(stream, 21_333_333) + .expect("declare delay"); // 1024/48000s for _ in 0..10i64 { let mut packet = Packet::new(0, rate, vec![0u8; 8]); packet.duration = Some(1024); @@ -44,7 +46,8 @@ fn aac_priming_round_trips_through_codec_delay() { let demuxer = MatroskaDemuxer::new(BufReader::new(File::open(&dst).expect("opens"))).expect("reopens"); assert_eq!( - demuxer.streams()[0].initial_padding, 1024, + demuxer.streams()[0].initial_padding, + 1024, "CodecDelay round trips to a sample count" ); } @@ -802,7 +805,11 @@ fn truncated_prefixes_are_eof_not_corrupt() { table.join("\n") ); } - println!("{}\nidx,cut,class,packets\n{}", path.display(), table.join("\n")); + println!( + "{}\nidx,cut,class,packets\n{}", + path.display(), + table.join("\n") + ); } fn matroska_prefix_class(data: &[u8]) -> (&'static str, u64) { @@ -823,7 +830,6 @@ fn matroska_prefix_class(data: &[u8]) -> (&'static str, u64) { } } - /// Where our own demuxer's seek lands on a real 5.1 E-AC-3 Matroska, in /// *timestamp* -- split from decode, per the round's charter: this measures /// only [`MatroskaDemuxer::seek`] plus the first packet's `pts`, against what @@ -963,7 +969,12 @@ fn same_class_sweep(path: &str, wants: &[f64], tolerance_ms: f64) { #[test] #[ignore = "sweeps his real library, run manually with --ignored"] fn laced_audio_sweep_across_his_library() { - let manifest = Path::new("/home/user/Documents/Code/Rust/edith_codecs/fixtures/real-library-manifest.tsv"); + // lane-h264reallib: `fixtures()` like every sibling, instead of a + // hardcoded absolute path into the primary checkout. The absolute form + // silently defeated worktree isolation: a run in a worktree or a gate tree + // read the MAIN checkout's manifest, so this test measured a different + // tree's library than the one it was compiled from. + let manifest = &fixtures().join("real-library-manifest.tsv"); let Ok(rows) = std::fs::read_to_string(manifest) else { eprintln!("skipped: {} not present", manifest.display()); return; @@ -987,8 +998,7 @@ fn laced_audio_sweep_across_his_library() { if !film.exists() { continue; } - let Ok(mut demux) = - MatroskaDemuxer::new(BufReader::new(File::open(film).expect("opens"))) + let Ok(mut demux) = MatroskaDemuxer::new(BufReader::new(File::open(film).expect("opens"))) else { eprintln!("{path}: failed to open"); continue; @@ -1004,8 +1014,7 @@ fn laced_audio_sweep_across_his_library() { for frac in [0.3, 0.7] { let want = duration * frac; let target = Timestamp::new( - (want * audio.time_base.den() as f64 / audio.time_base.num() as f64).round() - as i64, + (want * audio.time_base.den() as f64 / audio.time_base.num() as f64).round() as i64, audio.time_base, ); if demux @@ -1096,8 +1105,8 @@ fn real_hdr_film_container_states_no_light_metadata() { // duplication, pts) or the shared decoder crate, and which physical channel // our 5.1 decode calls "channel 0". -use ec_ac3::Ac3Decoder; use ec_aac::AacDecoder; +use ec_ac3::Ac3Decoder; /// Opens whichever container `path` actually is — both crates implement the /// same `Demuxer` trait, so the rest of the harness never has to know which. @@ -1109,9 +1118,15 @@ fn open_any(path: &Path) -> Box { .read_exact(&mut head) .expect("read head"); if ec_mp4::is_mp4(&head) { - Box::new(ec_mp4::Mp4Demuxer::new(BufReader::new(File::open(path).expect("open"))).expect("mp4 opens")) + Box::new( + ec_mp4::Mp4Demuxer::new(BufReader::new(File::open(path).expect("open"))) + .expect("mp4 opens"), + ) } else { - Box::new(MatroskaDemuxer::new(BufReader::new(File::open(path).expect("open"))).expect("mkv opens")) + Box::new( + MatroskaDemuxer::new(BufReader::new(File::open(path).expect("open"))) + .expect("mkv opens"), + ) } } @@ -1201,7 +1216,15 @@ fn ffmpeg_decode_planar(path: &Path, channels: usize) -> Vec> { .args(["-v", "error", "-i"]) .arg(path) .args([ - "-map", "0:a:0", "-t", "20", "-f", "f32le", "-acodec", "pcm_f32le", "-", + "-map", + "0:a:0", + "-t", + "20", + "-f", + "f32le", + "-acodec", + "pcm_f32le", + "-", ]) .output() .expect("ffmpeg runs"); @@ -1251,8 +1274,14 @@ fn best_lag_correlation(ours: &[f32], theirs: &[f32]) -> (i64, f64) { let mut best_abs = -1.0f64; let mut best = (0i64, 0.0f64); for lag in -LAG_MAX..=LAG_MAX { - let (oa, ob) = if lag >= 0 { (0usize, lag as usize) } else { ((-lag) as usize, 0usize) }; - let len = WINDOW.min(ours.len().saturating_sub(oa)).min(theirs.len().saturating_sub(ob)); + let (oa, ob) = if lag >= 0 { + (0usize, lag as usize) + } else { + ((-lag) as usize, 0usize) + }; + let len = WINDOW + .min(ours.len().saturating_sub(oa)) + .min(theirs.len().saturating_sub(ob)); if len < 1024 { continue; } @@ -1387,7 +1416,11 @@ fn mkv_51_channel_order() { pkts.iter().take(5).map(|(p, _)| *p).collect::>() ); let planes = decode_ac3(&pkts); - assert!(!planes.is_empty(), "{}: no channels decoded", path.display()); + assert!( + !planes.is_empty(), + "{}: no channels decoded", + path.display() + ); let ffref = ffmpeg_decode_planar(path, planes.len()); for (i, ch) in planes.iter().enumerate() { let (lag, c) = best_lag_correlation(ch, &ffref[0]); diff --git a/crates/ec-probe/tests/library.rs b/crates/ec-probe/tests/library.rs index 223a2cc2..98c6f16f 100644 --- a/crates/ec-probe/tests/library.rs +++ b/crates/ec-probe/tests/library.rs @@ -487,7 +487,20 @@ fn a_real_library_sweep() { taken += 1; } } - assert!(!chosen.is_empty(), "no readable files in the manifest"); + // lane-h264reallib: NOT an `assert!` here. The file's own header, lines + // 5-6, is the spec: "Files that have since moved are skipped and + // reported, never failed -- the manifest is a snapshot of a moving + // library." An empty `chosen` IS the moved-files case, so failing on it + // contradicted the contract this file declares. It was also red on any + // host whose manifest paths no longer resolve, for a reason that had + // nothing to do with the probe. Reported and returned, which is what + // "skipped and reported, never failed" asks for. + if chosen.is_empty() { + eprintln!( + "skipped: no readable file in the manifest (every row has moved or is unreadable)" + ); + return; + } let mut rows = Vec::new(); let mut failures = Vec::new(); diff --git a/lanes/h264reallib.report.md b/lanes/h264reallib.report.md new file mode 100644 index 00000000..66f40a73 --- /dev/null +++ b/lanes/h264reallib.report.md @@ -0,0 +1,204 @@ +# lane-h264reallib — real-library sweep: shape, local verdict, class sweep + +Branch `lane-h264reallib` (worktree `~/.cache/wt/h264reallib`, base `a21f3680`). +Tests only. No decoder change, no assertion weakened. + +Three separate deliverables, per Main's request to keep them apart: +(a) the local verdict on the real library, (b) the shape change that stops +runners reporting a false red, (c) the count and table of the rest of the class. + +--- + +## (a) Local verdict — PASSES on the workstation, no decoder defect + +Run on the workstation, where the library is: + +``` +EC_NOMEMGUARD=1 cargo test -p ec-h264 --test conformance \ + real_library_streams_match_ffmpeg -- --ignored --nocapture +``` + +`fixtures/real-library-manifest.tsv` is gitignored and generated by +`scripts/scan-real-library.sh` (ffprobe sweep of `~/Videos ~/Downloads ~/Music`). +Copied from the primary checkout into the worktree for the run; **111 h264 rows, +all 111 paths resolve** on this host. + +Result — **15 decoded bit-exact, 0 refused by name, 0 failures**, 1918 s: + +| file | container | width | frames | +|---|---|---|---| +| reel-24f2c8 | matroska,webm | 2560px | 500 bit-exact | +| reel-7538d2 | mov,mp4,m4a,3gp,3g2,mj2 | 2560px | 500 bit-exact | +| reel-1c3a81 | matroska,webm | 1280px | 500 bit-exact | +| reel-286c86 | mov,mp4,… | 3840px | 500 bit-exact | +| reel-010d74 | mov,mp4,… | 576px | 500 bit-exact | +| reel-ab1f6d | mov,mp4,… | 640px | 500 bit-exact | +| reel-e99558 | mov,mp4,… | 1920px | 500 bit-exact (container demux) | +| reel-436303 | mov,mp4,… | 1274px | 439 bit-exact | +| reel-28cd87 | mov,mp4,… | 720px | 500 bit-exact | +| reel-bf1a18 | matroska,webm | 1920px | 500 bit-exact | +| reel-92d5fc | mov,mp4,… | 1080px | 500 bit-exact | +| reel-6ee243 | mov,mp4,… | 1078px | 500 bit-exact | +| reel-1db5fd | mov,mp4,… | 1280px | 185 bit-exact | +| reel-4148f8 | mov,mp4,… | 1916px | 500 bit-exact | +| reel-ccbe4e | mov,mp4,… | 1138px | 500 bit-exact | + +Both demuxers are exercised (matroska + mov/mp4), the sweep covers 576px→3840px, +and one file took the container-demux fallback exactly as designed. **The +decoder is fine; the fleet red was never about the decoder.** + +Runtime: **1918 s (~32 min)**, matching Main's independent observation that it +runs past 840 s. That number is now in the ignore reason so the next person does +not read the wall time as a wedge. + +## (b) Shape change — why `#[ignore]`, and what it stops + +`crates/ec-h264/tests/conformance.rs:1846` `real_library_streams_match_ffmpeg`. + +The precondition is a personal media library, which has exactly two possible +behaviours on a runner, and **both are wrong**: + +- manifest absent → the existing `SKIP: … missing` early return prints + **green**. That is the silent-skip class this batch is removing: a green that + means "nothing was checked". +- manifest present but its absolute paths unresolvable (a host that ran the scan + script against an empty library) → zero files swept and `decoded >= 3` fails. + That is **the red every fleet run currently eats**, and it is red for a reason + that has nothing to do with the decoder. + +`#[ignore]` over an env-gated SKIP, justified: an env gate whose variable is +absent on the runner prints *the same green the missing manifest already prints* — +that is the defect, not the fix. An ignore is visible in +`cargo test -- --list`, cannot go green silently, and needs no runner-side +configuration that could itself drift. The assertion is untouched: `decoded >= 3` +still stands, and still holds, on the machine that can run it (it did: 15 ≥ 3). + +Verified — the target is no longer red, and the reason is printed verbatim: + +``` + +test real_library_streams_match_ffmpeg ... ignored, sweeps the PERSONAL media +library (~/Videos, ~/Downloads, ~/Music) through the gitignored +fixtures/real-library-manifest.tsv; MINUTES of wall time (measured past 840 s on +the workstation), so workstation only -- budget an hour, it is not wedged. ... +test result: ok. 0 passed; 0 failed; 1 ignored; 0 measured; 22 filtered out +``` + +Also fixed, because the fix is the *identical* one-line `#[ignore]` + reason and +no judgement call: `crates/ec-aac/tests/oracle.rs:680` +`real_library_tracks_match_ffmpeg` — same manifest, same +"skip if manifest missing, then assert `checked >= 3`" shape, same two failure +modes. Verified reporting `1 ignored`. + +## (c) Class sweep — 51 sites examined, 2 fixed, 3 need a decision, 46 already correct + +The class: a test that reads `~/Music`, `~/Videos`, `~/Downloads`, a hardcoded +`/home//` path, or the generated manifest; **or** asserts a minimum count +of personal files. Swept `crates/*/tests/**`, `crates/*/src/**` (incl. +`#[cfg(test)]`), `tests/**`, `tools/**`, `shims/**`, and the scripts. + +**Members of the class that are RED-ON-RUNNER and not ignored — the ones that +still need a decision (not fixed here, because the right fix is NOT the +identical one-liner):** + +| file:line | what it needs | runs on a runner? | current behaviour | proposed shape | +|---|---|---|---|---| +| `crates/ec-probe/tests/library.rs:490` `a_real_library_sweep` | manifest + ≥1 row whose path still exists | partially | red-on-runner | **Remove the minimum-count assert, do not ignore.** The file's own header (:5-6) states moved files are "skipped and reported, never failed" — the `:490` assert contradicts the stated contract. This is a real bug in the test's own spec, not a shape problem. | +| `crates/ec-aac/tests/sbr_real_library.rs:4797` `sbr_residual_locator` | `$HOME` set at all — bare `env::var("HOME").unwrap()` | partially | red-on-runner | **One-line `unwrap_or_default()`**, matching the five sibling HOME reads in the same file (:2710, :3426, :4109, :4182, :4575). The `:4803` `path.exists()` guard already handles the absent file; only the bare `unwrap` panics. | +| `crates/ec-aac/tests/obs_real_content.rs:151` `obs_content_table` | `$HOME` set — bare `unwrap()` | partially | silent-skip | **One-line `unwrap_or_default()`**, same reason. The `read_dir` guard at :152 already handles the absent directory. | + +**Already correctly shaped — `leave alone` (14 named, rest by the same pattern):** +these read personal paths but handle absence correctly, so they are NOT the +class. The template worth copying: + +- `crates/ec-h264/tests/encode.rs:751` `real_library_frames_encode_and_decode_exactly` + — **the reference "correct" shape of this class**: `:728-731` soft-skips when no + qualifying row survives, so the `sources.len() >= 6` assert is only reachable + once a real file was actually opened. This is what the two sites above should + be rewritten to. +- `crates/ec-aac/tests/oracle.rs:848` `he_aac_library_track_decodes_to_its_core` + — sibling of the one I ignored, correctly shaped: prints a named SKIP at :919 + and returns at :917, so the :912 assert only fires on a file it decoded. +- `crates/ec-image/tests/real_library.rs:52`, `:132`; `crates/ec-truehd/tests/library.rs:78`, + `crates/ec-truehd/tests/oracle.rs:87`; `crates/ec-probe/tests/library.rs:585`, `:621`, + `:756`; `crates/ec-aac/tests/reelh_per_frame.rs:29`; `crates/ec-hw/tests/gpu.rs:2050` + (and the three other gpu.rs personal-path sites, all GPU-guarded) — all guard + on `exists()`/`read_dir` and print a named skip. +- `crates/ec-aac/tests/sbr_real_library.rs:2710`, `:3690`, `:4176`, `:4566` — filter + candidates on `.exists()`, empty list skips, no minimum-count assert. + +**Already `#[ignore]`d with a reason naming the precondition — `leave alone` +(~20):** `ec-mp3/tests/encode_matrix.rs:639`, `:851`; `ec-mp4/tests/mp4.rs:789`; +`ec-matroska/tests/matroska.rs:538`, `:965`, `:1058`, `:1282`, `:1400`; +`ec-vorbis/tests/oracle.rs:1190`; `ec-opus/tests/conformance.rs:758`, `:2958`, +`:3149`, `:3428`, `:3654`, `:3859`, `:4091`, `:4572`; `ec-av1/src/encode.rs:16808`, +`:19748`, `:20068`, `:20175`, `:21054`, `:21163`, `:22857`, `:22982`. The repo's +dominant convention is already "ignore + reason", which is why this lane's fix +follows it rather than inventing a new shape. + +**False positives — do NOT touch (the class looks bigger than it is):** + +- `scripts/extract_vp8_tables.py:15`, `scripts/build-aom-oracle.sh:17`, + `build-aom-affine-oracle.sh:23`, `instrument-aom-oracle.sh:73`, + `gen_vp8_fixtures.sh:52`, `memguard-runner.sh:39` — `$HOME/.cache/{aom-oracle,vp8}` + and `$HOME/.config/systemd`: build/toolchain locations, all env-overridable, + none read media. +- `tools/ec-bench/src/main.rs:82` — non-test bench binary; reports "no candidate". +- `crates/ec-aac/tests/sbr_real_library.rs:3715`, `:4572` — `$CARGO_MANIFEST_DIR/../../.cache/heaac-fixtures`, + a generated-fixture cache relative to the repo. +- `crates/ec-vp9/tests/scaledref_exact.rs:18` — a doc comment recording how a + *committed* .ivf was produced; the test reads the tracked file. +- `crates/ec-mp4/tests/mp4.rs:635` — personal file is purely additive to a repo + fixture that is always present; not a dependency. + +**Non-test dependents of the manifest** (why it exists on some hosts and not +others — worth knowing when reading a red): + +- `scripts/scan-real-library.sh` — the generator; defaults to + `$HOME/Videos $HOME/Downloads $HOME/Music`, writes the gitignored + `fixtures/real-library-manifest.tsv`, honours `EC_FIXTURES`. +- `lanes/b64b/bin-control:59261` — a built binary that reads the manifest. +- No CI workflow file in the repo runs the scan, which is exactly why runner + behaviour differs: a host that once ran the script by hand keeps a manifest + whose paths no longer resolve, and that is the state that produces the false red. + +**One incidental finding, not fixed (out of scope, flagged not hidden):** +`crates/ec-matroska/tests/matroska.rs:966` reads the manifest at a **hardcoded +absolute** `/home/user/Documents/Code/Rust/edith_codecs/fixtures/…` instead +of `CARGO_MANIFEST_DIR`-relative like every sibling. It is already `#[ignore]`d +with a soft skip, so it is harmless today, and it also silently defeats +worktree isolation. Worth converting to the relative form if that ignore is ever +lifted. + +### Round 2 — the four approved follow-ups (all now fixed) + +| site | change | before | after | +|---|---|---|---| +| `crates/ec-probe/tests/library.rs:490` | `assert!(!chosen.is_empty())` → named SKIP + `return` | red-on-runner whenever every manifest path had moved | `1 passed; 0 failed; 0 ignored` | +| `crates/ec-aac/tests/sbr_real_library.rs:4797` | `env::var("HOME").unwrap()` → `.unwrap_or_default()` | `FAILED. 0 passed; 1 failed` — `called Result::unwrap() on an Err value: NotPresent` | `1 passed; 0 failed; 0 ignored` | +| `crates/ec-aac/tests/obs_real_content.rs:151` | same | `FAILED. 0 passed; 1 failed` — same panic | `1 passed; 0 failed; 0 ignored` | +| `crates/ec-matroska/tests/matroska.rs:966` | hardcoded absolute manifest path → `fixtures()` | read the PRIMARY checkout's manifest from any worktree | `fixtures()` = `CARGO_MANIFEST_DIR/../../fixtures`, like every sibling | + +The two HOME fixes were proved by running them under `env -u HOME` (the +runner shape) before and after; the probe fix was proved by running the test +with its manifest paths unresolvable. + +**Sweep disposition after round 2: 6 fixed, 0 remaining, 14 already correct, +the rest already `#[ignore]`d or false positives.** No member of this class is +left red-on-runner. + +## Change list + +| file | change | +|---|---| +| `crates/ec-h264/tests/conformance.rs:1870` | `#[ignore = "…"]` + 25-line reason above the test; assertion untouched | +| `crates/ec-aac/tests/oracle.rs:688` | `#[ignore = "…"]` + reason; identical shape, assertion untouched | +| `crates/ec-probe/tests/library.rs:490` | minimum-count assert → named SKIP + return; restores the file's own :5-6 contract | +| `crates/ec-aac/tests/sbr_real_library.rs:4797` | bare `env::var("HOME").unwrap()` → `unwrap_or_default()` | +| `crates/ec-aac/tests/obs_real_content.rs:151` | same | +| `crates/ec-matroska/tests/matroska.rs:966` | hardcoded absolute manifest path → `fixtures()` | + +No decoder change anywhere. Two new `#[ignore]`s, both previously +red-on-runner and never green. The only assertion removed is the +`ec-probe` minimum count, and removing it RESTORES the contract that file's +own header declares rather than hiding a failure; no other assertion weakened.