[xiph-commits] r9192 - in trunk/speex: . libspeex

jm at motherfish-iii.xiph.org jm at motherfish-iii.xiph.org
Thu Apr 28 22:33:48 PDT 2005


Author: jm
Date: 2005-04-28 22:33:45 -0700 (Thu, 28 Apr 2005)
New Revision: 9192

Modified:
   trunk/speex/Speex.spec.in
   trunk/speex/libspeex/arch.h
   trunk/speex/libspeex/ltp.c
   trunk/speex/libspeex/nb_celp.c
   trunk/speex/libspeex/sb_celp.c
Log:
Think I fixed the PLC slowdown due to denorm/underflow. Also don't re-
synthesize on encode (i.e. don't overwrite input buffer).


Modified: trunk/speex/Speex.spec.in
===================================================================
--- trunk/speex/Speex.spec.in	2005-04-28 00:50:13 UTC (rev 9191)
+++ trunk/speex/Speex.spec.in	2005-04-29 05:33:45 UTC (rev 9192)
@@ -41,7 +41,7 @@
 %setup
 
 %build
-export CFLAGS='-O3 -DRELEASE'
+export CFLAGS='-O3'
 ./configure --prefix=/usr --enable-shared --enable-static
 make
 

Modified: trunk/speex/libspeex/arch.h
===================================================================
--- trunk/speex/libspeex/arch.h	2005-04-28 00:50:13 UTC (rev 9191)
+++ trunk/speex/libspeex/arch.h	2005-04-29 05:33:45 UTC (rev 9192)
@@ -98,7 +98,7 @@
 #define LPC_SHIFT    0
 #define SIG_SHIFT    0
 
-#define VERY_SMALL 1e-30
+#define VERY_SMALL 1e-15
 
 #define NEG16(x) (-(x))
 #define NEG32(x) (-(x))

Modified: trunk/speex/libspeex/ltp.c
===================================================================
--- trunk/speex/libspeex/ltp.c	2005-04-28 00:50:13 UTC (rev 9191)
+++ trunk/speex/libspeex/ltp.c	2005-04-29 05:33:45 UTC (rev 9192)
@@ -719,7 +719,7 @@
       }
 #else
       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];
 #endif
    }
 }

Modified: trunk/speex/libspeex/nb_celp.c
===================================================================
--- trunk/speex/libspeex/nb_celp.c	2005-04-28 00:50:13 UTC (rev 9191)
+++ trunk/speex/libspeex/nb_celp.c	2005-04-29 05:33:45 UTC (rev 9192)
@@ -515,9 +515,10 @@
       /* Final signal synthesis from excitation */
       iir_mem2(st->exc, st->interp_qlpc, st->frame, st->frameSize, st->lpcSize, st->mem_sp);
 
+#ifdef RESYNTH
       for (i=0;i<st->frameSize;i++)
          in[i]=st->frame[i];
-
+#endif
       return 0;
 
    }
@@ -905,6 +906,7 @@
    /* The next frame will not be the first (Duh!) */
    st->first = 0;
 
+#ifdef RESYNTH
    /* Replace input by synthesized speech */
    for (i=0;i<st->frameSize;i++)
    {
@@ -915,6 +917,7 @@
          sig = -32767;
      in[i]=sig;
    }
+#endif
 
    if (SUBMODE(innovation_quant) == noise_codebook_quant || st->submodeID==0)
       st->bounded_pitch = 1;
@@ -1034,7 +1037,7 @@
    if (pitch_gain>.95)
       pitch_gain=.95;
 
-   pitch_gain *= fact;
+   pitch_gain = fact*pitch_gain + VERY_SMALL;
 
    /* Shift all buffers by one frame */
    /*speex_move(st->inBuf, st->inBuf+st->frameSize, (st->bufSize-st->frameSize)*sizeof(spx_sig_t));*/
@@ -1089,7 +1092,7 @@
          /*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
       }
@@ -1267,7 +1270,7 @@
             pgain=.6;
 	 innov_gain = compute_rms(st->innov, st->frameSize);
          for (i=0;i<st->frameSize;i++)
-            st->exc[i]=0;
+            st->exc[i]=VERY_SMALL;
          speex_rand_vec(innov_gain, st->exc, st->frameSize);
       }
 

Modified: trunk/speex/libspeex/sb_celp.c
===================================================================
--- trunk/speex/libspeex/sb_celp.c	2005-04-28 00:50:13 UTC (rev 9191)
+++ trunk/speex/libspeex/sb_celp.c	2005-04-29 05:33:45 UTC (rev 9192)
@@ -525,8 +525,7 @@
       /* Final signal synthesis from excitation */
       iir_mem2(st->exc, st->interp_qlpc, st->high, st->frame_size, st->lpcSize, st->mem_sp);
 
-#ifndef RELEASE
-
+#ifdef RESYNTH
       /* Reconstruct the original */
       fir_mem_up(st->x0d, h0, st->y0, st->full_frame_size, QMF_ORDER, st->g0_mem, stack);
       fir_mem_up(st->high, h1, st->y1, st->full_frame_size, QMF_ORDER, st->g1_mem, stack);
@@ -759,8 +758,7 @@
    }
 
 
-#ifndef RELEASE
-
+#ifdef RESYNTH
    /* Reconstruct the original */
    fir_mem_up(st->x0d, h0, st->y0, st->full_frame_size, QMF_ORDER, st->g0_mem, stack);
    fir_mem_up(st->high, h1, st->y1, st->full_frame_size, QMF_ORDER, st->g1_mem, stack);



More information about the commits mailing list