GNU Radio v3.6.2-149-ga6d285d9 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      * \class gr_pfb_interpolator_ccf
00035      *
00036      * \brief Polyphase filterbank interpolator with gr_complex input,
00037      * gr_complex output and float taps
00038      *
00039      * \ingroup filter_blk
00040      * \ingroup pfb_blk
00041      *
00042      * This block takes in a signal stream and performs interger up-
00043      * sampling (interpolation) with a polyphase filterbank. The first
00044      * input is the integer specifying how much to interpolate by. The
00045      * second input is a vector (Python list) of floating-point taps
00046      * of the prototype filter.
00047      *
00048      * The filter's taps should be based on the interpolation rate
00049      * specified. That is, the bandwidth specified is relative to the
00050      * bandwidth after interpolation.
00051      *
00052      * For example, using the GNU Radio's firdes utility to building
00053      * filters, we build a low-pass filter with a sampling rate of
00054      * <EM>fs</EM>, a 3-dB bandwidth of <EM>BW</EM> and a transition
00055      * bandwidth of <EM>TB</EM>. We can also specify the out-of-band
00056      * attenuation to use, ATT, and the filter window function (a
00057      * Blackman-harris window in this case). The first input is the
00058      * gain, which is also specified as the interpolation rate so that
00059      * the output levels are the same as the input (this creates an
00060      * overall increase in power).
00061      *
00062      *   <B><EM>self._taps = filter.firdes.low_pass_2(interp, interp*fs, BW, TB,
00063      *      attenuation_dB=ATT, window=filter.firdes.WIN_BLACKMAN_hARRIS)</EM></B>
00064      *
00065      * The PFB interpolator code takes the taps generated above and
00066      * builds a set of filters. The set contains <EM>interp</EM>
00067      * number of filters and each filter contains
00068      * ceil(taps.size()/interp) number of taps. Each tap from the
00069      * filter prototype is sequentially inserted into the next
00070      * filter. When all of the input taps are used, the remaining
00071      * filters in the filterbank are filled out with 0's to make sure
00072      * each filter has the same number of taps.
00073      *
00074      * The theory behind this block can be found in Chapter 7.1 of the
00075      * following book.
00076      *
00077      *    <B><EM>f. harris, "Multirate Signal Processing for Communication
00078      *       Systems</EM>," Upper Saddle River, NJ: Prentice Hall,
00079      *       Inc. 2004.</EM></B>
00080      */
00081 
00082     class FILTER_API pfb_interpolator_ccf : virtual public gr_sync_interpolator
00083     {
00084     public:
00085       // gr::filter::pfb_interpolator_ccf::sptr
00086       typedef boost::shared_ptr<pfb_interpolator_ccf> sptr;
00087 
00088       /*!
00089        * Build the polyphase filterbank interpolator.
00090        * \param interp  (unsigned integer) Specifies the interpolation rate to use
00091        * \param taps    (vector/list of floats) The prototype filter to populate the filterbank. The taps
00092        *                                        should be generated at the interpolated sampling rate.
00093        */
00094       static sptr make(unsigned int interp,
00095                                   const std::vector<float> &taps);
00096 
00097       /*!
00098        * Resets the filterbank's filter taps with the new prototype filter
00099        * \param taps    (vector/list of floats) The prototype filter to populate the filterbank.
00100        *                The taps should be generated at the interpolated sampling rate.
00101        */
00102       virtual void set_taps(const std::vector<float> &taps) = 0;
00103 
00104       /*!
00105        * Return a vector<vector<>> of the filterbank taps
00106        */
00107       virtual std::vector<std::vector<float> > taps() const = 0;
00108 
00109       /*!
00110        * Print all of the filterbank taps to screen.
00111        */
00112       virtual void print_taps() = 0;
00113     };
00114 
00115   } /* namespace filter */
00116 } /* namespace gr */
00117 
00118 #endif /* INCLUDED_FILTER_PFB_INTERPOLATOR_CCF_H */