[xiph-commits] r13621 - trunk/ghost/libghost
jm at svn.xiph.org
jm at svn.xiph.org
Sat Aug 25 04:13:42 PDT 2007
Author: jm
Date: 2007-08-25 04:13:42 -0700 (Sat, 25 Aug 2007)
New Revision: 13621
Modified:
trunk/ghost/libghost/pitch.c
trunk/ghost/libghost/pitch.h
Log:
Slightly better pitch selection criteria -- still kludgy though
Modified: trunk/ghost/libghost/pitch.c
===================================================================
--- trunk/ghost/libghost/pitch.c 2007-08-25 11:13:36 UTC (rev 13620)
+++ trunk/ghost/libghost/pitch.c 2007-08-25 11:13:42 UTC (rev 13621)
@@ -67,7 +67,7 @@
}
-void find_spectral_pitch(float *x, float *y, int lag, int len, int *pitch)
+void find_spectral_pitch(float *x, float *y, int lag, int len, int *pitch, float *curve)
{
//FIXME: Yuck!!!
static void *fft;
@@ -90,8 +90,13 @@
X[0] = X[0]*Y[0];
for (i=1;i<lag/2;i++)
{
- float n = 1.f/(1e3+sqrt((X[2*i-1]*X[2*i-1] + X[2*i ]*X[2*i ])*(Y[2*i-1]*Y[2*i-1] + Y[2*i ]*Y[2*i ])));
+ float n = 1.f/(1e1+sqrt((X[2*i-1]*X[2*i-1] + X[2*i ]*X[2*i ])*(Y[2*i-1]*Y[2*i-1] + Y[2*i ]*Y[2*i ])));
//n = 1;
+ n = 1.f/sqrt(1+curve[i]);
+ if (i>10)
+ n *= .5;
+ if (i>20)
+ n *= .5;
float tmp = X[2*i-1];
X[2*i-1] = (X[2*i-1]*Y[2*i-1] + X[2*i ]*Y[2*i ])*n;
X[2*i ] = (- X[2*i ]*Y[2*i-1] + tmp*Y[2*i ])*n;
Modified: trunk/ghost/libghost/pitch.h
===================================================================
--- trunk/ghost/libghost/pitch.h 2007-08-25 11:13:36 UTC (rev 13620)
+++ trunk/ghost/libghost/pitch.h 2007-08-25 11:13:42 UTC (rev 13621)
@@ -27,6 +27,6 @@
void find_pitch(float *x, float *gain, float *pitch, int start, int end, int len);
-void find_spectral_pitch(float *x, float *y, int lag, int len, int *pitch);
+void find_spectral_pitch(float *x, float *y, int lag, int len, int *pitch, float *curve);
#endif
More information about the commits
mailing list