kopia lustrzana https://github.com/projecthorus/radiosonde_auto_rx
Rebase demodulators
rodzic
af7e631be1
commit
edba9bc2fd
|
@ -12,7 +12,7 @@ from queue import Queue
|
|||
# MINOR - New sonde type support, other fairly big changes that may result in telemetry or config file incompatability issus.
|
||||
# PATCH - Small changes, or minor feature additions.
|
||||
|
||||
__version__ = "1.6.0-beta12"
|
||||
__version__ = "1.6.0-beta13"
|
||||
|
||||
|
||||
# Global Variables
|
||||
|
|
|
@ -618,17 +618,17 @@ static int lowpass_update(float f, int taps, float *ws) {
|
|||
}
|
||||
|
||||
static float complex lowpass0(float complex buffer[], ui32_t sample, ui32_t taps, float *ws) {
|
||||
ui32_t n;
|
||||
ui32_t n; // sample: oldest_sample
|
||||
double complex w = 0;
|
||||
for (n = 0; n < taps; n++) {
|
||||
w += buffer[(sample+n+1)%taps]*ws[taps-1-n];
|
||||
w += buffer[(sample+n)%taps]*ws[taps-1-n];
|
||||
}
|
||||
return (float complex)w;
|
||||
}
|
||||
static float complex lowpass1a(float complex buffer[], ui32_t sample, ui32_t taps, float *ws) {
|
||||
double complex w = 0;
|
||||
ui32_t n;
|
||||
ui32_t S = taps + (sample % taps);
|
||||
ui32_t S = taps-1 + (sample % taps);
|
||||
for (n = 0; n < taps; n++) {
|
||||
w += buffer[n]*ws[S-n]; // ws[taps+s-n] = ws[(taps+sample-n)%taps]
|
||||
}
|
||||
|
@ -639,7 +639,7 @@ static float complex lowpass1a(float complex buffer[], ui32_t sample, ui32_t tap
|
|||
static float complex lowpass(float complex buffer[], ui32_t sample, ui32_t taps, float *ws) {
|
||||
float complex w = 0;
|
||||
int n; // -Ofast
|
||||
int S = taps-1 - (sample % taps);
|
||||
int S = taps - (sample % taps);
|
||||
for (n = 0; n < taps; n++) {
|
||||
w += buffer[n]*ws[S+n]; // ws[taps+s-n] = ws[(taps+sample-n)%taps]
|
||||
}
|
||||
|
@ -650,9 +650,9 @@ static float complex lowpass2(float complex buffer[], ui32_t sample, ui32_t taps
|
|||
float complex w = 0;
|
||||
int n; // -Ofast
|
||||
int s = sample % taps;
|
||||
int S1 = s+1;
|
||||
int S1 = s;
|
||||
int S1N = S1-taps;
|
||||
int n0 = taps-1-s;
|
||||
int n0 = taps-s;
|
||||
for (n = 0; n < n0; n++) {
|
||||
w += buffer[S1+n]*ws[n];
|
||||
}
|
||||
|
@ -664,16 +664,16 @@ static float complex lowpass2(float complex buffer[], ui32_t sample, ui32_t taps
|
|||
}
|
||||
static float complex lowpass0_sym(float complex buffer[], ui32_t sample, ui32_t taps, float *ws) {
|
||||
ui32_t n;
|
||||
double complex w = buffer[(sample+(taps+1)/2) % taps]*ws[(taps-1)/2]; // (N+1)/2 = (N-1)/2 + 1
|
||||
double complex w = buffer[(sample+(taps-1)/2) % taps]*ws[(taps-1)/2]; // (N+1)/2 = (N-1)/2 + 1
|
||||
for (n = 0; n < (taps-1)/2; n++) {
|
||||
w += (buffer[(sample+n+1)%taps]+buffer[(sample+taps-n)%taps])*ws[n];
|
||||
w += (buffer[(sample+n)%taps]+buffer[(sample+taps-n-1)%taps])*ws[n];
|
||||
}
|
||||
return (float complex)w;
|
||||
}
|
||||
static float complex lowpass2_sym(float complex buffer[], ui32_t sample, ui32_t taps, float *ws) {
|
||||
float complex w = 0;
|
||||
int n;
|
||||
int s = (sample+1) % taps; // lpIQ
|
||||
int s = sample % taps; // lpIQ
|
||||
int SW = (taps-1)/2;
|
||||
int B1 = s + SW;
|
||||
int n1 = SW - s;
|
||||
|
@ -704,18 +704,18 @@ static float re_lowpass0(float buffer[], ui32_t sample, ui32_t taps, float *ws)
|
|||
ui32_t n;
|
||||
double w = 0;
|
||||
for (n = 0; n < taps; n++) {
|
||||
w += buffer[(sample+n+1)%taps]*ws[taps-1-n];
|
||||
w += buffer[(sample+n)%taps]*ws[taps-1-n];
|
||||
}
|
||||
return (float)w;
|
||||
}
|
||||
static float re_lowpass(float buffer[], ui32_t sample, ui32_t taps, float *ws) {
|
||||
ui32_t n;
|
||||
ui32_t s = sample % taps;
|
||||
double w = 0;
|
||||
float w = 0;
|
||||
int n;
|
||||
int S = taps - (sample % taps);
|
||||
for (n = 0; n < taps; n++) {
|
||||
w += buffer[n]*ws[taps+s-n]; // ws[taps+s-n] = ws[(taps+sample-n)%taps]
|
||||
w += buffer[n]*ws[S+n]; // ws[taps+s-n] = ws[(taps+sample-n)%taps]
|
||||
}
|
||||
return (float)w;
|
||||
return w;
|
||||
}
|
||||
|
||||
|
||||
|
@ -750,7 +750,7 @@ int f32buf_sample(dsp_t *dsp, int inv) {
|
|||
}
|
||||
if (dsp->decM > 1)
|
||||
{
|
||||
z = lowpass(dsp->decXbuffer, dsp->sample_decX, dsp->dectaps, ws_dec);
|
||||
z = lowpass(dsp->decXbuffer, dsp->sample_decX, dsp->dectaps, ws_dec); // oldest sample: dsp->sample_decX
|
||||
}
|
||||
}
|
||||
else if ( f32read_csample(dsp, &z) == EOF ) return EOF;
|
||||
|
@ -764,7 +764,7 @@ int f32buf_sample(dsp_t *dsp, int inv) {
|
|||
// IF-lowpass
|
||||
if (dsp->opt_lp & LP_IQ) {
|
||||
dsp->lpIQ_buf[dsp->sample_in % dsp->lpIQtaps] = z;
|
||||
z = lowpass(dsp->lpIQ_buf, dsp->sample_in, dsp->lpIQtaps, dsp->ws_lpIQ);
|
||||
z = lowpass(dsp->lpIQ_buf, dsp->sample_in+1, dsp->lpIQtaps, dsp->ws_lpIQ);
|
||||
}
|
||||
|
||||
|
||||
|
@ -842,7 +842,7 @@ int f32buf_sample(dsp_t *dsp, int inv) {
|
|||
// FM-lowpass
|
||||
if (dsp->opt_lp & LP_FM) {
|
||||
dsp->lpFM_buf[dsp->sample_in % dsp->lpFMtaps] = s_fm;
|
||||
s_fm = re_lowpass(dsp->lpFM_buf, dsp->sample_in, dsp->lpFMtaps, dsp->ws_lpFM);
|
||||
s_fm = re_lowpass(dsp->lpFM_buf, dsp->sample_in+1, dsp->lpFMtaps, dsp->ws_lpFM);
|
||||
if (dsp->opt_iq < 2) s = s_fm;
|
||||
}
|
||||
|
||||
|
|
|
@ -397,7 +397,7 @@ static int lowpass_init(float f, int taps, float **pws) {
|
|||
static float complex lowpass1a(float complex buffer[], ui32_t sample, ui32_t taps, float *ws) {
|
||||
double complex w = 0;
|
||||
ui32_t n;
|
||||
ui32_t S = taps + (sample % taps);
|
||||
ui32_t S = taps-1 + (sample % taps);
|
||||
for (n = 0; n < taps; n++) {
|
||||
w += buffer[n]*ws[S-n]; // ws[taps+s-n] = ws[(taps+sample-n)%taps]
|
||||
}
|
||||
|
@ -408,7 +408,7 @@ static float complex lowpass1a(float complex buffer[], ui32_t sample, ui32_t tap
|
|||
static float complex lowpass(float complex buffer[], ui32_t sample, ui32_t taps, float *ws) {
|
||||
float complex w = 0;
|
||||
int n; // -Ofast
|
||||
int S = taps-1 - (sample % taps);
|
||||
int S = taps - (sample % taps);
|
||||
for (n = 0; n < taps; n++) {
|
||||
w += buffer[n]*ws[S+n]; // ws[taps+s-n] = ws[(taps+sample-n)%taps]
|
||||
}
|
||||
|
@ -419,9 +419,9 @@ static float complex lowpass2(float complex buffer[], ui32_t sample, ui32_t taps
|
|||
float complex w = 0; // -Ofast
|
||||
int n;
|
||||
int s = sample % taps; // lpIQ
|
||||
int S1 = s+1;
|
||||
int S1 = s;
|
||||
int S1N = S1-taps;
|
||||
int n0 = taps-1-s;
|
||||
int n0 = taps-s;
|
||||
for (n = 0; n < n0; n++) {
|
||||
w += buffer[S1+n]*ws[n];
|
||||
}
|
||||
|
@ -433,13 +433,13 @@ static float complex lowpass2(float complex buffer[], ui32_t sample, ui32_t taps
|
|||
}
|
||||
|
||||
static float re_lowpass(float buffer[], ui32_t sample, ui32_t taps, float *ws) {
|
||||
ui32_t n;
|
||||
ui32_t s = sample % taps;
|
||||
double w = 0;
|
||||
float w = 0;
|
||||
int n;
|
||||
int S = taps - (sample % taps);
|
||||
for (n = 0; n < taps; n++) {
|
||||
w += buffer[n]*ws[taps+s-n]; // ws[taps+s-n] = ws[(taps+sample-n)%taps]
|
||||
w += buffer[n]*ws[S+n]; // ws[taps+s-n] = ws[(taps+sample-n)%taps]
|
||||
}
|
||||
return (float)w;
|
||||
return w;
|
||||
}
|
||||
|
||||
static
|
||||
|
@ -498,7 +498,7 @@ int f32_sample(dsp_t *dsp, float *out) {
|
|||
// IF-lowpass
|
||||
if (dsp->opt_lp & LP_IQ) {
|
||||
dsp->lpIQ_buf[_sample % dsp->lpIQtaps] = z;
|
||||
z = lowpass(dsp->lpIQ_buf, _sample, dsp->lpIQtaps, dsp->ws_lpIQ);
|
||||
z = lowpass(dsp->lpIQ_buf, _sample+1, dsp->lpIQtaps, dsp->ws_lpIQ);
|
||||
}
|
||||
|
||||
|
||||
|
@ -520,7 +520,7 @@ int f32_sample(dsp_t *dsp, float *out) {
|
|||
if (dsp->opt_lp & LP_FM) {
|
||||
dsp->lpFM_buf[_sample % dsp->lpFMtaps] = s_fm;
|
||||
if (m+1 == decFM) {
|
||||
s_fm = re_lowpass(dsp->lpFM_buf, _sample, dsp->lpFMtaps, dsp->ws_lpFM);
|
||||
s_fm = re_lowpass(dsp->lpFM_buf, _sample+1, dsp->lpFMtaps, dsp->ws_lpFM);
|
||||
if (dsp->opt_iq < 2 || dsp->opt_iq > 5) s = s_fm; //opt_iq==0,1,6
|
||||
}
|
||||
}
|
||||
|
|
|
@ -735,7 +735,7 @@ static int lowpass_init(float f, int taps, float **pws) {
|
|||
static float complex lowpass1a(float complex buffer[], ui32_t sample, ui32_t taps, float *ws) {
|
||||
double complex w = 0;
|
||||
ui32_t n;
|
||||
ui32_t S = taps + (sample % taps);
|
||||
ui32_t S = taps-1 + (sample % taps);
|
||||
for (n = 0; n < taps; n++) {
|
||||
w += buffer[n]*ws[S-n]; // ws[taps+s-n] = ws[(taps+sample-n)%taps]
|
||||
}
|
||||
|
@ -746,7 +746,7 @@ static float complex lowpass1a(float complex buffer[], ui32_t sample, ui32_t tap
|
|||
static float complex lowpass(float complex buffer[], ui32_t sample, ui32_t taps, float *ws) {
|
||||
float complex w = 0;
|
||||
int n; // -Ofast
|
||||
int S = taps-1 - (sample % taps);
|
||||
int S = taps - (sample % taps);
|
||||
for (n = 0; n < taps; n++) {
|
||||
w += buffer[n]*ws[S+n]; // ws[taps+s-n] = ws[(taps+sample-n)%taps]
|
||||
}
|
||||
|
@ -757,9 +757,9 @@ static float complex lowpass2(float complex buffer[], ui32_t sample, ui32_t taps
|
|||
float complex w = 0;
|
||||
int n;
|
||||
int s = sample % taps;
|
||||
int S1 = s+1;
|
||||
int S1 = s;
|
||||
int S1N = S1-taps;
|
||||
int n0 = taps-1-s;
|
||||
int n0 = taps-s;
|
||||
for (n = 0; n < n0; n++) {
|
||||
w += buffer[S1+n]*ws[n];
|
||||
}
|
||||
|
@ -771,13 +771,13 @@ static float complex lowpass2(float complex buffer[], ui32_t sample, ui32_t taps
|
|||
}
|
||||
|
||||
static float re_lowpass(float buffer[], ui32_t sample, ui32_t taps, float *ws) {
|
||||
ui32_t n;
|
||||
ui32_t s = sample % taps;
|
||||
double w = 0;
|
||||
float w = 0;
|
||||
int n;
|
||||
int S = taps - (sample % taps);
|
||||
for (n = 0; n < taps; n++) {
|
||||
w += buffer[n]*ws[taps+s-n]; // ws[taps+s-n] = ws[(taps+sample-n)%taps]
|
||||
w += buffer[n]*ws[S+n]; // ws[taps+s-n] = ws[(taps+sample-n)%taps]
|
||||
}
|
||||
return (float)w;
|
||||
return w;
|
||||
}
|
||||
|
||||
|
||||
|
@ -835,7 +835,7 @@ int f32buf_sample(dsp_t *dsp, int inv) {
|
|||
// IF-lowpass
|
||||
if (dsp->opt_lp & LP_IQ) {
|
||||
dsp->lpIQ_buf[_sample % dsp->lpIQtaps] = z;
|
||||
z = lowpass(dsp->lpIQ_buf, _sample, dsp->lpIQtaps, dsp->ws_lpIQ);
|
||||
z = lowpass(dsp->lpIQ_buf, _sample+1, dsp->lpIQtaps, dsp->ws_lpIQ);
|
||||
}
|
||||
|
||||
|
||||
|
@ -919,7 +919,7 @@ int f32buf_sample(dsp_t *dsp, int inv) {
|
|||
if (dsp->opt_lp & LP_FM) {
|
||||
dsp->lpFM_buf[_sample % dsp->lpFMtaps] = s_fm;
|
||||
if (m+1 == decFM) {
|
||||
s_fm = re_lowpass(dsp->lpFM_buf, _sample, dsp->lpFMtaps, dsp->ws_lpFM);
|
||||
s_fm = re_lowpass(dsp->lpFM_buf, _sample+1, dsp->lpFMtaps, dsp->ws_lpFM);
|
||||
if (dsp->opt_iq < 2 || dsp->opt_iq > 5) s = s_fm; //opt_iq==0,1,6
|
||||
}
|
||||
}
|
||||
|
@ -928,7 +928,7 @@ int f32buf_sample(dsp_t *dsp, int inv) {
|
|||
if (dsp->opt_lp & LP_IQFM) { // opt_iq==5
|
||||
dsp->lpIQFM_buf[_sample % dsp->lpIQFMtaps] = s;
|
||||
if (m+1 == decFM) {
|
||||
s = re_lowpass(dsp->lpIQFM_buf, _sample, dsp->lpIQFMtaps, dsp->ws_lpIQFM);
|
||||
s = re_lowpass(dsp->lpIQFM_buf, _sample+1, dsp->lpIQFMtaps, dsp->ws_lpIQFM);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -646,7 +646,7 @@ static float complex lowpass0(float complex buffer[], ui32_t sample, ui32_t taps
|
|||
ui32_t n;
|
||||
double complex w = 0;
|
||||
for (n = 0; n < taps; n++) {
|
||||
w += buffer[(sample+n+1)%taps]*ws[taps-1-n];
|
||||
w += buffer[(sample+n)%taps]*ws[taps-1-n];
|
||||
}
|
||||
return (float complex)w;
|
||||
}
|
||||
|
@ -654,7 +654,7 @@ static float complex lowpass0(float complex buffer[], ui32_t sample, ui32_t taps
|
|||
static float complex lowpass(float complex buffer[], ui32_t sample, ui32_t taps, float *ws) {
|
||||
float complex w = 0;
|
||||
int n; // -Ofast
|
||||
int S = taps-1 - (sample % taps);
|
||||
int S = taps - (sample % taps);
|
||||
for (n = 0; n < taps; n++) {
|
||||
w += buffer[n]*ws[S+n]; // ws[taps+s-n] = ws[(taps+sample-n)%taps]
|
||||
}
|
||||
|
@ -665,9 +665,9 @@ static float complex lowpass2(float complex buffer[], ui32_t sample, ui32_t taps
|
|||
float complex w = 0;
|
||||
int n;
|
||||
int s = sample % taps;
|
||||
int S1 = s+1;
|
||||
int S1 = s;
|
||||
int S1N = S1-taps;
|
||||
int n0 = taps-1-s;
|
||||
int n0 = taps-s;
|
||||
for (n = 0; n < n0; n++) {
|
||||
w += buffer[S1+n]*ws[n];
|
||||
}
|
||||
|
@ -711,8 +711,8 @@ static int f32buf_sample(FILE *fp, int inv) {
|
|||
// b) 3 FM-streams
|
||||
//
|
||||
lpIQ_buf[sample_in % dsp__lpIQtaps] = z;
|
||||
z_fm0 = lowpass(lpIQ_buf, sample_in, dsp__lpIQtaps, ws_lpIQ[0]);
|
||||
z_fm1 = lowpass(lpIQ_buf, sample_in, dsp__lpIQtaps, ws_lpIQ[1]);
|
||||
z_fm0 = lowpass(lpIQ_buf, sample_in+1, dsp__lpIQtaps, ws_lpIQ[0]);
|
||||
z_fm1 = lowpass(lpIQ_buf, sample_in+1, dsp__lpIQtaps, ws_lpIQ[1]);
|
||||
|
||||
// IQ: different modulation indices h=h(rs) -> FM-demod
|
||||
w = z_fm0 * conj(z0_fm0);
|
||||
|
|
Ładowanie…
Reference in New Issue