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

jm at svn.xiph.org jm at svn.xiph.org
Sun Oct 9 21:02:01 PDT 2005


Author: jm
Date: 2005-10-09 21:01:55 -0700 (Sun, 09 Oct 2005)
New Revision: 10143

Modified:
   trunk/speex/libspeex/arch.h
   trunk/speex/libspeex/fixed_generic.h
   trunk/speex/libspeex/modes.c
   trunk/speex/libspeex/modes.h
   trunk/speex/libspeex/nb_celp.c
   trunk/speex/libspeex/nb_celp.h
   trunk/speex/libspeex/sb_celp.c
   trunk/speex/libspeex/sb_celp.h
Log:
lpc floor converted to fixed-point


Modified: trunk/speex/libspeex/arch.h
===================================================================
--- trunk/speex/libspeex/arch.h	2005-10-07 15:37:39 UTC (rev 10142)
+++ trunk/speex/libspeex/arch.h	2005-10-10 04:01:55 UTC (rev 10143)
@@ -119,6 +119,9 @@
 #define VERY_LARGE32 1e15f
 #define VERY_LARGE16 1e15f
 
+#define QCONST16(x,bits) (x)
+#define QCONST32(x,bits) (x)
+
 #define NEG16(x) (-(x))
 #define NEG32(x) (-(x))
 #define EXTRACT16(x) (x)

Modified: trunk/speex/libspeex/fixed_generic.h
===================================================================
--- trunk/speex/libspeex/fixed_generic.h	2005-10-07 15:37:39 UTC (rev 10142)
+++ trunk/speex/libspeex/fixed_generic.h	2005-10-10 04:01:55 UTC (rev 10143)
@@ -35,6 +35,9 @@
 #ifndef FIXED_GENERIC_H
 #define FIXED_GENERIC_H
 
+#define QCONST16(x,bits) ((spx_word16_t)((x)*(1<<(bits))+(1<<((bits)-1))))
+#define QCONST32(x,bits) ((spx_word32_t)((x)*(1<<(bits))+(1<<((bits)-1))))
+
 #define NEG16(x) (-(x))
 #define NEG32(x) (-(x))
 #define EXTRACT16(x) ((spx_word16_t)x)

Modified: trunk/speex/libspeex/modes.c
===================================================================
--- trunk/speex/libspeex/modes.c	2005-10-07 15:37:39 UTC (rev 10142)
+++ trunk/speex/libspeex/modes.c	2005-10-10 04:01:55 UTC (rev 10143)
@@ -387,7 +387,7 @@
    0.9, 0.6, /* gamma1, gamma2 */
 #endif
    .012,   /*lag_factor*/
-   .0002, /*lpc_floor*/
+   QCONST16(.0002,15), /*lpc_floor*/
 #ifdef EPIC_48K
    0,
 #endif
@@ -543,7 +543,7 @@
    0.9, 0.6, /* gamma1, gamma2 */
 #endif
    .001,   /*lag_factor*/
-   .0001, /*lpc_floor*/
+   QCONST16(.0001,15), /*lpc_floor*/
    0.9,
    {NULL, &wb_submode1, &wb_submode2, &wb_submode3, &wb_submode4, NULL, NULL, NULL},
    3,
@@ -589,7 +589,7 @@
    0.9, 0.6, /* gamma1, gamma2 */
 #endif
    .002,   /*lag_factor*/
-   .0001, /*lpc_floor*/
+   QCONST16(.0001,15), /*lpc_floor*/
    0.7,
    {NULL, &wb_submode1, NULL, NULL, NULL, NULL, NULL, NULL},
    1,
@@ -677,7 +677,7 @@
    0.9,    /*gamma1*/
    0.6,    /*gamma2*/
    .01,   /*lag_factor*/
-   .0003, /*lpc_floor*/
+   QCONST16(.0003,15), /*lpc_floor*/
    1,
    {NULL, NULL, &nb_48k_submode, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL},
    2,

Modified: trunk/speex/libspeex/modes.h
===================================================================
--- trunk/speex/libspeex/modes.h	2005-10-07 15:37:39 UTC (rev 10142)
+++ trunk/speex/libspeex/modes.h	2005-10-10 04:01:55 UTC (rev 10143)
@@ -111,7 +111,7 @@
    spx_word16_t gamma1;    /**< Perceptual filter parameter #1 */
    spx_word16_t gamma2;    /**< Perceptual filter parameter #2 */
    float   lag_factor;     /**< Lag-windowing parameter */
