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

Jean-Marc Valin jm at xiph.org
Sat Nov 8 22:20:34 PST 2003



jm          03/11/09 01:20:34

  Modified:    libspeex ltp.c
  Log:
  removed sqrt's that ended up not being used in some cases in the open-loop
  pitch function

Revision  Changes    Path
1.94      +15 -9     speex/libspeex/ltp.c

Index: ltp.c
===================================================================
RCS file: /usr/local/cvsroot/speex/libspeex/ltp.c,v
retrieving revision 1.93
retrieving revision 1.94
diff -u -r1.93 -r1.94
--- ltp.c	2 Nov 2003 06:59:48 -0000	1.93
+++ ltp.c	9 Nov 2003 06:20:33 -0000	1.94
@@ -142,17 +142,11 @@
    }
 #endif
 
+   /* Extract best scores */
    for (i=start;i<=end;i++)
    {
       if (score[i-start]>best_score[N-1])
       {
-         float g1, g;
-         g1 = corr[i-start]/(energy[i-start]+10.);
-         g = sqrt(g1*corr[i-start]/(e0+10.));
-         if (g>g1)
-            g=g1;
-         if (g<0)
-            g=0;
          for (j=0;j<N;j++)
          {
             if (score[i-start] > best_score[j])
@@ -161,16 +155,28 @@
                {
                   best_score[k]=best_score[k-1];
                   pitch[k]=pitch[k-1];
-                  gain[k] = gain[k-1];
                }
                best_score[j]=score[i-start];
                pitch[j]=i;
-               gain[j]=g;
                break;
             }
          }
       }
    }
+   
+   /* Compute open-loop gain */
+   for (j=0;j<N;j++)
+   {
+      float g1, g;
+      i=pitch[j];
+      g1 = corr[i-start]/(energy[i-start]+10.);
+      g = sqrt(g1*corr[i-start]/(e0+10.));
+      if (g>g1)
+         g=g1;
+      if (g<0)
+         g=0;
+      gain[j]=g;
+   }
 
 }
 

<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