[xiph-cvs] cvs commit: speex/libspeex filters.c filters.h modes.c modes.h

Jean-Marc Valin jm at xiph.org
Tue Dec 23 00:20:40 PST 2003



jm          03/12/23 03:20:40

  Modified:    libspeex filters.c filters.h modes.c modes.h
  Log:
  fixed-point: converted comb_gain

Revision  Changes    Path
1.75      +3 -10     speex/libspeex/filters.c

Index: filters.c
===================================================================
RCS file: /usr/local/cvsroot/speex/libspeex/filters.c,v
retrieving revision 1.74
retrieving revision 1.75
diff -u -r1.74 -r1.75
--- filters.c	4 Dec 2003 21:29:17 -0000	1.74
+++ filters.c	23 Dec 2003 08:20:40 -0000	1.75
@@ -461,7 +461,7 @@
 int nsf,             /*sub-frame size*/
 int pitch,           /*pitch period*/
 spx_word16_t *pitch_gain,   /*pitch gain (3-tap)*/
-float  comb_gain,    /*gain of comb filter*/
+spx_word16_t  comb_gain,    /*gain of comb filter*/
 CombFilterMem *mem
 )
 {
@@ -470,7 +470,6 @@
    float gain;
    spx_word16_t step;
    spx_word16_t fact;
-   spx_word16_t cgain;
 
    /*Compute excitation amplitude prior to enhancement*/
    exc_energy = compute_rms(exc, nsf);
@@ -484,17 +483,11 @@
       if (g>1.3)
          comb_gain*=1.3/g;
       if (g<.5)
-         comb_gain*=2*g;
+         comb_gain*=2.*g;
    }
    step = DIV32(COMB_STEP, nsf);
    fact=0;
 
-#ifdef FIXED_POINT
-   cgain = comb_gain*32768;
-#else
-   cgain = comb_gain;
-#endif
-
    /*Apply pitch comb-filter (filter out noise between pitch harmonics)*/
    for (i=0;i<nsf;i++)
    {
@@ -509,7 +502,7 @@
                  MULT16_32_Q15(SHL(mem->last_pitch_gain[1],7),exc[i-mem->last_pitch]) +
                  MULT16_32_Q15(SHL(mem->last_pitch_gain[2],7),exc[i-mem->last_pitch-1]),2);
 
-      new_exc[i] = exc[i] + MULT16_32_Q15(cgain,MULT16_32_Q15(fact,exc1)  + MULT16_32_Q15(SUB16(COMB_STEP,fact), exc2));
+      new_exc[i] = exc[i] + MULT16_32_Q15(comb_gain,MULT16_32_Q15(fact,exc1)  + MULT16_32_Q15(SUB16(COMB_STEP,fact), exc2));
    }
 
    mem->last_pitch_gain[0] = pitch_gain[0];

<p><p>1.38      +1 -4      speex/libspeex/filters.h

Index: filters.h
===================================================================
RCS file: /usr/local/cvsroot/speex/libspeex/filters.h,v
retrieving revision 1.37
retrieving revision 1.38
diff -u -r1.37 -r1.38
--- filters.h	4 Dec 2003 21:29:17 -0000	1.37
+++ filters.h	23 Dec 2003 08:20:40 -0000	1.38
@@ -65,9 +65,6 @@
 
 
 
-/* FIR filter */
-void fir_decim_mem(const spx_sig_t *x, const float *a, spx_sig_t *y, int N, int M, float *mem);
-
 void syn_percep_zero(const spx_sig_t *x, const spx_coef_t *ak, const spx_coef_t *awk1, const spx_coef_t *awk2, spx_sig_t *y, int N, int ord, char *stack);
 
 void residue_percep_zero(const spx_sig_t *xx, const spx_coef_t *ak, const spx_coef_t *awk1, const spx_coef_t *awk2, spx_sig_t *y, int N, int ord, char *stack);
@@ -82,7 +79,7 @@
 int nsf,             /*sub-frame size*/
 int pitch,           /*pitch period*/
 spx_word16_t *pitch_gain,   /*pitch gain (3-tap)*/
