mirror of
https://github.com/storytold/craft-libs.git
synced 2026-11-25 12:03:42 +01:00
Shorter statistical and loudness signals, sampled opus multistream garbage
This commit is contained in:
1 parent
4d13bda621
commit
385325fda8
3 files changed
+6
-6
No files matched your search
@@ -639,7 +639,7 @@ mod tests {
|
||||
#[test]
|
||||
fn interleaved_matches_planar() {
|
||||
let sr = 48000.0;
|
||||
let x = segments(1000.0, sr, &[(5.0, -20.0)]);
|
||||
let x = segments(1000.0, sr, &[(2.0, -20.0)]);
|
||||
let il: Vec<f32> = x.iter().flat_map(|&v| [v, v]).collect();
|
||||
let mut m = LoudnessMeter::new(sr, 2);
|
||||
m.process_interleaved(&il);
|
||||
@@ -885,12 +885,12 @@ mod tests {
|
||||
#[test]
|
||||
fn reset_clears_everything() {
|
||||
let sr = 48000.0;
|
||||
let x = segments(1000.0, sr, &[(5.0, -20.0)]);
|
||||
let x = segments(1000.0, sr, &[(2.0, -20.0)]);
|
||||
let mut m = stereo_measure(&x, sr);
|
||||
m.reset();
|
||||
assert_eq!(m.integrated(), f64::NEG_INFINITY);
|
||||
assert_eq!(m.true_peak(), 0.0);
|
||||
let x = segments(1000.0, sr, &[(5.0, -30.0)]);
|
||||
let x = segments(1000.0, sr, &[(2.0, -30.0)]);
|
||||
m.process(&[&x, &x]);
|
||||
assert!((m.integrated() + 30.0).abs() < 0.1);
|
||||
}
|
||||
|
||||
@@ -53,7 +53,7 @@ fn multistream_garbage_never_panics() {
|
||||
h.extend([1, 6, 0x38, 0x01, 0x80, 0xBB, 0, 0, 0, 0, 1, 4, 2, 0, 4, 1, 2, 3, 5]);
|
||||
let mut dec = Decoder::new(&h).unwrap();
|
||||
let mut rng = Rng(42);
|
||||
for _ in 0..2000 {
|
||||
for _ in 0..2000usize.div_ceil(craft_media_testkit::hostile::divisor()) {
|
||||
let len = (rng.next() % 600) as usize;
|
||||
let pkt: Vec<u8> = (0..len).map(|_| rng.next() as u8).collect();
|
||||
if let Ok(out) = dec.decode(Some(&pkt)) {
|
||||
|
||||
@@ -129,7 +129,7 @@ fn small_render_is_the_downscaled_reference() {
|
||||
fn strength_matches_the_target_at_mid_grey() {
|
||||
for (a, s, r) in [(50.0, 25.0, 50.0), (25.0, 25.0, 50.0), (50.0, 0.0, 50.0), (50.0, 100.0, 50.0), (50.0, 25.0, 0.0)] {
|
||||
let g = CrystalGrain::new(&Grain { amount: a, size: s, roughness: r, seed: 3 }, REF_LONG).expect("grain");
|
||||
let n = 500;
|
||||
let n = 320;
|
||||
let lum: Vec<f32> = (0..n * n)
|
||||
.map(|k| {
|
||||
let (x, y) = ((k % n) as f32 + 0.5, (k / n) as f32 + 0.5);
|
||||
@@ -153,7 +153,7 @@ fn tones_keep_their_mean() {
|
||||
for (amount, size, levels) in cases {
|
||||
let g = CrystalGrain::new(&Grain { amount, size, roughness: 50.0, seed: 3 }, REF_LONG).expect("grain");
|
||||
for &level in levels {
|
||||
let n = 400;
|
||||
let n = 256;
|
||||
let mut sum = 0.0f64;
|
||||
for k in 0..n * n {
|
||||
let (x, y) = ((k % n) as f32 + 0.5, (k / n) as f32 + 0.5);
|
||||
|
||||
Reference in new issue
Block a user