[xiph-commits] r10726 - trunk/ghost/libghost
jm at svn.xiph.org
jm at svn.xiph.org
Mon Jan 9 20:31:36 PST 2006
Author: jm
Date: 2006-01-09 20:31:33 -0800 (Mon, 09 Jan 2006)
New Revision: 10726
Modified:
trunk/ghost/libghost/ghost.c
trunk/ghost/libghost/sinusoids.c
Log:
fixed a bunch of NaNs
Modified: trunk/ghost/libghost/ghost.c
===================================================================
--- trunk/ghost/libghost/ghost.c 2006-01-10 03:55:51 UTC (rev 10725)
+++ trunk/ghost/libghost/ghost.c 2006-01-10 04:31:33 UTC (rev 10726)
@@ -91,10 +91,10 @@
spx_fft_float(st->big_fft, st->pcm_buf, psd);
for (i=1;i<(PCM_BUF_SIZE>>1);i++)
{
- psd[i] = 10*log10(psd[2*i-1]*psd[2*i-1] + psd[2*i]*psd[2*i]);
+ psd[i] = 10*log10(1+psd[2*i-1]*psd[2*i-1] + psd[2*i]*psd[2*i]);
}
- psd[0] = 10*log10(psd[0]*psd[0]);
- psd[(PCM_BUF_SIZE>>1)-1] = 10*log10(psd[PCM_BUF_SIZE-1]*psd[PCM_BUF_SIZE-1]);
+ psd[0] = 10*log10(1+psd[0]*psd[0]);
+ psd[(PCM_BUF_SIZE>>1)-1] = 10*log10(1+psd[PCM_BUF_SIZE-1]*psd[PCM_BUF_SIZE-1]);
find_sinusoids(psd, wi, SINUSOIDS, (PCM_BUF_SIZE>>1)+1);
/*for (i=0;i<SINUSOIDS;i++)
{
Modified: trunk/ghost/libghost/sinusoids.c
===================================================================
--- trunk/ghost/libghost/sinusoids.c 2006-01-10 03:55:51 UTC (rev 10725)
+++ trunk/ghost/libghost/sinusoids.c 2006-01-10 04:31:33 UTC (rev 10726)
@@ -104,7 +104,8 @@
tmp2 += (x[j]-y[j])*sin_table[i][j];
}
tmp1 /= cosE[i];
- tmp2 /= sinE[i];
+ //Just in case it's a DC! Must fix that anyway
+ tmp2 /= (.0001+sinE[i]);
for (j=0;j<len;j++)
{
y[j] += tmp1*cos_table[i][j] + tmp2*sin_table[i][j];
More information about the commits
mailing list