GNU Radio 3.7.1 C++ API
gr::filter::pfb_arb_resampler_fff Class Reference

Polyphase filterbank arbitrary resampler with float input, float output and float taps. More...

#include <pfb_arb_resampler_fff.h>

Inheritance diagram for gr::filter::pfb_arb_resampler_fff:

List of all members.

Public Types

typedef boost::shared_ptr
< pfb_arb_resampler_fff
sptr

Public Member Functions

virtual void set_taps (const std::vector< float > &taps)=0
virtual std::vector
< std::vector< float > > 
taps () const =0
virtual void print_taps ()=0
virtual void set_rate (float rate)=0
virtual void set_phase (float ph)=0
virtual float phase () const =0
virtual unsigned int taps_per_filter () const =0
virtual unsigned int interpolation_rate () const =0
virtual unsigned int decimation_rate () const =0
virtual float fractional_rate () const =0
virtual int group_delay () const =0
virtual float phase_offset (float freq, float fs)=0

Static Public Member Functions

static sptr make (float rate, const std::vector< float > &taps, unsigned int filter_size=32)

Detailed Description

Polyphase filterbank arbitrary resampler with float input, float output and float taps.

This block takes in a signal stream and performs arbitrary resampling. The resampling rate can be any real number r. The resampling is done by constructing N filters where N is the interpolation rate. We then calculate D where D = floor(N/r).

Using N and D, we can perform rational resampling where N/D is a rational number close to the input rate r where we have N filters and we cycle through them as a polyphase filterbank with a stride of D so that i+1 = (i + D) % N.

To get the arbitrary rate, we want to interpolate between two points. For each value out, we take an output from the current filter, i, and the next filter i+1 and then linearly interpolate between the two based on the real resampling rate we want.

The linear interpolation only provides us with an approximation to the real sampling rate specified. The error is a quantization error between the two filters we used as our interpolation points. To this end, the number of filters, N, used determines the quantization error; the larger N, the smaller the noise. You can design for a specified noise floor by setting the filter size (parameters filter_size). The size defaults to 32 filters, which is about as good as most implementations need.

The trick with designing this filter is in how to specify the taps of the prototype filter. Like the PFB interpolator, the taps are specified using the interpolated filter rate. In this case, that rate is the input sample rate multiplied by the number of filters in the filterbank, which is also the interpolation rate. All other values should be relative to this rate.

For example, for a 32-filter arbitrary resampler and using the GNU Radio's firdes utility to build the filter, we build a low-pass filter with a sampling rate of fs, a 3-dB bandwidth of BW and a transition bandwidth of TB. We can also specify the out-of-band attenuation to use, ATT, and the filter window function (a Blackman-harris window in this case). The first input is the gain of the filter, which we specify here as the interpolation rate (32).

self._taps = filter.firdes.low_pass_2(32, 32*fs, BW, TB, attenuation_dB=ATT, window=filter.firdes.WIN_BLACKMAN_hARRIS)

The theory behind this block can be found in Chapter 7.5 of the following book.

f. harris, "Multirate Signal Processing for Communication Systems", Upper Saddle River, NJ: Prentice Hall, Inc. 2004.


Member Typedef Documentation


Member Function Documentation

virtual unsigned int gr::filter::pfb_arb_resampler_fff::decimation_rate ( ) const [pure virtual]

Gets the decimation rate of the filter.

virtual float gr::filter::pfb_arb_resampler_fff::fractional_rate ( ) const [pure virtual]

Gets the fractional rate of the filter.

virtual int gr::filter::pfb_arb_resampler_fff::group_delay ( ) const [pure virtual]

Get the group delay of the filter.

virtual unsigned int gr::filter::pfb_arb_resampler_fff::interpolation_rate ( ) const [pure virtual]

Gets the interpolation rate of the filter.

static sptr gr::filter::pfb_arb_resampler_fff::make ( float  rate,
const std::vector< float > &  taps,
unsigned int  filter_size = 32 
) [static]

Build the polyphase filterbank arbitray resampler.

Parameters:
rate(float) Specifies the resampling rate to use
taps(vector/list of floats) The prototype filter to populate the filterbank. The taps should be generated at the filter_size sampling rate.
filter_size(unsigned int) The number of filters in the filter bank. This is directly related to quantization noise introduced during the resampling. Defaults to 32 filters.
virtual float gr::filter::pfb_arb_resampler_fff::phase ( ) const [pure virtual]

Gets the current phase of the resampler in radians (2 to 2pi).

virtual float gr::filter::pfb_arb_resampler_fff::phase_offset ( float  freq,
float  fs 
) [pure virtual]

Calculates the phase offset expected by a sine wave of frequency freq and sampling rate fs (assuming input sine wave has 0 degree phase).

Print all of the filterbank taps to screen.

virtual void gr::filter::pfb_arb_resampler_fff::set_phase ( float  ph) [pure virtual]

Sets the current phase offset in radians (0 to 2pi).

virtual void gr::filter::pfb_arb_resampler_fff::set_rate ( float  rate) [pure virtual]

Sets the resampling rate of the block.

virtual void gr::filter::pfb_arb_resampler_fff::set_taps ( const std::vector< float > &  taps) [pure virtual]

Resets the filterbank's filter taps with the new prototype filter

Parameters:
taps(vector/list of floats) The prototype filter to populate the filterbank.
virtual std::vector<std::vector<float> > gr::filter::pfb_arb_resampler_fff::taps ( ) const [pure virtual]

Return a vector<vector<>> of the filterbank taps

virtual unsigned int gr::filter::pfb_arb_resampler_fff::taps_per_filter ( ) const [pure virtual]

Gets the number of taps per filter.


The documentation for this class was generated from the following file: