13#include <boost/scoped_array.hpp>
26 typedef std::shared_ptr<filter_info_base>
sptr;
30 : _type(type), _bypass(bypass), _position_index(position_index)
62 std::string _analog_type;
65 typedef std::shared_ptr<analog_filter_base>
sptr;
68 size_t position_index,
69 const std::string& analog_type)
89 typedef std::shared_ptr<analog_filter_lp>
sptr;
92 size_t position_index,
93 const std::string& analog_type,
121template <
typename tap_t>
133 typedef std::shared_ptr<digital_filter_base>
sptr;
136 size_t position_index,
138 size_t interpolation,
140 double tap_full_scale,
142 const std::vector<tap_t>& taps)
145 , _interpolation(interpolation)
146 , _decimation(decimation)
147 , _tap_full_scale(tap_full_scale)
148 , _max_num_taps(max_num_taps)
156 return (_bypass ? _rate : (_rate / _decimation * _interpolation));
166 return _interpolation;
176 return _tap_full_scale;
186 std::ostringstream os;
188 <<
"\tinput rate: " << _rate << std::endl
189 <<
"\tinterpolation: " << _interpolation << std::endl
190 <<
"\tdecimation: " << _decimation << std::endl
191 <<
"\tfull-scale: " << _tap_full_scale << std::endl
192 <<
"\tmax num taps: " << _max_num_taps << std::endl
193 <<
"\ttaps: " << std::endl;
196 for (
size_t i = 0; i < _taps.size(); i++) {
197 os <<
"(tap " << i <<
": " << _taps[i] <<
")";
198 if (((i % 10) == 0) && (i != 0)) {
199 os << std::endl <<
"\t\t";
203 return std::string(os.str());
207template <
typename tap_t>
211 typedef std::shared_ptr<digital_filter_fir<tap_t>>
sptr;
215 size_t position_index,
217 size_t interpolation,
219 size_t tap_bit_width,
221 const std::vector<tap_t>& taps)
237 std::size_t num_taps = taps.size();
238 if (num_taps < this->_max_num_taps) {
240 "coefficients. Appending zeros";
241 std::vector<tap_t> coeffs;
242 for (
size_t i = 0; i < this->_max_num_taps; i++) {
244 coeffs.push_back(taps[i]);
249 this->_taps = coeffs;
Definition: filters.hpp:61
UHD_INLINE const std::string & get_analog_type()
Definition: filters.hpp:75
std::string to_pp_string() override
analog_filter_base(filter_type type, bool bypass, size_t position_index, const std::string &analog_type)
Definition: filters.hpp:66
std::shared_ptr< analog_filter_base > sptr
Definition: filters.hpp:65
Definition: filters.hpp:84
std::shared_ptr< analog_filter_lp > sptr
Definition: filters.hpp:89
analog_filter_lp(filter_type type, bool bypass, size_t position_index, const std::string &analog_type, double cutoff, double rolloff)
Definition: filters.hpp:90
std::string to_pp_string() override
UHD_INLINE double get_cutoff()
Definition: filters.hpp:103
UHD_INLINE void set_cutoff(const double cutoff)
Definition: filters.hpp:113
UHD_INLINE double get_rolloff()
Definition: filters.hpp:108
Definition: filters.hpp:123
uint32_t _decimation
Definition: filters.hpp:127
std::string to_pp_string() override
Definition: filters.hpp:184
std::shared_ptr< digital_filter_base > sptr
Definition: filters.hpp:133
tap_t _tap_full_scale
Definition: filters.hpp:128
UHD_INLINE std::vector< tap_t > & get_taps()
Definition: filters.hpp:179
UHD_INLINE double get_interpolation()
Definition: filters.hpp:164
uint32_t _interpolation
Definition: filters.hpp:126
UHD_INLINE double get_output_rate()
Definition: filters.hpp:154
UHD_INLINE double get_tap_full_scale()
Definition: filters.hpp:174
digital_filter_base(filter_type type, bool bypass, size_t position_index, double rate, size_t interpolation, size_t decimation, double tap_full_scale, size_t max_num_taps, const std::vector< tap_t > &taps)
Definition: filters.hpp:134
double _rate
Definition: filters.hpp:125
UHD_INLINE double get_input_rate()
Definition: filters.hpp:159
UHD_INLINE double get_decimation()
Definition: filters.hpp:169
uint32_t _max_num_taps
Definition: filters.hpp:129
std::vector< tap_t > _taps
Definition: filters.hpp:130
Definition: filters.hpp:209
std::shared_ptr< digital_filter_fir< tap_t > > sptr
Definition: filters.hpp:211
void set_taps(const std::vector< tap_t > &taps)
Definition: filters.hpp:235
digital_filter_fir(filter_info_base::filter_type type, bool bypass, size_t position_index, double rate, size_t interpolation, size_t decimation, size_t tap_bit_width, size_t max_num_taps, const std::vector< tap_t > &taps)
Definition: filters.hpp:213
Definition: filters.hpp:24
UHD_INLINE filter_type get_type()
Definition: filters.hpp:40
virtual std::string to_pp_string()
virtual ~filter_info_base()
Definition: filters.hpp:45
size_t _position_index
Definition: filters.hpp:55
filter_type _type
Definition: filters.hpp:53
filter_type
Definition: filters.hpp:27
@ ANALOG_BAND_PASS
Definition: filters.hpp:27
virtual UHD_INLINE bool is_bypassed()
Definition: filters.hpp:35
std::shared_ptr< filter_info_base > sptr
Definition: filters.hpp:26
filter_info_base(filter_type type, bool bypass, size_t position_index)
Definition: filters.hpp:29
bool _bypass
Definition: filters.hpp:54
#define UHD_INLINE
Definition: config.h:65
#define UHD_API
Definition: config.h:87
#define UHD_LOGGER_WARNING(component)
Definition: log.hpp:264
Definition: build_info.hpp:12
UHD_API std::ostream & operator<<(std::ostream &os, filter_info_base &f)