-float  comb_gain,    /*gain of comb filter*/
+spx_word16_t  comb_gain,    /*gain of comb filter*/
 CombFilterMem *mem
 );
 

<p><p>1.113     +7 -7      speex/libspeex/modes.c

Index: modes.c
===================================================================
RCS file: /usr/local/cvsroot/speex/libspeex/modes.c,v
retrieving revision 1.112
retrieving revision 1.113
diff -u -r1.112 -r1.113
--- modes.c	23 Dec 2003 08:11:13 -0000	1.112
+++ modes.c	23 Dec 2003 08:20:40 -0000	1.113
@@ -207,7 +207,7 @@
    split_cb_shape_sign_unquant,
    &split_cb_nb_ulbr,
 #ifdef FIXED_POINT
-   22938, 16384, 11796, .65,
+   22938, 16384, 11796, 21299,
 #else
    0.7, 0.5, .36, .65,
 #endif
@@ -232,7 +232,7 @@
    split_cb_shape_sign_unquant,
    &split_cb_nb_vlbr,
 #ifdef FIXED_POINT
-   22938, 16384, 11796, .55,
+   22938, 16384, 11796, 18022,
 #else
    0.7, 0.5, .36, .55,
 #endif
@@ -257,7 +257,7 @@
    split_cb_shape_sign_unquant,
    &split_cb_nb_lbr,
 #ifdef FIXED_POINT
-   22938, 18022, 9830, .45,
+   22938, 18022, 9830, 14746,
 #else
    0.7, 0.55, .30, .45,
 #endif
@@ -282,7 +282,7 @@
    split_cb_shape_sign_unquant,
    &split_cb_nb_med,
 #ifdef FIXED_POINT
-   22938, 20644, 5243, .35,
+   22938, 20644, 5243, 11469,
 #else
    0.7, 0.63, .16, .35,
 #endif
@@ -307,7 +307,7 @@
    split_cb_shape_sign_unquant,
    &split_cb_nb,
 #ifdef FIXED_POINT
-   22938, 21299, 3932, .25,
+   22938, 21299, 3932, 8192,
 #else
    0.7, 0.65, .12, .25,
 #endif
@@ -332,7 +332,7 @@
    split_cb_shape_sign_unquant,
    &split_cb_sb,
 #ifdef FIXED_POINT
-   22282, 21299, 2294, .1,
+   22282, 21299, 2294, 3277,
 #else
    0.68, 0.65, .07, .1,
 #endif
@@ -638,7 +638,7 @@
    split_cb_shape_sign_unquant,
    &split_cb_nb_48k,
 #ifdef FIXED_POINT
-   22938, 16384, 11796, .55,
+   22938, 16384, 11796, 18022,
 #else
    0.7, 0.5, .36, .55,
 #endif

<p><p>1.52      +1 -1      speex/libspeex/modes.h

Index: modes.h
===================================================================
RCS file: /usr/local/cvsroot/speex/libspeex/modes.h,v
retrieving revision 1.51
retrieving revision 1.52
diff -u -r1.51 -r1.52
--- modes.h	23 Dec 2003 08:11:13 -0000	1.51
+++ modes.h	23 Dec 2003 08:20:40 -0000	1.52
@@ -95,7 +95,7 @@
    spx_word16_t      lpc_enh_k1; /**< Enhancer constant */
    spx_word16_t      lpc_enh_k2; /**< Enhancer constant */
    spx_word16_t      lpc_enh_k3; /**< Enhancer constant */
-   float             comb_gain;  /**< Gain of enhancer comb filter */
+   spx_word16_t      comb_gain;  /**< Gain of enhancer comb filter */
 
    int               bits_per_frame; /**< Number of bits per frame after encoding*/
 } SpeexSubmode;

<p><p>--- >8 ----
List archives:  http://www.xiph.org/archives/
Ogg project homepage: http://www.xiph.org/ogg/
To unsubscribe from this list, send a message to 'cvs-request at xiph.org'
containing only the word 'unsubscribe' in the body.  No subject is needed.
Unsubscribe messages sent to the list will be ignored/filtered.



More information about the commits mailing list