mirror of
https://github.com/gnss-sdr/gnss-sdr
synced 2025-04-04 17:57:03 +00:00
Adding a filter for complex short streams
This commit is contained in:
parent
b89e2b0802
commit
42902c4663
@ -2,6 +2,7 @@
|
||||
* \file fir_filter.cc
|
||||
* \brief Adapts a gnuradio gr_fir_filter designed with gr_remez
|
||||
* \author Luis Esteve, 2012. luis(at)epsilon-formacion.com
|
||||
* Carles Fernandez-Prades, 2015 cfernandez(at)cttc.es
|
||||
*
|
||||
* -------------------------------------------------------------------------
|
||||
*
|
||||
@ -57,6 +58,24 @@ 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("cshort") == 0))
|
||||
{
|
||||
item_size = sizeof(lv_16sc_t);
|
||||
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();
|
||||
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))
|
||||
{
|
||||
@ -125,6 +144,20 @@ void FirFilter::connect(gr::top_block_sptr top_block)
|
||||
DLOG(INFO) << "Nothing to connect internally";
|
||||
}
|
||||
}
|
||||
else if ((taps_item_type_.compare("float") == 0) && (input_item_type_.compare("cshort") == 0)
|
||||
&& (output_item_type_.compare("cshort") == 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_short_1_, 0);
|
||||
top_block->connect(fir_filter_fff_2_, 0, 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_, 1);
|
||||
if (dump_)
|
||||
{
|
||||
top_block->connect(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("gr_complex") == 0))
|
||||
{
|
||||
@ -177,7 +210,26 @@ void FirFilter::disconnect(gr::top_block_sptr top_block)
|
||||
top_block->disconnect(fir_filter_fff_1_, 0, float_to_complex_, 0);
|
||||
top_block->disconnect(cbyte_to_float_x2_, 1, fir_filter_fff_2_, 0);
|
||||
top_block->disconnect(cbyte_to_float_x2_, 0, fir_filter_fff_1_, 0);
|
||||
if (dump_)
|
||||
{
|
||||
top_block->disconnect(float_to_complex_, 0, file_sink_, 0);
|
||||
}
|
||||
}
|
||||
else if ((taps_item_type_.compare("float") == 0) && (input_item_type_.compare("cshort") == 0)
|
||||
&& (output_item_type_.compare("cshort") == 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_short_1_, 0);
|
||||
top_block->disconnect(fir_filter_fff_2_, 0, 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_, 1);
|
||||
if (dump_)
|
||||
{
|
||||
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))
|
||||
{
|
||||
@ -194,7 +246,7 @@ void FirFilter::disconnect(gr::top_block_sptr top_block)
|
||||
}
|
||||
else
|
||||
{
|
||||
LOG(ERROR) << " unknown input filter item type";
|
||||
LOG(ERROR) << " Unknown item type conversion";
|
||||
}
|
||||
}
|
||||
|
||||
@ -207,6 +259,11 @@ gr::basic_block_sptr FirFilter::get_left_block()
|
||||
{
|
||||
return fir_filter_ccf_;
|
||||
}
|
||||
else if ((taps_item_type_.compare("float") == 0) && (input_item_type_.compare("cshort") == 0)
|
||||
&& (output_item_type_.compare("cshort") == 0))
|
||||
{
|
||||
return cshort_to_float_x2_;
|
||||
}
|
||||
else if ((taps_item_type_.compare("float") == 0) && (input_item_type_.compare("cbyte") == 0)
|
||||
&& (output_item_type_.compare("gr_complex") == 0))
|
||||
{
|
||||
@ -220,7 +277,7 @@ gr::basic_block_sptr FirFilter::get_left_block()
|
||||
else
|
||||
{
|
||||
return nullptr;
|
||||
LOG(ERROR) << " unknown input filter item type";
|
||||
LOG(ERROR) << " Unknown item type conversion";
|
||||
}
|
||||
}
|
||||
|
||||
@ -233,6 +290,11 @@ gr::basic_block_sptr FirFilter::get_right_block()
|
||||
{
|
||||
return fir_filter_ccf_;
|
||||
}
|
||||
else if ((taps_item_type_.compare("float") == 0) && (input_item_type_.compare("cshort") == 0)
|
||||
&& (output_item_type_.compare("cshort") == 0))
|
||||
{
|
||||
return short_x2_to_cshort_;
|
||||
}
|
||||
else if ((taps_item_type_.compare("float") == 0) && (input_item_type_.compare("cbyte") == 0)
|
||||
&& (output_item_type_.compare("gr_complex") == 0))
|
||||
{
|
||||
|
@ -40,6 +40,7 @@
|
||||
#include <gnuradio/blocks/file_sink.h>
|
||||
#include <gnuradio/blocks/float_to_char.h>
|
||||
#include <gnuradio/blocks/float_to_complex.h>
|
||||
#include <gnuradio/blocks/float_to_short.h>
|
||||
#include <gnuradio/filter/fir_filter_ccf.h>
|
||||
#include <gnuradio/filter/fir_filter_fff.h>
|
||||
#include <gnuradio/msg_queue.h>
|
||||
@ -47,6 +48,8 @@
|
||||
#include "gnss_block_interface.h"
|
||||
#include "complex_byte_to_float_x2.h"
|
||||
#include "byte_x2_to_complex_byte.h"
|
||||
#include "short_x2_to_cshort.h"
|
||||
#include "cshort_to_float_x2.h"
|
||||
|
||||
class ConfigurationInterface;
|
||||
|
||||
@ -111,6 +114,11 @@ private:
|
||||
gr::blocks::float_to_char::sptr float_to_char_2_;
|
||||
byte_x2_to_complex_byte_sptr char_x2_cbyte_;
|
||||
gr::blocks::float_to_complex::sptr float_to_complex_;
|
||||
cshort_to_float_x2_sptr cshort_to_float_x2_;
|
||||
gr::blocks::float_to_short::sptr float_to_short_1_;
|
||||
gr::blocks::float_to_short::sptr float_to_short_2_;
|
||||
short_x2_to_cshort_sptr short_x2_to_cshort_;
|
||||
|
||||
};
|
||||
|
||||
#endif
|
||||
|
Loading…
x
Reference in New Issue
Block a user