ha7ilm / csdr

A simple DSP library and command-line tool for Software Defined Radio.
523 stars 171 forks source link

CIC based DDC #30

Open tejeez opened 7 years ago

tejeez commented 7 years ago

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!)

ha7ilm commented 7 years ago

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!

tejeez commented 7 years ago

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.

ha7ilm commented 7 years ago

Yes, some documentation would help me to better understand the code.

There are 3 places where I usually put documentation:

ha7ilm commented 7 years ago

Anyway, what you do sounds really great, thanks for working on that!