mirror of
https://github.com/f4exb/sdrangel.git
synced 2024-11-22 08:04:49 -05:00
Bandpass FFT.
This commit is contained in:
parent
1752be6262
commit
4135c8f5ad
@ -48,7 +48,8 @@ public:
|
||||
void create_filter(float f1, float f2);
|
||||
void rtty_filter(float);
|
||||
|
||||
int run(const cmplx& in, cmplx **out, bool usb);
|
||||
int runFilt(const cmplx& in, cmplx **out);
|
||||
int runSSB(const cmplx& in, cmplx **out, bool usb);
|
||||
};
|
||||
|
||||
#endif
|
||||
|
@ -67,7 +67,7 @@ void SSBDemod::feed(SampleVector::const_iterator begin, SampleVector::const_iter
|
||||
c *= m_nco.nextIQ();
|
||||
|
||||
if(m_interpolator.interpolate(&m_sampleDistanceRemain, c, &ci)) {
|
||||
n_out = SSBFilter->run(ci, &sideband, m_usb);
|
||||
n_out = SSBFilter->runSSB(ci, &sideband, m_usb);
|
||||
m_sampleDistanceRemain += (Real)m_sampleRate / 48000.0;
|
||||
} else
|
||||
n_out = 0;
|
||||
|
@ -73,7 +73,7 @@ void TCPSrc::feed(SampleVector::const_iterator begin, SampleVector::const_iterat
|
||||
if(m_ssbSockets.count() > 0) {
|
||||
for(SampleVector::const_iterator it = m_sampleBuffer.begin(); it != m_sampleBuffer.end(); ++it) {
|
||||
Complex cj(it->real() / 20000.0, it->imag() / 20000.0);
|
||||
int n_out = TCPFilter->run(cj, &sideband, true);
|
||||
int n_out = TCPFilter->runSSB(cj, &sideband, true);
|
||||
if (n_out) {
|
||||
for (int i = 0; i < n_out; i+=2) {
|
||||
Real one = (sideband[i].real() + sideband[i].imag()) * 0.7 * 32000.0;
|
||||
|
@ -89,11 +89,11 @@ void USBDemod::feed(SampleVector::const_iterator begin, SampleVector::const_iter
|
||||
b = it->imag();
|
||||
c = Complex(a / 65536.0, b / 65536.0);
|
||||
|
||||
n_out = USBFilter->run(c, &sideband, true);
|
||||
n_out = USBFilter->runSSB(c, &sideband, true);
|
||||
if (m_sampleRate <= 72000)
|
||||
n_out += USBFilter->run(c, &sideband, true);
|
||||
n_out += USBFilter->runSSB(c, &sideband, true);
|
||||
if (m_sampleRate == 64000)
|
||||
n_out += USBFilter->run(c, &sideband, true);
|
||||
n_out += USBFilter->runSSB(c, &sideband, true);
|
||||
for (i = m_i ; i < n_out; i += samplestep) {
|
||||
Real demod = (sideband[i].real() + sideband[i].imag()) * 32768.0;
|
||||
|
||||
|
@ -144,7 +144,31 @@ void fftfilt::create_filter(float f1, float f2)
|
||||
}
|
||||
|
||||
// Filter with fast convolution (overlap-add algorithm).
|
||||
int fftfilt::run(const cmplx & in, cmplx **out, bool usb)
|
||||
int fftfilt::runFilt(const cmplx & in, cmplx **out)
|
||||
{
|
||||
timedata[inptr++] = in;
|
||||
if (inptr < flen2)
|
||||
return 0;
|
||||
inptr = 0;
|
||||
|
||||
memcpy(freqdata, timedata, flen * sizeof(cmplx));
|
||||
fft->ComplexFFT(freqdata);
|
||||
for (int i = 0; i < flen; i++)
|
||||
freqdata[i] *= filter[i];
|
||||
|
||||
fft->InverseComplexFFT(freqdata);
|
||||
|
||||
for (int i = 0; i < flen2; i++) {
|
||||
output[i] = ovlbuf[i] + freqdata[i];
|
||||
ovlbuf[i] = freqdata[flen2 + i];
|
||||
}
|
||||
|
||||
*out = output;
|
||||
return flen2;
|
||||
}
|
||||
|
||||
// Second version for single sideband
|
||||
int fftfilt::runSSB(const cmplx & in, cmplx **out, bool usb)
|
||||
{
|
||||
timedata[inptr++] = in;
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user