-   float   lpc_floor;      /**< Noise floor for LPC analysis */
+   spx_word16_t   lpc_floor;      /**< Noise floor for LPC analysis */
 
 #ifdef EPIC_48K
    int     lbr48k;         /**< 1 for the special 4.8 kbps mode */
@@ -133,7 +133,7 @@
    spx_word16_t gamma1;   /**< Perceptual filter parameter #1 */
    spx_word16_t gamma2;   /**< Perceptual filter parameter #1 */
    float   lag_factor;    /**< Lag-windowing parameter */
-   float   lpc_floor;     /**< Noise floor for LPC analysis */
+   spx_word16_t   lpc_floor;     /**< Noise floor for LPC analysis */
    float   folding_gain;
 
    const SpeexSubmode *submodes[SB_SUBMODES]; /**< Sub-mode data for the mode */

Modified: trunk/speex/libspeex/nb_celp.c
===================================================================
--- trunk/speex/libspeex/nb_celp.c	2005-10-07 15:37:39 UTC (rev 10142)
+++ trunk/speex/libspeex/nb_celp.c	2005-10-10 04:01:55 UTC (rev 10143)
@@ -297,7 +297,7 @@
       /* Compute auto-correlation */
       _spx_autocorr(w_sig, st->autocorr, st->lpcSize+1, st->windowSize);
    }
-   st->autocorr[0] = ADD16(st->autocorr[0],(spx_word16_t) (st->autocorr[0]*st->lpc_floor)); /* Noise floor in auto-correlation domain */
+   st->autocorr[0] = ADD16(st->autocorr[0],MULT16_16_Q15(st->autocorr[0],st->lpc_floor)); /* Noise floor in auto-correlation domain */
 
    /* Lag windowing: equivalent to filtering in the power-spectrum domain */
    for (i=0;i<st->lpcSize+1;i++)

Modified: trunk/speex/libspeex/nb_celp.h
===================================================================
--- trunk/speex/libspeex/nb_celp.h	2005-10-07 15:37:39 UTC (rev 10142)
+++ trunk/speex/libspeex/nb_celp.h	2005-10-10 04:01:55 UTC (rev 10143)
@@ -67,7 +67,7 @@
    spx_word16_t  gamma1;         /**< Perceptual filter: A(z/gamma1) */
    spx_word16_t  gamma2;         /**< Perceptual filter: A(z/gamma2) */
    float  lag_factor;     /**< Lag windowing Gaussian width */
-   float  lpc_floor;      /**< Noise floor multiplier for A[0] in LPC analysis*/
+   spx_word16_t  lpc_floor;      /**< Noise floor multiplier for A[0] in LPC analysis*/
    char  *stack;          /**< Pseudo-stack allocation for temporary memory */
    spx_sig_t *inBuf;          /**< Input buffer (original signal) */
    spx_sig_t *frame;          /**< Start of original frame */

Modified: trunk/speex/libspeex/sb_celp.c
===================================================================
--- trunk/speex/libspeex/sb_celp.c	2005-10-07 15:37:39 UTC (rev 10142)
+++ trunk/speex/libspeex/sb_celp.c	2005-10-10 04:01:55 UTC (rev 10143)
@@ -445,8 +445,7 @@
       /* Compute auto-correlation */
       _spx_autocorr(w_sig, st->autocorr, st->lpcSize+1, st->windowSize);
    }
-   
-   st->autocorr[0] = ADD16(st->autocorr[0],(spx_word16_t) (st->autocorr[0]*st->lpc_floor)); /* Noise floor in auto-correlation domain */
+   st->autocorr[0] = ADD16(st->autocorr[0],MULT16_16_Q15(st->autocorr[0],st->lpc_floor)); /* Noise floor in auto-correlation domain */
 
    /* Lag windowing: equivalent to filtering in the power-spectrum domain */
    for (i=0;i<st->lpcSize+1;i++)

Modified: trunk/speex/libspeex/sb_celp.h
===================================================================
--- trunk/speex/libspeex/sb_celp.h	2005-10-07 15:37:39 UTC (rev 10142)
+++ trunk/speex/libspeex/sb_celp.h	2005-10-10 04:01:55 UTC (rev 10143)
@@ -53,7 +53,7 @@
    int    bufSize;             /**< Buffer size */
    int    first;               /**< First frame? */
    float  lag_factor;          /**< Lag-windowing control parameter */
-   float  lpc_floor;           /**< Controls LPC analysis noise floor */
+   spx_word16_t  lpc_floor;           /**< Controls LPC analysis noise floor */
    spx_word16_t  gamma1;              /**< Perceptual weighting coef 1 */
    spx_word16_t  gamma2;              /**< Perceptual weighting coef 2 */
 



More information about the commits mailing list