kopia lustrzana https://github.com/rs1729/RS
multi decode: baseband samplecount overflow
rodzic
bd9831b64c
commit
8f869a1efa
|
@ -452,7 +452,7 @@ static int get_SNR(dsp_t *dsp) {
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int res = 1; // 1..10 Hz, exp_lut resolution
|
static ui32_t res = 1; // 1..10 Hz, exp_lut resolution
|
||||||
|
|
||||||
static double sinc(double x) {
|
static double sinc(double x) {
|
||||||
double y;
|
double y;
|
||||||
|
@ -475,9 +475,9 @@ int decimate_init(int taps, float f) {
|
||||||
|
|
||||||
if ( M < 1 ) M = 1;
|
if ( M < 1 ) M = 1;
|
||||||
|
|
||||||
h = (double*)calloc( M+1, sizeof(double));
|
h = (double*)calloc( M+1, sizeof(double)); if (h == NULL) return -1;
|
||||||
w = (double*)calloc( M+1, sizeof(double));
|
w = (double*)calloc( M+1, sizeof(double)); if (w == NULL) return -1;
|
||||||
ws_dec = (double*)calloc( M+1, sizeof(double));
|
ws_dec = (double*)calloc( M+1, sizeof(double)); if (ws_dec == NULL) return -1;
|
||||||
|
|
||||||
for (n = 0; n < M; n++) {
|
for (n = 0; n < M; n++) {
|
||||||
w[n] = 7938/18608.0 - 9240/18608.0*cos(2*M_PI*n/(M-1)) + 1430/18608.0*cos(4*M_PI*n/(M-1)); // Blackmann
|
w[n] = 7938/18608.0 - 9240/18608.0*cos(2*M_PI*n/(M-1)) + 1430/18608.0*cos(4*M_PI*n/(M-1)); // Blackmann
|
||||||
|
@ -504,8 +504,8 @@ int decimate_free() {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
static float complex lowpass(float complex buffer[], int sample, int M) {
|
static float complex lowpass(float complex buffer[], ui32_t sample, ui32_t M) {
|
||||||
int n;
|
ui32_t n;
|
||||||
double complex w = 0;
|
double complex w = 0;
|
||||||
for (n = 0; n < M; n++) {
|
for (n = 0; n < M; n++) {
|
||||||
w += buffer[(sample+n+1)%M]*ws_dec[M-1-n];
|
w += buffer[(sample+n+1)%M]*ws_dec[M-1-n];
|
||||||
|
@ -526,11 +526,13 @@ int f32buf_sample(dsp_t *dsp, int inv) {
|
||||||
if (dsp->opt_iq) {
|
if (dsp->opt_iq) {
|
||||||
|
|
||||||
if (dsp->opt_iq == 5) {
|
if (dsp->opt_iq == 5) {
|
||||||
|
ui32_t s_reset = dsp->dectaps*dsp->sr_base; // dsp->sr_base % res == 0
|
||||||
int j;
|
int j;
|
||||||
if ( f32read_cblock(dsp) < dsp->decM ) return EOF;
|
if ( f32read_cblock(dsp) < dsp->decM ) return EOF;
|
||||||
for (j = 0; j < dsp->decM; j++) {
|
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->decXbuffer[dsp->sample_dec % dsp->dectaps] = dsp->decMbuf[j] * dsp->ex[dsp->sample_dec % (dsp->sr_base/res)];
|
||||||
dsp->sample_dec += 1;
|
dsp->sample_dec += 1;
|
||||||
|
if (dsp->sample_dec == s_reset) dsp->sample_dec = 0;
|
||||||
}
|
}
|
||||||
z = lowpass(dsp->decXbuffer, dsp->sample_dec, dsp->dectaps);
|
z = lowpass(dsp->decXbuffer, dsp->sample_dec, dsp->dectaps);
|
||||||
}
|
}
|
||||||
|
|
|
@ -112,10 +112,10 @@ typedef struct {
|
||||||
double V_signal;
|
double V_signal;
|
||||||
double SNRdB;
|
double SNRdB;
|
||||||
|
|
||||||
int sr_base;
|
|
||||||
int decM;
|
int decM;
|
||||||
int dectaps;
|
|
||||||
int blk_cnt;
|
int blk_cnt;
|
||||||
|
ui32_t sr_base;
|
||||||
|
ui32_t dectaps;
|
||||||
ui32_t sample_dec;
|
ui32_t sample_dec;
|
||||||
float complex *decXbuffer;
|
float complex *decXbuffer;
|
||||||
float complex *decMbuf;
|
float complex *decMbuf;
|
||||||
|
|
|
@ -57,7 +57,8 @@ static int pcm_dec_init(pcm_t *p) {
|
||||||
|
|
||||||
taps = decimate_init(taps, f_lp);
|
taps = decimate_init(taps, f_lp);
|
||||||
|
|
||||||
p->dectaps = taps;
|
if (taps < 0) return -1;
|
||||||
|
p->dectaps = (ui32_t)taps;
|
||||||
p->sr_base = sr_base;
|
p->sr_base = sr_base;
|
||||||
p->sr = IF_sr; // sr_base/decM
|
p->sr = IF_sr; // sr_base/decM
|
||||||
p->decM = decM;
|
p->decM = decM;
|
||||||
|
|
Ładowanie…
Reference in New Issue