[xiph-commits] r12020 - trunk/speex/libspeex

jm at svn.xiph.org jm at svn.xiph.org
Sun Nov 5 01:28:38 PST 2006


Author: jm
Date: 2006-11-05 01:28:36 -0800 (Sun, 05 Nov 2006)
New Revision: 12020

Modified:
   trunk/speex/libspeex/preprocess.c
Log:
Fast Bark-scale gain computation is in fixed-point


Modified: trunk/speex/libspeex/preprocess.c
===================================================================
--- trunk/speex/libspeex/preprocess.c	2006-11-05 09:06:47 UTC (rev 12019)
+++ trunk/speex/libspeex/preprocess.c	2006-11-05 09:28:36 UTC (rev 12020)
@@ -858,13 +858,13 @@
    } else {
       for (i=N;i<N+M;i++)
       {
-         float p = FRAC_SCALING_1*st->gain2[i];
-         if (st->gain[i] < st->gain_floor[i])
-            st->gain[i] = st->gain_floor[i];
-         st->gain2[i]=FRAC_SCALING*(p*sqrt(FRAC_SCALING_1*st->gain[i])+sqrt(FRAC_SCALING_1*st->gain_floor[i])*(1-p)) * (p*sqrt(FRAC_SCALING_1*st->gain[i])+sqrt(FRAC_SCALING_1*st->gain_floor[i])*(1-p));
+         spx_word16_t tmp;
+         spx_word16_t p = st->gain2[i];
+         st->gain[i] = MAX16(st->gain[i], st->gain_floor[i]);         
+         tmp = MULT16_16_P15(p,spx_sqrt(SHL32(EXTEND32(st->gain[i]),15))) + MULT16_16_P15(SUB16(Q15_ONE,p),spx_sqrt(SHL32(EXTEND32(st->gain_floor[i]),15)));
+         st->gain2[i]=SQR16_Q15(tmp);
       }
       filterbank_compute_psd16(st->bank,st->gain2+N, st->gain2);
-      
    }
    
    /* If noise suppression is off, don't apply the gain (but then why call this in the first place!) */



More information about the commits mailing list