csdr
csdr copied to clipboard
CIC based DDC
To be able to use OpenWebRX at high sample rates (5-50 MHz), I've written an optimized cascaded-integrator-comb based down-converter. To give some numbers on its speed, it takes 20% of one core on an Intel Q9400 processing a complex signal at 30 Msps.
So far, I've only optimized the DDC on 64-bit x86 machines, and it uses 64-bit integers and a sine table whose size is chosen to fit in the typical L1 cache they have. It should work on ARM and other 32-bit machines too but I have no idea about its performance on them. A 32-bit optimized version is something I could attempt next though.
To implement a delay buffer feature (mainly for use in OpenWebRX) and to further improve performance, this can also read directly from an shmbuffer without pipes. There's also some additional features for FFT functions to somewhat reduce CPU use.
I really should have contributed this half a year ago when I made it, but thought I should do some cleanup and some more testing and optimizing... Now that I've successfully used it for 6 months and haven't done anything for it, I decided it's already useful enough to make a pull request. Better to merge it now before our csdr branches diverge too much! (Btw, as tabs had changed to 4 spaces in the code, merge seemed really frustrating until I realized git had the -Xignore-space-change option!)
To give some numbers on its speed, it takes 20% of one core on an Intel Q9400 processing a complex signal at 30 Msps.
Wow! Looks great!
Btw, the CIC should usually be used as the first stage of a two-stage (or more) resampler because the CIC itself has a quite sloppy frequency response. Should maybe write some documentation about it...
I've made the changes to openwebrx for this multiple-stage decimation and use of shmbuffer for history, but merging them with other latest openwebrx changes will need some more work because I haven't that actively maintained the fork. I'll try to do it soon. Of course, the DDC can be used in other csdr applications even if not yet integrated into mainline openwebrx.
Yes, some documentation would help me to better understand the code.
There are 3 places where I usually put documentation:
- at the beginning of
csdr.c
, where the output of--help
resides, there is the full syntax of each command, - I also put the full syntax of the command in a comment to the place where it is in
csdr.c
(on the!strcmp
line) - I write about the syntax, the concrete use cases and sample commands if needed in
README.md
.
Anyway, what you do sounds really great, thanks for working on that!