GNU Radio Manual and C++ API Reference 3.10.5.1
The Free & Open Software Radio Ecosystem
fir_filter.h
Go to the documentation of this file.
1/* -*- c++ -*- */
2/*
3 * Copyright 2004,2010,2012,2018 Free Software Foundation, Inc.
4 *
5 * This file is part of GNU Radio
6 *
7 * SPDX-License-Identifier: GPL-3.0-or-later
8 *
9 */
10
11#ifndef INCLUDED_FILTER_FIR_FILTER_H
12#define INCLUDED_FILTER_FIR_FILTER_H
13
14#include <gnuradio/filter/api.h>
15#include <gnuradio/gr_complex.h>
16#include <volk/volk_alloc.hh>
17#include <cstdint>
18#include <vector>
19
20namespace gr {
21namespace filter {
22namespace kernel {
23
24template <class IN_T, class OUT_T, class TAP_T>
26{
27public:
28 fir_filter(const std::vector<TAP_T>& taps);
29
30 // Disallow copy.
31 //
32 // This prevents accidentally doing needless copies, not just of fir_filter,
33 // but every block that contains one.
34 fir_filter(const fir_filter&) = delete;
35 fir_filter& operator=(const fir_filter&) = delete;
36 fir_filter(fir_filter&&) = default;
38
39 void set_taps(const std::vector<TAP_T>& taps);
40 void update_tap(TAP_T t, unsigned int index);
41 std::vector<TAP_T> taps() const;
42 unsigned int ntaps() const;
43
44 OUT_T filter(const IN_T input[]) const;
45 void filterN(OUT_T output[], const IN_T input[], unsigned long n);
46 void filterNdec(OUT_T output[],
47 const IN_T input[],
48 unsigned long n,
49 unsigned int decimate);
50
51protected:
52 std::vector<TAP_T> d_taps;
53 unsigned int d_ntaps;
54 std::vector<volk::vector<TAP_T>> d_aligned_taps;
55 volk::vector<OUT_T> d_output;
58};
65} /* namespace kernel */
66} /* namespace filter */
67} /* namespace gr */
68
69#endif /* INCLUDED_FILTER_FIR_FILTER_H */
Definition: fir_filter.h:26
void filterN(OUT_T output[], const IN_T input[], unsigned long n)
int d_naligned
Definition: fir_filter.h:57
std::vector< volk::vector< TAP_T > > d_aligned_taps
Definition: fir_filter.h:54
void filterNdec(OUT_T output[], const IN_T input[], unsigned long n, unsigned int decimate)
std::vector< TAP_T > taps() const
fir_filter(const std::vector< TAP_T > &taps)
void update_tap(TAP_T t, unsigned int index)
fir_filter & operator=(fir_filter &&)=default
fir_filter & operator=(const fir_filter &)=delete
int d_align
Definition: fir_filter.h:56
std::vector< TAP_T > d_taps
Definition: fir_filter.h:52
unsigned int ntaps() const
volk::vector< OUT_T > d_output
Definition: fir_filter.h:55
fir_filter(const fir_filter &)=delete
unsigned int d_ntaps
Definition: fir_filter.h:53
OUT_T filter(const IN_T input[]) const
void set_taps(const std::vector< TAP_T > &taps)
fir_filter(fir_filter &&)=default
#define FILTER_API
Definition: gr-filter/include/gnuradio/filter/api.h:18
static constexpr float taps[NSTEPS+1][NTAPS]
Definition: interpolator_taps.h:9
fir_filter< gr_complex, gr_complex, float > fir_filter_ccf
Definition: fir_filter.h:60
fir_filter< float, std::int16_t, float > fir_filter_fsf
Definition: fir_filter.h:64
fir_filter< gr_complex, gr_complex, gr_complex > fir_filter_ccc
Definition: fir_filter.h:62
fir_filter< std::int16_t, gr_complex, gr_complex > fir_filter_scc
Definition: fir_filter.h:63
fir_filter< float, gr_complex, gr_complex > fir_filter_fcc
Definition: fir_filter.h:61
fir_filter< float, float, float > fir_filter_fff
Definition: fir_filter.h:59
GNU Radio logging wrapper.
Definition: basic_block.h:29