1
0
mirror of https://github.com/f4exb/sdrangel.git synced 2024-09-27 15:26:33 -04:00

Inf/Sup frequency shift scheme change to set bandwidth closer to device center frequency

This commit is contained in:
f4exb 2018-05-10 22:17:39 +02:00
parent 6a5a35285e
commit 4bb749ce65
11 changed files with 306 additions and 269 deletions

View File

@ -72,9 +72,14 @@ The I/Q stream from the BladeRF ADC is downsampled by a power of two before bein
Possible values are:
- **Cen**: the decimation operation takes place around the BladeRF Rx center frequency
- **Inf**: the decimation operation takes place around the center of the lower half of the BladeRF Rx passband.
- **Sup**: the decimation operation takes place around the center of the upper half of the BladeRF Rx passband.
- **Cen**: the decimation operation takes place around the BladeRF Rx center frequency Fs
- **Inf**: the decimation operation takes place around Fs - Fc.
- **Sup**: the decimation operation takes place around Fs + Fc.
With SR as the sample rate before decimation Fc is calculated as:
- if decimation n is 4 or lower: Fc = SR/2^(log2(n)-1). The device center frequency is on the side of the baseband. You need a RF filter bandwidth at least twice the baseband.
- if decimation n is 8 or higher: Fc = SR/n. The device center frequency is half the baseband away from the side of the baseband. You need a RF filter bandwidth at least 3 times the baseband.
<h3>7: Rx filter bandwidth</h3>

View File

@ -75,11 +75,7 @@ This is the HackRF device ADC sample rate in S/s.
Use the wheels to adjust the sample rate. Left click on a digit sets the cursor position at this digit. Right click on a digit sets all digits on the right to zero. This effectively floors value at the digit position. Wheels are moved with the mousewheel while pointing at the wheel or by selecting the wheel with the left mouse click and using the keyboard arrows. Pressing shift simultaneously moves digit by 5 and pressing control moves it by 2.
<h3>7: Rx filter bandwidth</h3>
This is the Rx filter bandwidth in kHz. Possible values are: 1750, 2500, 3500, 5000, 5500, 6000, 7000, 8000, 9000, 10000, 12000, 14000, 15000, 20000, 24000, 28000 kHz.
<h3>8: Decimation factor</h3>
<h3>7: Decimation factor</h3>
The device stream from the HackRF is decimated to obtain the baseband stream. Possible values are:
@ -90,6 +86,21 @@ The device stream from the HackRF is decimated to obtain the baseband stream. Po
- **16**: divide device stream sample rate by 16
- **32**: divide device stream sample rate by 32
<h3>8: Baseband center frequency position relative the the HackRF Rx center frequency</h3>
- **Cen**: the decimation operation takes place around the HackRF Rx center frequency Fs
- **Inf**: the decimation operation takes place around Fs - Fc.
- **Sup**: the decimation operation takes place around Fs + Fc.
With SR as the sample rate before decimation Fc is calculated as:
- if decimation n is 4 or lower: Fc = SR/2^(log2(n)-1). The device center frequency is on the side of the baseband. You need a RF filter bandwidth at least twice the baseband.
- if decimation n is 8 or higher: Fc = SR/n. The device center frequency is half the baseband away from the side of the baseband. You need a RF filter bandwidth at least 3 times the baseband.
<h3>9: Rx filter bandwidth</h3>
This is the Rx filter bandwidth in kHz. Possible values are: 1750, 2500, 3500, 5000, 5500, 6000, 7000, 8000, 9000, 10000, 12000, 14000, 15000, 20000, 24000, 28000 kHz.
<h3>10: Internal LNA gain</h3>
The LNA gain can be adjusted from 0 dB to 40 dB in 8 dB steps.

View File

@ -106,11 +106,16 @@ Use these buttons to confirm ("OK") or dismiss ("Cancel") your changes.
The I/Q stream from the PlutoSDR is downsampled by a power of two by software inside the plugin before being sent to the passband. Possible values are increasing powers of two: 1 (no decimation), 2, 4, 8, 16, 32, 64.
<h3>6: Decimated bandpass center frequency placement</h3>
<h3>6: Decimated bandpass center frequency position relative the the PlutoSDR Rx center frequency</h3>
- **Inf**: Infradyne: the decimation takes place in the lower sideband
- **Sup**: Supradyne: the decimation takes place in the lower sideband
- **Cen**: Centered: the decimation takes place around the center
- **Cen**: the decimation operation takes place around the PlutoSDR Rx center frequency Fs
- **Inf**: the decimation operation takes place around Fs - Fc.
- **Sup**: the decimation operation takes place around Fs + Fc.
With SR as the sample rate before decimation Fc is calculated as:
- if decimation n is 4 or lower: Fc = SR/2^(log2(n)-1). The device center frequency is on the side of the baseband. You need a RF filter bandwidth at least twice the baseband.
- if decimation n is 8 or higher: Fc = SR/n. The device center frequency is half the baseband away from the side of the baseband. You need a RF filter bandwidth at least 3 times the baseband.
<h3>7: Antenna (input) connection</h3>

View File

