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

jm at svn.xiph.org jm at svn.xiph.org
Mon May 8 03:24:43 PDT 2006


Author: jm
Date: 2006-05-08 03:24:36 -0700 (Mon, 08 May 2006)
New Revision: 11373

Modified:
   trunk/speex/libspeex/filters.c
   trunk/speex/libspeex/filters.h
   trunk/speex/libspeex/nb_celp.c
   trunk/speex/libspeex/nb_celp.h
   trunk/speex/libspeex/sb_celp.c
Log:
Enable the new enhancer by default.


Modified: trunk/speex/libspeex/filters.c
===================================================================
--- trunk/speex/libspeex/filters.c	2006-05-08 02:13:29 UTC (rev 11372)
+++ trunk/speex/libspeex/filters.c	2006-05-08 10:24:36 UTC (rev 11373)
@@ -640,7 +640,7 @@
       mem[i+1] = xx[i];
 }
 
-#ifdef NEW_ENHANCER
+#ifndef OLD_ENHANCER
 
 #ifdef FIXED_POINT
 #if 0
@@ -874,8 +874,9 @@
    for (i=0;i<nsf;i++)
       new_exc[i] = MULT16_16_Q14(ngain, new_exc[i]);
 }
-#endif
 
+#else
+
 void comb_filter_mem_init (CombFilterMem *mem)
 {
    mem->last_pitch=0;
@@ -994,3 +995,5 @@
    for (i=0;i<nsf;i++)
       _new_exc[i] = EXTRACT16(PSHR32(new_exc[i],SIG_SHIFT));
 }
+
+#endif

Modified: trunk/speex/libspeex/filters.h
===================================================================
--- trunk/speex/libspeex/filters.h	2006-05-08 02:13:29 UTC (rev 11372)
+++ trunk/speex/libspeex/filters.h	2006-05-08 10:24:36 UTC (rev 11373)
@@ -48,14 +48,7 @@
 
 #endif
 
-/** Combined filter memory. */
-typedef struct {
-   int   last_pitch;
-   spx_word16_t last_pitch_gain[3];
-   spx_word16_t smooth_gain;
-} CombFilterMem;
 
-
 void qmf_decomp(const spx_word16_t *xx, const spx_word16_t *aa, spx_sig_t *, spx_sig_t *y2, int N, int M, spx_word16_t *mem, char *stack);
 void fir_mem_up(const spx_sig_t *x, const spx_word16_t *a, spx_sig_t *y, int N, int M, spx_word32_t *mem, char *stack);
 
@@ -79,7 +72,7 @@
 
 void compute_impulse_response(const spx_coef_t *ak, const spx_coef_t *awk1, const spx_coef_t *awk2, spx_word16_t *y, int N, int ord, char *stack);
 
-#ifdef NEW_ENHANCER
+#ifndef OLD_ENHANCER
 void multicomb(
 spx_sig_t *exc,          /*decoded excitation*/
 spx_word16_t *new_exc,      /*enhanced excitation*/
@@ -91,8 +84,15 @@
 spx_word16_t  comb_gain,    /*gain of comb filter*/
 char *stack
 );
-#endif
+#else
 
+/** Combined filter memory. */
+typedef struct {
+   int   last_pitch;
+   spx_word16_t last_pitch_gain[3];
+   spx_word16_t smooth_gain;
+} CombFilterMem;
+
 void comb_filter_mem_init (CombFilterMem *mem);
 
 void comb_filter(
@@ -106,6 +106,6 @@
 spx_word16_t  comb_gain,    /*gain of comb filter*/
 CombFilterMem *mem
 );
+#endif
 
-
 #endif

Modified: trunk/speex/libspeex/nb_celp.c
===================================================================
--- trunk/speex/libspeex/nb_celp.c	2006-05-08 02:13:29 UTC (rev 11372)
+++ trunk/speex/libspeex/nb_celp.c	2006-05-08 10:24:36 UTC (rev 11373)
@@ -1039,10 +1039,10 @@
    return 1;
 }
 
-#ifdef NEW_ENHANCER
+#ifdef OLD_ENHANCER
+#define PITCH_PERIODS 1
+#else
 #define PITCH_PERIODS 3
-#else
-#define PITCH_PERIODS 1
 #endif
 
 void *nb_decoder_init(const SpeexMode *m)
@@ -1092,9 +1092,10 @@
    st->interp_qlpc = speex_alloc(st->lpcSize*sizeof(spx_coef_t));
    st->old_qlsp = speex_alloc(st->lpcSize*sizeof(spx_lsp_t));
    st->mem_sp = speex_alloc((5*st->lpcSize)*sizeof(spx_mem_t));
+#ifdef OLD_ENHANCER
    st->comb_mem = speex_alloc(sizeof(CombFilterMem));
    comb_filter_mem_init (st->comb_mem);
-
+#endif
    st->pi_gain = speex_alloc((st->nbSubframes)*sizeof(spx_word32_t));
    st->last_pitch = 40;
    st->count_lost=0;
@@ -1132,7 +1133,9 @@
    speex_free (st->interp_qlpc);
    speex_free (st->old_qlsp);
    speex_free (st->mem_sp);
+#ifdef OLD_ENHANCER
    speex_free (st->comb_mem);
+#endif
    speex_free (st->pi_gain);
 
    speex_free(state);
