[Speex-dev] cheb_poly_eva using Clenshaw's recurrence formula

Matthieu Poullet
2005-11-29T07:27:47Z

Hi,

After reading the paper entitled "The Computation of Line Spectral
Frequencies Using Chebyshev Polynomials", P. Kabal and R.
Ramachandran, IEEE Trans. on ASSP, Vol. 34, No. 6, December 1986, I
rewrite the function cheb_poly_eva in lsp.c using the Clenshaw's
recurrence formula, as described, for example, in Numerical Recipes in
C, Second Edition (5.5 and 5.8) :

static float cheb_poly_eva(spx_word32_t *coef, float x, int m, char *stack)
{
 int k;
 float b0, b1, tmp;
 int m2=m>>1;

 /* Initial conditions */
 b0=0; /* b_(m+1) */
 b1=0; /* b_(m+2) */

 x*=2;

 /* Calculate the b_(k) */
 for(k=m2;k>0;k--)
 {
    tmp=b0;                           /* tmp holds the previous value of b0 */
    b0=x*b0-b1+coef[m2-k];    /* b0 holds its new value based on b0 and b1 */
    b1=tmp;                           /* b1 holds the previous value of b0 */
 }

return(-b1+x/2*b0+coef[m2]);
}

I don't really know if it's a little improvement or not, so I'd like
to have feedback from the Speex experts here.

Thanks a lot for releasing Speex, it helps me a lot to understand
speech coding !

Matthieu Poullet