2012-07-18 13:29:18 +00:00
|
|
|
/*!
|
|
|
|
* \file freq_xlating_fir_filter.cc
|
2017-11-06 09:33:08 +00:00
|
|
|
* \brief Adapts a gnuradio gr_freq_xlating_fir_filter designed with gr_remez or gr_firdes
|
2012-07-18 13:29:18 +00:00
|
|
|
* \author Luis Esteve, 2012. luis(at)epsilon-formacion.com
|
2017-11-06 09:33:08 +00:00
|
|
|
* Antonio Ramos, 2017. antonio.ramos(at)cttc.es
|
2012-07-18 13:29:18 +00:00
|
|
|
*
|
|
|
|
* -------------------------------------------------------------------------
|
|
|
|
*
|
2019-07-26 10:38:20 +00:00
|
|
|
* Copyright (C) 2010-2019 (see AUTHORS file for a list of contributors)
|
2012-07-18 13:29:18 +00:00
|
|
|
*
|
|
|
|
* GNSS-SDR is a software defined Global Navigation
|
|
|
|
* Satellite Systems receiver
|
|
|
|
*
|
|
|
|
* This file is part of GNSS-SDR.
|
|
|
|
*
|
2020-02-08 00:20:02 +00:00
|
|
|
* SPDX-License-Identifier: GPL-3.0-or-later
|
2012-07-18 13:29:18 +00:00
|
|
|
*
|
|
|
|
* -------------------------------------------------------------------------
|
|
|
|
*/
|
|
|
|
|
|
|
|
#include "freq_xlating_fir_filter.h"
|
2018-02-26 02:15:53 +00:00
|
|
|
#include "configuration_interface.h"
|
2018-12-09 21:00:09 +00:00
|
|
|
#include <glog/logging.h>
|
2013-07-04 13:47:40 +00:00
|
|
|
#include <gnuradio/blocks/file_sink.h>
|
2017-11-06 09:32:11 +00:00
|
|
|
#include <gnuradio/filter/firdes.h>
|
2018-12-09 21:00:09 +00:00
|
|
|
#include <gnuradio/filter/pm_remez.h>
|
2015-02-04 17:04:51 +00:00
|
|
|
#include <volk/volk.h>
|
2018-12-09 21:00:09 +00:00
|
|
|
#include <utility>
|
2012-07-18 13:29:18 +00:00
|
|
|
|
|
|
|
|
|
|
|
FreqXlatingFirFilter::FreqXlatingFirFilter(ConfigurationInterface* configuration, std::string role,
|
2018-12-03 14:43:43 +00:00
|
|
|
unsigned int in_streams, unsigned int out_streams) : config_(configuration), role_(std::move(role)), in_streams_(in_streams), out_streams_(out_streams)
|
2012-07-18 13:29:18 +00:00
|
|
|
{
|
2018-08-02 10:46:08 +00:00
|
|
|
std::string default_input_item_type = "gr_complex";
|
|
|
|
std::string default_output_item_type = "gr_complex";
|
|
|
|
std::string default_taps_item_type = "float";
|
|
|
|
std::string default_dump_filename = "../data/input_filter.dat";
|
|
|
|
double default_intermediate_freq = 0.0;
|
|
|
|
double default_sampling_freq = 4000000.0;
|
|
|
|
int default_number_of_taps = 6;
|
|
|
|
unsigned int default_number_of_bands = 2;
|
|
|
|
std::vector<double> default_bands = {0.0, 0.4, 0.6, 1.0};
|
|
|
|
std::vector<double> default_ampl = {1.0, 1.0, 0.0, 0.0};
|
|
|
|
std::vector<double> default_error_w = {1.0, 1.0};
|
|
|
|
std::string default_filter_type = "bandpass";
|
|
|
|
int default_grid_density = 16;
|
2012-11-01 17:01:29 +00:00
|
|
|
int default_decimation_factor = 1;
|
2018-08-02 10:46:08 +00:00
|
|
|
|
|
|
|
DLOG(INFO) << "role " << role_;
|
|
|
|
|
|
|
|
input_item_type_ = config_->property(role_ + ".input_item_type", default_input_item_type);
|
|
|
|
output_item_type_ = config_->property(role_ + ".output_item_type", default_output_item_type);
|
|
|
|
taps_item_type_ = config_->property(role_ + ".taps_item_type", default_taps_item_type);
|
|
|
|
dump_ = config_->property(role_ + ".dump", false);
|
|
|
|
dump_filename_ = config_->property(role_ + ".dump_filename", default_dump_filename);
|
|
|
|
intermediate_freq_ = config_->property(role_ + ".IF", default_intermediate_freq);
|
|
|
|
sampling_freq_ = config_->property(role_ + ".sampling_frequency", default_sampling_freq);
|
|
|
|
int number_of_taps = config_->property(role_ + ".number_of_taps", default_number_of_taps);
|
|
|
|
unsigned int number_of_bands = config_->property(role_ + ".number_of_bands", default_number_of_bands);
|
|
|
|
std::string filter_type = config_->property(role_ + ".filter_type", default_filter_type);
|
|
|
|
decimation_factor_ = config_->property(role_ + ".decimation_factor", default_decimation_factor);
|
|
|
|
|
2018-12-03 11:52:17 +00:00
|
|
|
if (filter_type != "lowpass")
|
2018-08-02 10:46:08 +00:00
|
|
|
{
|
|
|
|
std::vector<double> taps_d;
|
|
|
|
std::vector<double> bands;
|
|
|
|
std::vector<double> ampl;
|
|
|
|
std::vector<double> error_w;
|
|
|
|
std::string option;
|
|
|
|
double option_value;
|
|
|
|
|
|
|
|
for (unsigned int i = 0; i < number_of_bands; i++)
|
|
|
|
{
|
2018-12-03 22:34:29 +00:00
|
|
|
option = ".band" + std::to_string(i + 1) + "_begin";
|
2018-08-02 10:46:08 +00:00
|
|
|
option_value = config_->property(role_ + option, default_bands[i]);
|
|
|
|
bands.push_back(option_value);
|
|
|
|
|
2018-12-03 22:34:29 +00:00
|
|
|
option = ".band" + std::to_string(i + 1) + "_end";
|
2018-08-02 10:46:08 +00:00
|
|
|
option_value = config_->property(role_ + option, default_bands[i]);
|
|
|
|
bands.push_back(option_value);
|
|
|
|
|
2018-12-03 22:34:29 +00:00
|
|
|
option = ".ampl" + std::to_string(i + 1) + "_begin";
|
2018-08-02 10:46:08 +00:00
|
|
|
option_value = config_->property(role_ + option, default_bands[i]);
|
|
|
|
ampl.push_back(option_value);
|
|
|
|
|
2018-12-03 22:34:29 +00:00
|
|
|
option = ".ampl" + std::to_string(i + 1) + "_end";
|
2018-08-02 10:46:08 +00:00
|
|
|
option_value = config_->property(role_ + option, default_bands[i]);
|
|
|
|
ampl.push_back(option_value);
|
|
|
|
|
2018-12-03 22:34:29 +00:00
|
|
|
option = ".band" + std::to_string(i + 1) + "_error";
|
2018-08-02 10:46:08 +00:00
|
|
|
option_value = config_->property(role_ + option, default_bands[i]);
|
|
|
|
error_w.push_back(option_value);
|
|
|
|
}
|
|
|
|
|
|
|
|
int grid_density = config_->property(role_ + ".grid_density", default_grid_density);
|
|
|
|
taps_d = gr::filter::pm_remez(number_of_taps - 1, bands, ampl, error_w, filter_type, grid_density);
|
|
|
|
taps_.reserve(taps_d.size());
|
2018-12-03 22:34:29 +00:00
|
|
|
for (double& it : taps_d)
|
2018-08-02 10:46:08 +00:00
|
|
|
{
|
2018-12-03 17:03:25 +00:00
|
|
|
taps_.push_back(static_cast<float>(it));
|
2018-08-02 10:46:08 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
double default_bw = (sampling_freq_ / decimation_factor_) / 2;
|
|
|
|
double bw_ = config_->property(role_ + ".bw", default_bw);
|
|
|
|
double default_tw = bw_ / 10.0;
|
|
|
|
double tw_ = config_->property(role_ + ".tw", default_tw);
|
|
|
|
taps_ = gr::filter::firdes::low_pass(1.0, sampling_freq_, bw_, tw_);
|
|
|
|
}
|
|
|
|
|
|
|
|
size_t item_size;
|
2019-07-21 17:32:52 +00:00
|
|
|
LOG(INFO) << "Created freq_xlating_fir_filter with " << taps_.size() << " taps";
|
2018-12-03 11:52:17 +00:00
|
|
|
if ((taps_item_type_ == "float") && (input_item_type_ == "gr_complex") && (output_item_type_ == "gr_complex"))
|
2012-07-18 13:29:18 +00:00
|
|
|
{
|
2019-08-18 20:16:13 +00:00
|
|
|
item_size = sizeof(gr_complex); // output
|
|
|
|
input_size_ = sizeof(gr_complex); // input
|
2018-08-02 10:46:08 +00:00
|
|
|
freq_xlating_fir_filter_ccf_ = gr::filter::freq_xlating_fir_filter_ccf::make(decimation_factor_, taps_, intermediate_freq_, sampling_freq_);
|
2012-07-18 13:29:18 +00:00
|
|
|
DLOG(INFO) << "input_filter(" << freq_xlating_fir_filter_ccf_->unique_id() << ")";
|
|
|
|
}
|
2018-12-03 11:52:17 +00:00
|
|
|
else if ((taps_item_type_ == "float") && (input_item_type_ == "float") && (output_item_type_ == "gr_complex"))
|
2013-10-14 16:51:47 +00:00
|
|
|
{
|
|
|
|
item_size = sizeof(gr_complex);
|
2019-08-18 20:16:13 +00:00
|
|
|
input_size_ = sizeof(float); // input
|
2018-08-02 10:46:08 +00:00
|
|
|
freq_xlating_fir_filter_fcf_ = gr::filter::freq_xlating_fir_filter_fcf::make(decimation_factor_, taps_, intermediate_freq_, sampling_freq_);
|
2013-10-14 16:51:47 +00:00
|
|
|
DLOG(INFO) << "input_filter(" << freq_xlating_fir_filter_fcf_->unique_id() << ")";
|
|
|
|
}
|
2018-12-03 11:52:17 +00:00
|
|
|
else if ((taps_item_type_ == "float") && (input_item_type_ == "short") && (output_item_type_ == "gr_complex"))
|
2014-11-29 13:00:15 +00:00
|
|
|
{
|
|
|
|
item_size = sizeof(gr_complex);
|
2019-08-18 20:16:13 +00:00
|
|
|
input_size_ = sizeof(int16_t); // input
|
2018-08-02 10:46:08 +00:00
|
|
|
freq_xlating_fir_filter_scf_ = gr::filter::freq_xlating_fir_filter_scf::make(decimation_factor_, taps_, intermediate_freq_, sampling_freq_);
|
2014-11-29 13:00:15 +00:00
|
|
|
DLOG(INFO) << "input_filter(" << freq_xlating_fir_filter_scf_->unique_id() << ")";
|
|
|
|
}
|
2018-12-03 11:52:17 +00:00
|
|
|
else if ((taps_item_type_ == "float") && (input_item_type_ == "short") && (output_item_type_ == "cshort"))
|
2015-02-04 20:45:16 +00:00
|
|
|
{
|
|
|
|
item_size = sizeof(lv_16sc_t);
|
2019-08-18 20:16:13 +00:00
|
|
|
input_size_ = sizeof(int16_t); // input
|
2018-08-02 10:46:08 +00:00
|
|
|
freq_xlating_fir_filter_scf_ = gr::filter::freq_xlating_fir_filter_scf::make(decimation_factor_, taps_, intermediate_freq_, sampling_freq_);
|
2015-02-04 20:45:16 +00:00
|
|
|
DLOG(INFO) << "input_filter(" << freq_xlating_fir_filter_scf_->unique_id() << ")";
|
|
|
|
complex_to_float_ = gr::blocks::complex_to_float::make();
|
|
|
|
float_to_short_1_ = gr::blocks::float_to_short::make();
|
|
|
|
float_to_short_2_ = gr::blocks::float_to_short::make();
|
|
|
|
short_x2_to_cshort_ = make_short_x2_to_cshort();
|
|
|
|
}
|
2018-12-03 11:52:17 +00:00
|
|
|
else if ((taps_item_type_ == "float") && (input_item_type_ == "byte") && (output_item_type_ == "gr_complex"))
|
2015-02-04 17:04:51 +00:00
|
|
|
{
|
|
|
|
item_size = sizeof(gr_complex);
|
2019-08-18 20:16:13 +00:00
|
|
|
input_size_ = sizeof(int8_t); // input
|
2015-02-04 20:45:16 +00:00
|
|
|
gr_char_to_short_ = gr::blocks::char_to_short::make();
|
2018-08-02 10:46:08 +00:00
|
|
|
freq_xlating_fir_filter_scf_ = gr::filter::freq_xlating_fir_filter_scf::make(decimation_factor_, taps_, intermediate_freq_, sampling_freq_);
|
2015-02-04 17:04:51 +00:00
|
|
|
DLOG(INFO) << "input_filter(" << freq_xlating_fir_filter_scf_->unique_id() << ")";
|
|
|
|
}
|
2018-12-03 11:52:17 +00:00
|
|
|
else if ((taps_item_type_ == "float") && (input_item_type_ == "byte") && (output_item_type_ == "cbyte"))
|
2015-02-04 20:45:16 +00:00
|
|
|
{
|
|
|
|
item_size = sizeof(lv_8sc_t);
|
2019-08-18 20:16:13 +00:00
|
|
|
input_size_ = sizeof(int8_t); // input
|
2015-02-04 20:45:16 +00:00
|
|
|
gr_char_to_short_ = gr::blocks::char_to_short::make();
|
2018-08-02 10:46:08 +00:00
|
|
|
freq_xlating_fir_filter_scf_ = gr::filter::freq_xlating_fir_filter_scf::make(decimation_factor_, taps_, intermediate_freq_, sampling_freq_);
|
2015-02-04 20:45:16 +00:00
|
|
|
DLOG(INFO) << "input_filter(" << freq_xlating_fir_filter_scf_->unique_id() << ")";
|
|
|
|
complex_to_complex_byte_ = make_complex_float_to_complex_byte();
|
|
|
|
}
|
2012-07-18 13:29:18 +00:00
|
|
|
else
|
|
|
|
{
|
2015-02-05 00:14:04 +00:00
|
|
|
LOG(ERROR) << " Unknown input filter input/output item type conversion";
|
2019-08-18 20:16:13 +00:00
|
|
|
item_size = sizeof(gr_complex); // avoids uninitialization
|
|
|
|
input_size_ = sizeof(gr_complex); // avoids uninitialization
|
2012-07-18 13:29:18 +00:00
|
|
|
}
|
2013-10-14 16:51:47 +00:00
|
|
|
|
2012-07-18 13:29:18 +00:00
|
|
|
if (dump_)
|
|
|
|
{
|
|
|
|
DLOG(INFO) << "Dumping output into file " << dump_filename_;
|
2013-11-17 10:48:27 +00:00
|
|
|
std::cout << "Dumping output into file " << dump_filename_ << std::endl;
|
2013-07-04 13:47:40 +00:00
|
|
|
file_sink_ = gr::blocks::file_sink::make(item_size, dump_filename_.c_str());
|
2012-07-18 13:29:18 +00:00
|
|
|
}
|
2018-06-03 17:11:16 +00:00
|
|
|
if (in_streams_ > 1)
|
|
|
|
{
|
|
|
|
LOG(ERROR) << "This implementation only supports one input stream";
|
|
|
|
}
|
|
|
|
if (out_streams_ > 1)
|
|
|
|
{
|
|
|
|
LOG(ERROR) << "This implementation only supports one output stream";
|
|
|
|
}
|
2012-07-18 13:29:18 +00:00
|
|
|
}
|
|
|
|
|
2012-11-01 17:01:29 +00:00
|
|
|
|
2013-07-04 13:47:40 +00:00
|
|
|
void FreqXlatingFirFilter::connect(gr::top_block_sptr top_block)
|
2012-07-18 13:29:18 +00:00
|
|
|
{
|
2018-12-03 11:52:17 +00:00
|
|
|
if ((taps_item_type_ == "float") && (input_item_type_ == "gr_complex") && (output_item_type_ == "gr_complex"))
|
2015-02-04 20:45:16 +00:00
|
|
|
{
|
|
|
|
if (dump_)
|
|
|
|
{
|
|
|
|
top_block->connect(freq_xlating_fir_filter_ccf_, 0, file_sink_, 0);
|
|
|
|
}
|
|
|
|
}
|
2018-12-03 11:52:17 +00:00
|
|
|
else if ((taps_item_type_ == "float") && (input_item_type_ == "float") && (output_item_type_ == "gr_complex"))
|
2012-07-18 13:29:18 +00:00
|
|
|
{
|
2015-02-04 20:45:16 +00:00
|
|
|
if (dump_)
|
2013-11-17 10:48:27 +00:00
|
|
|
{
|
|
|
|
top_block->connect(freq_xlating_fir_filter_fcf_, 0, file_sink_, 0);
|
|
|
|
}
|
2015-02-04 20:45:16 +00:00
|
|
|
}
|
2018-12-03 11:52:17 +00:00
|
|
|
else if ((taps_item_type_ == "float") && (input_item_type_ == "short") && (output_item_type_ == "gr_complex"))
|
2015-02-04 20:45:16 +00:00
|
|
|
{
|
|
|
|
if (dump_)
|
|
|
|
{
|
|
|
|
top_block->connect(freq_xlating_fir_filter_scf_, 0, file_sink_, 0);
|
|
|
|
}
|
|
|
|
}
|
2018-12-03 11:52:17 +00:00
|
|
|
else if ((taps_item_type_ == "float") && (input_item_type_ == "short") && (output_item_type_ == "cshort"))
|
2015-02-04 20:45:16 +00:00
|
|
|
{
|
|
|
|
top_block->connect(freq_xlating_fir_filter_scf_, 0, complex_to_float_, 0);
|
|
|
|
top_block->connect(complex_to_float_, 0, float_to_short_1_, 0);
|
|
|
|
top_block->connect(complex_to_float_, 1, float_to_short_2_, 0);
|
|
|
|
top_block->connect(float_to_short_1_, 0, short_x2_to_cshort_, 0);
|
|
|
|
top_block->connect(float_to_short_2_, 0, short_x2_to_cshort_, 0);
|
|
|
|
if (dump_)
|
|
|
|
{
|
|
|
|
top_block->connect(short_x2_to_cshort_, 0, file_sink_, 0);
|
|
|
|
}
|
|
|
|
}
|
2018-12-03 11:52:17 +00:00
|
|
|
else if ((taps_item_type_ == "float") && (input_item_type_ == "byte") && (output_item_type_ == "gr_complex"))
|
2015-02-04 20:45:16 +00:00
|
|
|
{
|
|
|
|
top_block->connect(gr_char_to_short_, 0, freq_xlating_fir_filter_scf_, 0);
|
|
|
|
if (dump_)
|
2014-11-29 13:00:15 +00:00
|
|
|
{
|
|
|
|
top_block->connect(freq_xlating_fir_filter_scf_, 0, file_sink_, 0);
|
|
|
|
}
|
2015-02-04 20:45:16 +00:00
|
|
|
}
|
2018-12-03 11:52:17 +00:00
|
|
|
else if ((taps_item_type_ == "float") && (input_item_type_ == "byte") && (output_item_type_ == "cbyte"))
|
2015-02-04 20:45:16 +00:00
|
|
|
{
|
|
|
|
top_block->connect(gr_char_to_short_, 0, freq_xlating_fir_filter_scf_, 0);
|
|
|
|
top_block->connect(freq_xlating_fir_filter_scf_, 0, complex_to_complex_byte_, 0);
|
|
|
|
if (dump_)
|
2013-11-17 10:48:27 +00:00
|
|
|
{
|
2015-02-04 20:45:16 +00:00
|
|
|
top_block->connect(complex_to_complex_byte_, 0, file_sink_, 0);
|
2013-11-17 10:48:27 +00:00
|
|
|
}
|
2012-07-18 13:29:18 +00:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2015-02-05 00:14:04 +00:00
|
|
|
LOG(ERROR) << " Unknown input filter input/output item type conversion";
|
2012-07-18 13:29:18 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2012-11-01 17:01:29 +00:00
|
|
|
|
2013-07-04 13:47:40 +00:00
|
|
|
void FreqXlatingFirFilter::disconnect(gr::top_block_sptr top_block)
|
2012-07-18 13:29:18 +00:00
|
|
|
{
|
2018-12-03 11:52:17 +00:00
|
|
|
if ((taps_item_type_ == "float") && (input_item_type_ == "gr_complex") && (output_item_type_ == "gr_complex"))
|
2015-02-04 20:45:16 +00:00
|
|
|
{
|
|
|
|
if (dump_)
|
|
|
|
{
|
|
|
|
top_block->disconnect(freq_xlating_fir_filter_ccf_, 0, file_sink_, 0);
|
|
|
|
}
|
|
|
|
}
|
2018-12-03 11:52:17 +00:00
|
|
|
else if ((taps_item_type_ == "float") && (input_item_type_ == "float") && (output_item_type_ == "gr_complex"))
|
2012-07-18 13:29:18 +00:00
|
|
|
{
|
2015-02-04 20:45:16 +00:00
|
|
|
if (dump_)
|
2013-11-17 10:48:27 +00:00
|
|
|
{
|
|
|
|
top_block->disconnect(freq_xlating_fir_filter_fcf_, 0, file_sink_, 0);
|
|
|
|
}
|
2015-02-04 20:45:16 +00:00
|
|
|
}
|
2018-12-03 11:52:17 +00:00
|
|
|
else if ((taps_item_type_ == "float") && (input_item_type_ == "short") && (output_item_type_ == "gr_complex"))
|
2015-02-04 20:45:16 +00:00
|
|
|
{
|
|
|
|
if (dump_)
|
|
|
|
{
|
|
|
|
top_block->disconnect(freq_xlating_fir_filter_scf_, 0, file_sink_, 0);
|
|
|
|
}
|
|
|
|
}
|
2018-12-03 11:52:17 +00:00
|
|
|
else if ((taps_item_type_ == "float") && (input_item_type_ == "short") && (output_item_type_ == "cshort"))
|
2015-02-04 20:45:16 +00:00
|
|
|
{
|
|
|
|
top_block->disconnect(freq_xlating_fir_filter_scf_, 0, complex_to_float_, 0);
|
|
|
|
top_block->disconnect(complex_to_float_, 0, float_to_short_1_, 0);
|
|
|
|
top_block->disconnect(complex_to_float_, 1, float_to_short_2_, 0);
|
|
|
|
top_block->disconnect(float_to_short_1_, 0, short_x2_to_cshort_, 0);
|
|
|
|
top_block->disconnect(float_to_short_2_, 0, short_x2_to_cshort_, 0);
|
|
|
|
if (dump_)
|
|
|
|
{
|
|
|
|
top_block->disconnect(short_x2_to_cshort_, 0, file_sink_, 0);
|
|
|
|
}
|
|
|
|
}
|
2018-12-03 11:52:17 +00:00
|
|
|
else if ((taps_item_type_ == "float") && (input_item_type_ == "byte") && (output_item_type_ == "gr_complex"))
|
2015-02-04 20:45:16 +00:00
|
|
|
{
|
|
|
|
top_block->disconnect(gr_char_to_short_, 0, freq_xlating_fir_filter_scf_, 0);
|
|
|
|
if (dump_)
|
2014-11-29 13:00:15 +00:00
|
|
|
{
|
|
|
|
top_block->disconnect(freq_xlating_fir_filter_scf_, 0, file_sink_, 0);
|
|
|
|
}
|
2015-02-04 20:45:16 +00:00
|
|
|
}
|
2018-12-03 11:52:17 +00:00
|
|
|
else if ((taps_item_type_ == "float") && (input_item_type_ == "byte") && (output_item_type_ == "cbyte"))
|
2015-02-04 20:45:16 +00:00
|
|
|
{
|
|
|
|
top_block->disconnect(gr_char_to_short_, 0, freq_xlating_fir_filter_scf_, 0);
|
|
|
|
top_block->disconnect(freq_xlating_fir_filter_scf_, 0, complex_to_complex_byte_, 0);
|
|
|
|
if (dump_)
|
2013-11-17 10:48:27 +00:00
|
|
|
{
|
2015-02-04 20:45:16 +00:00
|
|
|
top_block->disconnect(complex_to_complex_byte_, 0, file_sink_, 0);
|
2013-11-17 10:48:27 +00:00
|
|
|
}
|
2012-07-18 13:29:18 +00:00
|
|
|
}
|
2015-02-04 20:45:16 +00:00
|
|
|
else
|
|
|
|
{
|
2015-02-05 00:14:04 +00:00
|
|
|
LOG(ERROR) << " Unknown input filter input/output item type conversion";
|
2015-02-04 20:45:16 +00:00
|
|
|
}
|
2012-07-18 13:29:18 +00:00
|
|
|
}
|
|
|
|
|
2012-11-01 17:01:29 +00:00
|
|
|
|
2013-07-04 13:47:40 +00:00
|
|
|
gr::basic_block_sptr FreqXlatingFirFilter::get_left_block()
|
2012-07-18 13:29:18 +00:00
|
|
|
{
|
2018-12-03 11:52:17 +00:00
|
|
|
if ((taps_item_type_ == "float") && (input_item_type_ == "gr_complex") && (output_item_type_ == "gr_complex"))
|
2015-02-04 20:45:16 +00:00
|
|
|
{
|
|
|
|
return freq_xlating_fir_filter_ccf_;
|
|
|
|
}
|
2018-12-03 21:08:19 +00:00
|
|
|
if ((taps_item_type_ == "float") && (input_item_type_ == "float") && (output_item_type_ == "gr_complex"))
|
2013-11-17 10:48:27 +00:00
|
|
|
{
|
|
|
|
return freq_xlating_fir_filter_fcf_;
|
|
|
|
}
|
2018-12-04 12:20:49 +00:00
|
|
|
if ((taps_item_type_ == "float") && (input_item_type_ == "short") && (output_item_type_ == "gr_complex"))
|
2015-02-04 20:45:16 +00:00
|
|
|
{
|
|
|
|
return freq_xlating_fir_filter_scf_;
|
|
|
|
}
|
2018-12-08 17:49:31 +00:00
|
|
|
if ((taps_item_type_ == "float") && (input_item_type_ == "short") && (output_item_type_ == "cshort"))
|
2014-11-29 13:00:15 +00:00
|
|
|
{
|
|
|
|
return freq_xlating_fir_filter_scf_;
|
|
|
|
}
|
2018-12-08 17:49:31 +00:00
|
|
|
if ((taps_item_type_ == "float") && (input_item_type_ == "byte") && (output_item_type_ == "gr_complex"))
|
2015-02-04 20:45:16 +00:00
|
|
|
{
|
|
|
|
return gr_char_to_short_;
|
|
|
|
}
|
2019-02-11 14:53:50 +00:00
|
|
|
if ((taps_item_type_ == "float") && (input_item_type_ == "byte") && (output_item_type_ == "cbyte"))
|
2015-02-04 20:45:16 +00:00
|
|
|
{
|
|
|
|
return gr_char_to_short_;
|
|
|
|
}
|
2019-08-04 11:15:03 +00:00
|
|
|
|
|
|
|
LOG(WARNING) << " Unknown input filter input/output item type conversion";
|
|
|
|
return nullptr;
|
2012-07-18 13:29:18 +00:00
|
|
|
}
|
|
|
|
|
2012-11-01 17:01:29 +00:00
|
|
|
|
2013-07-04 13:47:40 +00:00
|
|
|
gr::basic_block_sptr FreqXlatingFirFilter::get_right_block()
|
2012-07-18 13:29:18 +00:00
|
|
|
{
|
2018-12-03 11:52:17 +00:00
|
|
|
if ((taps_item_type_ == "float") && (input_item_type_ == "gr_complex") && (output_item_type_ == "gr_complex"))
|
2015-02-04 20:45:16 +00:00
|
|
|
{
|
|
|
|
return freq_xlating_fir_filter_ccf_;
|
|
|
|
}
|
2018-12-03 21:08:19 +00:00
|
|
|
if ((taps_item_type_ == "float") && (input_item_type_ == "float") && (output_item_type_ == "gr_complex"))
|
2013-11-17 10:48:27 +00:00
|
|
|
{
|
|
|
|
return freq_xlating_fir_filter_fcf_;
|
|
|
|
}
|
2018-12-04 12:20:49 +00:00
|
|
|
if ((taps_item_type_ == "float") && (input_item_type_ == "short") && (output_item_type_ == "gr_complex"))
|
2014-11-29 13:00:15 +00:00
|
|
|
{
|
|
|
|
return freq_xlating_fir_filter_scf_;
|
|
|
|
}
|
2018-12-08 17:49:31 +00:00
|
|
|
if ((taps_item_type_ == "float") && (input_item_type_ == "short") && (output_item_type_ == "cshort"))
|
2015-02-04 20:45:16 +00:00
|
|
|
{
|
2015-02-04 20:58:22 +00:00
|
|
|
return short_x2_to_cshort_;
|
2015-02-04 20:45:16 +00:00
|
|
|
}
|
2018-12-08 17:49:31 +00:00
|
|
|
if ((taps_item_type_ == "float") && (input_item_type_ == "byte") && (output_item_type_ == "gr_complex"))
|
2015-02-04 20:45:16 +00:00
|
|
|
{
|
|
|
|
return freq_xlating_fir_filter_scf_;
|
|
|
|
}
|
2019-02-11 14:53:50 +00:00
|
|
|
if ((taps_item_type_ == "float") && (input_item_type_ == "byte") && (output_item_type_ == "cbyte"))
|
2015-02-04 20:45:16 +00:00
|
|
|
{
|
|
|
|
return complex_to_complex_byte_;
|
|
|
|
}
|
2019-08-04 11:15:03 +00:00
|
|
|
|
|
|
|
LOG(WARNING) << " Unknown input filter input/output item type conversion";
|
|
|
|
return nullptr;
|
2012-07-18 13:29:18 +00:00
|
|
|
}
|