GNU Radio 3.6.5 C++ API

pfb_synthesizer_ccf_impl.h

Go to the documentation of this file.
00001 /* -*- c++ -*- */
00002 /*
00003  * Copyright 2010,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_SYNTHESIZER_CCF_IMPL_H
00025 #define INCLUDED_PFB_SYNTHESIZER_CCF_IMPL_H
00026 
00027 #include <filter/pfb_synthesizer_ccf.h>
00028 #include <filter/fir_filter_with_buffer.h>
00029 #include <fft/fft.h>
00030 #include <gruel/thread.h>
00031 
00032 namespace gr {
00033   namespace filter {
00034     
00035     // While this is a polyphase_filterbank, we don't use the normal
00036     // parent class because we have to use the fir_filter_with_buffer
00037     // objects instead of normal filters.
00038 
00039     class FILTER_API pfb_synthesizer_ccf_impl : public pfb_synthesizer_ccf
00040     {
00041     private:
00042       bool              d_updated;
00043       unsigned int      d_numchans;
00044       unsigned int      d_taps_per_filter;
00045       fft::fft_complex *d_fft;
00046       std::vector< kernel::fir_filter_with_buffer_ccf*> d_filters;
00047       std::vector< std::vector<float> >                 d_taps;
00048       int              d_state;
00049       std::vector<int> d_channel_map;
00050       unsigned int     d_twox;
00051       gruel::mutex     d_mutex; // mutex to protect set/work access
00052 
00053       /*!
00054        * \brief Tap setting algorithm for critically sampled channels
00055        */
00056       void set_taps1(const std::vector<float> &taps);
00057 
00058       /*!
00059        * \brief Tap setting algorithm for 2x over-sampled channels
00060        */
00061       void set_taps2(const std::vector<float> &taps);
00062 
00063 
00064     public:
00065       pfb_synthesizer_ccf_impl(unsigned int numchans,
00066                                const std::vector<float> &taps,
00067                                bool twox);
00068       ~pfb_synthesizer_ccf_impl();
00069 
00070       void set_taps(const std::vector<float> &taps);
00071       std::vector<std::vector<float> > taps() const;
00072       void print_taps();
00073 
00074       void set_channel_map(const std::vector<int> &map);
00075       std::vector<int> channel_map() const;
00076 
00077       int work(int noutput_items,
00078                gr_vector_const_void_star &input_items,
00079                gr_vector_void_star &output_items);
00080     };
00081 
00082   } /* namespace filter */
00083 } /* namespace gr */
00084 
00085 #endif /* INCLUDED_PFB_SYNTHESIZER_CCF_IMPL_H */