Tests: drop added comment lines in ec-aac/ac3/alac/amr per no-comments rule
Browse files at this commit02218766d917030b98fe9e71a050ea48f07ce248Parent: 0e512e613 changed files +0 -90
- crates/ec-aac/tests/it/multichannel_parity.rs +0 -4
- crates/ec-aac/tests/oracle.rs +0 -2
- crates/ec-aac/tests/sbr_real_library/chunk_a.rs +0 -61
- crates/ec-aac/tests/sbr_real_library/helpers.rs +0 -1
- crates/ec-aac/tests/sbr_real_library/main.rs +0 -5
- crates/ec-ac3/tests/it/decode_matrix.rs +0 -2
- crates/ec-ac3/tests/it/dependent.rs +0 -1
- crates/ec-ac3/tests/it/encode_matrix.rs +0 -2
- crates/ec-ac3/tests/it/real_library.rs +0 -5
- crates/ec-alac/tests/encode.rs +0 -4
- crates/ec-alac/tests/oracle.rs +0 -1
- crates/ec-amr/tests/oracle.rs +0 -1
- crates/ec-amr/tests/wb_oracle.rs +0 -1
crates/ec-aac/tests/it/multichannel_parity.rsmodified+0 -4
| @@ -11,8 +11,6 @@ | |||
| 11 | //! then each channel's correlation must reach 0.999. For 5.1 and 7.1 the channel | 11 | //! then each channel's correlation must reach 0.999. For 5.1 and 7.1 the channel |
| 12 | //! order is also checked: our channel k must correlate best with FFmpeg's channel k. | 12 | //! order is also checked: our channel k must correlate best with FFmpeg's channel k. |
| 13 | //! | 13 | //! |
| 14 | -//! Fixtures are generated at test time, so no media is committed. A missing | ||
| 15 | -//! ffmpeg or encoder fails the test. | ||
| 16 | 14 | ||
| 17 | use std::fs::File; | 15 | use std::fs::File; |
| 18 | use std::io::BufReader; | 16 | use std::io::BufReader; |
| @@ -73,14 +71,12 @@ const LAYOUTS: &[Layout] = &[ | |||
| 73 | Layout { name: "7.1", channels: 8, freqs: &[300, 450, 620, 780, 960, 1130, 1310, 1500] }, | 71 | Layout { name: "7.1", channels: 8, freqs: &[300, 450, 620, 780, 960, 1130, 1310, 1500] }, |
| 74 | ]; | 72 | ]; |
| 75 | 73 | ||
| 76 | -/// The encoders under test, both built into the pinned ffmpeg. | ||
| 77 | const ENCODERS: &[&str] = &["aac", "libfdk_aac"]; | 74 | const ENCODERS: &[&str] = &["aac", "libfdk_aac"]; |
| 78 | 75 | ||
| 79 | fn fixtures_dir() -> PathBuf { | 76 | fn fixtures_dir() -> PathBuf { |
| 80 | PathBuf::from(env!("CARGO_TARGET_TMPDIR")).join("aac_multichannel") | 77 | PathBuf::from(env!("CARGO_TARGET_TMPDIR")).join("aac_multichannel") |
| 81 | } | 78 | } |
| 82 | 79 | ||
| 83 | -/// Encodes a multitone of `layout` with `encoder` into `container`. Returns the path. | ||
| 84 | fn encode(layout: &Layout, encoder: &str, container: Container) -> PathBuf { | 80 | fn encode(layout: &Layout, encoder: &str, container: Container) -> PathBuf { |
| 85 | let dir = fixtures_dir(); | 81 | let dir = fixtures_dir(); |
| 86 | std::fs::create_dir_all(&dir).expect("fixture dir"); | 82 | std::fs::create_dir_all(&dir).expect("fixture dir"); |
crates/ec-aac/tests/oracle.rsmodified+0 -2
| @@ -1,5 +1,3 @@ | |||
| 1 | -//! Decoder and encoder against ffmpeg, on the generated fixtures. A missing | ||
| 2 | -//! fixture or ffmpeg fails the test. | ||
| 3 | 1 | ||
| 4 | use std::path::{Path, PathBuf}; | 2 | use std::path::{Path, PathBuf}; |
| 5 | 3 | ||
crates/ec-aac/tests/sbr_real_library/chunk_a.rsmodified+0 -61
| @@ -216,9 +216,6 @@ pub(super) fn full_chain_low_band_matches_own_core() { | |||
| 216 | } | 216 | } |
| 217 | } | 217 | } |
| 218 | 218 | ||
| 219 | -/// SBR rows over the open FATE HE-AAC streams (`fate_aac`), each decoded | ||
| 220 | -/// through its container and compared with ffmpeg, with the sideinfo and | ||
| 221 | -/// instrumentation printed per row. Instrumentation only, not a regression gate. | ||
| 222 | #[test] | 219 | #[test] |
| 223 | pub(super) fn synthetic_heaac_matrix() { | 220 | pub(super) fn synthetic_heaac_matrix() { |
| 224 | let _guard = DECODE_SERIAL.lock().unwrap_or_else(|e| e.into_inner()); | 221 | let _guard = DECODE_SERIAL.lock().unwrap_or_else(|e| e.into_inner()); |
| @@ -263,17 +260,6 @@ pub(super) fn synthetic_heaac_matrix() { | |||
| 263 | +/-{WIDE_LAG_MAX} search's own edge", | 260 | +/-{WIDE_LAG_MAX} search's own edge", |
| 264 | path.display() | 261 | path.display() |
| 265 | ); | 262 | ); |
| 266 | - // HE rows: a per-channel free lag search on periodic/tonal | ||
| 267 | - // content is unreliable (coupled_cpe_channel_swap_probe | ||
| 268 | - // proved this file's ref L vs ref R itself mis-searches -- | ||
| 269 | - // lag=-24 corr=0.213 vs the fixed lag=0 corr=0.873 -- and | ||
| 270 | - // the same coarse search can land two channels of the SAME | ||
| 271 | - // stream on DIFFERENT, individually-wrong lags, faking a | ||
| 272 | - // channel swap that a fixed-lag check rules out). Derive | ||
| 273 | - // ONE lag per stream from the summed (mono) signal instead, | ||
| 274 | - // and reuse it for both channels -- more robust than | ||
| 275 | - // trusting a single, possibly-periodic channel's own search | ||
| 276 | - // -- via the same top-K/refine-on-first-10s robust method. | ||
| 277 | if ours.len() >= 2 && theirs.len() >= 2 { | 263 | if ours.len() >= 2 && theirs.len() >= 2 { |
| 278 | let mono_o: Vec<f32> = | 264 | let mono_o: Vec<f32> = |
| 279 | ours[0].iter().zip(&ours[1]).map(|(a, b)| a + b).collect(); | 265 | ours[0].iter().zip(&ours[1]).map(|(a, b)| a + b).collect(); |
| @@ -293,32 +279,16 @@ pub(super) fn synthetic_heaac_matrix() { | |||
| 293 | lag = mono_lag; | 279 | lag = mono_lag; |
| 294 | full = correlation_at_lag(o, t, lag); | 280 | full = correlation_at_lag(o, t, lag); |
| 295 | } | 281 | } |
| 296 | - // Crossover in Hz from the actual parsed kx (band width | ||
| 297 | - // rate/128, same domain `sbr_chain.rs`'s own doc comment | ||
| 298 | - // gives `kx`/`k2` in) when SBR engaged; a fixed quarter-Nyquist | ||
| 299 | - // split for the LC controls, which carry no kx at all. | ||
| 300 | let crossover_hz = if kx > 0 { | 282 | let crossover_hz = if kx > 0 { |
| 301 | f64::from(our_rate) * (kx as f64) / 128.0 | 283 | f64::from(our_rate) * (kx as f64) / 128.0 |
| 302 | } else { | 284 | } else { |
| 303 | f64::from(our_rate) * 0.25 | 285 | f64::from(our_rate) * 0.25 |
| 304 | }; | 286 | }; |
| 305 | - // Same single robust `lag` the full/above bands use, not an | ||
| 306 | - // independent search: a narrowband low-passed signal's | ||
| 307 | - // correlation surface is broad and flat across nearby lags, | ||
| 308 | - // which used to let an independent search here silently | ||
| 309 | - // report a different (and unvalidated) alignment than the | ||
| 310 | - // one everything else in the row is anchored at. | ||
| 311 | let below = correlation_at_lag( | 287 | let below = correlation_at_lag( |
| 312 | &lowpass(o, our_rate, crossover_hz), | 288 | &lowpass(o, our_rate, crossover_hz), |
| 313 | &lowpass(t, our_rate, crossover_hz), | 289 | &lowpass(t, our_rate, crossover_hz), |
| 314 | lag, | 290 | lag, |
| 315 | ); | 291 | ); |
| 316 | - // `above` re-slices at the FULL-band winning `lag` before | ||
| 317 | - // splitting, same convention `sbr_real_library_matches_reference` | ||
| 318 | - // uses -- round-52's first cut of this row measured `o[..n]` | ||
| 319 | - // against `t[..n]` with no lag offset at all, which is only | ||
| 320 | - // valid by accident at lag 0 and was silently wrong for | ||
| 321 | - // every other winning lag in that table. | ||
| 322 | let (oa, ob) = if lag >= 0 { | 292 | let (oa, ob) = if lag >= 0 { |
| 323 | (0usize, lag as usize) | 293 | (0usize, lag as usize) |
| 324 | } else { | 294 | } else { |
| @@ -335,27 +305,6 @@ pub(super) fn synthetic_heaac_matrix() { | |||
| 335 | } else { | 305 | } else { |
| 336 | 0.0 | 306 | 0.0 |
| 337 | }; | 307 | }; |
| 338 | - // Round-51's self-consistency probe (our full chain's low | ||
| 339 | - // band vs our own core-only decode), run per-row so a | ||
| 340 | - // rate/kx-specific self-inconsistency shows in the same | ||
| 341 | - // table instead of needing a second pass. | ||
| 342 | - // | ||
| 343 | - // Fixed (this round): the original convention naively | ||
| 344 | - // nearest-neighbor UPSAMPLED the core 2x and compared it | ||
| 345 | - // against the full-rate signal, low-passed at | ||
| 346 | - // `core_rate*0.4` -- that stairstep-and-lowpass round trip | ||
| 347 | - // is lossy enough on its own to sink a genuinely-correct | ||
| 348 | - // pair's correlation (measured flat ~-0.12 here even on | ||
| 349 | - // rows whose `full`/`below` columns read 0.999+ against the | ||
| 350 | - // real reference). `core_only_matches_reference` already | ||
| 351 | - // proved a clean pattern for this exact comparison: stay in | ||
| 352 | - // the CORE's own native rate (DECIMATE the full/reference | ||
| 353 | - // signal down instead of upsampling the core up) and use a | ||
| 354 | - // wide lag search there. `decimate` below is a lowpass | ||
| 355 | - // (well under the core Nyquist) followed by a plain | ||
| 356 | - // every-other-sample drop -- the inverse of the old | ||
| 357 | - // `[s, s]` upsample, at the same information cost but | ||
| 358 | - // without its stairstep artifact. | ||
| 359 | let decimate = |s: &[f32], from_rate: u32, to_rate: u32| -> Vec<f32> { | 308 | let decimate = |s: &[f32], from_rate: u32, to_rate: u32| -> Vec<f32> { |
| 360 | let cutoff = f64::from(to_rate) * 0.45; | 309 | let cutoff = f64::from(to_rate) * 0.45; |
| 361 | lowpass(s, from_rate, cutoff) | 310 | lowpass(s, from_rate, cutoff) |
| @@ -373,16 +322,6 @@ pub(super) fn synthetic_heaac_matrix() { | |||
| 373 | } else { | 322 | } else { |
| 374 | None | 323 | None |
| 375 | }; | 324 | }; |
| 376 | - // Coordinator follow-up 2: splits "our core decode of THIS | ||
| 377 | - // fixture is wrong" (core_v_ref ~0) from "the SBR chain | ||
| 378 | - // scrambles a good core" (core_v_ref >= ~0.99 while `below`/ | ||
| 379 | - // `above` stays ~0/negative) -- OUR core-only decode, same | ||
| 380 | - // native-core-rate convention `ours_v_core` now uses, against | ||
| 381 | - // the REFERENCE decoder's own decode resampled to that same | ||
| 382 | - // core rate (`ffmpeg_decode_at_rate`, the same helper | ||
| 383 | - // `core_only_matches_reference` already trusts) -- wide lag | ||
| 384 | - // search since this is an independent alignment from | ||
| 385 | - // `full`/`below`'s (core-only carries no SBR delay). | ||
| 386 | let (core_v_ref, core_rate_str) = if kx > 0 { | 325 | let (core_v_ref, core_rate_str) = if kx > 0 { |
| 387 | match our_decode_core_only(&path, 0) { | 326 | match our_decode_core_only(&path, 0) { |
| 388 | Some((core, core_rate)) => { | 327 | Some((core, core_rate)) => { |
crates/ec-aac/tests/sbr_real_library/helpers.rsmodified+0 -1
| @@ -1,4 +1,3 @@ | |||
| 1 | -//! Shared analysis helpers for the SBR probes. | ||
| 2 | 1 | ||
| 3 | use super::*; | 2 | use super::*; |
| 4 | 3 | ||
crates/ec-aac/tests/sbr_real_library/main.rsmodified+0 -5
| @@ -1,8 +1,3 @@ | |||
| 1 | -//! The SBR chain, against the open FATE HE-AAC files (`open/fate/aac`), | ||
| 2 | -//! decoded through their real container (mp4 `esds` / Matroska `CodecPrivate`) | ||
| 3 | -//! so `AacDecoder::with_config_bytes` actually arms the SBR path -- `tests/oracle.rs` | ||
| 4 | -//! remuxes everything to bare ADTS first, and an ADTS stream carries no | ||
| 5 | -//! AudioSpecificConfig, so its SBR chain never sees a frame. | ||
| 6 | 1 | ||
| 7 | use std::fs::File; | 2 | use std::fs::File; |
| 8 | use std::io::{BufReader, Read}; | 3 | use std::io::{BufReader, Read}; |
crates/ec-ac3/tests/it/decode_matrix.rsmodified+0 -2
| @@ -2,8 +2,6 @@ | |||
| 2 | //! compared against ffmpeg, plus the header surface a container reads and the | 2 | //! compared against ffmpeg, plus the header surface a container reads and the |
| 3 | //! no-panic contract on damaged input. | 3 | //! no-panic contract on damaged input. |
| 4 | //! | 4 | //! |
| 5 | -//! ffmpeg is test tooling, driven through `ec_testkit::ffmpeg()`. A missing | ||
| 6 | -//! fixture or ffmpeg fails the test. | ||
| 7 | 5 | ||
| 8 | use std::path::Path; | 6 | use std::path::Path; |
| 9 | 7 | ||
crates/ec-ac3/tests/it/dependent.rsmodified+0 -1
| @@ -2,7 +2,6 @@ | |||
| 2 | //! spliced stream: its channel placement (the replace-or-add rule of Table E2.5) | 2 | //! spliced stream: its channel placement (the replace-or-add rule of Table E2.5) |
| 3 | //! and its channel order, which ffprobe names in `channel_layout`. | 3 | //! and its channel order, which ffprobe names in `channel_layout`. |
| 4 | //! | 4 | //! |
| 5 | -//! A missing fixture or ffmpeg fails the test. | ||
| 6 | 5 | ||
| 7 | use std::path::Path; | 6 | use std::path::Path; |
| 8 | 7 | ||
crates/ec-ac3/tests/it/encode_matrix.rsmodified+0 -2
| @@ -1,5 +1,4 @@ | |||
| 1 | //! Encoder coverage: frames our own decoder round-trips, and that ffmpeg | 1 | //! Encoder coverage: frames our own decoder round-trips, and that ffmpeg |
| 2 | -//! accepts as valid AC-3 and decodes to the same audio — on | ||
| 3 | //! synthetic signals and on the real 16-bit fixtures, at every rate and | 2 | //! synthetic signals and on the real 16-bit fixtures, at every rate and |
| 4 | //! layout the encoder offers. | 3 | //! layout the encoder offers. |
| 5 | 4 | ||
| @@ -78,7 +77,6 @@ fn take_channel(interleaved: &[f32], channels: usize, ch: usize) -> Vec<f32> { | |||
| 78 | .collect() | 77 | .collect() |
| 79 | } | 78 | } |
| 80 | 79 | ||
| 81 | -/// The fixture's PCM decoded by ffmpeg, with its rate and channel count. | ||
| 82 | fn read_wav(path: &Path) -> (Vec<f32>, u32, usize) { | 80 | fn read_wav(path: &Path) -> (Vec<f32>, u32, usize) { |
| 83 | let out = ec_testkit::ffmpeg() | 81 | let out = ec_testkit::ffmpeg() |
| 84 | .args(["-v", "error", "-i"]) | 82 | .args(["-v", "error", "-i"]) |
crates/ec-ac3/tests/it/real_library.rsmodified+0 -5
| @@ -1,6 +1,3 @@ | |||
| 1 | -//! AC-3 and E-AC-3 decode of the open FATE streams, compared against ffmpeg | ||
| 2 | -//! per channel. Every stream under `open/fate/ac3` and `open/fate/eac3` is | ||
| 3 | -//! decoded whole. | ||
| 4 | //! | 1 | //! |
| 5 | //! Gate: per-channel correlation >= 0.999 (the matrix floor), and the | 2 | //! Gate: per-channel correlation >= 0.999 (the matrix floor), and the |
| 6 | //! exact-sample share and RMS delta are reported for each file. | 3 | //! exact-sample share and RMS delta are reported for each file. |
| @@ -15,7 +12,6 @@ const SILENT_RMS: f64 = 1e-4; | |||
| 15 | /// RMS delta ceiling on a silent channel: 1/30 of a 16-bit LSB. | 12 | /// RMS delta ceiling on a silent channel: 1/30 of a 16-bit LSB. |
| 16 | const SILENT_DELTA: f64 = 1e-6; | 13 | const SILENT_DELTA: f64 = 1e-6; |
| 17 | 14 | ||
| 18 | -/// ffmpeg's decode of the stream as interleaved `f32`. | ||
| 19 | fn reference(path: &Path) -> Vec<f32> { | 15 | fn reference(path: &Path) -> Vec<f32> { |
| 20 | let out = ec_testkit::ffmpeg() | 16 | let out = ec_testkit::ffmpeg() |
| 21 | .args(["-v", "error", "-nostdin", "-i"]) | 17 | .args(["-v", "error", "-nostdin", "-i"]) |
| @@ -31,7 +27,6 @@ fn reference(path: &Path) -> Vec<f32> { | |||
| 31 | .collect() | 27 | .collect() |
| 32 | } | 28 | } |
| 33 | 29 | ||
| 34 | -/// Our decode of the stream (dither off, as in the matrix test) and the | ||
| 35 | /// channel count. | 30 | /// channel count. |
| 36 | fn decode(path: &Path) -> (Vec<f32>, usize) { | 31 | fn decode(path: &Path) -> (Vec<f32>, usize) { |
| 37 | let data = std::fs::read(path).expect("fixture"); | 32 | let data = std::fs::read(path).expect("fixture"); |
crates/ec-alac/tests/encode.rsmodified+0 -4
| @@ -1,5 +1,4 @@ | |||
| 1 | //! Round-trip the encoder through the decoder it was written to feed, then | 1 | //! Round-trip the encoder through the decoder it was written to feed, then |
| 2 | -//! through a real mp4 mux and ffmpeg/ffprobe. | ||
| 3 | 2 | ||
| 4 | use std::fs::File; | 3 | use std::fs::File; |
| 5 | use std::io::{BufReader, Cursor}; | 4 | use std::io::{BufReader, Cursor}; |
| @@ -75,7 +74,6 @@ fn mux_to_m4a(enc: &AlacEncoder, channels: usize, sample_rate: u32, samples: &[i | |||
| 75 | (dir, out_path) | 74 | (dir, out_path) |
| 76 | } | 75 | } |
| 77 | 76 | ||
| 78 | -/// ffmpeg's decode of `path` in raw format `fmt`. | ||
| 79 | fn ffmpeg_decode(path: &Path, fmt: &str) -> Vec<u8> { | 77 | fn ffmpeg_decode(path: &Path, fmt: &str) -> Vec<u8> { |
| 80 | let decode = ec_testkit::ffmpeg() | 78 | let decode = ec_testkit::ffmpeg() |
| 81 | .args(["-nostdin", "-v", "error", "-i"]) | 79 | .args(["-nostdin", "-v", "error", "-i"]) |
| @@ -252,8 +250,6 @@ fn muxed_stream_is_alac_at_the_right_rate_and_ffmpeg_agrees() { | |||
| 252 | } | 250 | } |
| 253 | 251 | ||
| 254 | 252 | ||
| 255 | -/// Encode through our encoder, decode through ours and the reference decoder | ||
| 256 | -/// via a real m4a; both must hand back `samples` exactly. | ||
| 257 | fn round_trip_both_decoders(channels: u8, samples: &[i32], allow_shift: bool, what: &str) { | 253 | fn round_trip_both_decoders(channels: u8, samples: &[i32], allow_shift: bool, what: &str) { |
| 258 | let mut enc = AlacEncoder::new(48_000, channels, 24, 4096).expect("encoder"); | 254 | let mut enc = AlacEncoder::new(48_000, channels, 24, 4096).expect("encoder"); |
| 259 | enc.set_byte_shift(allow_shift); | 255 | enc.set_byte_shift(allow_shift); |
crates/ec-alac/tests/oracle.rsmodified+0 -1
| @@ -2,7 +2,6 @@ | |||
| 2 | //! same bytes ffmpeg's decoder produces, sample for sample, in the same channel | 2 | //! same bytes ffmpeg's decoder produces, sample for sample, in the same channel |
| 3 | //! order. | 3 | //! order. |
| 4 | //! | 4 | //! |
| 5 | -//! Fixtures come from `scripts/fixtures.sh`; a missing one fails the test. | ||
| 6 | 5 | ||
| 7 | use std::fs::File; | 6 | use std::fs::File; |
| 8 | use std::io::BufReader; | 7 | use std::io::BufReader; |
crates/ec-amr/tests/oracle.rsmodified+0 -1
| @@ -3,7 +3,6 @@ | |||
| 3 | //! reference this port follows) the output must be bit-exact; against ffmpeg's native `amrnb` | 3 | //! reference this port follows) the output must be bit-exact; against ffmpeg's native `amrnb` |
| 4 | //! decoder the SNR is reported and must stay high. | 4 | //! decoder the SNR is reported and must stay high. |
| 5 | //! | 5 | //! |
| 6 | -//! The fixtures are generated on the fly with the pinned ffmpeg from lavfi sources. | ||
| 7 | 6 | ||
| 8 | use std::path::{Path, PathBuf}; | 7 | use std::path::{Path, PathBuf}; |
| 9 | 8 | ||
crates/ec-amr/tests/wb_oracle.rsmodified+0 -1
| @@ -2,7 +2,6 @@ | |||
| 2 | //! the 3GPP TS 26.173 reference code: the output must match it sample for sample. | 2 | //! the 3GPP TS 26.173 reference code: the output must match it sample for sample. |
| 3 | //! | 3 | //! |
| 4 | //! Fixtures are made here with ffmpeg's `libvo_amrwbenc` from a synthetic source, one file per | 4 | //! Fixtures are made here with ffmpeg's `libvo_amrwbenc` from a synthetic source, one file per |
| 5 | -//! mode, as `.awb` and as mp4 (`sawb`). The pinned ffmpeg must have those codecs. | ||
| 6 | 5 | ||
| 7 | use std::fs::File; | 6 | use std::fs::File; |
| 8 | use std::io::{BufReader, Cursor}; | 7 | use std::io::{BufReader, Cursor}; |