Enabled the filter, the FFT of which also had to be swapped. Fixed the shift direction.
This commit is contained in:
parent
b6fde4ce86
commit
6efdf7c809
4 changed files with 72 additions and 9 deletions
7
csdr.c
7
csdr.c
|
@ -1725,9 +1725,10 @@ int main(int argc, char *argv[])
|
|||
|
||||
//make the filter
|
||||
float filter_half_bw = 0.5/decimation;
|
||||
fprintf(stderr, "fastddc_inv_cc: preparing a bandpass filter of [%g, %g] cutoff rates. Real transition bandwidth is: %g\n", shift_rate-filter_half_bw, shift_rate+filter_half_bw, 4.0/ddc.taps_length);
|
||||
firdes_bandpass_c(taps, ddc.taps_length, shift_rate-filter_half_bw, shift_rate+filter_half_bw, window);
|
||||
fprintf(stderr, "fastddc_inv_cc: preparing a bandpass filter of [%g, %g] cutoff rates. Real transition bandwidth is: %g\n", (-shift_rate)-filter_half_bw, (-shift_rate)+filter_half_bw, 4.0/ddc.taps_length);
|
||||
firdes_bandpass_c(taps, ddc.taps_length, (-shift_rate)-filter_half_bw, (-shift_rate)+filter_half_bw, window);
|
||||
fft_execute(plan_taps);
|
||||
fft_swap_sides(taps_fft,ddc.fft_size);
|
||||
|
||||
//make FFT plan
|
||||
complexf* inv_input = (complexf*)fft_malloc(sizeof(complexf)*ddc.fft_inv_size);
|
||||
|
@ -1748,7 +1749,7 @@ int main(int argc, char *argv[])
|
|||
fread(input, sizeof(complexf), ddc.fft_size, stdin);
|
||||
shift_stat = fastddc_inv_cc(input, output, &ddc, plan_inverse, taps_fft, shift_stat);
|
||||
fwrite(output, sizeof(complexf), shift_stat.output_size, stdout);
|
||||
fprintf(stderr, "ss os = %d\n", shift_stat.output_size);
|
||||
//fprintf(stderr, "ss os = %d\n", shift_stat.output_size);
|
||||
TRY_YIELD;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -133,10 +133,10 @@ decimating_shift_addition_status_t fastddc_inv_cc(complexf* input, complexf* out
|
|||
// b = qof(input,i)
|
||||
// c = iof(taps_fft,i)
|
||||
// d = qof(taps_fft,i)
|
||||
//iof(inv_input,output_index) += iof(input,i) * iof(taps_fft,i) - qof(input,i) * qof(taps_fft,i);
|
||||
//qof(inv_input,output_index) += iof(input,i) * qof(taps_fft,i) + qof(input,i) * iof(taps_fft,i);
|
||||
iof(inv_input,output_index) += iof(input,i); //no filter
|
||||
qof(inv_input,output_index) += qof(input,i);
|
||||
iof(inv_input,output_index) += iof(input,i) * iof(taps_fft,i) - qof(input,i) * qof(taps_fft,i);
|
||||
qof(inv_input,output_index) += iof(input,i) * qof(taps_fft,i) + qof(input,i) * iof(taps_fft,i);
|
||||
//iof(inv_input,output_index) += iof(input,i); //no filter
|
||||
//qof(inv_input,output_index) += qof(input,i);
|
||||
}
|
||||
|
||||
//Normalize inv fft bins (now our output level is not higher than the input... but we may optimize this into the later loop when we normalize by size)
|
||||
|
|
|
@ -26,3 +26,4 @@ typedef struct fastddc_s
|
|||
int fastddc_init(fastddc_t* ddc, float transition_bw, int decimation, float shift_rate);
|
||||
decimating_shift_addition_status_t fastddc_inv_cc(complexf* input, complexf* output, fastddc_t* ddc, FFT_PLAN_T* plan_inverse, complexf* taps_fft, decimating_shift_addition_status_t shift_stat);
|
||||
void fastddc_print(fastddc_t* ddc, char* source);
|
||||
void fft_swap_sides(complexf* io, int fft_size);
|
||||
|
|
|
@ -182,6 +182,61 @@
|
|||
<value>250000</value>
|
||||
</param>
|
||||
</block>
|
||||
<block>
|
||||
<key>analog_noise_source_x</key>
|
||||
<param>
|
||||
<key>amp</key>
|
||||
<value>1</value>
|
||||
</param>
|
||||
<param>
|
||||
<key>alias</key>
|
||||
<value></value>
|
||||
</param>
|
||||
<param>
|
||||
<key>comment</key>
|
||||
<value></value>
|
||||
</param>
|
||||
<param>
|
||||
<key>affinity</key>
|
||||
<value></value>
|
||||
</param>
|
||||
<param>
|
||||
<key>_enabled</key>
|
||||
<value>0</value>
|
||||
</param>
|
||||
<param>
|
||||
<key>_coordinate</key>
|
||||
<value>(224, 403)</value>
|
||||
</param>
|
||||
<param>
|
||||
<key>_rotation</key>
|
||||
<value>0</value>
|
||||
</param>
|
||||
<param>
|
||||
<key>id</key>
|
||||
<value>analog_noise_source_x_0</value>
|
||||
</param>
|
||||
<param>
|
||||
<key>maxoutbuf</key>
|
||||
<value>0</value>
|
||||
</param>
|
||||
<param>
|
||||
<key>minoutbuf</key>
|
||||
<value>0</value>
|
||||
</param>
|
||||
<param>
|
||||
<key>noise_type</key>
|
||||
<value>analog.GR_GAUSSIAN</value>
|
||||
</param>
|
||||
<param>
|
||||
<key>type</key>
|
||||
<value>complex</value>
|
||||
</param>
|
||||
<param>
|
||||
<key>seed</key>
|
||||
<value>0</value>
|
||||
</param>
|
||||
</block>
|
||||
<block>
|
||||
<key>analog_sig_source_x</key>
|
||||
<param>
|
||||
|
@ -202,7 +257,7 @@
|
|||
</param>
|
||||
<param>
|
||||
<key>_enabled</key>
|
||||
<value>True</value>
|
||||
<value>1</value>
|
||||
</param>
|
||||
<param>
|
||||
<key>freq</key>
|
||||
|
@ -308,7 +363,7 @@
|
|||
</param>
|
||||
<param>
|
||||
<key>commandline</key>
|
||||
<value>csdr fastddc_fwd_cc 4 | csdr fastddc_inv_cc 4 0.1</value>
|
||||
<value>csdr fastddc_fwd_cc 4 | csdr fastddc_inv_cc 4 -0.1</value>
|
||||
</param>
|
||||
<param>
|
||||
<key>comment</key>
|
||||
|
@ -683,6 +738,12 @@
|
|||
<value>Counts</value>
|
||||
</param>
|
||||
</block>
|
||||
<connection>
|
||||
<source_block_id>analog_noise_source_x_0</source_block_id>
|
||||
<sink_block_id>blocks_throttle_0</sink_block_id>
|
||||
<source_key>0</source_key>
|
||||
<sink_key>0</sink_key>
|
||||
</connection>
|
||||
<connection>
|
||||
<source_block_id>analog_sig_source_x_0</source_block_id>
|
||||
<sink_block_id>blocks_throttle_0</sink_block_id>
|
||||
|
|
Loading…
Reference in a new issue