@ -49,13 +49,16 @@ These buttons control the local DSP auto correction options:
- **DC**: auto remove DC component
- **IQ**: auto make I/Q balance. The DC correction must be enabled for this to be effective.
<h3>4: Baseband center frequency position relative the center frequency</h3>
<h3>4: Decimated bandpass center frequency position relative the RTL-SDR center frequency</h3>
Possible values are:
- **Cen**: the decimation operation takes place around the RTL-SDR center frequency Fs
- **Inf**: the decimation operation takes place around Fs - Fc.
- **Sup**: the decimation operation takes place around Fs + Fc.
With SR as the sample rate before decimation Fc is calculated as:
- **Cen**: the decimation operation takes place around the BladeRF Rx center frequency
- **Inf**: the decimation operation takes place around the center of the lower half of the BladeRF Rx passband.
- **Sup**: the decimation operation takes place around the center of the upper half of the BladeRF Rx passband.
- if decimation n is 4 or lower: Fc = SR/2^(log2(n)-1). The device center frequency is on the side of the baseband. You need a RF filter bandwidth at least twice the baseband.
- if decimation n is 8 or higher: Fc = SR/n. The device center frequency is half the baseband away from the side of the baseband. You need a RF filter bandwidth at least 3 times the baseband.
<h3>4a: Transverter mode open dialog</h3>

View File

@ -75,13 +75,16 @@ You have the choice between various sample rates from 1536 to 8192 kHz. Some val
Decimation in powers of two from 1 (no decimation) to 64.
<h3>9. Center frequency position</h3>
<h3>9: Decimated bandpass center frequency position relative the SDRplay center frequency</h3>
Relative position of center frequency of decimated baseband relative to the original:
- **Cen**: the decimation operation takes place around the SDRplay center frequency Fs
- **Inf**: the decimation operation takes place around Fs - Fc.
- **Sup**: the decimation operation takes place around Fs + Fc.
With SR as the sample rate before decimation Fc is calculated as:
- Inf: infradyne i.e. in the lower half of original baseband: to be used with non zero IFs
- Cen: Centered i.e. around the center of the original baseband
- Sup: Supradyne i.e. in the upper half of original baseband
- if decimation n is 4 or lower: Fc = SR/2^(log2(n)-1). The device center frequency is on the side of the baseband. You need a RF filter bandwidth at least twice the baseband.
- if decimation n is 8 or higher: Fc = SR/n. The device center frequency is half the baseband away from the side of the baseband. You need a RF filter bandwidth at least 3 times the baseband.
<h3>10. Tuner gain mode</h3>

View File

@ -56,11 +56,14 @@ This exercises the decimation chain.
<h4>2.3: Baseband center frequency position relative the center frequency</h4>
Possible values are:
- **Cen**: the decimation operation takes place around the center frequency Fs
- **Inf**: the decimation operation takes place around Fs - Fc.
- **Sup**: the decimation operation takes place around Fs + Fc.
With SR as the sample rate before decimation Fc is calculated as:
- **Cen**: the decimation operation takes place around the BladeRF Rx center frequency
- **Inf**: the decimation operation takes place around the center of the lower half of the BladeRF Rx passband.
- **Sup**: the decimation operation takes place around the center of the upper half of the BladeRF Rx passband.
- if decimation n is 4 or lower: Fc = SR/2^(log2(n)-1). The device center frequency is on the side of the baseband. You need a RF filter bandwidth at least twice the baseband.
- if decimation n is 8 or higher: Fc = SR/n. The device center frequency is half the baseband away from the side of the baseband. You need a RF filter bandwidth at least 3 times the baseband.
<h3>2.4: Sample size</h3>

View File

