Full_chain_low_band uses top-K lag refinement and widens on a sub-bar winner (FMJ true lag 21566 sat outside the 20k bound)
Browse files at this commit11270e5df98fcbb67bdb32b06a89b21aa3da8f95Parent: 060a762- test
- full_chain_low_band uses top-K lag refinement and widens on a sub-bar winner (FMJ true lag 21566 sat outside the 20k bound)
1 changed file +19 -3
crates/ec-aac/tests/sbr_real_library.rsmodified+19 -3
| @@ -2262,10 +2262,26 @@ fn full_chain_low_band_matches_own_core() { | ||
| 2262 | 2262 | // without exposing the well-behaved one to the wider bound's |
| 2263 | 2263 | // noise floor. |
| 2264 | 2264 | const WIDE_LAG_MAX: i64 = 20_000; |
| 2265 | - // `_ex` itself widens to `SEARCH_LAG_MAX` and asserts when the | |
| 2266 | - // winner sits at the bound. | |
| 2267 | - let (lag, corr, _) = best_lag_correlation_ex(&ol, &ul, WIDE_LAG_MAX); | |
| 2265 | + // Top-K refinement, not the single coarse winner: FMJ's single | |
| 2266 | + // coarse pick landed on an in-bounds noise peak (lag 18995, | |
| 2267 | + // corr 0.10) while its true alignment scores >0.99 on refine. | |
| 2268 | + // A winner at the bound widens once, then is asserted off it. | |
| 2269 | + let (mut lag, mut corr, mut at_edge) = | |
| 2270 | + robust_lag_topk(&ol, &ul, WIDE_LAG_MAX, core_rate, 8); | |
| 2271 | + let mut bound = WIDE_LAG_MAX; | |
| 2272 | + // A sub-bar winner inside the narrow bound is the same symptom | |
| 2273 | + // (true peak outside the search), so it widens too. | |
| 2274 | + if at_edge || corr < 0.99 { | |
| 2275 | + bound = SEARCH_LAG_MAX; | |
| 2276 | + (lag, corr, at_edge) = robust_lag_topk(&ol, &ul, SEARCH_LAG_MAX, core_rate, 8); | |
| 2277 | + } | |
| 2268 | 2278 | println!(" ch{ch}: measured best lag {lag}, corr {corr:.6}"); |
| 2279 | + assert!( | |
| 2280 | + !at_edge, | |
| 2281 | + "{} ch{ch}: winning lag {lag} sits at the +/-{bound} \ | |
| 2282 | + search bound -- corr {corr:.6} is noise, not a measurement", | |
| 2283 | + c.path.display() | |
| 2284 | + ); | |
| 2269 | 2285 | assert!( |
| 2270 | 2286 | corr >= 0.99, |
| 2271 | 2287 | "{} ch{ch}: full-chain low band vs our own core-only decode \ |