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

jm at motherfish-iii.xiph.org jm at motherfish-iii.xiph.org
Wed Sep 22 00:09:48 PDT 2004


Author: jm
Date: 2004-09-22 00:09:48 -0700 (Wed, 22 Sep 2004)
New Revision: 7825

Modified:
   trunk/speex/libspeex/nb_celp.c
Log:
Fixed scaling problem for fixed-point


Modified: trunk/speex/libspeex/nb_celp.c
===================================================================
--- trunk/speex/libspeex/nb_celp.c	2004-09-22 05:35:43 UTC (rev 7824)
+++ trunk/speex/libspeex/nb_celp.c	2004-09-22 07:09:48 UTC (rev 7825)
@@ -1090,10 +1090,8 @@
       /*if (pitch_gain>.95)
         pitch_gain=.95;*/
       {
-         float innov_gain=0;
-         for (i=0;i<st->frameSize;i++)
-            innov_gain += 1.0*st->innov[i]*st->innov[i];
-         innov_gain=sqrt(innov_gain/st->frameSize);
+      float innov_gain=0;
+      innov_gain = compute_rms(st->innov, st->frameSize);
       for (i=0;i<st->subframeSize;i++)
       {
 #if 0
@@ -1279,10 +1277,8 @@
          float pgain=GAIN_SCALING_1*st->last_pitch_gain;
          if (pgain>.6)
             pgain=.6;
+	 innov_gain = compute_rms(st->innov, st->frameSize);
          for (i=0;i<st->frameSize;i++)
-            innov_gain += st->innov[i]*st->innov[i];
-         innov_gain=sqrt(innov_gain/st->frameSize);
-         for (i=0;i<st->frameSize;i++)
             st->exc[i]=0;
          speex_rand_vec(innov_gain, st->exc, st->frameSize);
       }



More information about the commits mailing list