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

jm at svn.xiph.org jm at svn.xiph.org
Fri Apr 7 01:29:08 PDT 2006


Author: jm
Date: 2006-04-07 01:29:03 -0700 (Fri, 07 Apr 2006)
New Revision: 11101

Modified:
   trunk/speex/libspeex/filters.c
   trunk/speex/libspeex/nb_celp.c
   trunk/speex/libspeex/nb_celp.h
   trunk/speex/libspeex/sb_celp.c
Log:
Fixed several fixed-point regressions:
- missing LSP_SCALING in case lpc_to_lsp() fails
- comb filter normalization tuning
- better estimation of innovation energy (fine gain)


Modified: trunk/speex/libspeex/filters.c
===================================================================
--- trunk/speex/libspeex/filters.c	2006-04-06 16:45:58 UTC (rev 11100)
+++ trunk/speex/libspeex/filters.c	2006-04-07 08:29:03 UTC (rev 11101)
@@ -160,7 +160,7 @@
       sum = ADD32(sum,SHR32(sum2,6));
    }
    
-   return EXTRACT16(SHR32(SHL32(EXTEND32(spx_sqrt(1+DIV32(sum,len))),(sig_shift+3)),SIG_SHIFT));
+   return EXTRACT16(PSHR32(SHL32(EXTEND32(spx_sqrt(1+DIV32(sum,len))),(sig_shift+3)),SIG_SHIFT));
 }
 
 
@@ -754,7 +754,11 @@
    if (exc_energy > new_exc_energy)
       exc_energy = new_exc_energy;
    
-   gain = DIV32_16(SHL32(EXTEND32(exc_energy),15),ADD16(1,new_exc_energy));
+   if (new_exc_energy<1)
+      new_exc_energy=1;
+   if (exc_energy<1)
+      exc_energy=1;
+   gain = DIV32_16(SUB32(SHL32(exc_energy,15),1),new_exc_energy);
 
 #ifdef FIXED_POINT
    if (gain < 16384)

Modified: trunk/speex/libspeex/nb_celp.c
===================================================================
--- trunk/speex/libspeex/nb_celp.c	2006-04-06 16:45:58 UTC (rev 11100)
+++ trunk/speex/libspeex/nb_celp.c	2006-04-07 08:29:03 UTC (rev 11101)
@@ -206,6 +206,7 @@
    st->mem_sw = speex_alloc((st->lpcSize)*sizeof(spx_mem_t));
    st->mem_sw_whole = speex_alloc((st->lpcSize)*sizeof(spx_mem_t));
    st->mem_exc = speex_alloc((st->lpcSize)*sizeof(spx_mem_t));
+   st->mem_exc2 = speex_alloc((st->lpcSize)*sizeof(spx_mem_t));
 
    st->pi_gain = speex_alloc((st->nbSubframes)*sizeof(spx_word32_t));
 
@@ -773,6 +774,7 @@
 
       for (i=0;i<st->subframeSize;i++)
          real_exc[i] = exc[i];
+      fir_mem2(sp, st->interp_qlpc, real_exc, st->subframeSize, st->lpcSize, st->mem_exc2);
       
       if (st->complexity==0)
          response_bound >>= 1;

Modified: trunk/speex/libspeex/nb_celp.h
===================================================================
--- trunk/speex/libspeex/nb_celp.h	2006-04-06 16:45:58 UTC (rev 11100)
+++ trunk/speex/libspeex/nb_celp.h	2006-04-07 08:29:03 UTC (rev 11101)
@@ -104,6 +104,7 @@
    spx_mem_t *mem_sw;         /**< Filter memory for perceptually-weighted signal */
    spx_mem_t *mem_sw_whole;   /**< Filter memory for perceptually-weighted signal (whole frame)*/
    spx_mem_t *mem_exc;        /**< Filter memory for excitation (whole frame) */
+   spx_mem_t *mem_exc2;        /**< Filter memory for excitation (whole frame) */
    spx_word32_t *pi_gain;        /**< Gain of LPC filter at theta=pi (fe/2) */
 
    VBRState *vbr;         /**< State of the VBR data */

Modified: trunk/speex/libspeex/sb_celp.c
===================================================================
--- trunk/speex/libspeex/sb_celp.c	2006-04-06 16:45:58 UTC (rev 11100)
+++ trunk/speex/libspeex/sb_celp.c	2006-04-07 08:29:03 UTC (rev 11101)
@@ -466,7 +466,7 @@
          /*If we can't find all LSP's, do some damage control and use a flat filter*/
          for (i=0;i<st->lpcSize;i++)
          {
-            st->lsp[i]=M_PI*((float)(i+1))/(st->lpcSize+1);
+            st->lsp[i]=LSP_SCALING*M_PI*((float)(i+1))/(st->lpcSize+1);
          }
       }
    }



More information about the commits mailing list