GNU Radio 3.6.5 C++ API

pfb_interpolator_ccf.h

Go to the documentation of this file.
00001 /* -*- c++ -*- */
00002 /*
00003  * Copyright 2009,2012 Free Software Foundation, Inc.
00004  *
00005  * This file is part of GNU Radio
00006  *
00007  * GNU Radio is free software; you can redistribute it and/or modify
00008  * it under the terms of the GNU General Public License as published by
00009  * the Free Software Foundation; either version 3, or (at your option)
00010  * any later version.
00011  *
00012  * GNU Radio is distributed in the hope that it will be useful,
00013  * but WITHOUT ANY WARRANTY; without even the implied warranty of
00014  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00015  * GNU General Public License for more details.
00016  *
00017  * You should have received a copy of the GNU General Public License
00018  * along with GNU Radio; see the file COPYING.  If not, write to
00019  * the Free Software Foundation, Inc., 51 Franklin Street,
00020  * Boston, MA 02110-1301, USA.
00021  */
00022 
00023 
00024 #ifndef INCLUDED_PFB_INTERPOLATOR_CCF_H
00025 #define INCLUDED_PFB_INTERPOLATOR_CCF_H
00026 
00027 #include <filter/api.h>
00028 #include <gr_sync_interpolator.h>
00029 
00030 namespace gr {
00031   namespace filter {
00032 
00033     /*!
00034      * \brief Polyphase filterbank interpolator with gr_complex input,
00035      * gr_complex output and float taps
00036      * \ingroup channelizers_blk
00037      *
00038      * \details
00039      * This block takes in a signal stream and performs interger up-
00040      * sampling (interpolation) with a polyphase filterbank. The first
00041      * input is the integer specifying how much to interpolate by. The
00042      * second input is a vector (Python list) of floating-point taps
00043      * of the prototype filter.
00044      *
00045      * The filter's taps should be based on the interpolation rate
00046      * specified. That is, the bandwidth specified is relative to the
00047      * bandwidth after interpolation.
00048      *
00049      * For example, using the GNU Radio's firdes utility to building
00050      * filters, we build a low-pass filter with a sampling rate of
00051      * <EM>fs</EM>, a 3-dB bandwidth of <EM>BW</EM> and a transition
00052      * bandwidth of <EM>TB</EM>. We can also specify the out-of-band
00053      * attenuation to use, ATT, and the filter window function (a
00054      * Blackman-harris window in this case). The first input is the
00055      * gain, which is also specified as the interpolation rate so that
00056      * the output levels are the same as the input (this creates an
00057      * overall increase in power).
00058      *
00059      *   <B><EM>self._taps = filter.firdes.low_pass_2(interp, interp*fs, BW, TB,
00060      *      attenuation_dB=ATT, window=filter.firdes.WIN_BLACKMAN_hARRIS)</EM></B>
00061      *
00062      * The PFB interpolator code takes the taps generated above and
00063      * builds a set of filters. The set contains <EM>interp</EM>
00064      * number of filters and each filter contains
00065      * ceil(taps.size()/interp) number of taps. Each tap from the
00066      * filter prototype is sequentially inserted into the next
00067      * filter. When all of the input taps are used, the remaining
00068      * filters in the filterbank are filled out with 0's to make sure
00069      * each filter has the same number of taps.
00070      *
00071      * The theory behind this block can be found in Chapter 7.1 of the
00072      * following book.
00073      *
00074      *    <B><EM>f. harris, "Multirate Signal Processing for Communication
00075      *       Systems</EM>," Upper Saddle River, NJ: Prentice Hall,
00076      *       Inc. 2004.</EM></B>
00077      */
00078 
00079     class FILTER_API pfb_interpolator_ccf : virtual public gr_sync_interpolator
00080     {
00081     public:
00082       // gr::filter::pfb_interpolator_ccf::sptr
00083       typedef boost::shared_ptr<pfb_interpolator_ccf> sptr;
00084 
00085       /*!
00086        * Build the polyphase filterbank interpolator.
00087        * \param interp  (unsigned integer) Specifies the interpolation rate to use
00088        * \param taps    (vector/list of floats) The prototype filter to populate the filterbank. The taps
00089        *                                        should be generated at the interpolated sampling rate.
00090        */
00091       static sptr make(unsigned int interp,
00092                                   const std::vector<float> &taps);
00093 
00094       /*!
00095        * Resets the filterbank's filter taps with the new prototype filter
00096        * \param taps    (vector/list of floats) The prototype filter to populate the filterbank.
00097        *                The taps should be generated at the interpolated sampling rate.
00098        */
00099       virtual void set_taps(const std::vector<float> &taps) = 0;
00100 
00101       /*!
00102        * Return a vector<vector<>> of the filterbank taps
00103        */
00104       virtual std::vector<std::vector<float> > taps() const = 0;
00105 
00106       /*!
00107        * Print all of the filterbank taps to screen.
00108        */
00109       virtual void print_taps() = 0;
00110     };
00111 
00112   } /* namespace filter */
00113 } /* namespace gr */
00114 
00115 #endif /* INCLUDED_FILTER_PFB_INTERPOLATOR_CCF_H */