1
0
mirror of https://github.com/f4exb/sdrangel.git synced 2024-12-23 01:55:48 -05:00

ATV Demod: FFT asymmetrical filter implementation

This commit is contained in:
f4exb 2017-03-18 13:19:24 +01:00
parent d6b48ed4d0
commit 4c6451b3c4
3 changed files with 61 additions and 7 deletions

View File

@ -193,13 +193,13 @@ void ATVDemod::feed(const SampleVector::const_iterator& begin, const SampleVecto
#endif
Complex c(fltI, fltQ);
if (m_objRFRunning.m_intFrequencyOffset != 0)
{
c *= m_nco.nextIQ();
}
if (m_objRFRunning.m_blndecimatorEnable)
{
if (m_objRFRunning.m_intFrequencyOffset != 0)
{
c *= m_nco.nextIQ();
}
if (m_interpolator.decimate(&m_interpolatorDistanceRemain, c, &ci))
{
demod(ci);
@ -231,10 +231,28 @@ void ATVDemod::demod(Complex& c)
float fltVal;
int intVal;
//********** FFT filtering **********
if (m_objRFRunning.m_blnFFTFiltering)
{
int n_out;
fftfilt::cmplx *filtered;
n_out = m_DSBFilter->runAsym(c, &filtered, m_objRFRunning.m_enmModulation != ATV_VAML); // all usb except explicitely lsb
if (n_out > 0)
{
memcpy((void *) m_DSBFilterBuffer, (const void *) filtered, n_out*sizeof(Complex));
m_DSBFilterBufferIndex = 0;
}
m_DSBFilterBufferIndex++;
}
//********** demodulation **********
float& fltI = c.real();
float& fltQ = c.imag();
float& fltI = m_objRFRunning.m_blnFFTFiltering ? m_DSBFilterBuffer[m_DSBFilterBufferIndex-1].real() : c.real();
float& fltQ = m_objRFRunning.m_blnFFTFiltering ? m_DSBFilterBuffer[m_DSBFilterBufferIndex-1].imag() : c.imag();
double magSq = fltI*fltI + fltQ*fltQ;
m_objMagSqAverage.feed(magSq);
@ -647,6 +665,19 @@ void ATVDemod::applySettings()
getOutputMessageQueue()->push(report);
}
if ((m_objConfigPrivate.m_intTVSampleRate != m_objRunningPrivate.m_intTVSampleRate)
|| (m_objRFConfig.m_fltRFBandwidth != m_objRFRunning.m_fltRFBandwidth)
|| (m_objRFConfig.m_fltRFOppBandwidth != m_objRFRunning.m_fltRFOppBandwidth))
{
m_objSettingsMutex.lock();
m_DSBFilter->create_asym_filter(m_objRFConfig.m_fltRFOppBandwidth / m_objConfigPrivate.m_intTVSampleRate,
m_objRFConfig.m_fltRFBandwidth / m_objConfigPrivate.m_intTVSampleRate);
memset(m_DSBFilterBuffer, 0, sizeof(Complex)*(m_ssbFftLen));
m_DSBFilterBufferIndex = 0;
m_objSettingsMutex.unlock();
}
m_objRunning = m_objConfig;
m_objRFRunning = m_objRFConfig;
m_objRunningPrivate = m_objConfigPrivate;

View File

@ -186,7 +186,9 @@ bool ATVDemodGUI::handleMessage(const Message& objMessage)
void ATVDemodGUI::viewChanged()
{
qDebug("ATVDemodGUI::viewChanged");
applySettings();
applyRFSettings();
}
void ATVDemodGUI::channelSampleRateChanged()

View File

@ -54,6 +54,9 @@
<layout class="QHBoxLayout" name="rfSettings1Layout">
<item>
<widget class="ButtonSwitch" name="decimatorEnable">
<property name="toolTip">
<string>Toggle decimator on/off</string>
</property>
<property name="text">
<string/>
</property>
@ -70,6 +73,9 @@
<layout class="QHBoxLayout" name="deltaFrequencyLayout">
<item>
<widget class="QToolButton" name="deltaFrequencyMinus">
<property name="toolTip">
<string>Channel center frequency shift direction</string>
</property>
<property name="text">
<string/>
</property>
@ -104,6 +110,9 @@
<pointsize>12</pointsize>
</font>
</property>
<property name="toolTip">
<string>Channel center frequency shift</string>
</property>
</widget>
</item>
<item>
@ -123,6 +132,9 @@
<height>0</height>
</size>
</property>
<property name="toolTip">
<string>Effective channel sample rate (kS/s)</string>
</property>
<property name="text">
<string> 00000k</string>
</property>
@ -184,6 +196,9 @@
<height>0</height>
</size>
</property>
<property name="toolTip">
<string>Channel power</string>
</property>
<property name="text">
<string>-100.0 dB</string>
</property>
@ -238,6 +253,9 @@
</item>
<item>
<widget class="QSlider" name="rfOppBW">
<property name="toolTip">
<string>Asymmetrical filter opposite band cutoff</string>
</property>
<property name="layoutDirection">
<enum>Qt::RightToLeft</enum>
</property>
@ -257,6 +275,9 @@
</item>
<item>
<widget class="QSlider" name="rfBW">
<property name="toolTip">
<string>Asymmetrical filter in band cutoff / Decimator filter cutoff</string>
</property>
<property name="minimum">
<number>1</number>
</property>