[xiph-cvs] cvs commit: speex/libspeex lsp.c ltp.c nb_celp.c

Jean-Marc Valin jm at xiph.org
Wed Oct 23 23:29:14 PDT 2002



jm          02/10/24 02:29:13

  Modified:    libspeex lsp.c ltp.c nb_celp.c
  Log:
  Decoder optimizations, mostly when perceptual enhancement is off.

Revision  Changes    Path
1.15      +4 -3      speex/libspeex/lsp.c

Index: lsp.c
===================================================================
RCS file: /usr/local/cvsroot/speex/libspeex/lsp.c,v
retrieving revision 1.14
retrieving revision 1.15
diff -u -r1.14 -r1.15
--- lsp.c	24 Oct 2002 03:59:35 -0000	1.14
+++ lsp.c	24 Oct 2002 06:29:13 -0000	1.15
@@ -280,13 +280,14 @@
       LSP coefficient */
 
     for(j=0;j<=lpcrdr;j++){
-	for(i=0;i<m;i++){
+       int i2=0;
+	for(i=0;i<m;i++,i2+=2){
             n1 = pw+(i*4);
             n2 = n1 + 1;
             n3 = n2 + 1;
             n4 = n3 + 1;
-	    xout1 = xin1 - 2*(freq[2*i]) * *n1 + *n2;
-	    xout2 = xin2 - 2*(freq[2*i+1]) * *n3 + *n4;
+	    xout1 = xin1 - 2*(freq[i2]) * *n1 + *n2;
+	    xout2 = xin2 - 2*(freq[i2+1]) * *n3 + *n4;
             *n2 = *n1;
             *n4 = *n3;
             *n1 = xin1;

<p><p>1.60      +18 -5     speex/libspeex/ltp.c

Index: ltp.c
===================================================================
RCS file: /usr/local/cvsroot/speex/libspeex/ltp.c,v
retrieving revision 1.59
retrieving revision 1.60
diff -u -r1.59 -r1.60
--- ltp.c	23 Oct 2002 19:06:19 -0000	1.59
+++ ltp.c	24 Oct 2002 06:29:13 -0000	1.60
@@ -466,6 +466,7 @@
       {
          int j;
          int pp=pitch+1-i;
+#if 0
          for (j=0;j<nsf;j++)
          {
             if (j-pp<0)
@@ -474,15 +475,27 @@
                e[i][j]=exc[j-pp-pitch];
             else
                e[i][j]=0;
-         /*if (j-pp<0)
+         }
+#else
+         {
+            int tmp1, tmp2;
+            tmp1=nsf;
+            if (tmp1>pp)
+               tmp1=pp;
+            for (j=0;j<tmp1;j++)
                e[i][j]=exc[j-pp];
-            else
-            e[i][j]=exc[j-pp-pitch];*/
+            tmp2=nsf;
+            if (tmp2>pp+pitch)
+               tmp2=pp+pitch;
+            for (j=tmp1;j<tmp2;j++)
+               e[i][j]=exc[j-pp-pitch];
+            for (j=tmp2;j<nsf;j++)
+               e[i][j]=0;
          }
+#endif
       }
       for (i=0;i<nsf;i++)
-         exc[i]=gain[0]*e[2][i]+gain[1]*e[1][i]+gain[2]*e[0][i];
-      
+           exc[i]=gain[0]*e[2][i]+gain[1]*e[1][i]+gain[2]*e[0][i];
    }
 }
 

<p><p>1.69      +26 -8     speex/libspeex/nb_celp.c

Index: nb_celp.c
===================================================================
RCS file: /usr/local/cvsroot/speex/libspeex/nb_celp.c,v
retrieving revision 1.68
retrieving revision 1.69
diff -u -r1.68 -r1.69
--- nb_celp.c	24 Oct 2002 03:59:35 -0000	1.68
+++ nb_celp.c	24 Oct 2002 06:29:13 -0000	1.69
@@ -822,6 +822,7 @@
       exc=st->exc+offset;
       /* Excitation after post-filter*/
 
+      if (st->lpc_enh_enabled)
       {
          float r=.9;
          
@@ -849,10 +850,18 @@
       for (i=0;i<st->subframeSize;i++)
          sp[i]=exc[i];
       
-      filter_mem2(sp, awk3, awk1, sp, st->subframeSize, st->lpcSize, 
-        st->mem_sp+st->lpcSize);
-      filter_mem2(sp, awk2, st->interp_qlpc, sp, st->subframeSize, st->lpcSize, 
-        st->mem_sp);
+      if (st->lpc_enh_enabled)
+      {
+         filter_mem2(sp, awk2, awk1, sp, st->subframeSize, st->lpcSize, 
+                     st->mem_sp+st->lpcSize);
+         filter_mem2(sp, awk3, st->interp_qlpc, sp, st->subframeSize, st->lpcSize, 
+                     st->mem_sp);
+      } else {
+         for (i=0;i<st->lpcSize;i++)
+            st->mem_sp[st->lpcSize+i] = 0;
+         iir_mem2(sp, st->interp_qlpc, sp, st->subframeSize, st->lpcSize, 
+                     st->mem_sp);
+      }
   
    }
 
@@ -1018,6 +1027,7 @@
       lsp_to_lpc(st->interp_qlsp, st->interp_qlpc, st->lpcSize, stack);
 
       /* Compute enhanced synthesis filter */
+      if (st->lpc_enh_enabled)
       {
          float r=.9;
          
@@ -1148,10 +1158,18 @@
       if (st->lpc_enh_enabled && SUBMODE(comb_gain>0))
          comb_filter(exc, sp, st->interp_qlpc, st->lpcSize, st->subframeSize,
                               pitch, pitch_gain, .5);
-      filter_mem2(sp, awk3, awk1, sp, st->subframeSize, st->lpcSize, 
-        st->mem_sp+st->lpcSize);
-      filter_mem2(sp, awk2, st->interp_qlpc, sp, st->subframeSize, st->lpcSize, 
-        st->mem_sp);
+      if (st->lpc_enh_enabled)
+      {
+         filter_mem2(sp, awk2, awk1, sp, st->subframeSize, st->lpcSize, 
+                     st->mem_sp+st->lpcSize);
+         filter_mem2(sp, awk3, st->interp_qlpc, sp, st->subframeSize, st->lpcSize, 
+                     st->mem_sp);
+      } else {
+         for (i=0;i<st->lpcSize;i++)
+            st->mem_sp[st->lpcSize+i] = 0;
+         iir_mem2(sp, st->interp_qlpc, sp, st->subframeSize, st->lpcSize, 
+                     st->mem_sp);
+      }
    }
    
    /*Copy output signal*/

<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