Skip to main content

lpc

Function lpc 

Source
pub fn lpc(
    signal: &[f32],
    order: usize,
    out_lpc: &mut [f32],
    out_reflection: &mut [f32],
) -> Result<(), AudioError>
Expand description

Compute order linear-prediction coefficients of signal by the Levinson-Durbin recursion, plus the associated reflection (PARCOR) coefficients.

The predictor models each sample as a linear combination of its order predecessors, x[n] ≈ Σ_{j=1}^{order} a_j · x[n-j]. On success out_lpc[j] receives the predictor coefficient a_{j+1} (so out_lpc[0] is the weight of x[n-1]) and out_reflection[i] the reflection coefficient k_{i+1} of stage i+1.

The biased autocorrelation is computed internally from signal; all recursion state lives in fixed on-stack arrays (MAX_LPC_ORDER), so the call performs no heap allocation.

Zero-heap: caller-supplied outputs; bounded on-stack scratch.

§Errors