[xiph-commits] r9246 - in trunk/speex: include/speex libspeex
jm at motherfish-iii.xiph.org
jm at motherfish-iii.xiph.org
Mon May 9 14:27:53 PDT 2005
Author: jm
Date: 2005-05-09 14:27:52 -0700 (Mon, 09 May 2005)
New Revision: 9246
Modified:
trunk/speex/include/speex/speex_echo.h
trunk/speex/libspeex/mdf.c
Log:
Smoothed correlation/energy
Modified: trunk/speex/include/speex/speex_echo.h
===================================================================
--- trunk/speex/include/speex/speex_echo.h 2005-05-09 21:03:13 UTC (rev 9245)
+++ trunk/speex/include/speex/speex_echo.h 2005-05-09 21:27:52 UTC (rev 9246)
@@ -47,7 +47,10 @@
int adapted;
float adapt_rate;
float sum_adapt;
-
+ float Sey;
+ float Syy;
+ float See;
+
float *x;
float *X;
float *d;
Modified: trunk/speex/libspeex/mdf.c
===================================================================
--- trunk/speex/libspeex/mdf.c 2005-05-09 21:03:13 UTC (rev 9245)
+++ trunk/speex/libspeex/mdf.c 2005-05-09 21:27:52 UTC (rev 9246)
@@ -121,7 +121,10 @@
st->cancel_count=0;
st->adapt_rate = .01f;
st->sum_adapt = 0;
-
+ st->Sey = 0;
+ st->Syy = 0;
+ st->See = 0;
+
st->fft_lookup = (struct drft_lookup*)speex_alloc(sizeof(struct drft_lookup));
spx_drft_init(st->fft_lookup, N);
@@ -151,13 +154,13 @@
st->W[i] = 0;
}
- st->regul[0] = (10.)/(M*(4.)*(4.));
+ st->regul[0] = (.01+(10.)/((4.)*(4.)))/M;
for (i=1,j=1;i<N-1;i+=2,j++)
{
- st->regul[i] = (10.)/(M*(j+4.)*(j+4.));
- st->regul[i+1] = (10.)/(M*(j+4.)*(j+4.));
+ st->regul[i] = .01+((10.)/((j+4.)*(j+4.)))/M;
+ st->regul[i+1] = .01+((10.)/((j+4.)*(j+4.)))/M;
}
- st->regul[i] = (10.)/(M*(j+4.)*(j+4.));
+ st->regul[i] = .01+((10.)/((j+4.)*(j+4.)))/M;
st->adapted = 0;
return st;
@@ -304,6 +307,11 @@
Syy = inner_prod(st->y+st->frame_size, st->y+st->frame_size, st->frame_size);
Srr = inner_prod(st->d+st->frame_size, st->d+st->frame_size, st->frame_size);
Sxx = inner_prod(st->x+st->frame_size, st->x+st->frame_size, st->frame_size);
+
+ st->Sey = .9*st->Sey + .1*Sey;
+ st->Syy = .9*st->Syy + .1*Syy;
+ st->See = .9*st->See + .1*See;
+
for (i=0;i<M*N;i++)
Sww += st->W[i]*st->W[i];
@@ -331,7 +339,7 @@
fprintf(stderr, "Adapted at %d %f\n", st->cancel_count, st->sum_adapt);
st->adapted = 1;
}
- //printf ("%f %f %f %f %f %f %f %f %f ", Srr, Syy, Sxx, See, ESR, SER, Sry, Sey, Sww);
+ printf ("%f %f %f %f %f %f %f %f %f %f %f %f\n", Srr, Syy, Sxx, See, ESR, SER, Sry, Sey, Sww, st->Sey, st->Syy, st->See);
for (i=0;i<=st->frame_size;i++)
{
st->fratio[i] = (.2*ESR+.8*min(.005+ESR,st->fratio[i]));
@@ -370,12 +378,10 @@
if (st->adapted)
{
for (i=0;i<=st->frame_size;i++)
- {
- st->power_1[i] = st->fratio[i] /(1e3f+st->power[i]);
- }
+ st->power_1[i] = st->fratio[i] /(1.f+st->power[i]);
} else {
for (i=0;i<=st->frame_size;i++)
- st->power_1[i] = 1.0f/(1e3f+st->power[i]);
+ st->power_1[i] = 1.0f/(1.f+st->power[i]);
}
}
@@ -422,12 +428,12 @@
}
}
- if (st->cancel_count%100==0)
+ /*if (st->cancel_count%100==0)
{
for (i=0;i<M*N;i++)
printf ("%f ", st->W[i]);
printf ("\n");
- }
+ }*/
/* Compute spectrum of estimated echo for use in an echo post-filter (if necessary)*/
@@ -450,7 +456,7 @@
power_spectrum(st->Yps, st->Yps, N);
for (i=0;i<=st->frame_size;i++)
- Yout[i] = 4*(.1+(.5/(1+st->sum_adapt)))*st->Yps[i];
+ Yout[i] = 3*(.1+(.5/(1+st->sum_adapt)))*st->Yps[i];
}
}
More information about the commits
mailing list