[xiph-commits] r9201 - branches/rel-1-0-branch/speex/libspeex

jm at motherfish-iii.xiph.org jm at motherfish-iii.xiph.org
Sun May 1 22:16:53 PDT 2005


Author: jm
Date: 2005-05-01 22:16:51 -0700 (Sun, 01 May 2005)
New Revision: 9201

Modified:
   branches/rel-1-0-branch/speex/libspeex/ltp.c
   branches/rel-1-0-branch/speex/libspeex/misc.h
   branches/rel-1-0-branch/speex/libspeex/nb_celp.c
Log:
fix (untested) for PLC slowdown due to denorm/underflow


Modified: branches/rel-1-0-branch/speex/libspeex/ltp.c
===================================================================
--- branches/rel-1-0-branch/speex/libspeex/ltp.c	2005-05-02 05:14:33 UTC (rev 9200)
+++ branches/rel-1-0-branch/speex/libspeex/ltp.c	2005-05-02 05:16:51 UTC (rev 9201)
@@ -31,6 +31,7 @@
 */
 
 #include <math.h>
+#include "misc.h"
 #include "ltp.h"
 #include "stack_alloc.h"
 #include "filters.h"
@@ -485,7 +486,7 @@
 #endif
       }
       for (i=0;i<nsf;i++)
-           exc[i]=gain[0]*e[2][i]+gain[1]*e[1][i]+gain[2]*e[0][i];
+           exc[i]=VERY_SMALL+gain[0]*e[2][i]+gain[1]*e[1][i]+gain[2]*e[0][i];
    }
 }
 

Modified: branches/rel-1-0-branch/speex/libspeex/misc.h
===================================================================
--- branches/rel-1-0-branch/speex/libspeex/misc.h	2005-05-02 05:14:33 UTC (rev 9200)
+++ branches/rel-1-0-branch/speex/libspeex/misc.h	2005-05-02 05:16:51 UTC (rev 9201)
@@ -49,7 +49,7 @@
 #pragma warning(disable : 4305)
 #endif
 
-#define VERY_SMALL 1e-30
+#define VERY_SMALL 1e-15
 
 #ifndef RELEASE
 void print_vec(float *vec, int len, char *name);

Modified: branches/rel-1-0-branch/speex/libspeex/nb_celp.c
===================================================================
--- branches/rel-1-0-branch/speex/libspeex/nb_celp.c	2005-05-02 05:14:33 UTC (rev 9200)
+++ branches/rel-1-0-branch/speex/libspeex/nb_celp.c	2005-05-02 05:16:51 UTC (rev 9201)
@@ -584,15 +584,15 @@
 
       /* Compute impulse response of A(z/g1) / ( A(z)*A(z/g2) )*/
       for (i=0;i<st->subframeSize;i++)
-         exc[i]=0;
+         exc[i]=VERY_SMALL;
       exc[0]=1;
       syn_percep_zero(exc, st->interp_qlpc, st->bw_lpc1, st->bw_lpc2, syn_resp, st->subframeSize, st->lpcSize, stack);
 
       /* Reset excitation */
       for (i=0;i<st->subframeSize;i++)
-         exc[i]=0;
+         exc[i]=VERY_SMALL;
       for (i=0;i<st->subframeSize;i++)
-         exc2[i]=0;
+         exc2[i]=VERY_SMALL;
 
       /* Compute zero response of A(z/g1) / ( A(z/g2) * A(z) ) */
       for (i=0;i<st->lpcSize;i++)
@@ -905,7 +905,7 @@
    if (pitch_gain>.95)
       pitch_gain=.95;
 
-   pitch_gain *= fact;
+   pitch_gain = pitch_gain*fact + VERY_SMALL;
 
    /* Shift all buffers by one frame */
    speex_move(st->inBuf, st->inBuf+st->frameSize, (st->bufSize-st->frameSize)*sizeof(float));
@@ -968,13 +968,13 @@
          /*rand();*/
 #else
          /*exc[i]=pitch_gain*exc[i-st->last_pitch] +  fact*st->innov[i+offset];*/
-         exc[i]=pitch_gain*exc[i-st->last_pitch] + 
+         exc[i]=pitch_gain*(exc[i-st->last_pitch]+VERY_SMALL) + 
          fact*sqrt(1-pitch_gain)*speex_rand(innov_gain);
 #endif
       }
       }
       for (i=0;i<st->subframeSize;i++)
-         sp[i]=exc[i];
+         sp[i]=exc[i]+VERY_SMALL;
       
       /* Signal synthesis */
       if (st->lpc_enh_enabled)



More information about the commits mailing list