* Corrected initialization of fft filter.
pull/1/head
David Freese 2014-12-23 08:49:23 -06:00
rodzic 5dc3851b33
commit 0a8f4a3b75
2 zmienionych plików z 20 dodań i 9 usunięć

Wyświetl plik

@ -52,6 +52,17 @@
// probably only need a single instance of g_fft !!
// use for both forward and reverse
void fftfilt::clear_filter()
{
memset(filter, 0, flen * sizeof(cmplx));
memset(timedata, 0, flen * sizeof(cmplx));
memset(freqdata, 0, flen * sizeof(cmplx));
memset(output, 0, flen * sizeof(cmplx));
memset(ovlbuf, 0, flen2 * sizeof(cmplx));
memset(ht, 0, flen * sizeof(cmplx));
inptr = 0;
}
void fftfilt::init_filter()
{
flen2 = flen >> 1;
@ -63,15 +74,12 @@ void fftfilt::init_filter()
output = new cmplx[flen];
ovlbuf = new cmplx[flen2];
ht = new cmplx[flen];
}
memset(filter, 0, flen * sizeof(cmplx));
memset(timedata, 0, flen * sizeof(cmplx));
memset(freqdata, 0, flen * sizeof(cmplx));
memset(output, 0, flen * sizeof(cmplx));
memset(ovlbuf, 0, flen2 * sizeof(cmplx));
memset(ht, 0, flen * sizeof(cmplx));
inptr = 0;
// number of samples needed to completely flush the filter
int fftfilt::flush_size()
{
return flen - inptr;
}
//------------------------------------------------------------------------------
@ -112,6 +120,7 @@ fftfilt::~fftfilt()
void fftfilt::create_filter(double f1, double f2)
{
clear_filter();
// initialize the filter to zero
memset(ht, 0, flen * sizeof(cmplx));
@ -179,7 +188,7 @@ void fftfilt::create_filter(double f1, double f2)
fspec.close();
delete [] revht;
*/
pass = 2;
pass = 1;//2; oh wow ... been wrong for years!
}
/*

Wyświetl plik

@ -54,6 +54,7 @@ protected:
0.08 * cos(4.0 * M_PI * i / len));
}
void init_filter();
void clear_filter();
public:
fftfilt(double f1, double f2, int len);
@ -71,6 +72,7 @@ public:
void rtty_filter(double);
int run(const cmplx& in, cmplx **out);
int flush_size();
};
#endif