mirror of
https://github.com/f4exb/sdrangel.git
synced 2024-11-16 13:21:50 -05:00
DATV demod: apply commit dd2d9b97025a34a1b168439d60528826b6c9ebf6 Fix RRC amplitude.
This commit is contained in:
parent
9cff60f143
commit
8f46029457
@ -88,7 +88,7 @@ int lowpass(int order, float Fcut, T **coeffs, float gain = 1)
|
||||
// https://en.wikipedia.org/wiki/Root-raised-cosine_filter
|
||||
|
||||
template <typename T>
|
||||
int root_raised_cosine(int order, float Fs, float rolloff, T **coeffs)
|
||||
int root_raised_cosine(int order, float Fs, float rolloff, T **coeffs, float gain=1)
|
||||
{
|
||||
float B = rolloff, pi = M_PI;
|
||||
int ncoeffs = (order + 1) | 1;
|
||||
@ -98,19 +98,18 @@ int root_raised_cosine(int order, float Fs, float rolloff, T **coeffs)
|
||||
int t = i - ncoeffs / 2;
|
||||
float c;
|
||||
if (t == 0)
|
||||
c = sqrt(Fs) * (1 - B + 4 * B / pi);
|
||||
c = (1 - B + 4*B/pi);
|
||||
else
|
||||
{
|
||||
float tT = t * Fs;
|
||||
float den = pi * tT * (1 - (4 * B * tT) * (4 * B * tT));
|
||||
if (!den)
|
||||
c = B * sqrt(Fs / 2) * ((1 + 2 / pi) * sin(pi / (4 * B)) + (1 - 2 / pi) * cos(pi / (4 * B)));
|
||||
c = B/sqrtf(2) * ( (1+2/pi)*sinf(pi/(4*B)) + (1-2/pi)*cosf(pi/(4*B)) );
|
||||
else
|
||||
c = sqrt(Fs) * (sin(pi * tT * (1 - B)) + 4 * B * tT * cos(pi * tT * (1 + B))) / den;
|
||||
c = ( sinf(pi*tT*(1-B)) + 4*B*tT*cosf(pi*tT*(1+B)) ) / den;
|
||||
}
|
||||
(*coeffs)[i] = c;
|
||||
(*coeffs)[i] = Fs * c * gain;
|
||||
}
|
||||
normalize_dcgain(ncoeffs, *coeffs);
|
||||
return ncoeffs;
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user