From 485f8e45f419446166b0de7bc403e74bed8234c5 Mon Sep 17 00:00:00 2001 From: el-j Date: Sun, 15 Nov 2026 22:41:38 +0100 Subject: [PATCH] craft-audio: ADPCM test lints --- crates/audio/tests/adpcm_oracle.rs | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/crates/audio/tests/adpcm_oracle.rs b/crates/audio/tests/adpcm_oracle.rs index ab3748b1d..87b891d23 100644 --- a/crates/audio/tests/adpcm_oracle.rs +++ b/crates/audio/tests/adpcm_oracle.rs @@ -188,7 +188,7 @@ fn alt_ima_decode(data: &[u8], channels: usize, block_align: usize) -> Vec out[base + ch] = pred[ch] as i16; } for (g, group) in block[4 * channels..].chunks_exact(4 * channels).enumerate() { - for (ch, bytes) in group.chunks_exact(4).enumerate() { + for (ch, bytes) in group.as_chunks::<4>().0.iter().enumerate() { for (k, b) in bytes.iter().enumerate() { for (half, nib) in [b & 0xF, b >> 4].into_iter().enumerate() { let step = STEPS[idx[ch] as usize]; @@ -248,6 +248,9 @@ fn same_as_either(what: &str, ours: &[i16], alt: &[i16], theirs: &[i16]) { assert!(a == 0 || b == 0, "{what}: ffmpeg's decode is neither ours ({a}) nor the other rounding ({b})"); } +/// A name, the WAV file around our stream, our decode of it and the other rounding's. +type Stream = (&'static str, Vec, Vec, Vec); + // ---- ffmpeg as the reference fn ffmpeg(ff: &Path, args: &[&str]) { @@ -375,7 +378,7 @@ fn ffmpeg_decodes_what_we_encode_to_the_samples_we_decode() { for channels in [1usize, 2] { let x = signal(channels, 12_000); let coefs: Vec = ms::COEFFICIENTS.iter().flat_map(|&(a, b)| [a as i16, b as i16].into_iter().flat_map(i16::to_le_bytes)).collect(); - let streams: Vec<(&str, Vec, Vec, Vec)> = { + let streams: Vec = { let e = ima::encode(&x, channels, 512).unwrap(); let per = ima::samples_per_block(512, channels).unwrap() as u16; let d = ima::decode(&e, channels, 512).unwrap();