diff --git a/csdr.c b/csdr.c
index c7ada5b..18472d6 100644
--- a/csdr.c
+++ b/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;
}
}
diff --git a/fastddc.c b/fastddc.c
index 9aab721..1e41043 100644
--- a/fastddc.c
+++ b/fastddc.c
@@ -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)
diff --git a/fastddc.h b/fastddc.h
index a948083..d65ca3c 100644
--- a/fastddc.h
+++ b/fastddc.h
@@ -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);
diff --git a/grc_tests/test_fastddc.grc b/grc_tests/test_fastddc.grc
index 099e75b..492fcab 100644
--- a/grc_tests/test_fastddc.grc
+++ b/grc_tests/test_fastddc.grc
@@ -182,6 +182,61 @@
250000
+
+ analog_noise_source_x
+
+ amp
+ 1
+
+
+ alias
+
+
+
+ comment
+
+
+
+ affinity
+
+
+
+ _enabled
+ 0
+
+
+ _coordinate
+ (224, 403)
+
+
+ _rotation
+ 0
+
+
+ id
+ analog_noise_source_x_0
+
+
+ maxoutbuf
+ 0
+
+
+ minoutbuf
+ 0
+
+
+ noise_type
+ analog.GR_GAUSSIAN
+
+
+ type
+ complex
+
+
+ seed
+ 0
+
+
analog_sig_source_x
@@ -202,7 +257,7 @@
_enabled
- True
+ 1
freq
@@ -308,7 +363,7 @@
commandline
- csdr fastddc_fwd_cc 4 | csdr fastddc_inv_cc 4 0.1
+ csdr fastddc_fwd_cc 4 | csdr fastddc_inv_cc 4 -0.1
comment
@@ -683,6 +738,12 @@
Counts
+
+ analog_noise_source_x_0
+ blocks_throttle_0
+ 0
+ 0
+
analog_sig_source_x_0
blocks_throttle_0