Whole-file windowed corr mean was double-applying the alignment lag
Browse files at this commitdd00c7cff2bb2ab8d73ef6cc7d8ffc0bae97d757Parent: 83c5aea- fix
- whole-file windowed corr mean was double-applying the alignment lag
1 changed file +8 -1
crates/ec-aac/tests/sbr_real_library.rsmodified+8 -1
| @@ -2383,7 +2383,14 @@ fn sbr_real_library_matches_reference() { | |||
| 2383 | } else { | 2383 | } else { |
| 2384 | (0..windows) | 2384 | (0..windows) |
| 2385 | .filter_map(|w| { | 2385 | .filter_map(|w| { |
| 2386 | - let base_o = (oa as i64 + lag + (w * 4_096) as i64).try_into().ok()?; | 2386 | + // `oa`/`ob` (computed above from `lag`) already encode the |
| 2387 | + // alignment shift via their differing base offsets -- do NOT | ||
| 2388 | + // add `lag` again here, that double-applies it and shifts | ||
| 2389 | + // every window an extra `lag` samples out of alignment | ||
| 2390 | + // (this collapsed the whole-file mean from ~0.96 to ~0.14 | ||
| 2391 | + // while leaving the single-WINDOW `full`/`low` numbers, | ||
| 2392 | + // which don't go through this path, unaffected). | ||
| 2393 | + let base_o = oa + w * 4_096; | ||
| 2387 | let base_t = ob + w * 4_096; | 2394 | let base_t = ob + w * 4_096; |
| 2388 | if base_o + 4_096 > o.len() || base_t + 4_096 > t.len() { | 2395 | if base_o + 4_096 > o.len() || base_t + 4_096 > t.len() { |
| 2389 | return None; | 2396 | return None; |