forge
Explore
Log in

Don't you dare go Hollow

tests: close the rest of the real-media-library class (4 sites)

Browse files at this commit

b1bc5d62b6a0a86d14e8700824f8ae9a3aeddbeeAhmet Kaan GümüşParent: fcb9ffb
Follow-ups to the shape sweep, all approved. Each was red on a runner for a
reason that had nothing to do with a decoder.

ec-probe/tests/library.rs:490 -- REMOVE the minimum-count assert rather than
ignore the test. The file's own header is the spec, and it says so at lines
5-6: "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 the assert contradicted the contract the file declares:
the contract is the spec, not the assert. Replaced with a named SKIP and a
return, which is what "skipped and reported" asks for.
  before: red-on-runner whenever every manifest path had moved
  after:  1 passed; 0 failed; 0 ignored

ec-aac/tests/sbr_real_library.rs:4797 and ec-aac/tests/obs_real_content.rs:151
-- bare env::var("HOME").unwrap() -> unwrap_or_default(), the shape the five
sibling HOME reads in sbr_real_library.rs already use (:2710, :3426, :4109,
:4182, :4575). A HOME-less host is a fleet runner, so this was a panic there;
the batch has now hit that class from three directions.
  before: FAILED. 0 passed; 1 failed
          called `Result::unwrap()` on an `Err` value: NotPresent
  after:  1 passed; 0 failed; 0 ignored      (both, under `env -u HOME`)

ec-matroska/tests/matroska.rs:966 -- the manifest was read from a hardcoded
absolute path into the primary checkout, unlike every sibling. That defeats
worktree isolation even while the test is ignored: a run in a worktree or a
gate tree read the MAIN checkout's manifest, so it measured a different
tree's library than the one it was compiled from. Now `fixtures()`, i.e.
CARGO_MANIFEST_DIR-relative.

The two HOME fixes were proved by running them under `env -u HOME` -- the
runner shape -- before and after; the before-state panic is quoted above.

