kopia lustrzana https://github.com/rs1729/RS
IQ baseband decode: samplecount overflow
rodzic
8f869a1efa
commit
729c90ce46
|
@ -381,7 +381,7 @@ static int get_SNR(dsp_t *dsp) {
|
|||
}
|
||||
|
||||
|
||||
static int res = 1; // 1..10 Hz, exp_lut resolution
|
||||
static ui32_t res = 1; // 1..10 Hz, exp_lut resolution
|
||||
static float *ws_dec;
|
||||
|
||||
static double sinc(double x) {
|
||||
|
@ -400,9 +400,9 @@ static int decimate_init(int taps, float f) {
|
|||
|
||||
if ( taps < 1 ) taps = 1;
|
||||
|
||||
h = (double*)calloc( taps+1, sizeof(double));
|
||||
w = (double*)calloc( taps+1, sizeof(double));
|
||||
ws_dec = (float*)calloc( taps+1, sizeof(float));
|
||||
h = (double*)calloc( taps+1, sizeof(double)); if (h == NULL) return -1;
|
||||
w = (double*)calloc( taps+1, sizeof(double)); if (w == NULL) return -1;
|
||||
ws_dec = (float*)calloc( taps+1, sizeof(float)); if (ws_dec == NULL) return -1;
|
||||
|
||||
for (n = 0; n < taps; n++) {
|
||||
w[n] = 7938/18608.0 - 9240/18608.0*cos(2*M_PI*n/(taps-1)) + 1430/18608.0*cos(4*M_PI*n/(taps-1)); // Blackmann
|
||||
|
@ -420,8 +420,8 @@ static int decimate_init(int taps, float f) {
|
|||
return taps;
|
||||
}
|
||||
|
||||
static float complex lowpass(float complex buffer[], int sample, int M) {
|
||||
int n;
|
||||
static float complex lowpass(float complex buffer[], ui32_t sample, ui32_t M) {
|
||||
ui32_t n;
|
||||
double complex w = 0;
|
||||
for (n = 0; n < M; n++) {
|
||||
w += buffer[(sample+n+1)%M]*ws_dec[M-1-n];
|
||||
|
@ -441,11 +441,13 @@ int f32buf_sample(dsp_t *dsp, int inv) {
|
|||
if (dsp->opt_iq) {
|
||||
|
||||
if (dsp->opt_iq == 5) {
|
||||
ui32_t s_reset = dsp->dectaps*dsp->sr_base; // dsp->sr_base % res == 0
|
||||
int j;
|
||||
if ( f32read_cblock(dsp) < dsp->decM ) return EOF;
|
||||
for (j = 0; j < dsp->decM; j++) {
|
||||
dsp->decXbuffer[dsp->sample_dec % dsp->dectaps] = dsp->decMbuf[j] * dsp->ex[dsp->sample_dec % (dsp->sr_base/res)];
|
||||
dsp->sample_dec += 1;
|
||||
if (dsp->sample_dec == s_reset) dsp->sample_dec = 0;
|
||||
}
|
||||
z = lowpass(dsp->decXbuffer, dsp->sample_dec, dsp->dectaps);
|
||||
}
|
||||
|
@ -774,7 +776,9 @@ int init_buffers(dsp_t *dsp) {
|
|||
t_bw /= sr_base;
|
||||
taps = 4.0/t_bw; if (taps%2==0) taps++;
|
||||
|
||||
dsp->dectaps = decimate_init(taps, f_lp);
|
||||
taps = decimate_init(taps, f_lp);
|
||||
if (taps < 0) return -1;
|
||||
dsp->dectaps = (ui32_t)taps;
|
||||
|
||||
dsp->sr_base = sr_base;
|
||||
dsp->sr = IF_sr; // sr_base/decM
|
||||
|
|
|
@ -92,13 +92,13 @@ typedef struct {
|
|||
double V_signal;
|
||||
double SNRdB;
|
||||
|
||||
int sr_base;
|
||||
int decM;
|
||||
int dectaps;
|
||||
ui32_t sr_base;
|
||||
ui32_t dectaps;
|
||||
ui32_t sample_dec;
|
||||
float complex *decXbuffer;
|
||||
float complex *decMbuf;
|
||||
float complex *ex; // exp_lut
|
||||
ui32_t sample_dec;
|
||||
double xlt_fq;
|
||||
|
||||
} dsp_t;
|
||||
|
|
Ładowanie…
Reference in New Issue