forge
Explore
Log in

Don't you dare go Hollow

U10: ec-aac drop EC_AAC env switches in adts_to_pcm probe and EC_AAC_PARITY_DEBUG dump in multichannel parity

Browse files at this commit

b5223b772eb2d9ca25a006cdc6be6b64ea034e55Ahmet Kaan GümüşParent: ade9b54
crates/ec-aac/examples/adts_to_pcm.rsmodified+1 -33
@@ -9,39 +9,7 @@ fn main() {
99 .nth(1)
1010 .expect("usage: adts_to_pcm <file.aac>");
1111 let data = std::fs::read(&path).expect("file readable");
12- // Plain `AacDecoder::new()` never enables SBR (it only turns on from an
13- // explicit AudioSpecificConfig's `sbr_present`, per `with_config`) --
14- // the probe streams here are raw same-rate-SBR ADTS with no ASC, so
15- // build one directly rather than parsing bytes we don't have.
16- let same_rate_sbr = std::env::var("EC_AAC_SBR_SAME_RATE").is_ok();
17- let channels: u16 = std::env::var("EC_AAC_SBR_CHANNELS")
18- .ok()
19- .and_then(|s| s.parse().ok())
20- .unwrap_or(1);
21- // Round-32: built via the SAME write_audio_specific_config +
22- // with_config_bytes round trip `wrap_sbr` uses (AOT_SBR, core rate
23- // 22050 = ADTS sf_index 7's SAMPLE_RATES entry, extension 44100) so this
24- // path and the reference's wrap_sbr-wrapped mp4 read byte-identical ASC
25- // semantics -- the prior hand-built config (object_type=2/AAC-LC,
26- // sample_rate=44100 for what is actually the 22050 Hz *core*) diverged
27- // from wrap_sbr's ASC, which is why the sanity gate (ours vs
28- // build_patches) was failing independent of any patch-map bug.
29- let mut decoder = if same_rate_sbr {
30- let asc = ec_aac::write_audio_specific_config(&ec_aac::AudioSpecificConfig {
31- object_type: ec_aac::AOT_SBR,
32- sample_rate: 22050,
33- sf_index: 7,
34- channels,
35- channel_config: channels as u8,
36- sbr_present: true,
37- ps_present: false,
38- extension_sample_rate: Some(44100),
39- pce: Vec::new(),
40- });
41- ec_aac::AacDecoder::with_config_bytes(&asc).expect("asc parses")
42- } else {
43- ec_aac::AacDecoder::new()
44- };
12+ let mut decoder = ec_aac::AacDecoder::new();
4513 let mut at = 0usize;
4614 let stdout = std::io::stdout();
4715 let mut out = stdout.lock();
crates/ec-aac/tests/it/multichannel_parity.rsmodified+0 -11
@@ -305,17 +305,6 @@ fn check_case(layout: &Layout, encoder: &str, container: Container, failures: &m
305305 .map(|(k, row)| format!("{:.6}", row[k]))
306306 .collect();
307307 println!("{label} lag {lag:>5} corr [{}]", diag.join(", "));
308- if std::env::var_os("EC_AAC_PARITY_DEBUG").is_some() {
309- let rms = |p: &[f32]| (p.iter().map(|v| f64::from(*v).powi(2)).sum::<f64>() / p.len() as f64).sqrt();
310- let fmt = |planes: &[Vec<f32>]| planes.iter().map(|p| format!("{:.4}", rms(p))).collect::<Vec<_>>().join(" ");
311- println!(" rms ours [{}]", fmt(&ours));
312- println!(" rms ffmpeg [{}]", fmt(&theirs));
313- for (k, row) in grid.iter().enumerate() {
314- let cells: Vec<String> = row.iter().map(|c| format!("{c:+.3}")).collect();
315- println!(" ours {k}: {}", cells.join(" "));
316- }
317- }
318-
319308 for (k, row) in grid.iter().enumerate() {
320309 let own = row[k];
321310 let (best_j, best_c) = row