forge
Explore
Log in

Don't you dare go Hollow

S11: opus one exp_rotation1; celt_flp/vq uses celt::exp_rotation1 (same ops: c*x1 + (-s)*x2 == c*x1 - s*x2 in IEEE)

Browse files at this commit

70a878b15912a8664d7d8f55d0d09cb8e16e175bAhmet Kaan GümüşParent: 4fd4ed4
crates/ec-opus/src/celt.rsmodified+1 -1
@@ -3001,7 +3001,7 @@ pub(crate) fn exp_rotation(
3001 }3001 }
3002 }3002 }
3003 3003
3004-fn exp_rotation1(x: &mut [f32], len: usize, stride: usize, c: f32, s: f32) {3004+pub(crate) fn exp_rotation1(x: &mut [f32], len: usize, stride: usize, c: f32, s: f32) {
3005 for i in 0..len.saturating_sub(stride) {3005 for i in 0..len.saturating_sub(stride) {
3006 let x1 = x[i];3006 let x1 = x[i];
3007 let x2 = x[i + stride];3007 let x2 = x[i + stride];
crates/ec-opus/src/celt_flp/vq.rsmodified+1 -17
@@ -1,5 +1,5 @@
1 use super::{EPSILON, celt_atan2p_norm, celt_cos_norm, celt_rcp, celt_rsqrt, celt_sqrt};1 use super::{EPSILON, celt_atan2p_norm, celt_cos_norm, celt_rcp, celt_rsqrt, celt_sqrt};
2-use crate::celt::{pvq_u, pvq_v};2+use crate::celt::{exp_rotation1, pvq_u, pvq_v};
3 use crate::range::RangeEncoder;3 use crate::range::RangeEncoder;
4 4
5 const SPREAD_FACTOR: [i32; 3] = [15, 10, 5];5 const SPREAD_FACTOR: [i32; 3] = [15, 10, 5];
@@ -13,22 +13,6 @@ fn inner_prod(x: &[f32], y: &[f32], n: usize) -> f32 {
13 xy13 xy
14 }14 }
15 15
16-fn exp_rotation1(x: &mut [f32], len: usize, stride: usize, c: f32, s: f32) {
17- let ms = -s;
18- for i in 0..len.saturating_sub(stride) {
19- let x1 = x[i];
20- let x2 = x[i + stride];
21- x[i + stride] = c * x2 + s * x1;
22- x[i] = c * x1 + ms * x2;
23- }
24- for i in (0..len.saturating_sub(2 * stride)).rev() {
25- let x1 = x[i];
26- let x2 = x[i + stride];
27- x[i + stride] = c * x2 + s * x1;
28- x[i] = c * x1 + ms * x2;
29- }
30-}
31-
32 /// `exp_rotation`.16 /// `exp_rotation`.
33 pub(crate) fn exp_rotation(17 pub(crate) fn exp_rotation(
34 x: &mut [f32],18 x: &mut [f32],