1
0
mirror of https://github.com/gnss-sdr/gnss-sdr synced 2025-01-12 02:10:34 +00:00

Adding cshort to gr_complex conversion

This commit is contained in:
Carles Fernandez 2015-02-26 12:56:29 +01:00
parent f95344c32f
commit c9ee0c4eab

View File

@ -76,6 +76,26 @@ FirFilter::FirFilter(ConfigurationInterface* configuration, std::string role,
file_sink_ = gr::blocks::file_sink::make(item_size, dump_filename_.c_str());
}
}
else if ((taps_item_type_.compare("float") == 0) && (input_item_type_.compare("cshort") == 0)
&& (output_item_type_.compare("gr_complex") == 0))
{
item_size = sizeof(gr_complex);
cshort_to_float_x2_ = make_cshort_to_float_x2();
fir_filter_fff_1_ = gr::filter::fir_filter_fff::make(1, taps_);
fir_filter_fff_2_ = gr::filter::fir_filter_fff::make(1, taps_);
DLOG(INFO) << "I input_filter(" << fir_filter_fff_1_->unique_id() << ")";
DLOG(INFO) << "Q input_filter(" << fir_filter_fff_2_->unique_id() << ")";
//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();
float_to_complex_ = gr::blocks::float_to_complex::make();
if (dump_)
{
DLOG(INFO) << "Dumping output into file " << dump_filename_;
file_sink_ = gr::blocks::file_sink::make(item_size, dump_filename_.c_str());
}
}
else if ((taps_item_type_.compare("float") == 0) && (input_item_type_.compare("cbyte") == 0)
&& (output_item_type_.compare("gr_complex") == 0))
{
@ -169,7 +189,6 @@ void FirFilter::connect(gr::top_block_sptr top_block)
{
top_block->connect(float_to_complex_, 0, file_sink_, 0);
}
}
else if ((taps_item_type_.compare("float") == 0) && (input_item_type_.compare("cbyte") == 0)
&& (output_item_type_.compare("cbyte") == 0))
@ -185,6 +204,18 @@ void FirFilter::connect(gr::top_block_sptr top_block)
top_block->connect(char_x2_cbyte_, 0, file_sink_, 0);
}
}
else if ((taps_item_type_.compare("float") == 0) && (input_item_type_.compare("cshort") == 0)
&& (output_item_type_.compare("gr_complex") == 0))
{
top_block->connect(cshort_to_float_x2_, 0, fir_filter_fff_1_, 0);
top_block->connect(cshort_to_float_x2_, 1, fir_filter_fff_2_, 0);
top_block->connect(fir_filter_fff_1_, 0, float_to_complex_, 0);
top_block->connect(fir_filter_fff_2_, 0, float_to_complex_, 1);
if (dump_)
{
top_block->connect(float_to_complex_, 0, file_sink_, 0);
}
}
else
{
LOG(ERROR) << " Unknown item type conversion";
@ -228,7 +259,6 @@ void FirFilter::disconnect(gr::top_block_sptr top_block)
{
top_block->disconnect(short_x2_to_cshort_, 0, file_sink_, 0);
}
}
else if ((taps_item_type_.compare("float") == 0) && (input_item_type_.compare("cbyte") == 0)
&& (output_item_type_.compare("cbyte") == 0))
@ -244,6 +274,18 @@ void FirFilter::disconnect(gr::top_block_sptr top_block)
top_block->disconnect(char_x2_cbyte_, 0, file_sink_, 0);
}
}
else if ((taps_item_type_.compare("float") == 0) && (input_item_type_.compare("cshort") == 0)
&& (output_item_type_.compare("gr_complex") == 0))
{
top_block->disconnect(cshort_to_float_x2_, 0, fir_filter_fff_1_, 0);
top_block->disconnect(cshort_to_float_x2_, 1, fir_filter_fff_2_, 0);
top_block->disconnect(fir_filter_fff_1_, 0, float_to_complex_, 0);
top_block->disconnect(fir_filter_fff_2_, 0, float_to_complex_, 1);
if (dump_)
{
top_block->disconnect(float_to_complex_, 0, file_sink_, 0);
}
}
else
{
LOG(ERROR) << " Unknown item type conversion";
@ -274,6 +316,11 @@ gr::basic_block_sptr FirFilter::get_left_block()
{
return cbyte_to_float_x2_;
}
else if ((taps_item_type_.compare("float") == 0) && (input_item_type_.compare("cshort") == 0)
&& (output_item_type_.compare("gr_complex") == 0))
{
return cshort_to_float_x2_;
}
else
{
return nullptr;
@ -305,6 +352,11 @@ gr::basic_block_sptr FirFilter::get_right_block()
{
return char_x2_cbyte_;
}
else if ((taps_item_type_.compare("float") == 0) && (input_item_type_.compare("cshort") == 0)
&& (output_item_type_.compare("gr_complex") == 0))
{
return float_to_complex_;
}
else
{
return nullptr;