From 02218766d917030b98fe9e71a050ea48f07ce248 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 04:43:05 +0300 Subject: [PATCH] Tests: drop added comment lines in ec-aac/ac3/alac/amr per no-comments rule --- crates/ec-aac/tests/it/multichannel_parity.rs | 4 -- crates/ec-aac/tests/oracle.rs | 2 - .../ec-aac/tests/sbr_real_library/chunk_a.rs | 61 ------------------- .../ec-aac/tests/sbr_real_library/helpers.rs | 1 - crates/ec-aac/tests/sbr_real_library/main.rs | 5 -- crates/ec-ac3/tests/it/decode_matrix.rs | 2 - crates/ec-ac3/tests/it/dependent.rs | 1 - crates/ec-ac3/tests/it/encode_matrix.rs | 2 - crates/ec-ac3/tests/it/real_library.rs | 5 -- crates/ec-alac/tests/encode.rs | 4 -- crates/ec-alac/tests/oracle.rs | 1 - crates/ec-amr/tests/oracle.rs | 1 - crates/ec-amr/tests/wb_oracle.rs | 1 - 13 files changed, 90 deletions(-) diff --git a/crates/ec-aac/tests/it/multichannel_parity.rs b/crates/ec-aac/tests/it/multichannel_parity.rs index b5865939..f6dd6f9a 100644 --- a/crates/ec-aac/tests/it/multichannel_parity.rs +++ b/crates/ec-aac/tests/it/multichannel_parity.rs @@ -11,8 +11,6 @@ //! then each channel's correlation must reach 0.999. For 5.1 and 7.1 the channel //! order is also checked: our channel k must correlate best with FFmpeg's channel k. //! -//! Fixtures are generated at test time, so no media is committed. A missing -//! ffmpeg or encoder fails the test. use std::fs::File; use std::io::BufReader; @@ -73,14 +71,12 @@ const LAYOUTS: &[Layout] = &[ Layout { name: "7.1", channels: 8, freqs: &[300, 450, 620, 780, 960, 1130, 1310, 1500] }, ]; -/// The encoders under test, both built into the pinned ffmpeg. const ENCODERS: &[&str] = &["aac", "libfdk_aac"]; fn fixtures_dir() -> PathBuf { PathBuf::from(env!("CARGO_TARGET_TMPDIR")).join("aac_multichannel") } -/// Encodes a multitone of `layout` with `encoder` into `container`. Returns the path. fn encode(layout: &Layout, encoder: &str, container: Container) -> PathBuf { let dir = fixtures_dir(); std::fs::create_dir_all(&dir).expect("fixture dir"); diff --git a/crates/ec-aac/tests/oracle.rs b/crates/ec-aac/tests/oracle.rs index b759cf01..02802b2e 100644 --- a/crates/ec-aac/tests/oracle.rs +++ b/crates/ec-aac/tests/oracle.rs @@ -1,5 +1,3 @@ -//! Decoder and encoder against ffmpeg, on the generated fixtures. A missing -//! fixture or ffmpeg fails the test. use std::path::{Path, PathBuf}; diff --git a/crates/ec-aac/tests/sbr_real_library/chunk_a.rs b/crates/ec-aac/tests/sbr_real_library/chunk_a.rs index 0b76de14..48bad545 100644 --- a/crates/ec-aac/tests/sbr_real_library/chunk_a.rs +++ b/crates/ec-aac/tests/sbr_real_library/chunk_a.rs @@ -216,9 +216,6 @@ pub(super) fn full_chain_low_band_matches_own_core() { } } -/// SBR rows over the open FATE HE-AAC streams (`fate_aac`), each decoded -/// through its container and compared with ffmpeg, with the sideinfo and -/// instrumentation printed per row. Instrumentation only, not a regression gate. #[test] pub(super) fn synthetic_heaac_matrix() { let _guard = DECODE_SERIAL.lock().unwrap_or_else(|e| e.into_inner()); @@ -263,17 +260,6 @@ pub(super) fn synthetic_heaac_matrix() { +/-{WIDE_LAG_MAX} search's own edge", path.display() ); - // HE rows: a per-channel free lag search on periodic/tonal - // content is unreliable (coupled_cpe_channel_swap_probe - // proved this file's ref L vs ref R itself mis-searches -- - // lag=-24 corr=0.213 vs the fixed lag=0 corr=0.873 -- and - // the same coarse search can land two channels of the SAME - // stream on DIFFERENT, individually-wrong lags, faking a - // channel swap that a fixed-lag check rules out). Derive - // ONE lag per stream from the summed (mono) signal instead, - // and reuse it for both channels -- more robust than - // trusting a single, possibly-periodic channel's own search - // -- via the same top-K/refine-on-first-10s robust method. if ours.len() >= 2 && theirs.len() >= 2 { let mono_o: Vec = ours[0].iter().zip(&ours[1]).map(|(a, b)| a + b).collect(); @@ -293,32 +279,16 @@ pub(super) fn synthetic_heaac_matrix() { lag = mono_lag; full = correlation_at_lag(o, t, lag); } - // Crossover in Hz from the actual parsed kx (band width - // rate/128, same domain `sbr_chain.rs`'s own doc comment - // gives `kx`/`k2` in) when SBR engaged; a fixed quarter-Nyquist - // split for the LC controls, which carry no kx at all. let crossover_hz = if kx > 0 { f64::from(our_rate) * (kx as f64) / 128.0 } else { f64::from(our_rate) * 0.25 }; - // Same single robust `lag` the full/above bands use, not an - // independent search: a narrowband low-passed signal's - // correlation surface is broad and flat across nearby lags, - // which used to let an independent search here silently - // report a different (and unvalidated) alignment than the - // one everything else in the row is anchored at. let below = correlation_at_lag( &lowpass(o, our_rate, crossover_hz), &lowpass(t, our_rate, crossover_hz), lag, ); - // `above` re-slices at the FULL-band winning `lag` before - // splitting, same convention `sbr_real_library_matches_reference` - // uses -- round-52's first cut of this row measured `o[..n]` - // against `t[..n]` with no lag offset at all, which is only - // valid by accident at lag 0 and was silently wrong for - // every other winning lag in that table. let (oa, ob) = if lag >= 0 { (0usize, lag as usize) } else { @@ -335,27 +305,6 @@ pub(super) fn synthetic_heaac_matrix() { } else { 0.0 }; - // Round-51's self-consistency probe (our full chain's low - // band vs our own core-only decode), run per-row so a - // rate/kx-specific self-inconsistency shows in the same - // table instead of needing a second pass. - // - // Fixed (this round): the original convention naively - // nearest-neighbor UPSAMPLED the core 2x and compared it - // against the full-rate signal, low-passed at - // `core_rate*0.4` -- that stairstep-and-lowpass round trip - // is lossy enough on its own to sink a genuinely-correct - // pair's correlation (measured flat ~-0.12 here even on - // rows whose `full`/`below` columns read 0.999+ against the - // real reference). `core_only_matches_reference` already - // proved a clean pattern for this exact comparison: stay in - // the CORE's own native rate (DECIMATE the full/reference - // signal down instead of upsampling the core up) and use a - // wide lag search there. `decimate` below is a lowpass - // (well under the core Nyquist) followed by a plain - // every-other-sample drop -- the inverse of the old - // `[s, s]` upsample, at the same information cost but - // without its stairstep artifact. let decimate = |s: &[f32], from_rate: u32, to_rate: u32| -> Vec { let cutoff = f64::from(to_rate) * 0.45; lowpass(s, from_rate, cutoff) @@ -373,16 +322,6 @@ pub(super) fn synthetic_heaac_matrix() { } else { None }; - // Coordinator follow-up 2: splits "our core decode of THIS - // fixture is wrong" (core_v_ref ~0) from "the SBR chain - // scrambles a good core" (core_v_ref >= ~0.99 while `below`/ - // `above` stays ~0/negative) -- OUR core-only decode, same - // native-core-rate convention `ours_v_core` now uses, against - // the REFERENCE decoder's own decode resampled to that same - // core rate (`ffmpeg_decode_at_rate`, the same helper - // `core_only_matches_reference` already trusts) -- wide lag - // search since this is an independent alignment from - // `full`/`below`'s (core-only carries no SBR delay). let (core_v_ref, core_rate_str) = if kx > 0 { match our_decode_core_only(&path, 0) { Some((core, core_rate)) => { diff --git a/crates/ec-aac/tests/sbr_real_library/helpers.rs b/crates/ec-aac/tests/sbr_real_library/helpers.rs index 1d41bc71..e8b0f15d 100644 --- a/crates/ec-aac/tests/sbr_real_library/helpers.rs +++ b/crates/ec-aac/tests/sbr_real_library/helpers.rs @@ -1,4 +1,3 @@ -//! Shared analysis helpers for the SBR probes. use super::*; diff --git a/crates/ec-aac/tests/sbr_real_library/main.rs b/crates/ec-aac/tests/sbr_real_library/main.rs index 7761c4c3..affe4205 100644 --- a/crates/ec-aac/tests/sbr_real_library/main.rs +++ b/crates/ec-aac/tests/sbr_real_library/main.rs @@ -1,8 +1,3 @@ -//! The SBR chain, against the open FATE HE-AAC files (`open/fate/aac`), -//! decoded through their real container (mp4 `esds` / Matroska `CodecPrivate`) -//! so `AacDecoder::with_config_bytes` actually arms the SBR path -- `tests/oracle.rs` -//! remuxes everything to bare ADTS first, and an ADTS stream carries no -//! AudioSpecificConfig, so its SBR chain never sees a frame. use std::fs::File; use std::io::{BufReader, Read}; diff --git a/crates/ec-ac3/tests/it/decode_matrix.rs b/crates/ec-ac3/tests/it/decode_matrix.rs index 942a41d2..706c5e73 100644 --- a/crates/ec-ac3/tests/it/decode_matrix.rs +++ b/crates/ec-ac3/tests/it/decode_matrix.rs @@ -2,8 +2,6 @@ //! compared against ffmpeg, plus the header surface a container reads and the //! no-panic contract on damaged input. //! -//! ffmpeg is test tooling, driven through `ec_testkit::ffmpeg()`. A missing -//! fixture or ffmpeg fails the test. use std::path::Path; diff --git a/crates/ec-ac3/tests/it/dependent.rs b/crates/ec-ac3/tests/it/dependent.rs index 3e06fea2..53044953 100644 --- a/crates/ec-ac3/tests/it/dependent.rs +++ b/crates/ec-ac3/tests/it/dependent.rs @@ -2,7 +2,6 @@ //! spliced stream: its channel placement (the replace-or-add rule of Table E2.5) //! and its channel order, which ffprobe names in `channel_layout`. //! -//! A missing fixture or ffmpeg fails the test. use std::path::Path; diff --git a/crates/ec-ac3/tests/it/encode_matrix.rs b/crates/ec-ac3/tests/it/encode_matrix.rs index 41982d71..518a724d 100644 --- a/crates/ec-ac3/tests/it/encode_matrix.rs +++ b/crates/ec-ac3/tests/it/encode_matrix.rs @@ -1,5 +1,4 @@ //! Encoder coverage: frames our own decoder round-trips, and that ffmpeg -//! accepts as valid AC-3 and decodes to the same audio — on //! synthetic signals and on the real 16-bit fixtures, at every rate and //! layout the encoder offers. @@ -78,7 +77,6 @@ fn take_channel(interleaved: &[f32], channels: usize, ch: usize) -> Vec { .collect() } -/// The fixture's PCM decoded by ffmpeg, with its rate and channel count. fn read_wav(path: &Path) -> (Vec, u32, usize) { let out = ec_testkit::ffmpeg() .args(["-v", "error", "-i"]) diff --git a/crates/ec-ac3/tests/it/real_library.rs b/crates/ec-ac3/tests/it/real_library.rs index 0fd5a8a4..cdda537e 100644 --- a/crates/ec-ac3/tests/it/real_library.rs +++ b/crates/ec-ac3/tests/it/real_library.rs @@ -1,6 +1,3 @@ -//! AC-3 and E-AC-3 decode of the open FATE streams, compared against ffmpeg -//! per channel. Every stream under `open/fate/ac3` and `open/fate/eac3` is -//! decoded whole. //! //! Gate: per-channel correlation >= 0.999 (the matrix floor), and the //! exact-sample share and RMS delta are reported for each file. @@ -15,7 +12,6 @@ const SILENT_RMS: f64 = 1e-4; /// RMS delta ceiling on a silent channel: 1/30 of a 16-bit LSB. const SILENT_DELTA: f64 = 1e-6; -/// ffmpeg's decode of the stream as interleaved `f32`. fn reference(path: &Path) -> Vec { let out = ec_testkit::ffmpeg() .args(["-v", "error", "-nostdin", "-i"]) @@ -31,7 +27,6 @@ fn reference(path: &Path) -> Vec { .collect() } -/// Our decode of the stream (dither off, as in the matrix test) and the /// channel count. fn decode(path: &Path) -> (Vec, usize) { let data = std::fs::read(path).expect("fixture"); diff --git a/crates/ec-alac/tests/encode.rs b/crates/ec-alac/tests/encode.rs index 02da23c5..19b5ea91 100644 --- a/crates/ec-alac/tests/encode.rs +++ b/crates/ec-alac/tests/encode.rs @@ -1,5 +1,4 @@ //! Round-trip the encoder through the decoder it was written to feed, then -//! through a real mp4 mux and ffmpeg/ffprobe. use std::fs::File; use std::io::{BufReader, Cursor}; @@ -75,7 +74,6 @@ fn mux_to_m4a(enc: &AlacEncoder, channels: usize, sample_rate: u32, samples: &[i (dir, out_path) } -/// ffmpeg's decode of `path` in raw format `fmt`. fn ffmpeg_decode(path: &Path, fmt: &str) -> Vec { let decode = ec_testkit::ffmpeg() .args(["-nostdin", "-v", "error", "-i"]) @@ -252,8 +250,6 @@ fn muxed_stream_is_alac_at_the_right_rate_and_ffmpeg_agrees() { } -/// Encode through our encoder, decode through ours and the reference decoder -/// via a real m4a; both must hand back `samples` exactly. fn round_trip_both_decoders(channels: u8, samples: &[i32], allow_shift: bool, what: &str) { let mut enc = AlacEncoder::new(48_000, channels, 24, 4096).expect("encoder"); enc.set_byte_shift(allow_shift); diff --git a/crates/ec-alac/tests/oracle.rs b/crates/ec-alac/tests/oracle.rs index 76062f60..64c66d4c 100644 --- a/crates/ec-alac/tests/oracle.rs +++ b/crates/ec-alac/tests/oracle.rs @@ -2,7 +2,6 @@ //! same bytes ffmpeg's decoder produces, sample for sample, in the same channel //! order. //! -//! Fixtures come from `scripts/fixtures.sh`; a missing one fails the test. use std::fs::File; use std::io::BufReader; diff --git a/crates/ec-amr/tests/oracle.rs b/crates/ec-amr/tests/oracle.rs index 2d709b60..070cf2bb 100644 --- a/crates/ec-amr/tests/oracle.rs +++ b/crates/ec-amr/tests/oracle.rs @@ -3,7 +3,6 @@ //! reference this port follows) the output must be bit-exact; against ffmpeg's native `amrnb` //! decoder the SNR is reported and must stay high. //! -//! The fixtures are generated on the fly with the pinned ffmpeg from lavfi sources. use std::path::{Path, PathBuf}; diff --git a/crates/ec-amr/tests/wb_oracle.rs b/crates/ec-amr/tests/wb_oracle.rs index 1b09249d..24d791d5 100644 --- a/crates/ec-amr/tests/wb_oracle.rs +++ b/crates/ec-amr/tests/wb_oracle.rs @@ -2,7 +2,6 @@ //! the 3GPP TS 26.173 reference code: the output must match it sample for sample. //! //! Fixtures are made here with ffmpeg's `libvo_amrwbenc` from a synthetic source, one file per -//! mode, as `.awb` and as mp4 (`sawb`). The pinned ffmpeg must have those codecs. use std::fs::File; use std::io::{BufReader, Cursor};