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

jm at svn.xiph.org jm at svn.xiph.org
Mon Feb 20 05:34:25 PST 2006


Author: jm
Date: 2006-02-20 05:34:21 -0800 (Mon, 20 Feb 2006)
New Revision: 10838

Modified:
   trunk/speex/libspeex/nb_celp.c
   trunk/speex/libspeex/sb_celp.c
Log:
reduced lpc lookahead from 10ms to 5ms. No significant impact on quality.


Modified: trunk/speex/libspeex/nb_celp.c
===================================================================
--- trunk/speex/libspeex/nb_celp.c	2006-02-20 06:16:59 UTC (rev 10837)
+++ trunk/speex/libspeex/nb_celp.c	2006-02-20 13:34:21 UTC (rev 10838)
@@ -125,9 +125,9 @@
    st->mode=m;
 
    st->frameSize = mode->frameSize;
-   st->windowSize = st->frameSize*3/2;
    st->nbSubframes=mode->frameSize/mode->subframeSize;
    st->subframeSize=mode->subframeSize;
+   st->windowSize = st->frameSize+st->subframeSize;
    st->lpcSize = mode->lpcSize;
    st->gamma1=mode->gamma1;
    st->gamma2=mode->gamma2;
@@ -164,14 +164,17 @@
 
    /* Asymmetric "pseudo-Hamming" window */
    {
-      int part1, part2;
-      part1=st->frameSize - (st->subframeSize>>1);
-      part2=(st->frameSize>>1) + (st->subframeSize>>1);
+      int part1, part2, part3;
+      part1=st->frameSize-st->subframeSize;
+      part2=st->subframeSize+10;
+      part3=st->subframeSize-10;
       st->window = speex_alloc((st->windowSize)*sizeof(spx_word16_t));
       for (i=0;i<part1;i++)
          st->window[i]=(spx_word16_t)(SIG_SCALING*(.54-.46*cos(M_PI*i/part1)));
       for (i=0;i<part2;i++)
-         st->window[part1+i]=(spx_word16_t)(SIG_SCALING*(.54+.46*cos(M_PI*i/part2)));
+         st->window[part1+i]=(spx_word16_t)(SIG_SCALING);
+      for (i=0;i<part3;i++)
+         st->window[part1+part2+i]=(spx_word16_t)(SIG_SCALING*sqrt(.504+.496*cos(M_PI*i/part3)));
    }
    /* Create the window for autocorrelation (lag-windowing) */
    st->lagWindow = speex_alloc((st->lpcSize+1)*sizeof(spx_word16_t));

Modified: trunk/speex/libspeex/sb_celp.c
===================================================================
--- trunk/speex/libspeex/sb_celp.c	2006-02-20 06:16:59 UTC (rev 10837)
+++ trunk/speex/libspeex/sb_celp.c	2006-02-20 13:34:21 UTC (rev 10838)
@@ -244,7 +244,7 @@
    st->frame_size = mode->frameSize;
    st->subframeSize = mode->subframeSize;
    st->nbSubframes = mode->frameSize/mode->subframeSize;
-   st->windowSize = st->frame_size*3/2;
+   st->windowSize = st->frame_size+st->subframeSize;
    st->lpcSize=mode->lpcSize;
    st->bufSize=mode->bufSize;
 
@@ -280,14 +280,17 @@
    st->target=speex_alloc((st->frame_size)*sizeof(spx_sig_t));
    /*Asymmetric "pseudo-Hamming" window*/
    {
-      int part1, part2;
-      part1 = st->subframeSize*7/2;
-      part2 = st->subframeSize*5/2;
+      int part1, part2, part3;
+      part1=st->frame_size-st->subframeSize;
+      part2=st->subframeSize+10;
+      part3=st->subframeSize-10;
       st->window = speex_alloc((st->windowSize)*sizeof(spx_word16_t));
       for (i=0;i<part1;i++)
          st->window[i]=(spx_word16_t)(SIG_SCALING*(.54-.46*cos(M_PI*i/part1)));
       for (i=0;i<part2;i++)
-         st->window[part1+i]=(spx_word16_t)(SIG_SCALING*(.54+.46*cos(M_PI*i/part2)));
+         st->window[part1+i]=(spx_word16_t)(SIG_SCALING);
+      for (i=0;i<part3;i++)
+         st->window[part1+part2+i]=(spx_word16_t)(SIG_SCALING*sqrt(.504+.496*cos(M_PI*i/part3)));
    }
 
    st->lagWindow = speex_alloc((st->lpcSize+1)*sizeof(spx_word16_t));



More information about the commits mailing list