Added to README and --help as well

This commit is contained in:
ha7ilm 2017-02-19 16:22:49 +01:00
parent 7e87ccb2a1
commit 3de0d42870
4 changed files with 1222 additions and 4 deletions

View file

@ -287,7 +287,12 @@ Other parameters were explained above at `firdes_lowpass_f`.
fir_decimate_cc <decimation_factor> [transition_bw [window]]
It is a decimator that keeps one sample out of `decimation_factor` samples.
To avoid aliasing, it runs a filter on the signal and removes spectral components above `0.5 × nyquist_frequency × decimation_factor`.
To avoid aliasing, it runs a filter on the signal and removes spectral components above `0.5 × nyquist_frequency × decimation_factor` from the input signal.
fir_interpolate_cc <interpolation_factor> [transition_bw [window]]
It is an interpolator that generates `interpolation_factor` number of output samples from one input sample.
To avoid aliasing, it runs a filter on the signal and removes spectral components above `0.5 × nyquist_frequency / interpolation_factor` from the output signal.
`transition_bw` and `window` are the parameters of the filter.

3
csdr.c
View file

@ -88,6 +88,7 @@ char usage[]=
" amdemod_cf\n"
" amdemod_estimator_cf\n"
" fir_decimate_cc <decimation_factor> [transition_bw [window]]\n"
" fir_interpolate_cc <interpolation_factor> [transition_bw [window]]\n"
" firdes_lowpass_f <cutoff_rate> <length> [window [--octave]]\n"
" firdes_bandpass_c <low_cut> <high_cut> <length> [window [--octave]]\n"
" agc_ff [hang_time [reference [attack_rate [decay_rate [max_gain [attack_wait [filter_alpha]]]]]]]\n"
@ -860,7 +861,7 @@ int main(int argc, char *argv[])
sscanf(argv[2],"%d",&factor);
assert(factor >= 1);
float transition_bw = 0.01;
float transition_bw = 0.05;
if(argc>=4) sscanf(argv[3],"%g",&transition_bw);
assert(transition_bw >= 0 && transition_bw < 1.);

File diff suppressed because it is too large Load diff

View file

@ -396,8 +396,8 @@ int fir_interpolate_cc(complexf *input, complexf *output, int input_size, int in
float accq=0;
//int tistart = (interpolation-ip)%interpolation;
int tistart = (interpolation-ip); //why does this work? why don't we need the % part?
for(int ti=tistart, si=0; ti<taps_length; ti+=interpolation, si++) acci += (iof(input,i+si)) * taps[ti]; //@fir_interpolate_cc: i loop
for(int ti=tistart, si=0; ti<taps_length; ti+=interpolation, si++) accq += (qof(input,i+si)) * taps[ti]; //@fir_interpolate_cc: q loop
for(int ti=tistart, si=0; ti<taps_length; (ti+=interpolation), (si++)) acci += (iof(input,i+si)) * taps[ti]; //@fir_interpolate_cc: i loop
for(int ti=tistart, si=0; ti<taps_length; (ti+=interpolation), (si++)) accq += (qof(input,i+si)) * taps[ti]; //@fir_interpolate_cc: q loop
iof(output,oi)=acci;
qof(output,oi)=accq;
oi++;