Skip to content

EffectCraft: An open-source motion graphics and compositing tool written by scratch in pure Rust

opusenc: halve the a2nlsf bisection steps

vangel76fd84350122c8
diff --git a/crates/opusenc/src/silk/analysis.rs b/crates/opusenc/src/silk/analysis.rs
index 2808b64b1..c84619222 100644
--- a/crates/opusenc/src/silk/analysis.rs
+++ b/crates/opusenc/src/silk/analysis.rs
@@ -88,8 +88,8 @@ fn cos_series(p: &[f64], w: f64) -> f64 {
const GRID: usize = 1024;
/// Largest multiple of ω in the series (half the LPC order, at most 16 / 2).
const MAX_H: usize = 8;
-/// Bisection steps per root.
-const BISECT_STEPS: usize = 40;
+/// Bisection steps per root: the bracket shrinks to 3e-9 rad, far below one Q15 NLSF step (9.6e-5 rad).
+const BISECT_STEPS: usize = 20;
/// `cos(m · π g / GRID)` for every grid point `g` and `m` in `0..=MAX_H`, computed with the same
/// expression as [`cos_series`], so the table values are bit-identical to calling `cos` there.