[xiph-commits] r13412 - trunk/ghost/libghost

jm at svn.xiph.org jm at svn.xiph.org
Mon Jul 30 21:47:40 PDT 2007


Author: jm
Date: 2007-07-30 21:47:40 -0700 (Mon, 30 Jul 2007)
New Revision: 13412

Modified:
   trunk/ghost/libghost/ghost.c
   trunk/ghost/libghost/sinusoids.c
Log:
sqrt(Hanning) for both analysis and synthesis should be equivalent to using

a regular Hanning.


Modified: trunk/ghost/libghost/ghost.c
===================================================================
--- trunk/ghost/libghost/ghost.c	2007-07-31 04:47:34 UTC (rev 13411)
+++ trunk/ghost/libghost/ghost.c	2007-07-31 04:47:40 UTC (rev 13412)
@@ -111,10 +111,12 @@
    }
    for (i=0;i<st->overlap;i++)
    {
-      //st->analysis_window[i] = .5-.5*cos(M_PI*(i+.5)/st->overlap);
-      //st->analysis_window[st->length-i-1] = .5-.5*cos(M_PI*(i+.5)/st->overlap);
-      st->analysis_window[i] = ((float)i+.5)/st->overlap;
-      st->analysis_window[st->length-i-1] = ((float)i+.5)/st->overlap;
+      st->synthesis_window[i] = st->analysis_window[i] = sqrt(.5-.5*cos(M_PI*(i+.5)/st->overlap));
+      st->synthesis_window[st->length-i-1] = st->analysis_window[st->length-i-1] = sqrt(.5-.5*cos(M_PI*(i+.5)/st->overlap));
+      //st->analysis_window[i] = ((float)i+.5)/st->overlap;
+      //st->analysis_window[st->length-i-1] = ((float)i+.5)/st->overlap;
+      //st->synthesis_window[i] = ((float)i+.5)/st->overlap;
+      //st->synthesis_window[st->length-i-1] = ((float)i+.5)/st->overlap;
    }
 #if 1
    for (i=0;i<st->lpc_length;i++)
@@ -141,8 +143,6 @@
 {
    int i;
    float gain;
-   float pitch;
-   float w;
    float curve[PCM_BUF_SIZE>>1];
    float awk1[MASK_LPC_ORDER], awk2[MASK_LPC_ORDER];
    float mask_gain;
@@ -184,6 +184,8 @@
       for (i=0;i<st->length;i++)
          x[i] = st->analysis_window[i]*st->current_frame[i];
       //extract_sinusoids(x, wi, st->window, ai, bi, y, SINUSOIDS, st->length);
+      //nb_sinusoids=1;
+      //wi[0] = 0.42745;
       extract_modulated_sinusoids(x, wi, st->analysis_window, ai, bi, ci, di, y, nb_sinusoids, st->length);
       
       /*for (i=0;i<st->length;i++)

Modified: trunk/ghost/libghost/sinusoids.c
===================================================================
--- trunk/ghost/libghost/sinusoids.c	2007-07-31 04:47:34 UTC (rev 13411)
+++ trunk/ghost/libghost/sinusoids.c	2007-07-31 04:47:40 UTC (rev 13412)
@@ -260,7 +260,7 @@
    for (i=0;i<N;i++)
       ai[i] = bi[i] = ci[i] = di[i] = 0;
    
-   nonlin = 3;
+   nonlin = 10;
    /* Iterate on the non-linear part (frequency) a couple times */
    while (1)
    {
@@ -352,7 +352,7 @@
    
       /* This is an iterative linear solution -- much quicker than inverting a matrix.
          It's pretty much the Gauss-Seidel algorithm */
-      for (iter=0;iter<2;iter++)
+      for (iter=0;iter<1;iter++)
       {
          for (i=0;i<N;i++)
          {
@@ -407,7 +407,7 @@
          dw[i] = (ci[i]*bi[i] - di[i]*ai[i])/(.01f+A[i]*A[i]);
          //printf ("%f %f %f %f %f %f %f %f %f\n", w[i], ai[i], bi[i], ci[i], di[i], A, phi, dA, dw);
          /* Update the frequency with only a fraction of the dw term to prevent instabilities */
-         w[i] = w[i] + .5*dw[i];
+         w[i] = w[i] + dw[i];
          /* Make sure we didn't deviate too much from the original frequency */
          if (w[i] > w0[i]+.025)
             w[i] = w0[i]+.025;



More information about the commits mailing list