gr::filter::kernel::pfb_arb_resampler_fff
gnuradio/filter/pfb_arb_resampler.h
std::vector< fir_filter_fff > std::vector<fir_filter_fff> gr::filter::kernel::pfb_arb_resampler_fff::d_filters d_filters gr::filter::kernel::pfb_arb_resampler_fff::d_filters
std::vector< fir_filter_fff > std::vector<fir_filter_fff> gr::filter::kernel::pfb_arb_resampler_fff::d_diff_filters d_diff_filters gr::filter::kernel::pfb_arb_resampler_fff::d_diff_filters
std::vector< std::vector< float > > std::vector<std::vector<float> > gr::filter::kernel::pfb_arb_resampler_fff::d_taps d_taps gr::filter::kernel::pfb_arb_resampler_fff::d_taps
std::vector< std::vector< float > > std::vector<std::vector<float> > gr::filter::kernel::pfb_arb_resampler_fff::d_dtaps d_dtaps gr::filter::kernel::pfb_arb_resampler_fff::d_dtaps
unsigned int unsigned int gr::filter::kernel::pfb_arb_resampler_fff::d_int_rate d_int_rate gr::filter::kernel::pfb_arb_resampler_fff::d_int_rate
unsigned int unsigned int gr::filter::kernel::pfb_arb_resampler_fff::d_dec_rate d_dec_rate gr::filter::kernel::pfb_arb_resampler_fff::d_dec_rate
float float gr::filter::kernel::pfb_arb_resampler_fff::d_flt_rate d_flt_rate gr::filter::kernel::pfb_arb_resampler_fff::d_flt_rate
float float gr::filter::kernel::pfb_arb_resampler_fff::d_acc d_acc gr::filter::kernel::pfb_arb_resampler_fff::d_acc
unsigned int unsigned int gr::filter::kernel::pfb_arb_resampler_fff::d_last_filter d_last_filter gr::filter::kernel::pfb_arb_resampler_fff::d_last_filter
unsigned int unsigned int gr::filter::kernel::pfb_arb_resampler_fff::d_taps_per_filter d_taps_per_filter gr::filter::kernel::pfb_arb_resampler_fff::d_taps_per_filter
int int gr::filter::kernel::pfb_arb_resampler_fff::d_delay d_delay gr::filter::kernel::pfb_arb_resampler_fff::d_delay
float float gr::filter::kernel::pfb_arb_resampler_fff::d_est_phase_change d_est_phase_change gr::filter::kernel::pfb_arb_resampler_fff::d_est_phase_change
void void gr::filter::kernel::pfb_arb_resampler_fff::create_diff_taps (const std::vector< float > &newtaps, std::vector< float > &difftaps) create_diff_taps gr::filter::kernel::pfb_arb_resampler_fff::create_diff_taps const std::vector< float > & newtaps std::vector< float > & difftaps

Takes in the taps and convolves them with [-1,0,1], which creates a differential set of taps that are used in the difference filterbank. newtaps

(vector of floats) The prototype filter.

difftaps

(vector of floats) (out) The differential filter taps.

void void gr::filter::kernel::pfb_arb_resampler_fff::create_taps (const std::vector< float > &newtaps, std::vector< std::vector< float > > &ourtaps, std::vector< kernel::fir_filter_fff > &ourfilter) create_taps gr::filter::kernel::pfb_arb_resampler_fff::create_taps const std::vector< float > & newtaps std::vector< std::vector< float > > & ourtaps std::vector< kernel::fir_filter_fff > & ourfilter

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

(vector of floats) The prototype filter to populate the filterbank. The taps should be generated at the interpolated sampling rate.

ourtaps

(vector of floats) Reference to our internal member of holding the taps.

ourfilter

(vector of filters) Reference to our internal filter to set the taps for.

gr::filter::kernel::pfb_arb_resampler_fff::pfb_arb_resampler_fff
(float rate, const std::vector< float > &taps, unsigned int filter_size)
pfb_arb_resampler_fff
gr::filter::kernel::pfb_arb_resampler_fff::pfb_arb_resampler_fff
float rate
const std::vector< float > & taps
unsigned int filter_size

Creates a kernel to perform arbitrary resampling on a set of samples. 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.

gr::filter::kernel::pfb_arb_resampler_fff::pfb_arb_resampler_fff
(const pfb_arb_resampler_fff &)=delete
pfb_arb_resampler_fff
gr::filter::kernel::pfb_arb_resampler_fff::pfb_arb_resampler_fff
const pfb_arb_resampler_fff &
pfb_arb_resampler_fff & pfb_arb_resampler_fff & gr::filter::kernel::pfb_arb_resampler_fff::operator= (const pfb_arb_resampler_fff &)=delete operator= gr::filter::kernel::pfb_arb_resampler_fff::operator= const pfb_arb_resampler_fff &
void void gr::filter::kernel::pfb_arb_resampler_fff::set_taps (const std::vector< float > &taps) set_taps gr::filter::kernel::pfb_arb_resampler_fff::set_taps const std::vector< float > & taps

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

(vector/list of floats) The prototype filter to populate the filterbank.

std::vector< std::vector< float > > std::vector< std::vector< float > > gr::filter::kernel::pfb_arb_resampler_fff::taps () const taps gr::filter::kernel::pfb_arb_resampler_fff::taps

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

