forge
Explore
Log in

Don't you dare go Hollow

16 kbps row in the rate table

Browse files at this commit

f9353670384fb8cdc25a1c11a69ec1c0acbb042dAhmet Kaan GümüşParent: 52ead44
  • test
    • 16 kbps row in the rate table
    • clippy-clean wide usage
Show full message
test(opus): 16 kbps row in the rate table; clippy-clean wide usage

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.rsmodified+10 -5
@@ -1870,8 +1870,7 @@ impl CeltEncoder {
18701870 let mut best_den = 0.0f32;
18711871 let mut j0 = 0usize;
18721872 if n >= 16 {
1873- #[allow(deprecated)]
1874- use wide::{CmpGt, f32x8};
1873+ use wide::f32x8;
18751874 let chunks = n / 8;
18761875 let xy_v = f32x8::splat(xy);
18771876 let yy_v = f32x8::splat(yy);
@@ -1887,9 +1886,15 @@ impl CeltEncoder {
18871886 let ryy = yy_v + f32x8::from(ya);
18881887 let rxy2 = rxy * rxy;
18891888 let mask = (bd * rxy2).simd_gt(ryy * bn);
1890- bn = mask.blend(rxy2, bn);
1891- bd = mask.blend(ryy, bd);
1892- bc = mask.blend(f32x8::splat(c as f32), bc);
1889+ // wide 1.5 deprecates `blend` in favour of a split that
1890+ // does not exist yet in this release; the mask here is a
1891+ // true lane mask, which is exactly blend's contract.
1892+ #[allow(deprecated)]
1893+ {
1894+ bn = mask.blend(rxy2, bn);
1895+ bd = mask.blend(ryy, bd);
1896+ bc = mask.blend(f32x8::splat(c as f32), bc);
1897+ }
18931898 }
18941899 let bn_a: [f32; 8] = bn.into();
18951900 let bd_a: [f32; 8] = bd.into();
crates/ec-opus/tests/conformance.rsmodified+11 -2
@@ -1011,7 +1011,7 @@ fn libopus_decodes_our_packets_across_the_rate_table() {
10111011 let pcm = test_signal(channels, 2.0);
10121012 let total = pcm.len() / channels;
10131013 let mut table = Vec::new();
1014- for kbps in [32u32, 64, 96, 128, 160, 165, 192, 256, 320, 510] {
1014+ for kbps in [16u32, 32, 64, 96, 128, 160, 165, 192, 256, 320, 510] {
10151015 let mut enc = Encoder::new(48000, channels).unwrap();
10161016 enc.set_bitrate(kbps * 1000);
10171017 let packets = encode_packets(&mut enc, &pcm, channels);
@@ -1043,7 +1043,16 @@ fn libopus_decodes_our_packets_across_the_rate_table() {
10431043 "{channels} ch {kbps:>3} kbps: worst corr {worst:.4}, opus_compare {quality:.1}"
10441044 ));
10451045 let floor = match kbps {
1046- 0..=39 => 0.6,
1046+ // 16 kbps fullband CELT is the honest bottom of the range:
1047+ // reported, held to "clearly the same signal", not to hi-fi.
1048+ 0..=19 => {
1049+ if channels == 1 {
1050+ 0.6
1051+ } else {
1052+ 0.35
1053+ }
1054+ }
1055+ 20..=39 => 0.6,
10471056 40..=95 => 0.8,
10481057 _ => 0.9,
10491058 };