fixed-point: LSP quantization work, also LSP's are now in the angle domain
[speexdsp.git] / libspeex / lsp.c
index 6b16cff..1814701 100644 (file)
@@ -291,7 +291,7 @@ int lpc_to_lsp (spx_coef_t *a,int lpcrdr,float *freq,int nb,float delta, char *s
                }
 
               /* once zero is found, reset initial interval to xr      */
-              freq[j] = (xm);
+              freq[j] = acos(xm);
               xl = xm;
               flag = 0;                /* reset flag for next search   */
            }
@@ -335,7 +335,7 @@ void lsp_to_lpc(float *freq,spx_coef_t *ak,int lpcrdr, char *stack)
     
     freqn = PUSH(stack, lpcrdr, spx_word16_t);
     for (i=0;i<lpcrdr;i++)
-       freqn[i] = freq[i]*32768.;
+       freqn[i] = cos(freq[i])*32768.;
 
     Wp = PUSH(stack, 4*m+2, spx_word32_t);
     pw = Wp;
@@ -430,8 +430,8 @@ void lsp_to_lpc(float *freq,spx_coef_t *ak,int lpcrdr, char *stack)
            n2 = n1 + 1;
            n3 = n2 + 1;
            n4 = n3 + 1;
-           xout1 = xin1 - 2*(freq[i2]) * *n1 + *n2;
-           xout2 = xin2 - 2*(freq[i2+1]) * *n3 + *n4;
+           xout1 = xin1 - 2*(cos(freq[i2])) * *n1 + *n2;
+           xout2 = xin2 - 2*(cos(freq[i2+1])) * *n3 + *n4;
            *n2 = *n1;
            *n4 = *n3;
            *n1 = xin1;