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

jm at svn.xiph.org jm at svn.xiph.org
Mon May 8 07:27:03 PDT 2006


Author: jm
Date: 2006-05-08 07:26:59 -0700 (Mon, 08 May 2006)
New Revision: 11378

Modified:
   trunk/speex/libspeex/nb_celp.c
Log:
reduced buffering size for the enhancer to what is actually needed


Modified: trunk/speex/libspeex/nb_celp.c
===================================================================
--- trunk/speex/libspeex/nb_celp.c	2006-05-08 14:16:53 UTC (rev 11377)
+++ trunk/speex/libspeex/nb_celp.c	2006-05-08 14:26:59 UTC (rev 11378)
@@ -1035,12 +1035,6 @@
    return 1;
 }
 
-#ifdef OLD_ENHANCER
-#define PITCH_PERIODS 1
-#else
-#define PITCH_PERIODS 3
-#endif
-
 void *nb_decoder_init(const SpeexMode *m)
 {
    DecState *st;
@@ -1079,9 +1073,13 @@
 
    st->lpc_enh_enabled=0;
 
-
-   st->excBuf = speex_alloc((st->frameSize + PITCH_PERIODS*st->max_pitch + 1 + 50)*sizeof(spx_sig_t));
-   st->exc = st->excBuf + PITCH_PERIODS*st->max_pitch + 1;
+#ifdef OLD_ENHANCER
+   st->excBuf = speex_alloc((st->frameSize + st->max_pitch + 1)*sizeof(spx_sig_t));
+   st->exc = st->excBuf + st->max_pitch + 1;
+#else
+   st->excBuf = speex_alloc((st->frameSize + 2*st->max_pitch + st->subframeSize + 12)*sizeof(spx_sig_t));
+   st->exc = st->excBuf + 2*st->max_pitch + st->subframeSize + 6;
+#endif
    for (i=0;i<st->frameSize + st->max_pitch + 1;i++)
       st->excBuf[i]=0;
 
@@ -1178,9 +1176,11 @@
    pitch_gain = MULT16_16_Q15(fact,pitch_gain) + VERY_SMALL;
 
    /* Shift all buffers by one frame */
-   /*speex_move(st->inBuf, st->inBuf+st->frameSize, (st->bufSize-st->frameSize)*sizeof(spx_sig_t));*/
-   speex_move(st->excBuf, st->excBuf+st->frameSize, (PITCH_PERIODS*st->max_pitch + 1)*sizeof(spx_sig_t));
-
+#ifdef OLD_ENHANCER
+   speex_move(st->excBuf, st->excBuf+st->frameSize, (st->max_pitch + 1)*sizeof(spx_sig_t));
+#else
+   speex_move(st->excBuf, st->excBuf+st->frameSize, (2*st->max_pitch + st->subframeSize + 12)*sizeof(spx_sig_t));
+#endif   
    for (sub=0;sub<st->nbSubframes;sub++)
    {
       int offset;
@@ -1355,7 +1355,11 @@
    }
 
    /* Shift all buffers by one frame */
-   speex_move(st->excBuf, st->excBuf+st->frameSize, (PITCH_PERIODS*st->max_pitch + 1)*sizeof(spx_sig_t));
+#ifdef OLD_ENHANCER
+   speex_move(st->excBuf, st->excBuf+st->frameSize, (st->max_pitch + 1)*sizeof(spx_sig_t));
+#else
+   speex_move(st->excBuf, st->excBuf+st->frameSize, (2*st->max_pitch + st->subframeSize + 12)*sizeof(spx_sig_t));
+#endif   
 
    /* If null mode (no transmission), just set a couple things to zero*/
    if (st->submodes[st->submodeID] == NULL)



More information about the commits mailing list