@ -274,11 +274,10 @@ bool TestSourceInput::applySettings(const TestSourceSettings& settings, bool for
if (settings.m_log2Decim != 0)
{
if (settings.m_fcPos == TestSourceSettings::FC_POS_INFRA) {
frequencyShift -= (devSampleRate / 4);
} else if (settings.m_fcPos == TestSourceSettings::FC_POS_SUPRA) {
frequencyShift += (devSampleRate / 4);
}
frequencyShift += DeviceSampleSource::calculateFrequencyShift(
settings.m_log2Decim,
(DeviceSampleSource::fcPos_t) settings.m_fcPos,
settings.m_sampleRate);
}
if (m_testSourceThread != 0)

View File

@ -463,31 +463,27 @@ void Decimators<StorageType, T, SdrBits, InputBits>::decimate2_u(SampleVector::i
template<typename StorageType, typename T, uint SdrBits, uint InputBits>
void Decimators<StorageType, T, SdrBits, InputBits>::decimate2_inf(SampleVector::iterator* it, const T* buf, qint32 len)
{
StorageType xreal[2], yimag[2];
StorageType buf2[4];
for (int pos = 0; pos < len - 7; pos += 8)
{
xreal[0] = buf[pos+2] << decimation_shifts<SdrBits, InputBits>::pre2;
yimag[0] = buf[pos+3] << decimation_shifts<SdrBits, InputBits>::pre2;
xreal[1] = buf[pos+6] << decimation_shifts<SdrBits, InputBits>::pre2;
yimag[1] = buf[pos+7] << decimation_shifts<SdrBits, InputBits>::pre2;
m_decimator2.myDecimateInf(
buf[pos+0] << decimation_shifts<SdrBits, InputBits>::pre2,
buf[pos+1] << decimation_shifts<SdrBits, InputBits>::pre2,
&xreal[0],
&yimag[0],
buf[pos+2] << decimation_shifts<SdrBits, InputBits>::pre2,
buf[pos+3] << decimation_shifts<SdrBits, InputBits>::pre2,
buf[pos+4] << decimation_shifts<SdrBits, InputBits>::pre2,
buf[pos+5] << decimation_shifts<SdrBits, InputBits>::pre2,
&xreal[1],
&yimag[1]);
buf[pos+6] << decimation_shifts<SdrBits, InputBits>::pre2,
buf[pos+7] << decimation_shifts<SdrBits, InputBits>::pre2,
&buf2[0]);
(**it).setReal(xreal[0] >> decimation_shifts<SdrBits, InputBits>::post2);
(**it).setImag(yimag[0] >> decimation_shifts<SdrBits, InputBits>::post2);
(**it).setReal(buf2[0] >> decimation_shifts<SdrBits, InputBits>::post2);
(**it).setImag(buf2[1] >> decimation_shifts<SdrBits, InputBits>::post2);
++(*it);
(**it).setReal(xreal[1] >> decimation_shifts<SdrBits, InputBits>::post2);
(**it).setImag(yimag[1] >> decimation_shifts<SdrBits, InputBits>::post2);
(**it).setReal(buf2[2] >> decimation_shifts<SdrBits, InputBits>::post2);
(**it).setImag(buf2[3] >> decimation_shifts<SdrBits, InputBits>::post2);
++(*it);
}
}
@ -495,31 +491,27 @@ void Decimators<StorageType, T, SdrBits, InputBits>::decimate2_inf(SampleVector:
template<typename StorageType, typename T, uint SdrBits, uint InputBits>
void Decimators<StorageType, T, SdrBits, InputBits>::decimate2_sup(SampleVector::iterator* it, const T* buf, qint32 len)
{
StorageType xreal[2], yimag[2];
StorageType buf2[4];
for (int pos = 0; pos < len - 7; pos += 8)
{
xreal[0] = buf[pos+2] << decimation_shifts<SdrBits, InputBits>::pre2;
yimag[0] = buf[pos+3] << decimation_shifts<SdrBits, InputBits>::pre2;
xreal[1] = buf[pos+6] << decimation_shifts<SdrBits, InputBits>::pre2;
yimag[1] = buf[pos+7] << decimation_shifts<SdrBits, InputBits>::pre2;
m_decimator2.myDecimateSup(
buf[pos+0] << decimation_shifts<SdrBits, InputBits>::pre2,
buf[pos+1] << decimation_shifts<SdrBits, InputBits>::pre2,
&xreal[0],
&yimag[0],
buf[pos+2] << decimation_shifts<SdrBits, InputBits>::pre2,
buf[pos+3] << decimation_shifts<SdrBits, InputBits>::pre2,
buf[pos+4] << decimation_shifts<SdrBits, InputBits>::pre2,
buf[pos+5] << decimation_shifts<SdrBits, InputBits>::pre2,
&xreal[1],
&yimag[1]);
buf[pos+6] << decimation_shifts<SdrBits, InputBits>::pre2,
buf[pos+7] << decimation_shifts<SdrBits, InputBits>::pre2,
&buf2[0]);
(**it).setReal(xreal[0] >> decimation_shifts<SdrBits, InputBits>::post2);
(**it).setImag(yimag[0] >> decimation_shifts<SdrBits, InputBits>::post2);
(**it).setReal(buf2[0] >> decimation_shifts<SdrBits, InputBits>::post2);
(**it).setImag(buf2[1] >> decimation_shifts<SdrBits, InputBits>::post2);
++(*it);
(**it).setReal(xreal[1] >> decimation_shifts<SdrBits, InputBits>::post2);
(**it).setImag(yimag[1] >> decimation_shifts<SdrBits, InputBits>::post2);
(**it).setReal(buf2[2] >> decimation_shifts<SdrBits, InputBits>::post2);
(**it).setImag(buf2[3] >> decimation_shifts<SdrBits, InputBits>::post2);
++(*it);
}
}
@ -549,114 +541,99 @@ void Decimators<StorageType, T, SdrBits, InputBits>::decimate2_sup(SampleVector:
template<typename StorageType, typename T, uint SdrBits, uint InputBits>
void Decimators<StorageType, T, SdrBits, InputBits>::decimate4_inf(SampleVector::iterator* it, const T* buf, qint32 len)
{
StorageType xreal[4], yimag[4];
StorageType buf2[8], buf4[4];
for (int pos = 0; pos < len - 15; pos += 16)
{
xreal[0] = buf[pos+2] << decimation_shifts<SdrBits, InputBits>::pre4;
yimag[0] = buf[pos+3] << decimation_shifts<SdrBits, InputBits>::pre4;
xreal[1] = buf[pos+6] << decimation_shifts<SdrBits, InputBits>::pre4;
yimag[1] = buf[pos+7] << decimation_shifts<SdrBits, InputBits>::pre4;
m_decimator2.myDecimateInf(
buf[pos+0] << decimation_shifts<SdrBits, InputBits>::pre4,
buf[pos+1] << decimation_shifts<SdrBits, InputBits>::pre4,
&xreal[0],
&yimag[0],
buf[pos+2] << decimation_shifts<SdrBits, InputBits>::pre4,
buf[pos+3] << decimation_shifts<SdrBits, InputBits>::pre4,
buf[pos+4] << decimation_shifts<SdrBits, InputBits>::pre4,
buf[pos+5] << decimation_shifts<SdrBits, InputBits>::pre4,
&xreal[1],
&yimag[1]);
xreal[2] = buf[pos+10] << decimation_shifts<SdrBits, InputBits>::pre4;
yimag[2] = buf[pos+11] << decimation_shifts<SdrBits, InputBits>::pre4;
xreal[3] = buf[pos+14] << decimation_shifts<SdrBits, InputBits>::pre4;
yimag[3] = buf[pos+15] << decimation_shifts<SdrBits, InputBits>::pre4;
buf[pos+6] << decimation_shifts<SdrBits, InputBits>::pre4,
buf[pos+7] << decimation_shifts<SdrBits, InputBits>::pre4,
&buf2[0]);
m_decimator2.myDecimateInf(
buf[pos+8] << decimation_shifts<SdrBits, InputBits>::pre4,
buf[pos+9] << decimation_shifts<SdrBits, InputBits>::pre4,
&xreal[2],
&yimag[2],
buf[pos+10] << decimation_shifts<SdrBits, InputBits>::pre4,
buf[pos+11] << decimation_shifts<SdrBits, InputBits>::pre4,
buf[pos+12] << decimation_shifts<SdrBits, InputBits>::pre4,
buf[pos+13] << decimation_shifts<SdrBits, InputBits>::pre4,
&xreal[3],
&yimag[3]);
buf[pos+14] << decimation_shifts<SdrBits, InputBits>::pre4,
buf[pos+15] << decimation_shifts<SdrBits, InputBits>::pre4,
&buf2[4]);
m_decimator4.myDecimateCen(
xreal[0],
yimag[0],
&xreal[1],
&yimag[1],
xreal[2],
yimag[2],
&xreal[3],
&yimag[3]);
m_decimator4.myDecimateSup(
buf2[0],
buf2[1],
buf2[2],
buf2[3],
buf2[4],
buf2[5],
buf2[6],
buf2[7],
&buf4[0]);
(**it).setReal(xreal[1] >> decimation_shifts<SdrBits, InputBits>::post4);
(**it).setImag(yimag[1] >> decimation_shifts<SdrBits, InputBits>::post4);
(**it).setReal(buf4[0] >> decimation_shifts<SdrBits, InputBits>::post4);
(**it).setImag(buf4[1] >> decimation_shifts<SdrBits, InputBits>::post4);
++(*it);
(**it).setReal(xreal[3] >> decimation_shifts<SdrBits, InputBits>::post4);
(**it).setImag(yimag[3] >> decimation_shifts<SdrBits, InputBits>::post4);
(**it).setReal(buf4[2] >> decimation_shifts<SdrBits, InputBits>::post4);
(**it).setImag(buf4[3] >> decimation_shifts<SdrBits, InputBits>::post4);
++(*it);
}
}
template<typename StorageType, typename T, uint SdrBits, uint InputBits>
void Decimators<StorageType, T, SdrBits, InputBits>::decimate4_sup(SampleVector::iterator* it, const T* buf, qint32 len)
{
StorageType xreal[4], yimag[4];
StorageType buf2[8], buf4[4];
for (int pos = 0; pos < len - 15; pos += 16)
{
xreal[0] = buf[pos+2] << decimation_shifts<SdrBits, InputBits>::pre4;
yimag[0] = buf[pos+3] << decimation_shifts<SdrBits, InputBits>::pre4;
xreal[1] = buf[pos+6] << decimation_shifts<SdrBits, InputBits>::pre4;
yimag[1] = buf[pos+7] << decimation_shifts<SdrBits, InputBits>::pre4;
m_decimator2.myDecimateSup(
buf[pos+0] << decimation_shifts<SdrBits, InputBits>::pre4,
buf[pos+1] << decimation_shifts<SdrBits, InputBits>::pre4,
&xreal[0],
&yimag[0],
buf[pos+2] << decimation_shifts<SdrBits, InputBits>::pre4,
buf[pos+3] << decimation_shifts<SdrBits, InputBits>::pre4,
buf[pos+4] << decimation_shifts<SdrBits, InputBits>::pre4,
buf[pos+5] << decimation_shifts<SdrBits, InputBits>::pre4,
&xreal[1],
&yimag[1]);
xreal[2] = buf[pos+10] << decimation_shifts<SdrBits, InputBits>::pre4;
yimag[2] = buf[pos+11] << decimation_shifts<SdrBits, InputBits>::pre4;
xreal[3] = buf[pos+14] << decimation_shifts<SdrBits, InputBits>::pre4;
yimag[3] = buf[pos+15] << decimation_shifts<SdrBits, InputBits>::pre4;
buf[pos+6] << decimation_shifts<SdrBits, InputBits>::pre4,
buf[pos+7] << decimation_shifts<SdrBits, InputBits>::pre4,
&buf2[0]);
m_decimator2.myDecimateSup(
buf[pos+8] << decimation_shifts<SdrBits, InputBits>::pre4,
buf[pos+9] << decimation_shifts<SdrBits, InputBits>::pre4,
&xreal[2],
&yimag[2],
buf[pos+10] << decimation_shifts<SdrBits, InputBits>::pre4,
buf[pos+11] << decimation_shifts<SdrBits, InputBits>::pre4,
buf[pos+12] << decimation_shifts<SdrBits, InputBits>::pre4,
buf[pos+13] << decimation_shifts<SdrBits, InputBits>::pre4,
&xreal[3],
&yimag[3]);
buf[pos+14] << decimation_shifts<SdrBits, InputBits>::pre4,
buf[pos+15] << decimation_shifts<SdrBits, InputBits>::pre4,
&buf2[4]);
m_decimator4.myDecimateCen(
xreal[0],
yimag[0],
&xreal[1],
&yimag[1],
xreal[2],
yimag[2],
&xreal[3],
&yimag[3]);
m_decimator4.myDecimateInf(
buf2[0],
buf2[1],
buf2[2],
buf2[3],
buf2[4],
buf2[5],
buf2[6],
buf2[7],
&buf4[0]);
(**it).setReal(xreal[1] >> decimation_shifts<SdrBits, InputBits>::post4);
(**it).setImag(yimag[1] >> decimation_shifts<SdrBits, InputBits>::post4);
(**it).setReal(buf4[0] >> decimation_shifts<SdrBits, InputBits>::post4);
(**it).setImag(buf4[1] >> decimation_shifts<SdrBits, InputBits>::post4);
++(*it);
(**it).setReal(xreal[3] >> decimation_shifts<SdrBits, InputBits>::post4);
(**it).setImag(yimag[3] >> decimation_shifts<SdrBits, InputBits>::post4);
(**it).setReal(buf4[2] >> decimation_shifts<SdrBits, InputBits>::post4);
(**it).setImag(buf4[3] >> decimation_shifts<SdrBits, InputBits>::post4);
++(*it);
}
}
@ -752,11 +729,11 @@ void Decimators<StorageType, T, SdrBits, InputBits>::decimate8_inf(SampleVector:
buf[pos+31] << decimation_shifts<SdrBits, InputBits>::pre8,
&buf2[12]);
m_decimator4.myDecimateCen(
m_decimator4.myDecimateSup(
&buf2[0],
&buf4[0]);
m_decimator4.myDecimateCen(
m_decimator4.myDecimateSup(
&buf2[8],
&buf4[4]);
@ -825,11 +802,11 @@ void Decimators<StorageType, T, SdrBits, InputBits>::decimate8_sup(SampleVector:
buf[pos+31] << decimation_shifts<SdrBits, InputBits>::pre8,
&buf2[12]);
m_decimator4.myDecimateCen(
m_decimator4.myDecimateInf(
&buf2[0],
&buf4[0]);
m_decimator4.myDecimateCen(
m_decimator4.myDecimateInf(
&buf2[8],
&buf4[4]);
@ -942,27 +919,27 @@ void Decimators<StorageType, T, SdrBits, InputBits>::decimate16_inf(SampleVector
buf[pos+63] << decimation_shifts<SdrBits, InputBits>::pre16,
&buf2[28]);
m_decimator4.myDecimateCen(
m_decimator4.myDecimateSup(
&buf2[0],
&buf4[0]);
m_decimator4.myDecimateCen(
m_decimator4.myDecimateSup(
&buf2[8],
&buf4[4]);
m_decimator4.myDecimateCen(
m_decimator4.myDecimateSup(
&buf2[16],
&buf4[8]);
m_decimator4.myDecimateCen(
m_decimator4.myDecimateSup(
&buf2[24],
&buf4[12]);
m_decimator8.myDecimateCen(
m_decimator8.myDecimateSup(
&buf4[0],
&buf8[0]);
m_decimator8.myDecimateCen(
m_decimator8.myDecimateSup(
&buf4[8],
&buf8[4]);
@ -1075,27 +1052,27 @@ void Decimators<StorageType, T, SdrBits, InputBits>::decimate16_sup(SampleVector
buf[pos+63] << decimation_shifts<SdrBits, InputBits>::pre16,
&buf2[28]);
m_decimator4.myDecimateCen(
m_decimator4.myDecimateInf(
&buf2[0],
&buf4[0]);
m_decimator4.myDecimateCen(
m_decimator4.myDecimateInf(
&buf2[8],
&buf4[4]);
m_decimator4.myDecimateCen(
m_decimator4.myDecimateInf(
&buf2[16],
&buf4[8]);
m_decimator4.myDecimateCen(
m_decimator4.myDecimateInf(
&buf2[24],
&buf4[12]);
m_decimator8.myDecimateCen(
m_decimator8.myDecimateInf(
&buf4[0],
&buf8[0]);
m_decimator8.myDecimateCen(
m_decimator8.myDecimateInf(
&buf4[8],
&buf8[4]);
@ -1296,59 +1273,59 @@ void Decimators<StorageType, T, SdrBits, InputBits>::decimate32_inf(SampleVector
buf[pos+127] << decimation_shifts<SdrBits, InputBits>::pre32,
&buf2[60]);
m_decimator4.myDecimateCen(
m_decimator4.myDecimateSup(
&buf2[0],
&buf4[0]);
m_decimator4.myDecimateCen(
m_decimator4.myDecimateSup(
&buf2[8],
&buf4[4]);
m_decimator4.myDecimateCen(
m_decimator4.myDecimateSup(
&buf2[16],
&buf4[8]);
m_decimator4.myDecimateCen(
m_decimator4.myDecimateSup(
&buf2[24],
&buf4[12]);
m_decimator4.myDecimateCen(
m_decimator4.myDecimateSup(
&buf2[32],
&buf4[16]);
m_decimator4.myDecimateCen(
m_decimator4.myDecimateSup(
&buf2[40],
&buf4[20]);
m_decimator4.myDecimateCen(
m_decimator4.myDecimateSup(
&buf2[48],
&buf4[24]);
m_decimator4.myDecimateCen(
m_decimator4.myDecimateSup(
&buf2[56],
&buf4[28]);
m_decimator8.myDecimateCen(
m_decimator8.myDecimateSup(
&buf4[0],
&buf8[0]);
m_decimator8.myDecimateCen(
m_decimator8.myDecimateSup(
&buf4[8],
&buf8[4]);
m_decimator8.myDecimateCen(
m_decimator8.myDecimateSup(
&buf4[16],
&buf8[8]);
m_decimator8.myDecimateCen(
m_decimator8.myDecimateSup(
&buf4[24],
&buf8[12]);
m_decimator16.myDecimateCen(
m_decimator16.myDecimateSup(
&buf8[0],
&buf16[0]);
m_decimator16.myDecimateCen(
m_decimator16.myDecimateSup(
&buf8[8],
&buf16[4]);
@ -1549,59 +1526,59 @@ void Decimators<StorageType, T, SdrBits, InputBits>::decimate32_sup(SampleVector
buf[pos+127] << decimation_shifts<SdrBits, InputBits>::pre32,
&buf2[60]);
m_decimator4.myDecimateCen(
m_decimator4.myDecimateInf(
&buf2[0],
&buf4[0]);
m_decimator4.myDecimateCen(
m_decimator4.myDecimateInf(
&buf2[8],
&buf4[4]);
m_decimator4.myDecimateCen(
m_decimator4.myDecimateInf(
&buf2[16],
&buf4[8]);
m_decimator4.myDecimateCen(
m_decimator4.myDecimateInf(
&buf2[24],
&buf4[12]);
m_decimator4.myDecimateCen(
m_decimator4.myDecimateInf(
&buf2[32],
&buf4[16]);
m_decimator4.myDecimateCen(
m_decimator4.myDecimateInf(
&buf2[40],
&buf4[20]);
m_decimator4.myDecimateCen(
m_decimator4.myDecimateInf(
&buf2[48],
&buf4[24]);
m_decimator4.myDecimateCen(
m_decimator4.myDecimateInf(
&buf2[56],
&buf4[28]);
m_decimator8.myDecimateCen(
m_decimator8.myDecimateInf(
&buf4[0],
&buf8[0]);
m_decimator8.myDecimateCen(
m_decimator8.myDecimateInf(
&buf4[8],
&buf8[4]);
m_decimator8.myDecimateCen(
m_decimator8.myDecimateInf(
&buf4[16],
&buf8[8]);
m_decimator8.myDecimateCen(
m_decimator8.myDecimateInf(
&buf4[24],
&buf8[12]);
m_decimator16.myDecimateCen(
m_decimator16.myDecimateInf(
&buf8[0],
&buf16[0]);
m_decimator16.myDecimateCen(
m_decimator16.myDecimateInf(
&buf8[8],
&buf16[4]);
@ -1978,123 +1955,123 @@ void Decimators<StorageType, T, SdrBits, InputBits>::decimate64_inf(SampleVector
buf[pos+255] << decimation_shifts<SdrBits, InputBits>::pre64,
&buf2[124]);
m_decimator4.myDecimateCen(
m_decimator4.myDecimateSup(
&buf2[0],
&buf4[0]);
m_decimator4.myDecimateCen(
m_decimator4.myDecimateSup(
&buf2[8],
&buf4[4]);
m_decimator4.myDecimateCen(
m_decimator4.myDecimateSup(
&buf2[16],
&buf4[8]);
m_decimator4.myDecimateCen(
m_decimator4.myDecimateSup(
&buf2[24],
&buf4[12]);
m_decimator4.myDecimateCen(
m_decimator4.myDecimateSup(
&buf2[32],
&buf4[16]);
m_decimator4.myDecimateCen(
m_decimator4.myDecimateSup(
&buf2[40],
&buf4[20]);
m_decimator4.myDecimateCen(
m_decimator4.myDecimateSup(
&buf2[48],
&buf4[24]);
m_decimator4.myDecimateCen(
m_decimator4.myDecimateSup(
&buf2[56],
&buf4[28]);
m_decimator4.myDecimateCen(
m_decimator4.myDecimateSup(
&buf2[64],
&buf4[32]);
m_decimator4.myDecimateCen(
m_decimator4.myDecimateSup(
&buf2[72],
&buf4[36]);
m_decimator4.myDecimateCen(
m_decimator4.myDecimateSup(
&buf2[80],
&buf4[40]);
m_decimator4.myDecimateCen(
m_decimator4.myDecimateSup(
&buf2[88],
&buf4[44]);
m_decimator4.myDecimateCen(
m_decimator4.myDecimateSup(
&buf2[96],
&buf4[48]);
m_decimator4.myDecimateCen(
m_decimator4.myDecimateSup(
&buf2[104],
&buf4[52]);
m_decimator4.myDecimateCen(
m_decimator4.myDecimateSup(
&buf2[112],
&buf4[56]);
m_decimator4.myDecimateCen(
m_decimator4.myDecimateSup(
&buf2[120],
&buf4[60]);
m_decimator8.myDecimateCen(
m_decimator8.myDecimateSup(
&buf4[0],
&buf8[0]);
m_decimator8.myDecimateCen(
m_decimator8.myDecimateSup(
&buf4[8],
&buf8[4]);
m_decimator8.myDecimateCen(
m_decimator8.myDecimateSup(
&buf4[16],
&buf8[8]);
m_decimator8.myDecimateCen(
m_decimator8.myDecimateSup(
&buf4[24],
&buf8[12]);
m_decimator8.myDecimateCen(
m_decimator8.myDecimateSup(
&buf4[32],
&buf8[16]);
m_decimator8.myDecimateCen(
m_decimator8.myDecimateSup(
&buf4[40],
&buf8[20]);
m_decimator8.myDecimateCen(
m_decimator8.myDecimateSup(
&buf4[48],
&buf8[24]);
m_decimator8.myDecimateCen(
m_decimator8.myDecimateSup(
&buf4[56],
&buf8[28]);
m_decimator16.myDecimateCen(
m_decimator16.myDecimateSup(
&buf8[0],
&buf16[0]);
m_decimator16.myDecimateCen(
m_decimator16.myDecimateSup(
&buf8[8],
&buf16[4]);
m_decimator16.myDecimateCen(
m_decimator16.myDecimateSup(
&buf8[16],
&buf16[8]);
m_decimator16.myDecimateCen(
m_decimator16.myDecimateSup(
&buf8[24],
&buf16[12]);
m_decimator32.myDecimateCen(
m_decimator32.myDecimateSup(
&buf16[0],
&buf32[0]);
m_decimator32.myDecimateCen(
m_decimator32.myDecimateSup(
&buf16[8],
&buf32[4]);
@ -2471,123 +2448,123 @@ void Decimators<StorageType, T, SdrBits, InputBits>::decimate64_sup(SampleVector
buf[pos+255] << decimation_shifts<SdrBits, InputBits>::pre64,
&buf2[124]);
m_decimator4.myDecimateCen(
m_decimator4.myDecimateInf(
&buf2[0],
&buf4[0]);
m_decimator4.myDecimateCen(
m_decimator4.myDecimateInf(
&buf2[8],
&buf4[4]);
m_decimator4.myDecimateCen(
m_decimator4.myDecimateInf(
&buf2[16],
&buf4[8]);
m_decimator4.myDecimateCen(
m_decimator4.myDecimateInf(
&buf2[24],
&buf4[12]);
m_decimator4.myDecimateCen(
m_decimator4.myDecimateInf(
&buf2[32],
&buf4[16]);
m_decimator4.myDecimateCen(
m_decimator4.myDecimateInf(
&buf2[40],
&buf4[20]);
m_decimator4.myDecimateCen(
m_decimator4.myDecimateInf(
&buf2[48],
&buf4[24]);
m_decimator4.myDecimateCen(
m_decimator4.myDecimateInf(
&buf2[56],
&buf4[28]);
m_decimator4.myDecimateCen(
m_decimator4.myDecimateInf(
&buf2[64],
&buf4[32]);
m_decimator4.myDecimateCen(
m_decimator4.myDecimateInf(
&buf2[72],
&buf4[36]);
m_decimator4.myDecimateCen(
m_decimator4.myDecimateInf(
&buf2[80],
&buf4[40]);
m_decimator4.myDecimateCen(
m_decimator4.myDecimateInf(
&buf2[88],
&buf4[44]);
m_decimator4.myDecimateCen(
m_decimator4.myDecimateInf(
&buf2[96],
&buf4[48]);
m_decimator4.myDecimateCen(
m_decimator4.myDecimateInf(
&buf2[104],
&buf4[52]);
m_decimator4.myDecimateCen(
m_decimator4.myDecimateInf(
&buf2[112],
&buf4[56]);
m_decimator4.myDecimateCen(
m_decimator4.myDecimateInf(
&buf2[120],
&buf4[60]);
m_decimator8.myDecimateCen(
m_decimator8.myDecimateInf(
&buf4[0],
&buf8[0]);
m_decimator8.myDecimateCen(
m_decimator8.myDecimateInf(
&buf4[8],
&buf8[4]);
m_decimator8.myDecimateCen(
m_decimator8.myDecimateInf(
&buf4[16],
&buf8[8]);
m_decimator8.myDecimateCen(
m_decimator8.myDecimateInf(
&buf4[24],
&buf8[12]);
m_decimator8.myDecimateCen(
m_decimator8.myDecimateInf(
&buf4[32],
&buf8[16]);
m_decimator8.myDecimateCen(
m_decimator8.myDecimateInf(
&buf4[40],
&buf8[20]);
m_decimator8.myDecimateCen(
m_decimator8.myDecimateInf(
&buf4[48],
&buf8[24]);
m_decimator8.myDecimateCen(
m_decimator8.myDecimateInf(
&buf4[56],
&buf8[28]);
m_decimator16.myDecimateCen(
m_decimator16.myDecimateInf(
&buf8[0],
&buf16[0]);
m_decimator16.myDecimateCen(
m_decimator16.myDecimateInf(
&buf8[8],
&buf16[4]);
m_decimator16.myDecimateCen(
m_decimator16.myDecimateInf(
&buf8[16],
&buf16[8]);
m_decimator16.myDecimateCen(
m_decimator16.myDecimateInf(
&buf8[24],
&buf16[12]);
m_decimator32.myDecimateCen(
m_decimator32.myDecimateInf(
&buf16[0],
&buf32[0]);
m_decimator32.myDecimateCen(
m_decimator32.myDecimateInf(
&buf16[8],
&buf32[4]);

View File

@ -54,23 +54,8 @@ qint64 DeviceSampleSource::calculateDeviceCenterFrequency(
deviceCenterFrequency = deviceCenterFrequency < 0 ? 0 : deviceCenterFrequency;
qint64 f_img = deviceCenterFrequency;
if ((log2Decim == 0) || (fcPos == FC_POS_CENTER))
{
f_img = deviceCenterFrequency;
}
else
{
if (fcPos == FC_POS_INFRA)
{
deviceCenterFrequency += (devSampleRate / 4);
f_img = deviceCenterFrequency + devSampleRate/2;
}
else if (fcPos == FC_POS_SUPRA)
{
deviceCenterFrequency -= (devSampleRate / 4);
f_img = deviceCenterFrequency - devSampleRate/2;
}
}
deviceCenterFrequency -= calculateFrequencyShift(log2Decim, fcPos, devSampleRate);
f_img -= 2*calculateFrequencyShift(log2Decim, fcPos, devSampleRate);
qDebug() << "DeviceSampleSource::calculateDeviceCenterFrequency:"
<< " desired center freq: " << centerFrequency << " Hz"
@ -82,3 +67,44 @@ qint64 DeviceSampleSource::calculateDeviceCenterFrequency(
return deviceCenterFrequency;
}
/**
* log2Decim = 0: no shift
*
* n = log2Decim <= 2: fc = +/- 1/2^(n-1)
* center
* | ^ |
* | inf | sup |
* ^ ^
*
* n = log2Decim > 2: fc = +/- 1/2^n
* center
* | ^ |
* | |inf| | |sup| |
* ^ ^
*/
qint32 DeviceSampleSource::calculateFrequencyShift(
int log2Decim,
fcPos_t fcPos,
quint32 devSampleRate)
{
if (log2Decim == 0) { // no shift at all
return 0;
} else if (log2Decim < 3) {
if (fcPos == FC_POS_INFRA) { // shift in the square next to center frequency
return -(devSampleRate / (1<<(log2Decim+1)));
} else if (fcPos == FC_POS_SUPRA) {
return devSampleRate / (1<<(log2Decim+1));
} else {
return 0;
}
} else {
if (fcPos == FC_POS_INFRA) { // shift centered in the square next to center frequency
return -(devSampleRate / (1<<(log2Decim)));
} else if (fcPos == FC_POS_SUPRA) {
return devSampleRate / (1<<(log2Decim));
} else {
return 0;
}
}
}

View File

@ -94,6 +94,11 @@ public:
quint32 devSampleRate,
bool transverterMode = false);
static qint32 calculateFrequencyShift(
int log2Decim,
fcPos_t fcPos,
quint32 devSampleRate);
protected slots:
void handleInputMessages();

View File

@ -623,23 +623,6 @@ public:
advancePointer();
}
void myDecimateInf(int32_t x1, int32_t y1, int32_t *x2, int32_t *y2, int32_t x3, int32_t y3, int32_t *x4, int32_t *y4)
{
storeSample32(-y1, x1);
advancePointer();
storeSample32(-*x2, -*y2);
doFIR(x2, y2);
advancePointer();
storeSample32(y3, -x3);
advancePointer();
storeSample32(*x4, *y4);
doFIR(x4, y4);
advancePointer();
}
void myDecimateInf(int32_t x1, int32_t y1, int32_t x2, int32_t y2, int32_t x3, int32_t y3, int32_t x4, int32_t y4, int32_t *out)
{
storeSample32(-y1, x1);
@ -657,20 +640,20 @@ public:
advancePointer();
}
void myDecimateSup(int32_t x1, int32_t y1, int32_t *x2, int32_t *y2, int32_t x3, int32_t y3, int32_t *x4, int32_t *y4)
void myDecimateInf(int32_t *in, int32_t *out)
{
storeSample32(y1, -x1);
storeSample32(-in[1], in[0]);
advancePointer();
storeSample32(-*x2, -*y2);
doFIR(x2, y2);
storeSample32(-in[2], -in[3]);
doFIR(&out[0], &out[1]);
advancePointer();
storeSample32(-y3, x3);
storeSample32(in[5], -in[4]);
advancePointer();
storeSample32(*x4, *y4);
doFIR(x4, y4);
storeSample32(in[6], in[7]);
doFIR(&out[2], &out[3]);
advancePointer();
}
@ -691,6 +674,23 @@ public:
advancePointer();
}
void myDecimateSup(int32_t *in, int32_t *out)
{
storeSample32(in[1], -in[0]);
advancePointer();
storeSample32(-in[2], -in[3]);
doFIR(&out[0], &out[1]);
advancePointer();
storeSample32(-in[5], in[4]);
advancePointer();
storeSample32(in[6], in[7]);
doFIR(&out[2], &out[3]);
advancePointer();
}
/** Simple zero stuffing and filter */
void myInterpolateZeroStuffing(Sample* sample1, Sample* sample2)
{