@@ -1212,12 +1215,12 @@
          exc[i]= MULT16_32_Q15(pitch_gain, (exc[i-pitch_val]+VERY_SMALL)) + 
                MULT16_32_Q15(fact, MULT16_32_Q15(SHL(Q15ONE,15)-SHL(MULT16_16(pitch_gain,pitch_gain),1),speex_rand(innov_gain, &st->seed)));
       }
-#ifdef NEW_ENHANCER
+#ifdef OLD_ENHANCER
       for (i=0;i<st->subframeSize;i++)
-         sp[i]=PSHR32(exc[i-st->subframeSize],SIG_SHIFT);
+         sp[i]=PSHR32(exc[i],SIG_SHIFT);
 #else
       for (i=0;i<st->subframeSize;i++)
-         sp[i]=PSHR32(exc[i],SIG_SHIFT);
+         sp[i]=PSHR32(exc[i-st->subframeSize],SIG_SHIFT);
 #endif 
       iir_mem16(sp, st->interp_qlpc, sp, st->subframeSize, st->lpcSize, 
                 st->mem_sp);
@@ -1673,7 +1676,7 @@
 
       }
 
-#ifndef NEW_ENHANCER
+#ifdef OLD_ENHANCER
       if (st->lpc_enh_enabled && SUBMODE(comb_gain)>0 && !st->count_lost)
       {
          comb_filter(exc, sp, st->interp_qlpc, st->lpcSize, st->subframeSize,
@@ -1688,7 +1691,7 @@
    
    ALLOC(interp_qlsp, st->lpcSize, spx_lsp_t);
 
-#ifdef NEW_ENHANCER
+#ifndef OLD_ENHANCER
    if (st->lpc_enh_enabled && SUBMODE(comb_gain)>0 && !st->count_lost)
    {
       multicomb(st->exc-st->subframeSize, out, st->interp_qlpc, st->lpcSize, 2*st->subframeSize, best_pitch, pitch_gain, SUBMODE(comb_gain), stack);
@@ -1719,10 +1722,10 @@
       for (i=0;i<st->frameSize;i++)
       {
          st->exc[i] = MULT16_32_Q14(gain, st->exc[i]);
-#ifdef NEW_ENHANCER
+#ifdef OLD_ENHANCER
+         out[i]=PSHR32(st->exc[i],SIG_SHIFT);
+#else
          out[i]=PSHR32(st->exc[i-st->subframeSize],SIG_SHIFT);
-#else
-         out[i]=PSHR32(st->exc[i],SIG_SHIFT);
 #endif
       }
    }
@@ -1749,7 +1752,7 @@
       /* Compute interpolated LPCs (unquantized) */
       lsp_to_lpc(interp_qlsp, ak, st->lpcSize, stack);
 
-#ifndef NEW_ENHANCER
+#ifdef OLD_ENHANCER
       for (i=0;i<st->lpcSize;i++)
          st->interp_qlpc[i] = ak[i];
 #endif
@@ -2039,10 +2042,10 @@
       (*(int*)ptr) = st->encode_submode;
       break;
    case SPEEX_GET_LOOKAHEAD:
-#ifdef NEW_ENHANCER
+#ifdef OLD_ENHANCER
+      (*(int*)ptr)=0;
+#else
       (*(int*)ptr)=st->subframeSize;
-#else
-      (*(int*)ptr)=0;
 #endif
       break;
    case SPEEX_GET_PI_GAIN:

Modified: trunk/speex/libspeex/nb_celp.h
===================================================================
--- trunk/speex/libspeex/nb_celp.h	2006-05-08 02:13:29 UTC (rev 11372)
+++ trunk/speex/libspeex/nb_celp.h	2006-05-08 10:24:36 UTC (rev 11373)
@@ -167,7 +167,9 @@
    const SpeexSubmode * const *submodes; /**< Sub-mode data */
    int    submodeID;      /**< Activated sub-mode */
    int    lpc_enh_enabled; /**< 1 when LPC enhancer is on, 0 otherwise */
+#ifdef OLD_ENHANCER
    CombFilterMem *comb_mem;
+#endif
    SpeexCallback speex_callbacks[SPEEX_MAX_CALLBACKS];
 
    SpeexCallback user_callback;

Modified: trunk/speex/libspeex/sb_celp.c
===================================================================
--- trunk/speex/libspeex/sb_celp.c	2006-05-08 02:13:29 UTC (rev 11372)
+++ trunk/speex/libspeex/sb_celp.c	2006-05-08 10:24:36 UTC (rev 11373)
@@ -1112,7 +1112,7 @@
       /* LSP to LPC */
       lsp_to_lpc(st->interp_qlsp, ak, st->lpcSize, stack);
 
-#ifndef NEW_ENHANCER
+#ifdef OLD_ENHANCER
       for (i=0;i<st->lpcSize;i++)
          st->interp_qlpc[i] = ak[i];
 #endif
@@ -1222,7 +1222,7 @@
             innov_save[2*i]=exc[i];
       }
       
-#ifndef NEW_ENHANCER
+#ifdef OLD_ENHANCER
       for (i=0;i<st->subframeSize;i++)
          st->excBuf[i]=exc[i];
 #endif
@@ -1230,7 +1230,7 @@
          sp[i]=st->excBuf[i];
       iir_mem2(sp, st->interp_qlpc, sp, st->subframeSize, st->lpcSize, 
                st->mem_sp);
-#ifdef NEW_ENHANCER
+#ifndef OLD_ENHANCER
       for (i=0;i<st->subframeSize;i++)
          st->excBuf[i]=exc[i];
       for (i=0;i<st->lpcSize;i++)



More information about the commits mailing list