root / gr-filter / include / filter / fir_filter_XXX.h.t @ e5aead88
History | View | Annotate | Download (2.5 kB)
| 1 | f64b971f | Tom Rondeau | /* -*- c++ -*- */ |
|---|---|---|---|
| 2 | f64b971f | Tom Rondeau | /* |
| 3 | f64b971f | Tom Rondeau | * Copyright 2004,2012 Free Software Foundation, Inc. |
| 4 | f64b971f | Tom Rondeau | * |
| 5 | f64b971f | Tom Rondeau | * This file is part of GNU Radio |
| 6 | f64b971f | Tom Rondeau | * |
| 7 | f64b971f | Tom Rondeau | * GNU Radio is free software; you can redistribute it and/or modify |
| 8 | f64b971f | Tom Rondeau | * it under the terms of the GNU General Public License as published by |
| 9 | f64b971f | Tom Rondeau | * the Free Software Foundation; either version 3, or (at your option) |
| 10 | f64b971f | Tom Rondeau | * any later version. |
| 11 | f64b971f | Tom Rondeau | * |
| 12 | f64b971f | Tom Rondeau | * GNU Radio is distributed in the hope that it will be useful, |
| 13 | f64b971f | Tom Rondeau | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 14 | f64b971f | Tom Rondeau | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 15 | f64b971f | Tom Rondeau | * GNU General Public License for more details. |
| 16 | f64b971f | Tom Rondeau | * |
| 17 | f64b971f | Tom Rondeau | * You should have received a copy of the GNU General Public License |
| 18 | f64b971f | Tom Rondeau | * along with GNU Radio; see the file COPYING. If not, write to |
| 19 | f64b971f | Tom Rondeau | * the Free Software Foundation, Inc., 51 Franklin Street, |
| 20 | f64b971f | Tom Rondeau | * Boston, MA 02110-1301, USA. |
| 21 | f64b971f | Tom Rondeau | */ |
| 22 | f64b971f | Tom Rondeau | |
| 23 | 32f807a8 | Tom Rondeau | /* @WARNING@ */ |
| 24 | 32f807a8 | Tom Rondeau | |
| 25 | 32f807a8 | Tom Rondeau | #ifndef @GUARD_NAME@ |
| 26 | 32f807a8 | Tom Rondeau | #define @GUARD_NAME@ |
| 27 | f64b971f | Tom Rondeau | |
| 28 | f64b971f | Tom Rondeau | #include <filter/api.h> |
| 29 | f64b971f | Tom Rondeau | #include <gr_sync_decimator.h> |
| 30 | f64b971f | Tom Rondeau | |
| 31 | f64b971f | Tom Rondeau | namespace gr {
|
| 32 | f64b971f | Tom Rondeau | namespace filter {
|
| 33 | f64b971f | Tom Rondeau | |
| 34 | 59ad06e0 | Tom Rondeau | /*! |
| 35 | 59ad06e0 | Tom Rondeau | * \brief FIR filter with @I_TYPE@ input, @O_TYPE@ output, and @TAP_TYPE@ taps |
| 36 | 59ad06e0 | Tom Rondeau | * \ingroup filter_blk |
| 37 | 59ad06e0 | Tom Rondeau | * |
| 38 | 59ad06e0 | Tom Rondeau | * The fir_filter_XXX blocks create finite impulse response |
| 39 | 59ad06e0 | Tom Rondeau | * (FIR) filters that perform the convolution in the time |
| 40 | 59ad06e0 | Tom Rondeau | * domain: |
| 41 | 59ad06e0 | Tom Rondeau | * |
| 42 | 59ad06e0 | Tom Rondeau | * \code |
| 43 | 59ad06e0 | Tom Rondeau | * out = 0 |
| 44 | 59ad06e0 | Tom Rondeau | * for i in ntaps: |
| 45 | 59ad06e0 | Tom Rondeau | * out += input[n-i] * taps[i] |
| 46 | 59ad06e0 | Tom Rondeau | * \endcode |
| 47 | 59ad06e0 | Tom Rondeau | * |
| 48 | 59ad06e0 | Tom Rondeau | * The taps are a C++ vector (or Python list) of values of the |
| 49 | 59ad06e0 | Tom Rondeau | * type specified by the third letter in the block's suffix. For |
| 50 | 59ad06e0 | Tom Rondeau | * this block, the value is of type @TAP_TYPE@. Taps can be |
| 51 | 59ad06e0 | Tom Rondeau | * created using the firdes or optfir tools. |
| 52 | 59ad06e0 | Tom Rondeau | * |
| 53 | 59ad06e0 | Tom Rondeau | * These versions of the filter can also act as down-samplers |
| 54 | 59ad06e0 | Tom Rondeau | * (or decimators) by specifying an integer value for \p |
| 55 | 59ad06e0 | Tom Rondeau | * decimation. |
| 56 | 59ad06e0 | Tom Rondeau | * |
| 57 | 59ad06e0 | Tom Rondeau | */ |
| 58 | 32f807a8 | Tom Rondeau | class FILTER_API @BASE_NAME@ : virtual public gr_sync_decimator |
| 59 | f64b971f | Tom Rondeau | {
|
| 60 | f64b971f | Tom Rondeau | public: |
| 61 | f64b971f | Tom Rondeau | |
| 62 | 32f807a8 | Tom Rondeau | // gr::filter::@BASE_NAME@::sptr |
| 63 | 32f807a8 | Tom Rondeau | typedef boost::shared_ptr<@BASE_NAME@> sptr; |
| 64 | f64b971f | Tom Rondeau | |
| 65 | f64b971f | Tom Rondeau | /*! |
| 66 | 32f807a8 | Tom Rondeau | * \brief FIR filter with @I_TYPE@ input, @O_TYPE@ output, and @TAP_TYPE@ taps |
| 67 | f64b971f | Tom Rondeau | * \ingroup filter_blk |
| 68 | 59ad06e0 | Tom Rondeau | * |
| 69 | 59ad06e0 | Tom Rondeau | * \param decimation set the integer decimation rate |
| 70 | 59ad06e0 | Tom Rondeau | * \param taps a vector/list of taps of type @TAP_TYPE@ |
| 71 | f64b971f | Tom Rondeau | */ |
| 72 | f64b971f | Tom Rondeau | static FILTER_API sptr make(int decimation, |
| 73 | 32f807a8 | Tom Rondeau | const std::vector<@TAP_TYPE@> &taps); |
| 74 | f64b971f | Tom Rondeau | |
| 75 | f5449ce2 | Tom Rondeau | virtual void set_taps(const std::vector<@TAP_TYPE@> &taps) = 0; |
| 76 | f5449ce2 | Tom Rondeau | virtual std::vector<@TAP_TYPE@> taps() const = 0; |
| 77 | f64b971f | Tom Rondeau | }; |
| 78 | f64b971f | Tom Rondeau | |
| 79 | f64b971f | Tom Rondeau | } /* namespace filter */ |
| 80 | f64b971f | Tom Rondeau | } /* namespace gr */ |
| 81 | f64b971f | Tom Rondeau | |
| 82 | 32f807a8 | Tom Rondeau | #endif /* @GUARD_NAME@ */ |