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

jm at svn.xiph.org jm at svn.xiph.org
Sat Oct 1 03:24:36 PDT 2005


Author: jm
Date: 2005-10-01 03:24:34 -0700 (Sat, 01 Oct 2005)
New Revision: 10108

Modified:
   trunk/speex/libspeex/sb_celp.c
Log:
Better packet-loss concealment for high band (no more spring-like noise) and
slightly better spectral folding (apply mirror)


Modified: trunk/speex/libspeex/sb_celp.c
===================================================================
--- trunk/speex/libspeex/sb_celp.c	2005-10-01 08:30:07 UTC (rev 10107)
+++ trunk/speex/libspeex/sb_celp.c	2005-10-01 10:24:34 UTC (rev 10108)
@@ -321,7 +321,6 @@
    st->complexity=2;
    speex_encoder_ctl(st->st_low, SPEEX_GET_SAMPLING_RATE, &st->sampling_rate);
    st->sampling_rate*=2;
-
 #ifdef ENABLE_VALGRIND
    VALGRIND_MAKE_READABLE(st, (st->stack-(char*)st));
 #endif
@@ -883,6 +882,7 @@
    st->mem_sp = speex_alloc((2*st->lpcSize)*sizeof(spx_mem_t));
    
    st->lpc_enh_enabled=0;
+   st->seed = 1000;
 
 #ifdef ENABLE_VALGRIND
    VALGRIND_MAKE_READABLE(st, (st->stack-(char*)st));
@@ -961,8 +961,10 @@
    /* Final signal synthesis from excitation */
    if (!dtx)
    {
+      spx_word16_t low_ener;
+      low_ener = .9*compute_rms(st->exc, st->frame_size);
       for (i=0;i<st->frame_size;i++)
-         st->exc[i] *= .9;
+         st->exc[i] = speex_rand(low_ener, &st->seed);
    }
 
    for (i=0;i<st->frame_size;i++)
@@ -1186,9 +1188,31 @@
          g /= filter_ratio;
 #endif
          /* High-band excitation using the low-band excitation and a gain */
+         
+#if 0
          for (i=0;i<st->subframeSize;i++)
             exc[i]=mode->folding_gain*g*low_innov[offset+i];
-         /*speex_rand_vec(mode->folding_gain*g*sqrt(el/st->subframeSize), exc, st->subframeSize);*/
+#else
+         {
+            float tmp=1;
+            /*static tmp1=0,tmp2=0;
+            static int seed=1;
+            el = compute_rms(low_innov+offset, st->subframeSize);*/
+            for (i=0;i<st->subframeSize;i++)
+            {
+               float e=tmp*g*mode->folding_gain*low_innov[offset+i];
+               tmp *= -1;
+               exc[i] = e;
+               /*float r = speex_rand(g*el,&seed);
+               exc[i] = .5*(r+tmp2 + e-tmp1);
+               tmp1 = e;
+               tmp2 = r;*/               
+            }
+            
+         }
+         
+         /*speex_rand_vec(mode->folding_gain*g*el, exc, st->subframeSize);*/
+#endif    
       } else {
          spx_word16_t gc;
          spx_word32_t scale;



More information about the commits mailing list