From b5223b772eb2d9ca25a006cdc6be6b64ea034e55 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ahmet=20Kaan=20G=C3=BCm=C3=BC=C5=9F?= Date: Wed, 2 Dec 2026 13:35:05 +0300 Subject: [PATCH] U10: ec-aac drop EC_AAC env switches in adts_to_pcm probe and EC_AAC_PARITY_DEBUG dump in multichannel parity --- crates/ec-aac/examples/adts_to_pcm.rs | 34 +------------------ crates/ec-aac/tests/it/multichannel_parity.rs | 11 ------ 2 files changed, 1 insertion(+), 44 deletions(-) diff --git a/crates/ec-aac/examples/adts_to_pcm.rs b/crates/ec-aac/examples/adts_to_pcm.rs index b1223663..59b06583 100644 --- a/crates/ec-aac/examples/adts_to_pcm.rs +++ b/crates/ec-aac/examples/adts_to_pcm.rs @@ -9,39 +9,7 @@ fn main() { .nth(1) .expect("usage: adts_to_pcm "); let data = std::fs::read(&path).expect("file readable"); - // Plain `AacDecoder::new()` never enables SBR (it only turns on from an - // explicit AudioSpecificConfig's `sbr_present`, per `with_config`) -- - // the probe streams here are raw same-rate-SBR ADTS with no ASC, so - // build one directly rather than parsing bytes we don't have. - let same_rate_sbr = std::env::var("EC_AAC_SBR_SAME_RATE").is_ok(); - let channels: u16 = std::env::var("EC_AAC_SBR_CHANNELS") - .ok() - .and_then(|s| s.parse().ok()) - .unwrap_or(1); - // Round-32: built via the SAME write_audio_specific_config + - // with_config_bytes round trip `wrap_sbr` uses (AOT_SBR, core rate - // 22050 = ADTS sf_index 7's SAMPLE_RATES entry, extension 44100) so this - // path and the reference's wrap_sbr-wrapped mp4 read byte-identical ASC - // semantics -- the prior hand-built config (object_type=2/AAC-LC, - // sample_rate=44100 for what is actually the 22050 Hz *core*) diverged - // from wrap_sbr's ASC, which is why the sanity gate (ours vs - // build_patches) was failing independent of any patch-map bug. - let mut decoder = if same_rate_sbr { - let asc = ec_aac::write_audio_specific_config(&ec_aac::AudioSpecificConfig { - object_type: ec_aac::AOT_SBR, - sample_rate: 22050, - sf_index: 7, - channels, - channel_config: channels as u8, - sbr_present: true, - ps_present: false, - extension_sample_rate: Some(44100), - pce: Vec::new(), - }); - ec_aac::AacDecoder::with_config_bytes(&asc).expect("asc parses") - } else { - ec_aac::AacDecoder::new() - }; + let mut decoder = ec_aac::AacDecoder::new(); let mut at = 0usize; let stdout = std::io::stdout(); let mut out = stdout.lock(); diff --git a/crates/ec-aac/tests/it/multichannel_parity.rs b/crates/ec-aac/tests/it/multichannel_parity.rs index 792b11d3..0e4f6320 100644 --- a/crates/ec-aac/tests/it/multichannel_parity.rs +++ b/crates/ec-aac/tests/it/multichannel_parity.rs @@ -305,17 +305,6 @@ fn check_case(layout: &Layout, encoder: &str, container: Container, failures: &m .map(|(k, row)| format!("{:.6}", row[k])) .collect(); println!("{label} lag {lag:>5} corr [{}]", diag.join(", ")); - if std::env::var_os("EC_AAC_PARITY_DEBUG").is_some() { - let rms = |p: &[f32]| (p.iter().map(|v| f64::from(*v).powi(2)).sum::() / p.len() as f64).sqrt(); - let fmt = |planes: &[Vec]| planes.iter().map(|p| format!("{:.4}", rms(p))).collect::>().join(" "); - println!(" rms ours [{}]", fmt(&ours)); - println!(" rms ffmpeg [{}]", fmt(&theirs)); - for (k, row) in grid.iter().enumerate() { - let cells: Vec = row.iter().map(|c| format!("{c:+.3}")).collect(); - println!(" ours {k}: {}", cells.join(" ")); - } - } - for (k, row) in grid.iter().enumerate() { let own = row[k]; let (best_j, best_c) = row