DSPRelated.com
Forums

Resampling

Started by Jens October 18, 2010
Hello,

When I want to interpolate by 1.5 I have to upsample by 3 and downsample by 
2 to preserve the bandwidth of the original signal. If the input signal is N 
samples long the current implementation requires a temporary 3N long buffer. 
Are there smarter implementations where the 3N long buffer can be avoided?

Thanks.

On 10/18/2010 10:54 AM, Jens wrote:
> Hello, > > When I want to interpolate by 1.5 I have to upsample by 3 and downsample > by 2 to preserve the bandwidth of the original signal. If the input > signal is N samples long the current implementation requires a temporary > 3N long buffer. Are there smarter implementations where the 3N long > buffer can be avoided?
Yes, depending. (Don't you love straight answers?) How are you doing the interpolation? With an FIR filter? FFT? If you're doing this with a FIR filter then even if you're doing the "upsample by 3, downsample by two" thing you only need to buffer enough points to match your filter length. You can save even more points (and processing power) by using polyphase filtering, particularly if your interpolation filter doesn't change the value of a sample that's lined up. There are probably clever things you can do if you're using an FFT, but I don't know what the best technique would be. I do know that the 'best' technique will depend on your needs, the length of your signals, and a cost tradeoff between design work vs. computer time vs. quality, etc. -- Tim Wescott Wescott Design Services http://www.wescottdesign.com Do you need to implement control loops in software? "Applied Control Theory for Embedded Systems" was written for you. See details at http://www.wescottdesign.com/actfes/actfes.html
> > How are you doing the interpolation? With an FIR filter? FFT?
The interpolation is done by inserting k zeros between each sample in the original signal and then low-pass filtering the new sequence. I use 4 second-order IIR filters to filter the new sequence. The filter response requirements are pretty "tight"...so that's why I am using an IIR filter. My current implementation costs 16 multiplications per input sample and 16 additions per input sample.
On 10/18/2010 11:41 AM, Jens wrote:
>> >> How are you doing the interpolation? With an FIR filter? FFT? > > The interpolation is done by inserting k zeros between each sample > in the original signal and then low-pass filtering the new sequence. > I use 4 second-order IIR filters to filter the new sequence. The filter > response requirements are pretty "tight"...so that's why I am using > an IIR filter. My current implementation costs 16 multiplications per > input sample and 16 additions per input sample.
Well, an FIR filter can be just as tight as an IIR, but not necessarily with less math. You shouldn't have to buffer the input -- just iterate the IIR once with real input, then twice more with zeros, then once, etc. As soon as the current sample is in the filter you can toss it out. There's no reason why you have to iterate the IIR filter three times for each input sample -- those zeros add no information, and you can eliminate that step. I outlined how to do this recently in a thread on this group -- the math is a bit opaque because I wasn't trying hard, but it's there. Basically you end up with a filter with poles that are three times faster, and with three numerators -- one for direct sampling, one for sampling at 1/3 sample, and one for sampling at 2/3 sample. -- Tim Wescott Wescott Design Services http://www.wescottdesign.com Do you need to implement control loops in software? "Applied Control Theory for Embedded Systems" was written for you. See details at http://www.wescottdesign.com/actfes/actfes.html