mirror of
https://github.com/f4exb/sdrangel.git
synced 2025-04-06 11:39:02 -04:00
Added Blackman-Harris 7 term FFT window
This commit is contained in:
parent
fd69174a51
commit
0a83f50821
@ -336,6 +336,11 @@
|
||||
<string>Black</string>
|
||||
</property>
|
||||
</item>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string>B-H7</string>
|
||||
</property>
|
||||
</item>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
|
@ -415,6 +415,11 @@
|
||||
<string>Black</string>
|
||||
</property>
|
||||
</item>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string>B-H7</string>
|
||||
</property>
|
||||
</item>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
|
@ -188,7 +188,8 @@ bool SSBDemodSettings::deserialize(const QByteArray& data)
|
||||
d.readS32(102+ 10*i, &tmp, 3);
|
||||
m_filterBank[i].m_lowCutoff = tmp * 100.0;
|
||||
d.readS32(103 + 10*i, &tmp, (int) FFTWindow::Blackman);
|
||||
m_filterBank[i].m_fftWindow = (FFTWindow::Function) (tmp < 0 ? 0 : tmp > (int) FFTWindow::Blackman ? (int) FFTWindow::Blackman : tmp);
|
||||
m_filterBank[i].m_fftWindow =
|
||||
(FFTWindow::Function) (tmp < 0 ? 0 : tmp > (int) FFTWindow::BlackmanHarris7 ? (int) FFTWindow::BlackmanHarris7 : tmp);
|
||||
}
|
||||
|
||||
return true;
|
||||
|
@ -76,6 +76,10 @@ void FFTWindow::create(Function function, int n)
|
||||
wFunc = blackman;
|
||||
break;
|
||||
|
||||
case BlackmanHarris7:
|
||||
wFunc = blackmanHarris7;
|
||||
break;
|
||||
|
||||
case Rectangle:
|
||||
default:
|
||||
wFunc = rectangle;
|
||||
|
@ -34,7 +34,8 @@ public:
|
||||
Hanning,
|
||||
Rectangle,
|
||||
Kaiser,
|
||||
Blackman
|
||||
Blackman,
|
||||
BlackmanHarris7
|
||||
};
|
||||
|
||||
FFTWindow();
|
||||
@ -65,15 +66,31 @@ private:
|
||||
return (2.0 / (n - 1.0)) * ( (n - 1.0) / 2.0 - fabs(i - (n - 1.0) / 2.0)) * 2.0;
|
||||
}
|
||||
|
||||
static inline Real blackmanHarris(Real n, Real i)
|
||||
static inline Real blackmanHarris(Real n, Real i) // 4 term Blackman-Harris
|
||||
{
|
||||
// amplitude correction = 2.79
|
||||
return (0.35875 - 0.48829 * cos((2.0 * M_PI * i) / n) + 0.14128 * cos((4.0 * M_PI * i) / n) - 0.01168 * cos((6.0 * M_PI * i) / n)) * 2.79;
|
||||
return (0.35875
|
||||
- 0.48829 * cos((2.0 * M_PI * i) / n)
|
||||
+ 0.14128 * cos((4.0 * M_PI * i) / n)
|
||||
- 0.01168 * cos((6.0 * M_PI * i) / n)) * 2.79;
|
||||
}
|
||||
|
||||
static inline Real blackman(Real n, Real i)
|
||||
static inline Real blackmanHarris7(Real n, Real i) // 7 term Blackman-Harris
|
||||
{
|
||||
return (0.27105
|
||||
- 0.43330 * cos((2.0 * M_PI * i) / n)
|
||||
+ 0.21812 * cos((4.0 * M_PI * i) / n)
|
||||
- 0.065925 * cos((6.0 * M_PI * i) / n)
|
||||
+ 0.010812 * cos((8.0 * M_PI * i) / n)
|
||||
- 0.00077658 * cos((10.0 * M_PI * i) / n)
|
||||
+ 0.000013887 * cos((12.0 * M_PI * i) / n)) * 3.72;
|
||||
}
|
||||
|
||||
static inline Real blackman(Real n, Real i) // 3 term Blackman
|
||||
{
|
||||
return (0.42438 - 0.49734 * cos(2.0 * M_PI * i / n) + 0.078279 * cos(4.0 * M_PI * i / n)) * 2.37;
|
||||
return (0.42438
|
||||
- 0.49734 * cos(2.0 * M_PI * i / n)
|
||||
+ 0.078279 * cos(4.0 * M_PI * i / n)) * 2.37;
|
||||
}
|
||||
|
||||
static inline Real hamming(Real n, Real i)
|
||||
|
@ -106,6 +106,11 @@
|
||||
<string>Black</string>
|
||||
</property>
|
||||
</item>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string>B-H7</string>
|
||||
</property>
|
||||
</item>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
|
Loading…
Reference in New Issue
Block a user