diff --git a/Cargo.lock b/Cargo.lock index cc823cef..5d6b6b03 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -446,6 +446,7 @@ name = "ec-dts" version = "0.1.0" dependencies = [ "ec-core", + "ec-testkit", ] [[package]] @@ -481,6 +482,7 @@ name = "ec-flac" version = "0.1.0" dependencies = [ "ec-core", + "ec-testkit", ] [[package]] @@ -581,6 +583,7 @@ version = "0.1.0" dependencies = [ "ec-core", "ec-dsp", + "ec-testkit", "wide", ] @@ -634,6 +637,7 @@ dependencies = [ "ec-core", "ec-dsp", "ec-ogg", + "ec-testkit", "rustfft", "tracking-allocator", "wide", @@ -646,6 +650,7 @@ dependencies = [ "ec-core", "ec-mp4", "ec-riff", + "ec-testkit", ] [[package]] @@ -716,6 +721,7 @@ version = "0.1.0" dependencies = [ "ec-core", "ec-matroska", + "ec-testkit", ] [[package]] @@ -739,6 +745,7 @@ dependencies = [ "ec-core", "ec-dsp", "ec-ogg", + "ec-testkit", ] [[package]] diff --git a/crates/ec-dts/tests/fate_vectors.rs b/crates/ec-dts/tests/fate_vectors.rs index 6a236464..29f62fcc 100644 --- a/crates/ec-dts/tests/fate_vectors.rs +++ b/crates/ec-dts/tests/fate_vectors.rs @@ -4,8 +4,6 @@ //! kHz, alone and with XCH), the core inside XBR and XLL (DTS-HD) streams and //! a DTS-ES elementary stream. //! -//! The samples live in `open/fate/dts` under the fixtures root; a missing one -//! fails. use std::path::Path; diff --git a/crates/ec-dts/tests/ffmpeg_exact.rs b/crates/ec-dts/tests/ffmpeg_exact.rs index dc449d35..0f702c48 100644 --- a/crates/ec-dts/tests/ffmpeg_exact.rs +++ b/crates/ec-dts/tests/ffmpeg_exact.rs @@ -6,8 +6,6 @@ //! The fixtures are made with ffmpeg's own DTS encoder (`-c:a dca -strict //! -2`): stereo and mono tones, a mono sweep at 32 kHz, 5.1 tones at 44.1 //! kHz and 5.1 noise with ADPCM at 48 kHz. Each is decoded here and by -//! ffmpeg and every 24-bit sample must be equal. A missing fixture or ffmpeg -//! fails. //! //! The 14-bit and little-endian stream layouts are derived from the same //! fixtures here and must decode to identical samples. diff --git a/crates/ec-flac/tests/xiph_vectors.rs b/crates/ec-flac/tests/xiph_vectors.rs index b89026a3..51af476b 100644 --- a/crates/ec-flac/tests/xiph_vectors.rs +++ b/crates/ec-flac/tests/xiph_vectors.rs @@ -5,8 +5,6 @@ //! [`ec_flac::decode::DecodedStream::to_pcm_bytes`] writes) and the two buffers //! must be identical. Lossless codec, no tolerance. //! -//! The corpus is fetched by `scripts/fixtures.sh`; without it every test here -//! fails. //! //! Run the tables: //! cargo test -p ec-flac --release --test xiph_vectors -- --nocapture diff --git a/crates/ec-mp3/tests/mp2_matrix.rs b/crates/ec-mp3/tests/mp2_matrix.rs index a31aa0c5..f8e2f5f1 100644 --- a/crates/ec-mp3/tests/mp2_matrix.rs +++ b/crates/ec-mp3/tests/mp2_matrix.rs @@ -6,7 +6,6 @@ //! mode, the joint-stereo bound, CRC-protected frames and Layer I -- things no //! encoder here produces. The oracle is `ffmpeg -c:a mp2 -i x.mp2 -f f32le`. //! -//! ffmpeg is needed. //! //! cargo test -p ec-mp3 --release --test mp2_matrix -- --nocapture diff --git a/crates/ec-opus/tests/conformance.rs b/crates/ec-opus/tests/conformance.rs index ef587a17..a32a20a8 100644 --- a/crates/ec-opus/tests/conformance.rs +++ b/crates/ec-opus/tests/conformance.rs @@ -2621,22 +2621,10 @@ fn hybrid_shapes_roundtrip() { assert!(toc.stereo); } -/// Self-contained regression guard for `opus_compare_err` / `opus_compare`. -/// -/// The pinned numbers below were cross-validated against the reference C -/// `opus_compare` tool (built from `opus_compare.c`) on byte-identical raw -/// PCM, so they encode the spectral error algorithm's expected output, not -/// any particular codec. Two cases: -/// * identical signals -> C err=0.000000, Q=100.0 (exact) -/// * mild perturbation -> C err=4.444987, Q=-593.31 (exact to 6 dp) -/// -/// The perturbation case sits in the practical error range (same band as the -/// real-audio validation pairs); the identical case pins the zero-error path -/// with no floating-point tolerance. No audio files or external tools needed. #[test] fn opus_compare_err_pinned_against_c() { let _timing = timing_shared(); - const N: usize = 48000 * 4; // 4 s per channel + const N: usize = 48000 * 4; let t: Vec = (0..N).map(|i| i as f64 / 48000.0).collect(); let base = |c: usize| -> Vec { @@ -2669,7 +2657,6 @@ fn opus_compare_err_pinned_against_c() { let b0 = base(0); let b1 = base(1); - // Case 1: identical -> zero error, Q=100 (exact, no tolerance). let a = stereo(&b0, &b1); let err_id = opus_compare_err(&a, &a, 2); let q_id = opus_compare(&a, &a, 2); diff --git a/crates/ec-pcm-ext/tests/oracle.rs b/crates/ec-pcm-ext/tests/oracle.rs index 1d467fa0..f57938a0 100644 --- a/crates/ec-pcm-ext/tests/oracle.rs +++ b/crates/ec-pcm-ext/tests/oracle.rs @@ -1,7 +1,6 @@ //! Bit-exact oracle: fixtures are generated with ffmpeg from synthetic lavfi //! sources, decoded here and by ffmpeg (`-f s16le`), and must match exactly. //! -//! Needs ffmpeg; a missing one fails. use std::fs::File; use std::io::BufReader; diff --git a/crates/ec-truehd/tests/it/atmos_synth.rs b/crates/ec-truehd/tests/it/atmos_synth.rs index cefd2a3d..260ad502 100644 --- a/crates/ec-truehd/tests/it/atmos_synth.rs +++ b/crates/ec-truehd/tests/it/atmos_synth.rs @@ -1,7 +1,5 @@ //! Atmos backward compatibility, tested on a synthetic 4-substream stream. //! -//! The stream is built from the open 7.1 TrueHD sample's own access units (the -//! first [`AUS`], 3 substreams each). For every access unit, //! [`with_object_substream`] rebuilds it with a 4th directory entry: the //! object-audio substream, here a run of [`FILLER_WORDS`] stand-in words //! appended after substream 2's coded data. The rebuilt access unit is: @@ -30,7 +28,6 @@ //! `ffmpeg -f truehd -i -f s32le` can be compared against this //! decoder's output (ffmpeg decodes the same 8-channel presentation). //! -//! Needs `open/fate/truehd/atmos.thd`. use std::path::Path; @@ -40,7 +37,6 @@ use ec_truehd::sync::AccessUnitHeader; use crate::common::raw_access_units; -/// Access units taken from the start of the sample: 1 s of 48 kHz audio, one /// major sync among them. const AUS: usize = 1200; /// Length of the object-audio stand-in, in 16-bit words. @@ -49,7 +45,6 @@ const FILLER_WORDS: u16 = 4; const MAX_AU_WORDS: usize = 0x0FFF; const MAJOR_SYNC_LEN: usize = 28; -/// The first [`AUS`] access units of the open 7.1 TrueHD sample. fn truehd_access_units() -> Vec> { let data = std::fs::read(ec_testkit::fixture("open/fate/truehd/atmos.thd")).expect("read atmos.thd"); diff --git a/crates/ec-truehd/tests/it/fixture_exact.rs b/crates/ec-truehd/tests/it/fixture_exact.rs index 4e12ca68..e9ce2396 100644 --- a/crates/ec-truehd/tests/it/fixture_exact.rs +++ b/crates/ec-truehd/tests/it/fixture_exact.rs @@ -1,14 +1,10 @@ //! Sample-for-sample equality with ffmpeg's TrueHD decoder on the committed -//! fixtures in `crates/ec-truehd/fixtures/`, and on the open 7.1 sample -//! `open/fate/truehd/atmos.thd`. //! //! The committed fixtures are made with ffmpeg's own TrueHD encoder //! (`-c:a truehd -strict -2`): 2.0 and 5.1 at 16-bit (s16p input) and 24-bit //! (s32p input), 48 kHz. The file name carries the channel count: `2ch` or `51`. //! //! Each file is decoded here and by ffmpeg (`-f s32le`), and every sample must -//! be equal. Lossless decoding has no tolerance. A missing fixture or ffmpeg -//! fails. use std::fs::File; use std::io::BufReader; @@ -151,8 +147,6 @@ fn fixtures_are_bit_exact_against_ffmpeg() { } } -/// The open 7.1 TrueHD sample, decoded from its raw access units and compared -/// sample-for-sample with ffmpeg's decode of the whole file. #[test] fn atmos_71_is_bit_exact_against_ffmpeg() { let path = ec_testkit::fixture("open/fate/truehd/atmos.thd"); diff --git a/crates/ec-truehd/tests/it/library.rs b/crates/ec-truehd/tests/it/library.rs index 2ef6e9c2..09b6060d 100644 --- a/crates/ec-truehd/tests/it/library.rs +++ b/crates/ec-truehd/tests/it/library.rs @@ -1,6 +1,3 @@ -//! The open 7.1 TrueHD sample walked access unit by access unit: the units -//! tile the file exactly and their count matches ffprobe's packet count. - use crate::common::raw_access_units; #[test] diff --git a/crates/ec-truehd/tests/it/oracle.rs b/crates/ec-truehd/tests/it/oracle.rs index 24c9aeab..30af64c0 100644 --- a/crates/ec-truehd/tests/it/oracle.rs +++ b/crates/ec-truehd/tests/it/oracle.rs @@ -1,9 +1,3 @@ -//! Bit-exactness against an external decoder: the first 60 s of the open -//! 7.1 TrueHD sample (3 substreams, noise type 1 matrices), and externally -//! encoded MLP/TrueHD streams (mono, stereo, 5.1 pink noise — every codebook, -//! matrices with the 2-channel noise generator, two substreams). Both need -//! `ffmpeg`; a missing one fails. - use ec_truehd::{TrueHdDecoder, TrueHdEncoder, frame_length}; use crate::common::raw_access_units;