void void gr::filter::kernel::pfb_arb_resampler_fff::print_taps () print_taps gr::filter::kernel::pfb_arb_resampler_fff::print_taps

Print all of the filterbank taps to screen.

void void gr::filter::kernel::pfb_arb_resampler_fff::set_rate (float rate) set_rate gr::filter::kernel::pfb_arb_resampler_fff::set_rate float rate

Sets the resampling rate of the block.

void void gr::filter::kernel::pfb_arb_resampler_fff::set_phase (float ph) set_phase gr::filter::kernel::pfb_arb_resampler_fff::set_phase float ph

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

float float gr::filter::kernel::pfb_arb_resampler_fff::phase () const phase gr::filter::kernel::pfb_arb_resampler_fff::phase

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

unsigned int unsigned int gr::filter::kernel::pfb_arb_resampler_fff::taps_per_filter () const taps_per_filter gr::filter::kernel::pfb_arb_resampler_fff::taps_per_filter

Gets the number of taps per filter.

unsigned int unsigned int gr::filter::kernel::pfb_arb_resampler_fff::interpolation_rate () const interpolation_rate gr::filter::kernel::pfb_arb_resampler_fff::interpolation_rate
unsigned int unsigned int gr::filter::kernel::pfb_arb_resampler_fff::decimation_rate () const decimation_rate gr::filter::kernel::pfb_arb_resampler_fff::decimation_rate
float float gr::filter::kernel::pfb_arb_resampler_fff::fractional_rate () const fractional_rate gr::filter::kernel::pfb_arb_resampler_fff::fractional_rate
int int gr::filter::kernel::pfb_arb_resampler_fff::group_delay () const group_delay gr::filter::kernel::pfb_arb_resampler_fff::group_delay

Get the group delay of the filter.

float float gr::filter::kernel::pfb_arb_resampler_fff::phase_offset (float freq, float fs) phase_offset gr::filter::kernel::pfb_arb_resampler_fff::phase_offset float freq float fs

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

int int gr::filter::kernel::pfb_arb_resampler_fff::filter (float *output, float *input, int n_to_read, int &n_read) filter gr::filter::kernel::pfb_arb_resampler_fff::filter float * output float * input int n_to_read int & n_read

Performs the filter operation that resamples the signal.

This block takes in a stream of samples and outputs a resampled and filtered stream. This block should be called such that the output has `rate` * `n_to_read` amount of space available in the `output` buffer.

output

The output samples at the new sample rate.

input

An input vector of samples to be resampled

n_to_read

Number of samples to read from `input`.

n_read

(out) Number of samples actually read from `input`.

Number of samples put into `output`.

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

This 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=fft.window.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.

- gr::filter::kernel::pfb_arb_resampler_fff
  create_diff_taps
- gr::filter::kernel::pfb_arb_resampler_fff
  create_taps
- gr::filter::kernel::pfb_arb_resampler_fff
  d_acc
- gr::filter::kernel::pfb_arb_resampler_fff
  d_dec_rate
- gr::filter::kernel::pfb_arb_resampler_fff
  d_delay
- gr::filter::kernel::pfb_arb_resampler_fff
  d_diff_filters
- gr::filter::kernel::pfb_arb_resampler_fff
  d_dtaps
- gr::filter::kernel::pfb_arb_resampler_fff
  d_est_phase_change
- gr::filter::kernel::pfb_arb_resampler_fff
  d_filters
- gr::filter::kernel::pfb_arb_resampler_fff
  d_flt_rate
- gr::filter::kernel::pfb_arb_resampler_fff
  d_int_rate
- gr::filter::kernel::pfb_arb_resampler_fff
  d_last_filter
- gr::filter::kernel::pfb_arb_resampler_fff
  d_taps
- gr::filter::kernel::pfb_arb_resampler_fff
  d_taps_per_filter
- gr::filter::kernel::pfb_arb_resampler_fff
  decimation_rate
- gr::filter::kernel::pfb_arb_resampler_fff
  filter
- gr::filter::kernel::pfb_arb_resampler_fff
  fractional_rate
- gr::filter::kernel::pfb_arb_resampler_fff
  group_delay
- gr::filter::kernel::pfb_arb_resampler_fff
  interpolation_rate
- gr::filter::kernel::pfb_arb_resampler_fff
  operator=
- gr::filter::kernel::pfb_arb_resampler_fff
  pfb_arb_resampler_fff
- gr::filter::kernel::pfb_arb_resampler_fff
  pfb_arb_resampler_fff
- gr::filter::kernel::pfb_arb_resampler_fff
  phase
- gr::filter::kernel::pfb_arb_resampler_fff
  phase_offset
- gr::filter::kernel::pfb_arb_resampler_fff
  print_taps
- gr::filter::kernel::pfb_arb_resampler_fff
  set_phase
- gr::filter::kernel::pfb_arb_resampler_fff
  set_rate
- gr::filter::kernel::pfb_arb_resampler_fff
  set_taps
- gr::filter::kernel::pfb_arb_resampler_fff
  taps
- gr::filter::kernel::pfb_arb_resampler_fff
  taps_per_filter