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

jm at svn.xiph.org jm at svn.xiph.org
Sat Dec 16 00:49:53 PST 2006


Author: jm
Date: 2006-12-16 00:49:50 -0800 (Sat, 16 Dec 2006)
New Revision: 12213

Modified:
   trunk/speex/libspeex/modes.c
   trunk/speex/libspeex/modes.h
   trunk/speex/libspeex/sb_celp.c
Log:
more wideband fixed-point work (folding_gain is now in fixed-point).


Modified: trunk/speex/libspeex/modes.c
===================================================================
--- trunk/speex/libspeex/modes.c	2006-12-16 02:40:27 UTC (rev 12212)
+++ trunk/speex/libspeex/modes.c	2006-12-16 08:49:50 UTC (rev 12213)
@@ -495,7 +495,7 @@
 #endif
    .012,   /*lag_factor*/
    QCONST16(.0002,15), /*lpc_floor*/
-   0.9,
+   QCONST16(0.9f,15),
    {NULL, &wb_submode1, &wb_submode2, &wb_submode3, &wb_submode4, NULL, NULL, NULL},
    3,
    {1, 8, 2, 3, 4, 5, 5, 6, 6, 7, 7},
@@ -541,7 +541,7 @@
 #endif
    .012,   /*lag_factor*/
    QCONST16(.0002,15), /*lpc_floor*/
-   0.7,
+   QCONST16(0.7f,15),
    {NULL, &wb_submode1, NULL, NULL, NULL, NULL, NULL, NULL},
    1,
    {0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10},

Modified: trunk/speex/libspeex/modes.h
===================================================================
--- trunk/speex/libspeex/modes.h	2006-12-16 02:40:27 UTC (rev 12212)
+++ trunk/speex/libspeex/modes.h	2006-12-16 08:49:50 UTC (rev 12213)
@@ -130,7 +130,7 @@
    spx_word16_t gamma2;   /**< Perceptual filter parameter #1 */
    float   lag_factor;    /**< Lag-windowing parameter */
    spx_word16_t   lpc_floor;     /**< Noise floor for LPC analysis */
-   float   folding_gain;
+   spx_word16_t   folding_gain;
 
    const SpeexSubmode *submodes[SB_SUBMODES]; /**< Sub-mode data for the mode */
    int     defaultSubmode; /**< Default sub-mode to use when encoding */

Modified: trunk/speex/libspeex/sb_celp.c
===================================================================
--- trunk/speex/libspeex/sb_celp.c	2006-12-16 02:40:27 UTC (rev 12212)
+++ trunk/speex/libspeex/sb_celp.c	2006-12-16 08:49:50 UTC (rev 12213)
@@ -317,7 +317,7 @@
    const SpeexSBMode *mode;
    spx_int32_t dtx;
    spx_word16_t *in = (spx_word16_t*)vin;
-   float e_low=0, e_high=0;
+   spx_word16_t e_low=0, e_high=0;
 
    st = (SBEncState*)state;
    stack=st->stack;
@@ -421,7 +421,7 @@
       }
 
 
-      ratio = 2*log((1+e_high)/(1+e_low));
+      ratio = 2*log((1.f+e_high)/(1.f+e_low));
       
       speex_encoder_ctl(st->st_low, SPEEX_GET_RELATIVE_QUALITY, &st->relative_quality);
       if (ratio<-4)
@@ -630,7 +630,7 @@
 
          /* This is a kludge that cleans up a historical bug */
          if (st->subframeSize==80)
-            gc *= 0.70711;
+            gc = MULT16_16_P15(QCONST16(0.70711f,15),gc);
          /*printf ("%f %f %f %f\n", el, eh, filter_ratio, gc);*/
 #ifdef FIXED_POINT
          {
@@ -650,7 +650,7 @@
          }         
 #endif
          if (st->subframeSize==80)
-            gc *= 1.4142;
+            gc = MULT16_16_P14(QCONST16(1.4142f,14), gc);
 
          scale = SHL32(MULT16_16(PDIV32_16(SHL32(EXTEND32(gc),SIG_SHIFT-6),filter_ratio),(1+el)),6);
 
@@ -1043,13 +1043,13 @@
             exc[i]=mode->folding_gain*g*st->low_innov[offset+i];
 #else
          {
-            float tmp=1;
+            spx_word16_t 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_alias[offset+i];
+               float e=tmp*g*MULT16_16_Q15(mode->folding_gain,low_innov_alias[offset+i]);
                tmp *= -1;
                exc[i] = SIG_SCALING*e;
                /*float r = speex_rand(g*el,&seed);
@@ -1074,7 +1074,7 @@
 #endif
 
          if (st->subframeSize==80)
-            gc *= 1.4142;
+            gc = MULT16_16_P14(QCONST16(1.4142f,14),gc);
 
          scale = SHL32(PDIV32(SHL32(MULT16_16(gc, el),3), filter_ratio),SIG_SHIFT-3);
          SUBMODE(innovation_unquant)(exc, SUBMODE(innovation_params), st->subframeSize, 



More information about the commits mailing list