This is fairly deep technical question that applies to all SDRs, purely my curiosity, posting on the chance there is an SDR expert out there who can answer it in a simple manner, or post a hyperlink...
I have always wondered how the raw ADC samples in the RTLSDR dongle (28.8 megasamples/second?) are processed and downsampled to the lower rates needed to transfer data out of the dongle to the PC software for a given bandwidth setting. In other words, a 2 MHz bandwidth setting requires a lot more bits/second from the USB connection than a 1 MHz setting, but how exactly is the original raw data from the ADC sampling transformed in the dongle? Is a FFT done, followed by filtering at the selected the bandwidth, then a reverse transform? Or some kind of mathematical averaging on the entire stream to downconvert it?
Direct sampling to bandwidth output, how done?

 Posts: 6
 Joined: Wed Jan 29, 2020 12:18 am
Re: Direct sampling to bandwidth output, how done?
The mathematically correct solution is to use a perfect bandlimiting antialiasing or lowpass filter before decimation or interpolation. In reality, no filter is perfect. So an antialiasing filter should have a stop band attenuation below the radio's desired noise floor at and above the new downsampled sample rate.
Antialias filtering can be implemented in software or hardware by many different methods, including using a highorder IIR filter, or using a windowed Sinc or computer optimized FIR filter. An IIR is usually implemented by sections of recursive arithmetic (biquads, corresponding to sections of analog LC filters). A IIR works similar to averaging, but due to feedback and multiple sections, is a lot smoother in the frequency domain. A FIR filter can be implemented by straight convolution (a lot of vector arithmetic), perhaps using a polyphase filter bank or Farrow interpolator for each set of FIR filter coefficients. or by overlapadd/save FFT/IFFT fast convolution for greater efficiency. There are other solutions including CIC filters and incremental multirate filtering and downsampling (reducing the sample rate in steps).
For fractional sample rate ratio changes, one can also upsample before downsampling, but I prefer polyphase interpolation methods to upsampling as more computationally efficient.
Bandpass filtering plus undersampling can also be used for downsampling a tuned spectrum slice. But, more commonly, heterodyning down to complex or IQ baseband before lowpass filtering seems to be a more efficient and commonly implemented algorithm.
Antialias filtering can be implemented in software or hardware by many different methods, including using a highorder IIR filter, or using a windowed Sinc or computer optimized FIR filter. An IIR is usually implemented by sections of recursive arithmetic (biquads, corresponding to sections of analog LC filters). A IIR works similar to averaging, but due to feedback and multiple sections, is a lot smoother in the frequency domain. A FIR filter can be implemented by straight convolution (a lot of vector arithmetic), perhaps using a polyphase filter bank or Farrow interpolator for each set of FIR filter coefficients. or by overlapadd/save FFT/IFFT fast convolution for greater efficiency. There are other solutions including CIC filters and incremental multirate filtering and downsampling (reducing the sample rate in steps).
For fractional sample rate ratio changes, one can also upsample before downsampling, but I prefer polyphase interpolation methods to upsampling as more computationally efficient.
Bandpass filtering plus undersampling can also be used for downsampling a tuned spectrum slice. But, more commonly, heterodyning down to complex or IQ baseband before lowpass filtering seems to be a more efficient and commonly implemented algorithm.