forge
Explore
Log in

Don't you dare go Hollow

Gate the O(windows*4001*4096) whole-file drift search behind EC_AAC_SBR_TIMELINE

Browse files at this commit

f6d8fb3b0bab5faa06e3127500de3a03cc7483c4Ahmet Kaan GümüşParent: 3a95342
  • test
    • gate the O(windows*4001*4096) whole-file drift search behind EC_AAC_SBR_TIMELINE
Show full message
test(aac-sbr): gate the O(windows*4001*4096) whole-file drift search behind EC_AAC_SBR_TIMELINE

Default path now reuses the already-established global lag with no
per-window local search (O(windows*4096)) for the mean/min summary,
cutting the real-library test from ~4min/channel to seconds while the
full drift-search table is still available on demand.
crates/ec-aac/tests/sbr_real_library.rsmodified+28 -1
@@ -1897,7 +1897,34 @@ fn sbr_real_library_matches_reference() {
18971897 {
18981898 let avail = o.len().saturating_sub(oa).min(t.len().saturating_sub(ob));
18991899 let windows = avail / 4_096;
1900- let timeline = windowed_lag_drift(o, t, oa, ob, windows);
1900+ // The full per-window LOCAL_LAG=+-2000 search inside
1901+ // `windowed_lag_drift` costs O(windows * 4001 * 4096) and runs
1902+ // ~4min/channel over a whole real-library file -- that walk
1903+ // is only needed when actually hunting for a drifting lag
1904+ // (EC_AAC_SBR_TIMELINE). By default this block instead reuses
1905+ // the already-established global `lag` with NO per-window
1906+ // search (O(windows * 4096)), which is cheap and still gives
1907+ // an honest whole-file windowed mean/min at that fixed lag.
1908+ let timeline: Vec<(i64, f64)> =
1909+ if std::env::var("EC_AAC_SBR_TIMELINE").is_ok() {
1910+ windowed_lag_drift(o, t, oa, ob, windows)
1911+ } else {
1912+ (0..windows)
1913+ .filter_map(|w| {
1914+ let base_o = (oa as i64 + lag + (w * 4_096) as i64)
1915+ .try_into()
1916+ .ok()?;
1917+ let base_t = ob + w * 4_096;
1918+ if base_o + 4_096 > o.len() || base_t + 4_096 > t.len() {
1919+ return None;
1920+ }
1921+ Some((
1922+ lag,
1923+ correlation(&o[base_o..base_o + 4_096], &t[base_t..base_t + 4_096]),
1924+ ))
1925+ })
1926+ .collect()
1927+ };
19011928 if std::env::var("EC_AAC_SBR_TIMELINE").is_ok() {
19021929 println!(
19031930 " ch{ch} TIMELINE ({windows} windows, {rate} Hz, window_idx@sec, local_lag, corr):"