mirror of
https://github.com/gnss-sdr/gnss-sdr
synced 2025-10-22 19:17:40 +00:00
Adding a new data_type_adapter, from interleaved short to
std::complex<short>
This commit is contained in:
@@ -18,10 +18,12 @@
|
||||
|
||||
|
||||
set(DATATYPE_ADAPTER_SOURCES
|
||||
ishort_to_complex.cc
|
||||
ibyte_to_complex.cc
|
||||
byte_to_short.cc
|
||||
ibyte_to_cbyte.cc )
|
||||
ibyte_to_cbyte.cc
|
||||
ibyte_to_complex.cc
|
||||
ishort_to_cshort.cc
|
||||
ishort_to_complex.cc
|
||||
)
|
||||
|
||||
include_directories(
|
||||
$(CMAKE_CURRENT_SOURCE_DIR)
|
||||
|
@@ -19,6 +19,7 @@
|
||||
|
||||
set(DATA_TYPE_GR_BLOCKS_SOURCES
|
||||
interleaved_byte_to_complex_byte.cc
|
||||
interleaved_short_to_complex_short.cc
|
||||
)
|
||||
|
||||
include_directories(
|
||||
@@ -30,4 +31,4 @@ include_directories(
|
||||
file(GLOB DATA_TYPE_GR_BLOCKS_HEADERS "*.h")
|
||||
add_library(data_type_gr_blocks ${DATA_TYPE_GR_BLOCKS_SOURCES} ${DATA_TYPE_GR_BLOCKS_HEADERS})
|
||||
source_group(Headers FILES ${DATA_TYPE_GR_BLOCKS_HEADERS})
|
||||
target_link_libraries(data_type_gr_blocks ${GNURADIO_RUNTIME_LIBRARIES})
|
||||
target_link_libraries(data_type_gr_blocks ${GNURADIO_RUNTIME_LIBRARIES} ${VOLK_LIBRARIES})
|
@@ -42,7 +42,7 @@ interleaved_byte_to_complex_byte_sptr make_interleaved_byte_to_complex_byte()
|
||||
|
||||
|
||||
interleaved_byte_to_complex_byte::interleaved_byte_to_complex_byte() : sync_decimator("interleaved_byte_to_complex_byte",
|
||||
gr::io_signature::make (1, 1, sizeof(char)),
|
||||
gr::io_signature::make (1, 1, sizeof(int8_t)),
|
||||
gr::io_signature::make (1, 1, sizeof(lv_8sc_t)), // lv_8sc_t is a Volk's typedef for std::complex<signed char>
|
||||
2)
|
||||
{
|
||||
@@ -55,11 +55,11 @@ int interleaved_byte_to_complex_byte::work(int noutput_items,
|
||||
gr_vector_const_void_star &input_items,
|
||||
gr_vector_void_star &output_items)
|
||||
{
|
||||
const signed char *in = (const signed char *) input_items[0];
|
||||
const int8_t *in = (const int8_t *) input_items[0];
|
||||
lv_8sc_t *out = (lv_8sc_t *) output_items[0];
|
||||
// This could be put into a Volk kernel
|
||||
signed char real_part;
|
||||
signed char imag_part;
|
||||
int8_t real_part;
|
||||
int8_t imag_part;
|
||||
for(unsigned int number = 0; number < 2 * noutput_items; number++)
|
||||
{
|
||||
// lv_cmake(r, i) defined at volk/volk_complex.h
|
||||
@@ -67,6 +67,5 @@ int interleaved_byte_to_complex_byte::work(int noutput_items,
|
||||
imag_part = *in++;
|
||||
*out++ = lv_cmake(real_part, imag_part);
|
||||
}
|
||||
|
||||
return noutput_items;
|
||||
}
|
||||
|
@@ -42,7 +42,7 @@ byte_x2_to_complex_byte_sptr make_byte_x2_to_complex_byte()
|
||||
|
||||
|
||||
byte_x2_to_complex_byte::byte_x2_to_complex_byte() : sync_block("byte_x2_to_complex_byte",
|
||||
gr::io_signature::make (2, 2, sizeof(char)),
|
||||
gr::io_signature::make (2, 2, sizeof(int8_t)), // int8_t, defined in stdint.h and included in volk.h (signed char)
|
||||
gr::io_signature::make (1, 1, sizeof(lv_8sc_t))) // lv_8sc_t is a Volk's typedef for std::complex<signed char>
|
||||
{
|
||||
const int alignment_multiple = volk_get_alignment() / sizeof(lv_8sc_t);
|
||||
@@ -54,12 +54,12 @@ int byte_x2_to_complex_byte::work(int noutput_items,
|
||||
gr_vector_const_void_star &input_items,
|
||||
gr_vector_void_star &output_items)
|
||||
{
|
||||
const char *in0 = (const char *) input_items[0];
|
||||
const char *in1 = (const char *) input_items[1];
|
||||
const int8_t *in0 = (const int8_t *) input_items[0];
|
||||
const int8_t *in1 = (const int8_t *) input_items[1];
|
||||
lv_8sc_t *out = (lv_8sc_t *) output_items[0];
|
||||
// This could be put into a volk kernel
|
||||
signed char real_part;
|
||||
signed char imag_part;
|
||||
int8_t real_part;
|
||||
int8_t imag_part;
|
||||
for(int number = 0; number < noutput_items; number++)
|
||||
{
|
||||
// lv_cmake(r, i) defined at volk/volk_complex.h
|
||||
@@ -67,6 +67,5 @@ int byte_x2_to_complex_byte::work(int noutput_items,
|
||||
imag_part = *in1++;
|
||||
*out++ = lv_cmake(real_part, imag_part);
|
||||
}
|
||||
|
||||
return noutput_items;
|
||||
}
|
||||
|
@@ -45,7 +45,7 @@ complex_byte_to_float_x2::complex_byte_to_float_x2() : sync_block("complex_byte_
|
||||
gr::io_signature::make (1, 1, sizeof(lv_8sc_t)), // lv_8sc_t is a Volk's typedef for std::complex<signed char>
|
||||
gr::io_signature::make (2, 2, sizeof(float)))
|
||||
{
|
||||
const int alignment_multiple = volk_get_alignment() / sizeof(lv_8sc_t);
|
||||
const int alignment_multiple = volk_get_alignment() / sizeof(float);
|
||||
set_alignment(std::max(1, alignment_multiple));
|
||||
}
|
||||
|
||||
|
@@ -52,9 +52,11 @@
|
||||
|
||||
#include "signal_conditioner.h"
|
||||
#include "array_signal_conditioner.h"
|
||||
#include "ishort_to_complex.h"
|
||||
#include "ibyte_to_complex.h"
|
||||
#include "byte_to_short.h"
|
||||
#include "ibyte_to_cbyte.h"
|
||||
#include "ibyte_to_complex.h"
|
||||
#include "ishort_to_cshort.h"
|
||||
#include "ishort_to_complex.h"
|
||||
#include "direct_resampler_conditioner.h"
|
||||
#include "fir_filter.h"
|
||||
#include "freq_xlating_fir_filter.h"
|
||||
@@ -444,15 +446,9 @@ std::unique_ptr<GNSSBlockInterface> GNSSBlockFactory::GetBlock(
|
||||
#endif
|
||||
|
||||
// DATA TYPE ADAPTER -----------------------------------------------------------
|
||||
else if (implementation.compare("Ishort_To_Complex") == 0)
|
||||
else if (implementation.compare("Byte_To_Short") == 0)
|
||||
{
|
||||
std::unique_ptr<GNSSBlockInterface>block_(new IshortToComplex(configuration.get(), role, in_streams,
|
||||
out_streams, queue));
|
||||
block = std::move(block_);
|
||||
}
|
||||
else if (implementation.compare("Ibyte_To_Complex") == 0)
|
||||
{
|
||||
std::unique_ptr<GNSSBlockInterface>block_(new IbyteToComplex(configuration.get(), role, in_streams,
|
||||
std::unique_ptr<GNSSBlockInterface>block_(new ByteToShort(configuration.get(), role, in_streams,
|
||||
out_streams, queue));
|
||||
block = std::move(block_);
|
||||
}
|
||||
@@ -462,6 +458,25 @@ std::unique_ptr<GNSSBlockInterface> GNSSBlockFactory::GetBlock(
|
||||
out_streams, queue));
|
||||
block = std::move(block_);
|
||||
}
|
||||
else if (implementation.compare("Ibyte_To_Complex") == 0)
|
||||
{
|
||||
std::unique_ptr<GNSSBlockInterface>block_(new IbyteToComplex(configuration.get(), role, in_streams,
|
||||
out_streams, queue));
|
||||
block = std::move(block_);
|
||||
}
|
||||
else if (implementation.compare("Ishort_To_Cshort") == 0)
|
||||
{
|
||||
std::unique_ptr<GNSSBlockInterface>block_(new IshortToCshort(configuration.get(), role, in_streams,
|
||||
out_streams, queue));
|
||||
block = std::move(block_);
|
||||
}
|
||||
else if (implementation.compare("Ishort_To_Complex") == 0)
|
||||
{
|
||||
std::unique_ptr<GNSSBlockInterface>block_(new IshortToComplex(configuration.get(), role, in_streams,
|
||||
out_streams, queue));
|
||||
block = std::move(block_);
|
||||
}
|
||||
|
||||
// INPUT FILTER ----------------------------------------------------------------
|
||||
else if (implementation.compare("Fir_Filter") == 0)
|
||||
{
|
||||
|
Reference in New Issue
Block a user