From f9353670384fb8cdc25a1c11a69ec1c0acbb042d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ahmet=20Kaan=20G=C3=BCm=C3=BC=C5=9F?= Date: Fri, 14 Aug 2026 13:26:27 +0300 Subject: [PATCH] test(opus): 16 kbps row in the rate table; clippy-clean wide usage MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The charter's honest bottom: 16 kbps fullband CELT lands at corr 0.94 mono / 0.52 stereo through libopus — reported and floored as such, not hidden. The PVQ lane-select keeps wide 1.5's blend under a scoped allow (its replacement API does not exist in that release). --- crates/ec-opus/src/celt_enc.rs | 15 ++++++++++----- crates/ec-opus/tests/conformance.rs | 13 +++++++++++-- 2 files changed, 21 insertions(+), 7 deletions(-) diff --git a/crates/ec-opus/src/celt_enc.rs b/crates/ec-opus/src/celt_enc.rs index 053fabca..708a254a 100644 --- a/crates/ec-opus/src/celt_enc.rs +++ b/crates/ec-opus/src/celt_enc.rs @@ -1870,8 +1870,7 @@ impl CeltEncoder { let mut best_den = 0.0f32; let mut j0 = 0usize; if n >= 16 { - #[allow(deprecated)] - use wide::{CmpGt, f32x8}; + use wide::f32x8; let chunks = n / 8; let xy_v = f32x8::splat(xy); let yy_v = f32x8::splat(yy); @@ -1887,9 +1886,15 @@ impl CeltEncoder { let ryy = yy_v + f32x8::from(ya); let rxy2 = rxy * rxy; let mask = (bd * rxy2).simd_gt(ryy * bn); - bn = mask.blend(rxy2, bn); - bd = mask.blend(ryy, bd); - bc = mask.blend(f32x8::splat(c as f32), bc); + // wide 1.5 deprecates `blend` in favour of a split that + // does not exist yet in this release; the mask here is a + // true lane mask, which is exactly blend's contract. + #[allow(deprecated)] + { + bn = mask.blend(rxy2, bn); + bd = mask.blend(ryy, bd); + bc = mask.blend(f32x8::splat(c as f32), bc); + } } let bn_a: [f32; 8] = bn.into(); let bd_a: [f32; 8] = bd.into(); diff --git a/crates/ec-opus/tests/conformance.rs b/crates/ec-opus/tests/conformance.rs index 04a05f53..5a434454 100644 --- a/crates/ec-opus/tests/conformance.rs +++ b/crates/ec-opus/tests/conformance.rs @@ -1011,7 +1011,7 @@ fn libopus_decodes_our_packets_across_the_rate_table() { let pcm = test_signal(channels, 2.0); let total = pcm.len() / channels; let mut table = Vec::new(); - for kbps in [32u32, 64, 96, 128, 160, 165, 192, 256, 320, 510] { + for kbps in [16u32, 32, 64, 96, 128, 160, 165, 192, 256, 320, 510] { let mut enc = Encoder::new(48000, channels).unwrap(); enc.set_bitrate(kbps * 1000); let packets = encode_packets(&mut enc, &pcm, channels); @@ -1043,7 +1043,16 @@ fn libopus_decodes_our_packets_across_the_rate_table() { "{channels} ch {kbps:>3} kbps: worst corr {worst:.4}, opus_compare {quality:.1}" )); let floor = match kbps { - 0..=39 => 0.6, + // 16 kbps fullband CELT is the honest bottom of the range: + // reported, held to "clearly the same signal", not to hi-fi. + 0..=19 => { + if channels == 1 { + 0.6 + } else { + 0.35 + } + } + 20..=39 => 0.6, 40..=95 => 0.8, _ => 0.9, };