jgaeddert / liquid-dsp

digital signal processing library for software-defined radios
http://liquidsdr.org
MIT License
1.89k stars 443 forks source link

firpfb behavior #43

Closed mndza closed 8 years ago

mndza commented 8 years ago

I just noticed an odd result when performing the same filtering operation through firdecim and firpfb. I wanted to be able to adjust the output phase using a timing estimate from my signal, so first I tested the output of firpfb with a fixed phase (0). From my understanding the output signals should be the same (as a polyphase filter is just a more efficient implementation of FIR filtering + decimation/interpolation). Then I noticed that the current implementation just subsamples the filter coefficients to form M filters and each output sample only uses 1 of them. Am i missing something? Is this behavior unintended? If so, I can help here. Keep up the good work!

JayKickliter commented 8 years ago

PFBs do use only one phase (sometimes called filter arm) per output sample. That's what makes them efficient.

Are you saying that the output didn't look right?

cjcliffe commented 8 years ago

Worked perfectly here after many experiments; some additional documentation would have been good though ;)

JayKickliter commented 8 years ago

I'm not the author of liquid, but I have written a multirate DSP library for another language. Despite being fairly simple, It took me forever to understand polyphase filtering. I finally realized that it's almost impossible to describe them with static diagrams. If you want more info feel free to contact me.

I lied in my previous response. If you want to do arbitrary (non-rational) sample rate conversion, a good way is to pick the two phases that straddle the virtual phase that you want, use both of them to output two samples, and then linearly interpolate between those two outputs.