Fixed handling a null input source for some functions, in order to work with the new squelch.

This commit is contained in:
ha7ilm 2016-03-20 23:30:21 +01:00
parent 4230198d91
commit 42ce9d4669
2 changed files with 21 additions and 23 deletions

View file

@ -741,7 +741,7 @@ complexf fmdemod_quadri_cf(complexf* input, float* output, int input_size, float
} }
for (int i=0; i<input_size; i++) //@fmdemod_quadri_cf: output division for (int i=0; i<input_size; i++) //@fmdemod_quadri_cf: output division
{ {
output[i]=fmdemod_quadri_K*output[i]/temp[i]; output[i]=(temp[i])?fmdemod_quadri_K*output[i]/temp[i]:0;
} }
return input[input_size-1]; return input[input_size-1];

View file

@ -219,10 +219,9 @@ float agc_ff(float* input, float* output, int input_size, float reference, float
} }
gain=gain+dgain; gain=gain+dgain;
//fprintf(stderr,"g=%f dg=%f\n",gain,dgain); //fprintf(stderr,"g=%f dg=%f\n",gain,dgain);
}
if(gain>max_gain) gain=max_gain; //We also have to limit our gain, it can't be infinity. if(gain>max_gain) gain=max_gain; //We also have to limit our gain, it can't be infinity.
if(gain<0) gain=0; if(gain<0) gain=0;
}
//output[i]=gain*input[i]; //Here we do the actual scaling of the samples. //output[i]=gain*input[i]; //Here we do the actual scaling of the samples.
//Here we do the actual scaling of the samples, but we run an IIR filter on the gain values: //Here we do the actual scaling of the samples, but we run an IIR filter on the gain values:
output[i]=(gain=gain+last_gain-gain_filter_alpha*last_gain)*input[i]; //dc-pass-filter: freqz([1 -1],[1 -0.99]) y[i]=x[i]+y[i-1]-alpha*x[i-1] output[i]=(gain=gain+last_gain-gain_filter_alpha*last_gain)*input[i]; //dc-pass-filter: freqz([1 -1],[1 -0.99]) y[i]=x[i]+y[i-1]-alpha*x[i-1]
@ -234,4 +233,3 @@ float agc_ff(float* input, float* output, int input_size, float reference, float
} }
#endif #endif