Class disposition after this commit: 6 fixed, 0 remaining red-on-runner,
14 already correct, the rest already ignored or false positives.
crates/ec-aac/tests/obs_real_content.rsmodified+70 -16
@@ -28,11 +28,23 @@ fn ffmpeg_decode(path: &Path, channels: usize) -> Vec<Vec<f32>> {
2828 .args(["-v", "error", "-i"])
2929 .arg(path)
3030 .args([
31- "-map", "0:a:0", "-t", "10", "-f", "f32le", "-acodec", "pcm_f32le", "-",
31+ "-map",
32+ "0:a:0",
33+ "-t",
34+ "10",
35+ "-f",
36+ "f32le",
37+ "-acodec",
38+ "pcm_f32le",
39+ "-",
3240 ])
3341 .output()
3442 .expect("ffmpeg runs");
35- assert!(out.status.success(), "{}", String::from_utf8_lossy(&out.stderr));
43+ assert!(
44+ out.status.success(),
45+ "{}",
46+ String::from_utf8_lossy(&out.stderr)
47+ );
3648 let samples: Vec<f32> = out
3749 .stdout
3850 .chunks_exact(4)
@@ -48,7 +60,10 @@ fn ffmpeg_decode(path: &Path, channels: usize) -> Vec<Vec<f32>> {
4860 fn extract_aac_track(path: &Path) -> Option<(Vec<u8>, Vec<Vec<u8>>)> {
4961 let f = File::open(path).ok()?;
5062 let mut d = Mp4Demuxer::new(BufReader::new(f)).ok()?;
51- let aac = d.streams().iter().find(|s| s.params.codec == CodecId::Aac)?;
63+ let aac = d
64+ .streams()
65+ .iter()
66+ .find(|s| s.params.codec == CodecId::Aac)?;
5267 let idx = aac.index;
5368 let asc = aac.params.extradata.as_ref()?.to_vec();
5469 let mut aus = Vec::new();
@@ -90,11 +105,18 @@ fn our_decode(path: &Path) -> Option<Vec<Vec<f32>>> {
90105 }
91106 }
92107 eprintln!(" {failed}/{} AUs failed", aus.len());
93- if planes.is_empty() { None } else { Some(planes) }
108+ if planes.is_empty() {
109+ None
110+ } else {
111+ Some(planes)
112+ }
94113 }
95114
96115 fn dot(a: &[f32], b: &[f32]) -> f64 {
97- a.iter().zip(b).map(|(x, y)| f64::from(*x) * f64::from(*y)).sum()
116+ a.iter()
117+ .zip(b)
118+ .map(|(x, y)| f64::from(*x) * f64::from(*y))
119+ .sum()
98120 }
99121
100122 fn correlation(a: &[f32], b: &[f32]) -> f64 {
@@ -114,14 +136,28 @@ fn correlation(a: &[f32], b: &[f32]) -> f64 {
114136
115137 fn best_lag_correlation(ours: &[f32], theirs: &[f32]) -> (i64, f64) {
116138 const COARSE: usize = 4_096;
117- let start = ours.len().min(theirs.len()).saturating_sub(WINDOW).min(ours.len() / 4);
139+ let start = ours
140+ .len()
141+ .min(theirs.len())
142+ .saturating_sub(WINDOW)
143+ .min(ours.len() / 4);
118144 let slice_at = |lag: i64, len: usize| -> Option<(usize, usize)> {
119- let (oa, ob) = if lag >= 0 { (start, start + lag as usize) } else { (start + (-lag) as usize, start) };
120- if oa + len > ours.len() || ob + len > theirs.len() { None } else { Some((oa, ob)) }
145+ let (oa, ob) = if lag >= 0 {
146+ (start, start + lag as usize)
147+ } else {
148+ (start + (-lag) as usize, start)
149+ };
150+ if oa + len > ours.len() || ob + len > theirs.len() {
151+ None
152+ } else {
153+ Some((oa, ob))
154+ }
121155 };
122156 let mut coarse_best = (0i64, -1.0f64, 0.0f64);
123157 for lag in -(LAG_MAX as i64)..=(LAG_MAX as i64) {
124- let Some((oa, ob)) = slice_at(lag, COARSE) else { continue };
158+ let Some((oa, ob)) = slice_at(lag, COARSE) else {
159+ continue;
160+ };
125161 let c = correlation(&ours[oa..oa + COARSE], &theirs[ob..ob + COARSE]);
126162 if c.abs() > coarse_best.1 {
127163 coarse_best = (lag, c.abs(), c);
@@ -129,7 +165,9 @@ fn best_lag_correlation(ours: &[f32], theirs: &[f32]) -> (i64, f64) {
129165 }
130166 let mut best = (coarse_best.0, -1.0f64, 0.0f64);
131167 for lag in (coarse_best.0 - 8)..=(coarse_best.0 + 8) {
132- let Some((oa, ob)) = slice_at(lag, WINDOW) else { continue };
168+ let Some((oa, ob)) = slice_at(lag, WINDOW) else {
169+ continue;
170+ };
133171 let c = correlation(&ours[oa..oa + WINDOW], &theirs[ob..ob + WINDOW]);
134172 if c.abs() > best.1 {
135173 best = (lag, c.abs(), c);
@@ -148,7 +186,13 @@ fn obs_content_table() {
148186 eprintln!("skip: no ffmpeg");
149187 return;
150188 }
151- let dir = PathBuf::from(std::env::var("HOME").unwrap()).join("Videos/OBS");
189+ // lane-h264reallib: `unwrap_or_default()` rather than a bare `unwrap()`.
190+ // A host with no HOME -- a fleet runner -- panicked here before reaching
191+ // the `read_dir` guard one line down, which already reports an absent
192+ // directory correctly. With an empty HOME the guard simply reports
193+ // `skip: no ./Videos/OBS`, so the test degrades to the silent skip its
194+ // own guard was written for instead of a red that says nothing about AAC.
195+ let dir = PathBuf::from(std::env::var("HOME").unwrap_or_default()).join("Videos/OBS");
152196 let Ok(rd) = std::fs::read_dir(&dir) else {
153197 eprintln!("skip: no {}", dir.display());
154198 return;
@@ -188,11 +232,21 @@ fn obs_content_table() {
188232 let rows = &all_rows[before..];
189233 let (mut pns, mut is_, mut ms, mut tns, mut cpe) = (0usize, 0usize, 0usize, 0usize, 0usize);
190234 for r in rows {
191- if r.pns_bands > 0 { pns += 1; }
192- if r.is_bands > 0 { is_ += 1; }
193- if r.ms_bands > 0 { ms += 1; }
194- if r.tns_present { tns += 1; }
195- if r.is_cpe { cpe += 1; }
235+ if r.pns_bands > 0 {
236+ pns += 1;
237+ }
238+ if r.is_bands > 0 {
239+ is_ += 1;
240+ }
241+ if r.ms_bands > 0 {
242+ ms += 1;
243+ }
244+ if r.tns_present {
245+ tns += 1;
246+ }
247+ if r.is_cpe {
248+ cpe += 1;
249+ }
196250 }
197251 eprintln!(
198252 " tools over {} AUs: cpe={cpe} pns_aus={pns} is_aus={is_} ms_aus={ms} tns_aus={tns}",
crates/ec-aac/tests/sbr_real_library.rsmodified+189 -63
@@ -437,7 +437,13 @@ fn exhaustive_lag_correlation(ours: &[f32], theirs: &[f32], lag_max: i64) -> (i6
437437 }
438438
439439 /// bucket (true if ITS coarse lag sat at the +/-`lag_max` search bound).
440-fn robust_lag_topk(ours: &[f32], theirs: &[f32], lag_max: i64, rate: u32, k: usize) -> (i64, f64, bool) {
440+fn robust_lag_topk(
441+ ours: &[f32],
442+ theirs: &[f32],
443+ lag_max: i64,
444+ rate: u32,
445+ k: usize,
446+) -> (i64, f64, bool) {
441447 const COARSE: usize = 4_096;
442448 let start = ours
443449 .len()
@@ -2111,7 +2117,10 @@ fn our_decode_core_only(path: &Path, stream_index: usize) -> Option<(Vec<Vec<f32
21112117 if dump && au_idx < 40 {
21122118 for c in 0..ch {
21132119 let plane: Vec<f32> = frame.samples.iter().skip(c).step_by(ch).copied().collect();
2114- let rms = (plane.iter().map(|v| f64::from(*v) * f64::from(*v)).sum::<f64>()
2120+ let rms = (plane
2121+ .iter()
2122+ .map(|v| f64::from(*v) * f64::from(*v))
2123+ .sum::<f64>()
21152124 / plane.len().max(1) as f64)
21162125 .sqrt();
21172126 eprintln!(
@@ -2229,7 +2238,11 @@ fn core_only_matches_reference() {
22292238 if at_edge {
22302239 (lag, corr, at_edge) = exhaustive_lag_correlation(&ol, &tl, SEARCH_LAG_MAX);
22312240 }
2232- let edge = if at_edge { " (AT SEARCH BOUND -- noise, not a measurement)" } else { "" };
2241+ let edge = if at_edge {
2242+ " (AT SEARCH BOUND -- noise, not a measurement)"
2243+ } else {
2244+ ""
2245+ };
22332246 println!(" ch{ch}: below {cutoff:.0}Hz lag {lag}, corr {corr:.6}{edge}");
22342247 }
22352248 }
@@ -2428,9 +2441,8 @@ fn synthetic_heaac_matrix() {
24282441 eprintln!("SKIP: ffmpeg not on PATH");
24292442 return;
24302443 }
2431- let dir = std::env::var("EC_AAC_HEAAC_FIXTURES").unwrap_or_else(|_| {
2432- format!("{}/../../.cache/heaac-fixtures", env!("CARGO_MANIFEST_DIR"))
2433- });
2444+ let dir = std::env::var("EC_AAC_HEAAC_FIXTURES")
2445+ .unwrap_or_else(|_| format!("{}/../../.cache/heaac-fixtures", env!("CARGO_MANIFEST_DIR")));
24342446 let dir = PathBuf::from(dir);
24352447 if !dir.is_dir() {
24362448 eprintln!(
@@ -2444,8 +2456,21 @@ fn synthetic_heaac_matrix() {
24442456 }
24452457 println!(
24462458 "{:>5} {:>6} {:>4} {:>4} {:>4} {:>8} {:>8} {:>8} {:>6} {:>11} {:>8} {:>10} {:>8} {:>9} {:>9}",
2447- "rate", "kbps", "prof", "kx", "k2", "full", "below", "above", "lag", "ours_v_core", "ovc_lag",
2448- "core_v_ref", "cvr_lag", "core_rate", "full_rate"
2459+ "rate",
2460+ "kbps",
2461+ "prof",
2462+ "kx",
2463+ "k2",
2464+ "full",
2465+ "below",
2466+ "above",
2467+ "lag",
2468+ "ours_v_core",
2469+ "ovc_lag",
2470+ "core_v_ref",
2471+ "cvr_lag",
2472+ "core_rate",
2473+ "full_rate"
24492474 );
24502475 // Wide enough that the WIDE_LAG_MAX==LC's own decoder priming delay
24512476 // (2048) plus a full SBR-chain worth of extra delay (a few thousand
@@ -2479,8 +2504,7 @@ fn synthetic_heaac_matrix() {
24792504 let o = &ours[0];
24802505 let t = &theirs[0];
24812506 const TOPK: usize = 5;
2482- let (mut lag, mut full, edge) =
2483- robust_lag_topk(o, t, WIDE_LAG_MAX, our_rate, TOPK);
2507+ let (mut lag, mut full, edge) = robust_lag_topk(o, t, WIDE_LAG_MAX, our_rate, TOPK);
24842508 assert!(
24852509 !edge,
24862510 "{}: {profile} row's refined winning lag {lag} sits at the \
@@ -2504,8 +2528,11 @@ fn synthetic_heaac_matrix() {
25042528 if profile == "HE" && ours.len() >= 2 && theirs.len() >= 2 {
25052529 let mono_o: Vec<f32> =
25062530 ours[0].iter().zip(&ours[1]).map(|(a, b)| a + b).collect();
2507- let mono_t: Vec<f32> =
2508- theirs[0].iter().zip(&theirs[1]).map(|(a, b)| a + b).collect();
2531+ let mono_t: Vec<f32> = theirs[0]
2532+ .iter()
2533+ .zip(&theirs[1])
2534+ .map(|(a, b)| a + b)
2535+ .collect();
25092536 let (mono_lag, _, mono_edge) =
25102537 robust_lag_topk(&mono_o, &mono_t, WIDE_LAG_MAX, our_rate, TOPK);
25112538 assert!(
@@ -2548,7 +2575,9 @@ fn synthetic_heaac_matrix() {
25482575 } else {
25492576 ((-lag) as usize, 0usize)
25502577 };
2551- let n = WINDOW.min(o.len().saturating_sub(oa)).min(t.len().saturating_sub(ob));
2578+ let n = WINDOW
2579+ .min(o.len().saturating_sub(oa))
2580+ .min(t.len().saturating_sub(ob));
25522581 let above = if n >= 1024 {
25532582 correlation(
25542583 &highpass(&o[oa..oa + n], our_rate, crossover_hz),
@@ -2886,8 +2915,14 @@ fn sbr_real_library_matches_reference() {
28862915 let high = if n >= 1024 {
28872916 let oh = highpass(&o[oa..oa + n], rate, c.crossover_hz);
28882917 let th = highpass(&t[ob..ob + n], rate, c.crossover_hz);
2889- let rms = |v: &[f32]| (v.iter().map(|x| f64::from(*x).powi(2)).sum::<f64>() / v.len().max(1) as f64).sqrt();
2890- println!(" ch{ch} above-crossover RMS ours/ref = {:.4}", rms(&oh) / rms(&th).max(1e-12));
2918+ let rms = |v: &[f32]| {
2919+ (v.iter().map(|x| f64::from(*x).powi(2)).sum::<f64>() / v.len().max(1) as f64)
2920+ .sqrt()
2921+ };
2922+ println!(
2923+ " ch{ch} above-crossover RMS ours/ref = {:.4}",
2924+ rms(&oh) / rms(&th).max(1e-12)
2925+ );
28912926 correlation(&oh, &th)
28922927 } else {
28932928 0.0
@@ -3154,7 +3189,10 @@ fn sbr_real_library_matches_reference() {
31543189 ci += c.im;
31553190 }
31563191 let coh = (cr * cr + ci * ci).sqrt() / (eo * et).sqrt().max(1e-30);
3157- println!(" band{band:>3}: {:>7.2} dB coh {coh:.4}", 10.0 * (eo / et.max(1e-30)).log10());
3192+ println!(
3193+ " band{band:>3}: {:>7.2} dB coh {coh:.4}",
3194+ 10.0 * (eo / et.max(1e-30)).log10()
3195+ );
31583196 }
31593197 }
31603198 let mean_in = |rows: &[(usize, f64)], lo: usize, hi: usize| {
@@ -3559,7 +3597,10 @@ fn sbr_actual_noise_fraction() {
35593597 // has nonzero entries for QMF bands up to `k2`).
35603598 let band_hz = f64::from(rate) / 128.0;
35613599 let kx_band = bookkept.iter().map(|(b, ..)| *b).min().unwrap_or(0);
3562- 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);
3600+ println!(
3601+ " (crossover: QMF band {kx_band}, {:.0} Hz -- rows below it are core-decoded and excluded from the total)",
3602+ kx_band as f64 * band_hz
3603+ );
35633604 println!(
35643605 " ACTUAL noise fraction (band_hz, energy_on, energy_off, actual_fraction, bookkept_fraction):"
35653606 );
@@ -3712,9 +3753,8 @@ fn sbr_header_feature_table() {
37123753 ffmpeg_stream: c.ffmpeg_stream,
37133754 })
37143755 .collect();
3715- let fixtures = std::env::var("EC_AAC_HEAAC_FIXTURES").unwrap_or_else(|_| {
3716- format!("{}/../../.cache/heaac-fixtures", env!("CARGO_MANIFEST_DIR"))
3717- });
3756+ let fixtures = std::env::var("EC_AAC_HEAAC_FIXTURES")
3757+ .unwrap_or_else(|_| format!("{}/../../.cache/heaac-fixtures", env!("CARGO_MANIFEST_DIR")));
37183758 let fixtures = PathBuf::from(fixtures);
37193759 if fixtures.is_dir() {
37203760 for rate in [48_000u32, 44_100] {
@@ -3746,8 +3786,25 @@ fn sbr_header_feature_table() {
37463786 const WIDE_LAG_MAX: i64 = 20_000;
37473787 println!(
37483788 "{:<20} {:>6} {:>4} {:>4} {:>4} {:>4} {:>4} {:>4} {:>4} {:>4} {:>4} {:>4} {:>5} {:>10} {:>10} {:>8} {:>8} {:>10} {:>6}",
3749- "stream", "rate", "kx", "k2", "xovr", "sfrq", "efrq", "fscl", "ascl", "nbnd", "lbnd", "lgn",
3750- "ifrq", "smooth", "envs", "invf", "harm", "df%", "corr"
3789+ "stream",
3790+ "rate",
3791+ "kx",
3792+ "k2",
3793+ "xovr",
3794+ "sfrq",
3795+ "efrq",
3796+ "fscl",
3797+ "ascl",
3798+ "nbnd",
3799+ "lbnd",
3800+ "lgn",
3801+ "ifrq",
3802+ "smooth",
3803+ "envs",
3804+ "invf",
3805+ "harm",
3806+ "df%",
3807+ "corr"
37513808 );
37523809 for r in &rows {
37533810 let before = ec_aac::sbr_sideinfo_log().len();
@@ -3760,7 +3817,11 @@ fn sbr_header_feature_table() {
37603817 continue;
37613818 }
37623819 let log = ec_aac::sbr_sideinfo_log();
3763- let frames: Vec<_> = log[before..].iter().filter(|row| row.ch == 0).take(20).collect();
3820+ let frames: Vec<_> = log[before..]
3821+ .iter()
3822+ .filter(|row| row.ch == 0)
3823+ .take(20)
3824+ .collect();
37643825 if frames.is_empty() {
37653826 eprintln!("SKIP {}: no sideinfo rows captured", r.label);
37663827 continue;
@@ -3772,13 +3833,24 @@ fn sbr_header_feature_table() {
37723833 let mut df_total = 0usize;
37733834 let mut df_ones = 0usize;
37743835 for row in &frames {
3775- *env_counts.entry(row.t_env.len().saturating_sub(1)).or_default() += 1;
3836+ *env_counts
3837+ .entry(row.t_env.len().saturating_sub(1))
3838+ .or_default() += 1;
37763839 invf_seen.extend(&row.invf_mode);
3777- if row.add_harmonic.as_ref().is_some_and(|h| h.iter().any(|&v| v != 0)) {
3840+ if row
3841+ .add_harmonic
3842+ .as_ref()
3843+ .is_some_and(|h| h.iter().any(|&v| v != 0))
3844+ {
37783845 any_harmonic = true;
37793846 }
37803847 df_total += row.df_env.len() + row.df_noise.len();
3781- df_ones += row.df_env.iter().chain(&row.df_noise).filter(|&&b| b != 0).count();
3848+ df_ones += row
3849+ .df_env
3850+ .iter()
3851+ .chain(&row.df_noise)
3852+ .filter(|&&b| b != 0)
3853+ .count();
37823854 }
37833855 let df_pct = if df_total > 0 {
37843856 100.0 * df_ones as f64 / df_total as f64
@@ -3790,20 +3862,36 @@ fn sbr_header_feature_table() {
37903862 .map(|(k, v)| format!("{k}x{v}"))
37913863 .collect::<Vec<_>>()
37923864 .join(",");
3793- let invf_str: String = invf_seen.iter().map(|v| v.to_string()).collect::<Vec<_>>().join("");
3865+ let invf_str: String = invf_seen
3866+ .iter()
3867+ .map(|v| v.to_string())
3868+ .collect::<Vec<_>>()
3869+ .join("");
37943870 let theirs = ffmpeg_decode(&r.path, r.ffmpeg_stream, ours.len());
37953871 let (_, corr) = best_lag_correlation_wide(&ours[0], &theirs[0], WIDE_LAG_MAX);
37963872 println!(
37973873 "{:<20} {:>6} {:>4} {:>4} {:>4} {:>4} {:>4} {:>4} {:>4} {:>4} {:>4} {:>4} {:>5} {:>10} {:>10} {:>8} {:>8} {:>10.1} {:>6.3}",
3798- r.label, our_rate, f0.kx, f0.k2, f0.xover_band, f0.start_freq, f0.stop_freq,
3799- f0.freq_scale, f0.alter_scale, f0.noise_bands, f0.limiter_bands, f0.limiter_gains,
3800- f0.interpol_freq, f0.smoothing_mode, envs_hist, invf_str,
3801- any_harmonic, df_pct, corr
3802- );
3803- println!(
3804- " patches (frame0): {:?}",
3805- f0.patch_lengths
3874+ r.label,
3875+ our_rate,
3876+ f0.kx,
3877+ f0.k2,
3878+ f0.xover_band,
3879+ f0.start_freq,
3880+ f0.stop_freq,
3881+ f0.freq_scale,
3882+ f0.alter_scale,
3883+ f0.noise_bands,
3884+ f0.limiter_bands,
3885+ f0.limiter_gains,
3886+ f0.interpol_freq,
3887+ f0.smoothing_mode,
3888+ envs_hist,
3889+ invf_str,
3890+ any_harmonic,
3891+ df_pct,
3892+ corr
38063893 );
3894+ println!(" patches (frame0): {:?}", f0.patch_lengths);
38073895 }
38083896 }
38093897
@@ -3874,7 +3962,11 @@ fn per_au_low_band_probe(label: &str, path: &Path, aac_stream: usize) {
38743962 }
38753963 }
38763964 if core_ch0.is_empty() || full_ch0.is_empty() {
3877- eprintln!("SKIP {label}: empty decode (core {} full {})", core_ch0.len(), full_ch0.len());
3965+ eprintln!(
3966+ "SKIP {label}: empty decode (core {} full {})",
3967+ core_ch0.len(),
3968+ full_ch0.len()
3969+ );
38783970 return;
38793971 }
38803972
@@ -3949,9 +4041,8 @@ fn per_au_low_band_divergence() {
39494041 for c in &candidates() {
39504042 per_au_low_band_probe(&c.path.display().to_string(), &c.path, c.aac_stream);
39514043 }
3952- let dir = std::env::var("EC_AAC_HEAAC_FIXTURES").unwrap_or_else(|_| {
3953- format!("{}/../../.cache/heaac-fixtures", env!("CARGO_MANIFEST_DIR"))
3954- });
4044+ let dir = std::env::var("EC_AAC_HEAAC_FIXTURES")
4045+ .unwrap_or_else(|_| format!("{}/../../.cache/heaac-fixtures", env!("CARGO_MANIFEST_DIR")));
39554046 let failing = PathBuf::from(&dir).join("heaac_44100_48k.m4a");
39564047 if failing.exists() {
39574048 per_au_low_band_probe("synthetic 44100 48k (failing)", &failing, 0);
@@ -4097,7 +4188,9 @@ fn probe_explicit_config_and_wide_lag() {
40974188 let theirs = ffmpeg_decode(&path, ffmpeg_stream, hand_planes.len());
40984189 if let (Some(o), Some(t)) = (hand_planes.first(), theirs.first()) {
40994190 let (lag, corr) = best_lag_correlation_wide(o, t, 100_000);
4100- println!(" hand-built explicit config: full-band vs reference: lag={lag} corr={corr:.6}");
4191+ println!(
4192+ " hand-built explicit config: full-band vs reference: lag={lag} corr={corr:.6}"
4193+ );
41014194 }
41024195 }
41034196
@@ -4111,10 +4204,9 @@ fn probe_explicit_config_and_wide_lag() {
41114204 "{home}/Downloads/reelp/reelp.mkv"
41124205 ));
41134206 if fmj.exists() {
4114- if let (Some((core, core_rate)), Some((full, sbr, full_rate))) = (
4115- our_decode_core_only(&fmj, 1),
4116- our_decode(&fmj, 1),
4117- ) {
4207+ if let (Some((core, core_rate)), Some((full, sbr, full_rate))) =
4208+ (our_decode_core_only(&fmj, 1), our_decode(&fmj, 1))
4209+ {
41184210 if sbr == ec_aac::SbrSupport::V1 {
41194211 let up: Vec<f32> = core[0].iter().flat_map(|&s| [s, s]).collect();
41204212 let cutoff = f64::from(core_rate) * 0.4;
@@ -4239,9 +4331,8 @@ fn coupled_cpe_channel_swap_probe() {
42394331 eprintln!("SKIP: ffmpeg not on PATH");
42404332 return;
42414333 }
4242- let dir = std::env::var("EC_AAC_HEAAC_FIXTURES").unwrap_or_else(|_| {
4243- format!("{}/../../.cache/heaac-fixtures", env!("CARGO_MANIFEST_DIR"))
4244- });
4334+ let dir = std::env::var("EC_AAC_HEAAC_FIXTURES")
4335+ .unwrap_or_else(|_| format!("{}/../../.cache/heaac-fixtures", env!("CARGO_MANIFEST_DIR")));
42454336 let path = PathBuf::from(&dir).join("heaac_44100_48k.m4a");
42464337 if !path.exists() {
42474338 eprintln!("SKIP: {} absent", path.display());
@@ -4256,7 +4347,10 @@ fn coupled_cpe_channel_swap_probe() {
42564347 let ref_r = ffmpeg_decode_pan_channel(&path, 0, 1);
42574348 {
42584349 let n = ref_l.len().min(ref_r.len()).min(WINDOW);
4259- println!("ref L vs ref R (no lag): corr={:.6}", correlation(&ref_l[..n], &ref_r[..n]));
4350+ println!(
4351+ "ref L vs ref R (no lag): corr={:.6}",
4352+ correlation(&ref_l[..n], &ref_r[..n])
4353+ );
42604354 let (lag, corr) = best_lag_correlation_wide(&ref_l, &ref_r, SEARCH_LAG_MAX);
42614355 println!("ref L vs ref R (best lag search): lag={lag} corr={corr:.6}");
42624356 }
@@ -4329,11 +4423,17 @@ fn coupled_cpe_channel_swap_probe() {
43294423 let (core_lag0, core_corr0) =
43304424 best_lag_correlation_wide(&core_planes[0], &ref_core[0], SEARCH_LAG_MAX);
43314425 let core_implied_lag = core_lag0 * 2;
4332- println!("core ch0 vs ref L best lag={core_lag0} corr={core_corr0:.6} -> implied full-rate lag={core_implied_lag}");
4426+ println!(
4427+ "core ch0 vs ref L best lag={core_lag0} corr={core_corr0:.6} -> implied full-rate lag={core_implied_lag}"
4428+ );
43334429 let mono_ours: Vec<f32> = ours[0].iter().zip(&ours[1]).map(|(a, b)| a + b).collect();
43344430 let mono_ref: Vec<f32> = {
43354431 let n = ref_l.len().min(ref_r.len());
4336- ref_l[..n].iter().zip(&ref_r[..n]).map(|(a, b)| a + b).collect()
4432+ ref_l[..n]
4433+ .iter()
4434+ .zip(&ref_r[..n])
4435+ .map(|(a, b)| a + b)
4436+ .collect()
43374437 };
43384438 let (mono_lag, mono_corr) = best_lag_correlation_wide(&mono_ours, &mono_ref, SEARCH_LAG_MAX);
43394439 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() {
43494449 // corr=0.873 above). So the TRUE best lag among our 4 candidates is
43504450 // whichever one actually maximizes the fixed-lag mono correlation, not
43514451 // whatever `mono_lag` the free search reported.
4352- let mut true_best = (mono_lag, "mono-best lag (free search)", 0.0f64, 0.0f64, 0.0f64, 0.0f64, mono_corr);
4452+ let mut true_best = (
4453+ mono_lag,
4454+ "mono-best lag (free search)",
4455+ 0.0f64,
4456+ 0.0f64,
4457+ 0.0f64,
4458+ 0.0f64,
4459+ mono_corr,
4460+ );
43534461 for (lag, label) in fixed_lags {
43544462 let c0l = correlation_at_lag(&ours[0], &ref_l, lag);
43554463 let c0r = correlation_at_lag(&ours[0], &ref_r, lag);
@@ -4398,7 +4506,9 @@ fn coupled_cpe_channel_swap_probe() {
43984506 }
43994507 let cl = correlation(&ours[0][oa..oa + step], &ref_l[ob..ob + step]);
44004508 let cr = correlation(&ours[0][oa..oa + step], &ref_r[ob..ob + step]);
4401- println!("subwindow t={w}s ch0 vs ref L/R @ lag {best_lag}: corr(L)={cl:.6} corr(R)={cr:.6}");
4509+ println!(
4510+ "subwindow t={w}s ch0 vs ref L/R @ lag {best_lag}: corr(L)={cl:.6} corr(R)={cr:.6}"
4511+ );
44024512 w += 1;
44034513 }
44044514 }
@@ -4569,9 +4679,8 @@ fn sbr441_family_sample_drift_probe() {
45694679 eprintln!("SKIP: ffmpeg not on PATH");
45704680 return;
45714681 }
4572- let dir = std::env::var("EC_AAC_HEAAC_FIXTURES").unwrap_or_else(|_| {
4573- format!("{}/../../.cache/heaac-fixtures", env!("CARGO_MANIFEST_DIR"))
4574- });
4682+ let dir = std::env::var("EC_AAC_HEAAC_FIXTURES")
4683+ .unwrap_or_else(|_| format!("{}/../../.cache/heaac-fixtures", env!("CARGO_MANIFEST_DIR")));
45754684 let home = std::env::var("HOME").unwrap_or_default();
45764685 let cases: [(&str, PathBuf, i64); 3] = [
45774686 (
@@ -4690,9 +4799,8 @@ fn sbr_hf_window_band_probe() {
46904799 eprintln!("SKIP: ffmpeg not on PATH");
46914800 return;
46924801 }
4693- let dir = std::env::var("EC_AAC_HEAAC_FIXTURES").unwrap_or_else(|_| {
4694- format!("{}/../../.cache/heaac-fixtures", env!("CARGO_MANIFEST_DIR"))
4695- });
4802+ let dir = std::env::var("EC_AAC_HEAAC_FIXTURES")
4803+ .unwrap_or_else(|_| format!("{}/../../.cache/heaac-fixtures", env!("CARGO_MANIFEST_DIR")));
46964804 let path = PathBuf::from(&dir).join("heaac_48000_64k.m4a");
46974805 if !path.exists() {
46984806 eprintln!("SKIP: {} absent", path.display());
@@ -4748,7 +4856,10 @@ fn sbr_hf_window_band_probe() {
47484856 let mean_t: f64 = mags_t.iter().sum::<f64>() / 8.0;
47494857 println!(
47504858 " band{band:>3}: |ours|dB mean={mean_o:>7.2} |ref|dB mean={mean_t:>7.2} dphase(deg)={:?}",
4751- dphase_deg.iter().map(|d| format!("{d:.0}")).collect::<Vec<_>>()
4859+ dphase_deg
4860+ .iter()
4861+ .map(|d| format!("{d:.0}"))
4862+ .collect::<Vec<_>>()
47524863 );
47534864 }
47544865 }
@@ -4794,7 +4905,13 @@ fn sbr_residual_locator() {
47944905 if !have_ffmpeg() {
47954906 return;
47964907 }
4797- let home = std::env::var("HOME").unwrap();
4908+ // lane-h264reallib: `unwrap_or_default()`, the shape this file's five
4909+ // other HOME reads already use (:2710, :3426, :4109, :4182, :4575). A bare
4910+ // `unwrap()` panicked on any host with no HOME -- a fleet runner -- which
4911+ // is a red with no bearing on the decoder. The `path.exists()` guard below
4912+ // already handles the absent-file case, so an empty HOME just makes the
4913+ // fallback path relative-and-nonexistent and the test returns.
4914+ let home = std::env::var("HOME").unwrap_or_default();
47984915 // `EC_AAC_SBR_LOCATOR_FILE` points the same instrument at any other
47994916 // HE-AAC file (e.g. a mono, uncoupled, noise-only probe encode).
48004917 let path = std::env::var("EC_AAC_SBR_LOCATOR_FILE")
@@ -4803,7 +4920,9 @@ fn sbr_residual_locator() {
48034920 if !path.exists() {
48044921 return;
48054922 }
4806- let Some((ours, _, rate)) = our_decode(&path, 0) else { return };
4923+ let Some((ours, _, rate)) = our_decode(&path, 0) else {
4924+ return;
4925+ };
48074926 let theirs = ffmpeg_decode(&path, 0, ours.len());
48084927 const W: usize = 2048;
48094928 const FFT_LEN: usize = 2048;
@@ -4815,7 +4934,12 @@ fn sbr_residual_locator() {
48154934 let n = ours[ch].len().min(theirs[ch].len());
48164935 let (o, t) = (&ours[ch][..n], &theirs[ch][..n]);
48174936 let mut wins: Vec<(f64, usize)> = (0..n / W)
4818- .map(|w| (correlation(&o[w * W..(w + 1) * W], &t[w * W..(w + 1) * W]), w))
4937+ .map(|w| {
4938+ (
4939+ correlation(&o[w * W..(w + 1) * W], &t[w * W..(w + 1) * W]),
4940+ w,
4941+ )
4942+ })
48194943 .collect();
48204944 wins.sort_by(|a, b| a.0.partial_cmp(&b.0).unwrap());
48214945 println!("ch{ch} worst windows (corr, frame): {:?}", &wins[..12]);
@@ -4865,7 +4989,9 @@ fn sbr_residual_locator() {
48654989 }
48664990 }
48674991 // group into 250 Hz bands up to 8 kHz, then 1 kHz
4868- let mut edges: Vec<usize> = (0..=32).map(|i| ((i as f64 * 250.0) / hz) as usize).collect();
4992+ let mut edges: Vec<usize> = (0..=32)
4993+ .map(|i| ((i as f64 * 250.0) / hz) as usize)
4994+ .collect();
48694995 edges.extend((9..=22).map(|i| ((i as f64 * 1000.0) / hz) as usize));
48704996 for e in edges.windows(2) {
48714997 let (mut c, mut po, mut pt) = (0.0, 0.0, 0.0);
crates/ec-matroska/tests/matroska.rsmodified+49 -16
@@ -32,7 +32,9 @@ fn aac_priming_round_trips_through_codec_delay() {
3232 let dst = work().join("aac-priming-round-trip.mkv");
3333 let mut muxer = MatroskaMuxer::new(File::create(&dst).expect("output"));
3434 let stream = muxer.add_stream(info).expect("stream declared");
35- muxer.set_track_delay(stream, 21_333_333).expect("declare delay"); // 1024/48000s
35+ muxer
36+ .set_track_delay(stream, 21_333_333)
37+ .expect("declare delay"); // 1024/48000s
3638 for _ in 0..10i64 {
3739 let mut packet = Packet::new(0, rate, vec![0u8; 8]);
3840 packet.duration = Some(1024);
@@ -44,7 +46,8 @@ fn aac_priming_round_trips_through_codec_delay() {
4446 let demuxer =
4547 MatroskaDemuxer::new(BufReader::new(File::open(&dst).expect("opens"))).expect("reopens");
4648 assert_eq!(
47- demuxer.streams()[0].initial_padding, 1024,
49+ demuxer.streams()[0].initial_padding,
50+ 1024,
4851 "CodecDelay round trips to a sample count"
4952 );
5053 }
@@ -802,7 +805,11 @@ fn truncated_prefixes_are_eof_not_corrupt() {
802805 table.join("\n")
803806 );
804807 }
805- println!("{}\nidx,cut,class,packets\n{}", path.display(), table.join("\n"));
808+ println!(
809+ "{}\nidx,cut,class,packets\n{}",
810+ path.display(),
811+ table.join("\n")
812+ );
806813 }
807814
808815 fn matroska_prefix_class(data: &[u8]) -> (&'static str, u64) {
@@ -823,7 +830,6 @@ fn matroska_prefix_class(data: &[u8]) -> (&'static str, u64) {
823830 }
824831 }
825832
826-
827833 /// Where our own demuxer's seek lands on a real 5.1 E-AC-3 Matroska, in
828834 /// *timestamp* -- split from decode, per the round's charter: this measures
829835 /// 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) {
963969 #[test]
964970 #[ignore = "sweeps his real library, run manually with --ignored"]
965971 fn laced_audio_sweep_across_his_library() {
966- let manifest = Path::new("/home/user/Documents/Code/Rust/edith_codecs/fixtures/real-library-manifest.tsv");
972+ // lane-h264reallib: `fixtures()` like every sibling, instead of a
973+ // hardcoded absolute path into the primary checkout. The absolute form
974+ // silently defeated worktree isolation: a run in a worktree or a gate tree
975+ // read the MAIN checkout's manifest, so this test measured a different
976+ // tree's library than the one it was compiled from.
977+ let manifest = &fixtures().join("real-library-manifest.tsv");
967978 let Ok(rows) = std::fs::read_to_string(manifest) else {
968979 eprintln!("skipped: {} not present", manifest.display());
969980 return;
@@ -987,8 +998,7 @@ fn laced_audio_sweep_across_his_library() {
987998 if !film.exists() {
988999 continue;
9891000 }
990- let Ok(mut demux) =
991- MatroskaDemuxer::new(BufReader::new(File::open(film).expect("opens")))
1001+ let Ok(mut demux) = MatroskaDemuxer::new(BufReader::new(File::open(film).expect("opens")))
9921002 else {
9931003 eprintln!("{path}: failed to open");
9941004 continue;
@@ -1004,8 +1014,7 @@ fn laced_audio_sweep_across_his_library() {
10041014 for frac in [0.3, 0.7] {
10051015 let want = duration * frac;
10061016 let target = Timestamp::new(
1007- (want * audio.time_base.den() as f64 / audio.time_base.num() as f64).round()
1008- as i64,
1017+ (want * audio.time_base.den() as f64 / audio.time_base.num() as f64).round() as i64,
10091018 audio.time_base,
10101019 );
10111020 if demux
@@ -1096,8 +1105,8 @@ fn real_hdr_film_container_states_no_light_metadata() {
10961105 // duplication, pts) or the shared decoder crate, and which physical channel
10971106 // our 5.1 decode calls "channel 0".
10981107
1099-use ec_ac3::Ac3Decoder;
11001108 use ec_aac::AacDecoder;
1109+use ec_ac3::Ac3Decoder;
11011110
11021111 /// Opens whichever container `path` actually is — both crates implement the
11031112 /// same `Demuxer` trait, so the rest of the harness never has to know which.
@@ -1109,9 +1118,15 @@ fn open_any(path: &Path) -> Box<dyn Demuxer> {
11091118 .read_exact(&mut head)
11101119 .expect("read head");
11111120 if ec_mp4::is_mp4(&head) {
1112- Box::new(ec_mp4::Mp4Demuxer::new(BufReader::new(File::open(path).expect("open"))).expect("mp4 opens"))
1121+ Box::new(
1122+ ec_mp4::Mp4Demuxer::new(BufReader::new(File::open(path).expect("open")))
1123+ .expect("mp4 opens"),
1124+ )
11131125 } else {
1114- Box::new(MatroskaDemuxer::new(BufReader::new(File::open(path).expect("open"))).expect("mkv opens"))
1126+ Box::new(
1127+ MatroskaDemuxer::new(BufReader::new(File::open(path).expect("open")))
1128+ .expect("mkv opens"),
1129+ )
11151130 }
11161131 }
11171132
@@ -1201,7 +1216,15 @@ fn ffmpeg_decode_planar(path: &Path, channels: usize) -> Vec<Vec<f32>> {
12011216 .args(["-v", "error", "-i"])
12021217 .arg(path)
12031218 .args([
1204- "-map", "0:a:0", "-t", "20", "-f", "f32le", "-acodec", "pcm_f32le", "-",
1219+ "-map",
1220+ "0:a:0",
1221+ "-t",
1222+ "20",
1223+ "-f",
1224+ "f32le",
1225+ "-acodec",
1226+ "pcm_f32le",
1227+ "-",
12051228 ])
12061229 .output()
12071230 .expect("ffmpeg runs");
@@ -1251,8 +1274,14 @@ fn best_lag_correlation(ours: &[f32], theirs: &[f32]) -> (i64, f64) {
12511274 let mut best_abs = -1.0f64;
12521275 let mut best = (0i64, 0.0f64);
12531276 for lag in -LAG_MAX..=LAG_MAX {
1254- let (oa, ob) = if lag >= 0 { (0usize, lag as usize) } else { ((-lag) as usize, 0usize) };
1255- let len = WINDOW.min(ours.len().saturating_sub(oa)).min(theirs.len().saturating_sub(ob));
1277+ let (oa, ob) = if lag >= 0 {
1278+ (0usize, lag as usize)
1279+ } else {
1280+ ((-lag) as usize, 0usize)
1281+ };
1282+ let len = WINDOW
1283+ .min(ours.len().saturating_sub(oa))
1284+ .min(theirs.len().saturating_sub(ob));
12561285 if len < 1024 {
12571286 continue;
12581287 }
@@ -1387,7 +1416,11 @@ fn mkv_51_channel_order() {
13871416 pkts.iter().take(5).map(|(p, _)| *p).collect::<Vec<_>>()
13881417 );
13891418 let planes = decode_ac3(&pkts);
1390- assert!(!planes.is_empty(), "{}: no channels decoded", path.display());
1419+ assert!(
1420+ !planes.is_empty(),
1421+ "{}: no channels decoded",
1422+ path.display()
1423+ );
13911424 let ffref = ffmpeg_decode_planar(path, planes.len());
13921425 for (i, ch) in planes.iter().enumerate() {
13931426 let (lag, c) = best_lag_correlation(ch, &ffref[0]);
crates/ec-probe/tests/library.rsmodified+14 -1
@@ -487,7 +487,20 @@ fn a_real_library_sweep() {
487487 taken += 1;
488488 }
489489 }
490- assert!(!chosen.is_empty(), "no readable files in the manifest");
490+ // lane-h264reallib: NOT an `assert!` here. The file's own header, lines
491+ // 5-6, is the spec: "Files that have since moved are skipped and
492+ // reported, never failed -- the manifest is a snapshot of a moving
493+ // library." An empty `chosen` IS the moved-files case, so failing on it
494+ // contradicted the contract this file declares. It was also red on any
495+ // host whose manifest paths no longer resolve, for a reason that had
496+ // nothing to do with the probe. Reported and returned, which is what
497+ // "skipped and reported, never failed" asks for.
498+ if chosen.is_empty() {
499+ eprintln!(
500+ "skipped: no readable file in the manifest (every row has moved or is unreadable)"
501+ );
502+ return;
503+ }
491504
492505 let mut rows = Vec::new();
493506 let mut failures = Vec::new();
lanes/h264reallib.report.mdmodified+27 -3
@@ -76,6 +76,7 @@ still stands, and still holds, on the machine that can run it (it did: 15 ≥ 3)
7676 Verified — the target is no longer red, and the reason is printed verbatim:
7777
7878 ```
79+
7980 test real_library_streams_match_ffmpeg ... ignored, sweeps the PERSONAL media
8081 library (~/Videos, ~/Downloads, ~/Music) through the gitignored
8182 fixtures/real-library-manifest.tsv; MINUTES of wall time (measured past 840 s on
@@ -169,12 +170,35 @@ with a soft skip, so it is harmless today, and it also silently defeats
169170 worktree isolation. Worth converting to the relative form if that ignore is ever
170171 lifted.
171172
173+### Round 2 — the four approved follow-ups (all now fixed)
174+
175+| site | change | before | after |
176+|---|---|---|---|
177+| `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` |
178+| `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` |
179+| `crates/ec-aac/tests/obs_real_content.rs:151` | same | `FAILED. 0 passed; 1 failed` — same panic | `1 passed; 0 failed; 0 ignored` |
180+| `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 |
181+
182+The two HOME fixes were proved by running them under `env -u HOME` (the
183+runner shape) before and after; the probe fix was proved by running the test
184+with its manifest paths unresolvable.
185+
186+**Sweep disposition after round 2: 6 fixed, 0 remaining, 14 already correct,
187+the rest already `#[ignore]`d or false positives.** No member of this class is
188+left red-on-runner.
189+
172190 ## Change list
173191
174192 | file | change |
175193 |---|---|
176194 | `crates/ec-h264/tests/conformance.rs:1870` | `#[ignore = "…"]` + 25-line reason above the test; assertion untouched |
177195 | `crates/ec-aac/tests/oracle.rs:688` | `#[ignore = "…"]` + reason; identical shape, assertion untouched |
178-
179-No decoder change. No new `#[ignore]` beyond the two class members above (both
180-were red-on-runner, never green). No assertion weakened anywhere.
196+| `crates/ec-probe/tests/library.rs:490` | minimum-count assert → named SKIP + return; restores the file's own :5-6 contract |
197+| `crates/ec-aac/tests/sbr_real_library.rs:4797` | bare `env::var("HOME").unwrap()` → `unwrap_or_default()` |
198+| `crates/ec-aac/tests/obs_real_content.rs:151` | same |
199+| `crates/ec-matroska/tests/matroska.rs:966` | hardcoded absolute manifest path → `fixtures()` |
200+
201+No decoder change anywhere. Two new `#[ignore]`s, both previously
202+red-on-runner and never green. The only assertion removed is the
203+`ec-probe` minimum count, and removing it RESTORES the contract that file's
204+own header declares rather than hiding a failure; no other assertion weakened.