intermediate fixed-point work
authorjm <jm@0101bb08-14d6-0310-b084-bc0e0c8e3800>
Tue, 25 Apr 2006 15:12:22 +0000 (15:12 +0000)
committerjm <jm@0101bb08-14d6-0310-b084-bc0e0c8e3800>
Tue, 25 Apr 2006 15:12:22 +0000 (15:12 +0000)
git-svn-id: http://svn.xiph.org/trunk/speex@11278 0101bb08-14d6-0310-b084-bc0e0c8e3800

libspeex/filters.c

index cc62d66..6489fe6 100644 (file)
@@ -777,7 +777,7 @@ char *stack
    if (comb_gain>0)
    {
 #ifdef FIXED_POINT
-      c1 = .4*comb_gain/32768.+.07;
+      c1 = (MULT16_16_Q15(QCONST16(.4,15),comb_gain)+QCONST16(.07,15))/32768.;
 #else
       c1 = .4*comb_gain+.07;
 #endif
@@ -786,13 +786,14 @@ char *stack
    {
       c1=c2=0;
    }
-   g1 = c1/(1-c2*pgain1*pgain1);
-   g2 = c1/(1-c2*pgain2*pgain2);
-   if (g1>1)
-      g1 = 1;
-   if (g2 > 1)
-      g2 = 1;
-   /*printf ("%d %f %f %f %f %d %d %d\n", corr_pitch, gg1, gg2, g1, g2, inner_prod(iexc+nsf,exc,nsf),inner_prod(iexc+nsf,iexc+nsf,nsf),inner_prod(exc,exc,nsf));*/
+   g1 = (1-c2*pgain1*pgain1);
+   if (g1<c1)
+      g1 = c1;
+   g2 = (1-c2*pgain2*pgain2);
+   if (g2<c1)
+      g2 = c1;
+   g1 = c1/g1;
+   g2 = c1/g2;
    if (corr_pitch>40)
    {
       gain0 = GSCALE*.7*g1*gg1;