1
0
mirror of https://github.com/gnss-sdr/gnss-sdr synced 2024-12-14 04:00:34 +00:00

Applied clang-format

This commit is contained in:
Cillian O'Driscoll 2019-11-08 13:47:08 +00:00
parent db57db839f
commit 3d27940b0a
12 changed files with 289 additions and 302 deletions

View File

@ -31,9 +31,9 @@
* ------------------------------------------------------------------------- * -------------------------------------------------------------------------
*/ */
#include "beidou_b1i_pcps_acquisition.h"
#include "Beidou_B1I.h" #include "Beidou_B1I.h"
#include "acq_conf.h" #include "acq_conf.h"
#include "beidou_b1i_pcps_acquisition.h"
#include "beidou_b1i_signal_processing.h" #include "beidou_b1i_signal_processing.h"
#include "configuration_interface.h" #include "configuration_interface.h"
#include "gnss_sdr_flags.h" #include "gnss_sdr_flags.h"

View File

@ -29,9 +29,9 @@
* ------------------------------------------------------------------------- * -------------------------------------------------------------------------
*/ */
#include "beidou_b3i_pcps_acquisition.h"
#include "Beidou_B3I.h" #include "Beidou_B3I.h"
#include "acq_conf.h" #include "acq_conf.h"
#include "beidou_b3i_pcps_acquisition.h"
#include "beidou_b3i_signal_processing.h" #include "beidou_b3i_signal_processing.h"
#include "configuration_interface.h" #include "configuration_interface.h"
#include "gnss_sdr_flags.h" #include "gnss_sdr_flags.h"

View File

@ -29,10 +29,10 @@
* ------------------------------------------------------------------------- * -------------------------------------------------------------------------
*/ */
#include "galileo_e1_pcps_ambiguous_acquisition.h"
#include "Galileo_E1.h" #include "Galileo_E1.h"
#include "acq_conf.h" #include "acq_conf.h"
#include "configuration_interface.h" #include "configuration_interface.h"
#include "galileo_e1_pcps_ambiguous_acquisition.h"
#include "galileo_e1_signal_processing.h" #include "galileo_e1_signal_processing.h"
#include "gnss_sdr_flags.h" #include "gnss_sdr_flags.h"
#include <boost/math/distributions/exponential.hpp> #include <boost/math/distributions/exponential.hpp>

View File

@ -28,11 +28,11 @@
* ------------------------------------------------------------------------- * -------------------------------------------------------------------------
*/ */
#include "galileo_e5a_pcps_acquisition.h"
#include "Galileo_E5a.h" #include "Galileo_E5a.h"
#include "acq_conf.h" #include "acq_conf.h"
#include "configuration_interface.h" #include "configuration_interface.h"
#include "galileo_e5_signal_processing.h" #include "galileo_e5_signal_processing.h"
#include "galileo_e5a_pcps_acquisition.h"
#include "gnss_sdr_flags.h" #include "gnss_sdr_flags.h"
#include <boost/math/distributions/exponential.hpp> #include <boost/math/distributions/exponential.hpp>
#include <glog/logging.h> #include <glog/logging.h>

View File

@ -31,10 +31,10 @@
* ------------------------------------------------------------------------- * -------------------------------------------------------------------------
*/ */
#include "glonass_l1_ca_pcps_acquisition.h"
#include "GLONASS_L1_L2_CA.h" #include "GLONASS_L1_L2_CA.h"
#include "acq_conf.h" #include "acq_conf.h"
#include "configuration_interface.h" #include "configuration_interface.h"
#include "glonass_l1_ca_pcps_acquisition.h"
#include "glonass_l1_signal_processing.h" #include "glonass_l1_signal_processing.h"
#include "gnss_sdr_flags.h" #include "gnss_sdr_flags.h"
#include <boost/math/distributions/exponential.hpp> #include <boost/math/distributions/exponential.hpp>

View File

@ -33,11 +33,11 @@
* ------------------------------------------------------------------------- * -------------------------------------------------------------------------
*/ */
#include "gps_l1_ca_pcps_acquisition.h"
#include "GPS_L1_CA.h" #include "GPS_L1_CA.h"
#include "acq_conf.h" #include "acq_conf.h"
#include "configuration_interface.h" #include "configuration_interface.h"
#include "gnss_sdr_flags.h" #include "gnss_sdr_flags.h"
#include "gps_l1_ca_pcps_acquisition.h"
#include "gps_sdr_signal_processing.h" #include "gps_sdr_signal_processing.h"
#include <boost/math/distributions/exponential.hpp> #include <boost/math/distributions/exponential.hpp>
#include <glog/logging.h> #include <glog/logging.h>
@ -55,7 +55,7 @@ GpsL1CaPcpsAcquisition::GpsL1CaPcpsAcquisition(
{ {
configuration_ = configuration; configuration_ = configuration;
acq_parameters_.ms_per_code = 1; acq_parameters_.ms_per_code = 1;
acq_parameters_.SetFromConfiguration( configuration_, role, GPS_L1_CA_CODE_RATE_CPS, GPS_L1_CA_OPT_ACQ_FS_SPS ); acq_parameters_.SetFromConfiguration(configuration_, role, GPS_L1_CA_CODE_RATE_CPS, GPS_L1_CA_OPT_ACQ_FS_SPS);
DLOG(INFO) << "role " << role; DLOG(INFO) << "role " << role;

View File

@ -52,7 +52,7 @@ GpsL5iPcpsAcquisition::GpsL5iPcpsAcquisition(
{ {
configuration_ = configuration; configuration_ = configuration;
acq_parameters_.ms_per_code = 1; acq_parameters_.ms_per_code = 1;
acq_parameters_.SetFromConfiguration( configuration_, role, GPS_L5I_CODE_RATE_CPS, GPS_L5_OPT_ACQ_FS_SPS ); acq_parameters_.SetFromConfiguration(configuration_, role, GPS_L5I_CODE_RATE_CPS, GPS_L5_OPT_ACQ_FS_SPS);
DLOG(INFO) << "role " << role; DLOG(INFO) << "role " << role;

View File

@ -33,12 +33,12 @@
* ------------------------------------------------------------------------- * -------------------------------------------------------------------------
*/ */
#include "pcps_acquisition.h"
#include "GLONASS_L1_L2_CA.h" // for GLONASS_TWO_PI #include "GLONASS_L1_L2_CA.h" // for GLONASS_TWO_PI
#include "GPS_L1_CA.h" // for GPS_TWO_PI #include "GPS_L1_CA.h" // for GPS_TWO_PI
#include "gnss_frequencies.h" #include "gnss_frequencies.h"
#include "gnss_sdr_create_directory.h" #include "gnss_sdr_create_directory.h"
#include "gnss_synchro.h" #include "gnss_synchro.h"
#include "pcps_acquisition.h"
#if HAS_STD_FILESYSTEM #if HAS_STD_FILESYSTEM
#if HAS_STD_FILESYSTEM_EXPERIMENTAL #if HAS_STD_FILESYSTEM_EXPERIMENTAL
#include <experimental/filesystem> #include <experimental/filesystem>

View File

@ -67,14 +67,14 @@ Acq_Conf::Acq_Conf()
resampler_latency_samples = 0U; resampler_latency_samples = 0U;
} }
void Acq_Conf::SetFromConfiguration( ConfigurationInterface *configuration, void Acq_Conf::SetFromConfiguration(ConfigurationInterface *configuration,
const std::string &role, double chip_rate, double opt_freq ) const std::string &role, double chip_rate, double opt_freq)
{ {
item_type = configuration->property(role + ".item_type", item_type); item_type = configuration->property(role + ".item_type", item_type);
item_type = external_item_type_to_internal( item_type ); item_type = external_item_type_to_internal(item_type);
if( !item_type_valid( item_type ) ) if (!item_type_valid(item_type))
{ {
throw std::invalid_argument( "Unknown item type: " + item_type ); throw std::invalid_argument("Unknown item type: " + item_type);
} }
chips_per_second = chip_rate; chips_per_second = chip_rate;
@ -103,9 +103,9 @@ void Acq_Conf::SetFromConfiguration( ConfigurationInterface *configuration,
resampled_fs = fs_in; resampled_fs = fs_in;
if( use_automatic_resampler ) if (use_automatic_resampler)
{ {
ConfigureAutomaticResampler( opt_freq ); ConfigureAutomaticResampler(opt_freq);
} }
it_size = item_type_size(item_type); it_size = item_type_size(item_type);
@ -114,16 +114,15 @@ void Acq_Conf::SetFromConfiguration( ConfigurationInterface *configuration,
doppler_step = configuration->property(role + ".doppler_step", doppler_step); doppler_step = configuration->property(role + ".doppler_step", doppler_step);
pfa = configuration->property(role + ".pfa", pfa); pfa = configuration->property(role + ".pfa", pfa);
pfa2 = configuration->property(role + ".pfa_second_step", pfa2); pfa2 = configuration->property(role + ".pfa_second_step", pfa2);
if( pfa2 <= 0.0 ) if (pfa2 <= 0.0)
pfa2 = pfa; pfa2 = pfa;
make_2_steps = configuration->property(role + ".make_two_steps", make_2_steps); make_2_steps = configuration->property(role + ".make_two_steps", make_2_steps);
blocking_on_standby = configuration->property(role + ".blocking_on_standby", blocking_on_standby); blocking_on_standby = configuration->property(role + ".blocking_on_standby", blocking_on_standby);
SetDerivedParams(); SetDerivedParams();
} }
void Acq_Conf::ConfigureAutomaticResampler( double opt_freq ) void Acq_Conf::ConfigureAutomaticResampler(double opt_freq)
{ {
if (use_automatic_resampler) if (use_automatic_resampler)
{ {
@ -146,7 +145,6 @@ void Acq_Conf::ConfigureAutomaticResampler( double opt_freq )
void Acq_Conf::SetDerivedParams() void Acq_Conf::SetDerivedParams()
{ {
samples_per_ms = static_cast<float>(resampled_fs) * 0.001; samples_per_ms = static_cast<float>(resampled_fs) * 0.001;
samples_per_chip = static_cast<unsigned int>(ceil(static_cast<float>(resampled_fs)/chips_per_second)); samples_per_chip = static_cast<unsigned int>(ceil(static_cast<float>(resampled_fs) / chips_per_second));
samples_per_code = samples_per_ms * ms_per_code; samples_per_code = samples_per_ms * ms_per_code;
} }

View File

@ -73,12 +73,12 @@ public:
Acq_Conf(); Acq_Conf();
void SetFromConfiguration( ConfigurationInterface *configuration, const std::string &role, double chip_rate, double opt_freq ); void SetFromConfiguration(ConfigurationInterface *configuration, const std::string &role, double chip_rate, double opt_freq);
private: private:
void SetDerivedParams(); void SetDerivedParams();
void ConfigureAutomaticResampler( double opt_freq ); void ConfigureAutomaticResampler(double opt_freq);
}; };
#endif #endif

View File

@ -31,51 +31,49 @@
*/ */
#include "item_type_helpers.h" #include "item_type_helpers.h"
#include <cstring> // memcpy
#include <volk/volk.h> #include <volk/volk.h>
#include <volk_gnsssdr/volk_gnsssdr.h> #include <volk_gnsssdr/volk_gnsssdr.h>
#include <cstring> // memcpy
std::string external_item_type_to_internal( const std::string &external_item_type ) std::string external_item_type_to_internal(const std::string &external_item_type)
{ {
std::string internal_item_type( "" ); std::string internal_item_type("");
if( external_item_type == "byte" ) if (external_item_type == "byte")
{ {
internal_item_type = "i8"; internal_item_type = "i8";
} }
else if( external_item_type == "ibyte" || external_item_type == "cbyte" ) else if (external_item_type == "ibyte" || external_item_type == "cbyte")
{ {
internal_item_type = "ic8"; internal_item_type = "ic8";
} }
else if( external_item_type == "short" ) else if (external_item_type == "short")
{ {
internal_item_type = "i16"; internal_item_type = "i16";
} }
else if( external_item_type == "ishort" || external_item_type == "cshort" ) else if (external_item_type == "ishort" || external_item_type == "cshort")
{ {
internal_item_type = "ic16"; internal_item_type = "ic16";
} }
else if( external_item_type == "float" ) else if (external_item_type == "float")
{ {
internal_item_type = "f32"; internal_item_type = "f32";
} }
else if( external_item_type == "gr_complex" ) else if (external_item_type == "gr_complex")
{ {
internal_item_type = "fc32"; internal_item_type = "fc32";
} }
return internal_item_type; return internal_item_type;
} }
bool item_type_valid( const std::string & item_type ) bool item_type_valid(const std::string &item_type)
{ {
if( item_type != "i8" and item_type != "ic8" and if (item_type != "i8" and item_type != "ic8" and
item_type != "i16" and item_type != "ic16" and item_type != "i16" and item_type != "ic16" and
item_type != "i32" and item_type != "ic32" and item_type != "i32" and item_type != "ic32" and
item_type != "f32" and item_type != "fc32" ) item_type != "f32" and item_type != "fc32")
{ {
return false; return false;
} }
@ -83,39 +81,39 @@ bool item_type_valid( const std::string & item_type )
return true; return true;
} }
size_t item_type_size( const std::string & item_type ) size_t item_type_size(const std::string &item_type)
{ {
if( item_type == "i8" ) if (item_type == "i8")
{ {
return sizeof( int8_t ); return sizeof(int8_t);
} }
else if( item_type == "ic8" ) else if (item_type == "ic8")
{ {
return 2*sizeof( int8_t ); return 2 * sizeof(int8_t);
} }
else if( item_type == "i16" ) else if (item_type == "i16")
{ {
return sizeof( int16_t ); return sizeof(int16_t);
} }
else if( item_type == "ic16" ) else if (item_type == "ic16")
{ {
return 2*sizeof( int16_t ); return 2 * sizeof(int16_t);
} }
else if( item_type == "i32" ) else if (item_type == "i32")
{ {
return sizeof( int32_t ); return sizeof(int32_t);
} }
else if( item_type == "ic32" ) else if (item_type == "ic32")
{ {
return 2*sizeof( int32_t ); return 2 * sizeof(int32_t);
} }
else if( item_type == "f32" ) else if (item_type == "f32")
{ {
return sizeof( float ); return sizeof(float);
} }
else if( item_type == "fc32" ) else if (item_type == "fc32")
{ {
return 2*sizeof(float); return 2 * sizeof(float);
} }
else else
{ {
@ -124,126 +122,126 @@ size_t item_type_size( const std::string & item_type )
} }
// VOLK doesnt do 32 bit integer converters // VOLK doesnt do 32 bit integer converters
template< typename OT > template <typename OT>
void convert_32i_generic( OT *dest, const int32_t *src, unsigned int num_items ) void convert_32i_generic(OT *dest, const int32_t *src, unsigned int num_items)
{ {
for( unsigned int i = 0; i < num_items; ++i ) for (unsigned int i = 0; i < num_items; ++i)
{ {
dest[i] = static_cast< OT >( src[i] ); dest[i] = static_cast<OT>(src[i]);
} }
} }
void copy_converter( void *dest, const void *src, unsigned int num_items, size_t item_size ) void copy_converter(void *dest, const void *src, unsigned int num_items, size_t item_size)
{ {
std::memcpy( dest, src, num_items*item_size ); std::memcpy(dest, src, num_items * item_size);
} }
void convert_8i_16i( void *dest, const void *src, unsigned int num_items ) void convert_8i_16i(void *dest, const void *src, unsigned int num_items)
{ {
volk_8i_convert_16i( reinterpret_cast< int16_t * >(dest), volk_8i_convert_16i(reinterpret_cast<int16_t *>(dest),
reinterpret_cast< const int8_t *>(src), num_items ); reinterpret_cast<const int8_t *>(src), num_items);
} }
void convert_8i_32f( void *dest, const void *src, unsigned int num_items ) void convert_8i_32f(void *dest, const void *src, unsigned int num_items)
{ {
volk_8i_s32f_convert_32f( reinterpret_cast< float * >(dest), volk_8i_s32f_convert_32f(reinterpret_cast<float *>(dest),
reinterpret_cast< const int8_t *>(src), 1.0f, num_items ); reinterpret_cast<const int8_t *>(src), 1.0f, num_items);
} }
void convert_8ic_16ic( void *dest, const void *src, unsigned int num_items ) void convert_8ic_16ic(void *dest, const void *src, unsigned int num_items)
{ {
volk_8i_convert_16i( reinterpret_cast< int16_t * >(dest), volk_8i_convert_16i(reinterpret_cast<int16_t *>(dest),
reinterpret_cast< const int8_t *>(src), 2*num_items ); reinterpret_cast<const int8_t *>(src), 2 * num_items);
} }
void convert_8ic_32fc( void *dest, const void *src, unsigned int num_items ) void convert_8ic_32fc(void *dest, const void *src, unsigned int num_items)
{ {
volk_8i_s32f_convert_32f( reinterpret_cast< float * >(dest), volk_8i_s32f_convert_32f(reinterpret_cast<float *>(dest),
reinterpret_cast< const int8_t *>(src), 1.0f, 2*num_items ); reinterpret_cast<const int8_t *>(src), 1.0f, 2 * num_items);
} }
void convert_16i_8i( void *dest, const void *src, unsigned int num_items ) void convert_16i_8i(void *dest, const void *src, unsigned int num_items)
{ {
volk_16i_convert_8i( reinterpret_cast< int8_t * >(dest), volk_16i_convert_8i(reinterpret_cast<int8_t *>(dest),
reinterpret_cast< const int16_t *>(src), num_items ); reinterpret_cast<const int16_t *>(src), num_items);
} }
void convert_16i_32f( void *dest, const void *src, unsigned int num_items ) void convert_16i_32f(void *dest, const void *src, unsigned int num_items)
{ {
volk_16i_s32f_convert_32f( reinterpret_cast< float * >(dest), volk_16i_s32f_convert_32f(reinterpret_cast<float *>(dest),
reinterpret_cast< const int16_t *>(src), 1.0f, num_items ); reinterpret_cast<const int16_t *>(src), 1.0f, num_items);
} }
void convert_16ic_8ic( void *dest, const void *src, unsigned int num_items ) void convert_16ic_8ic(void *dest, const void *src, unsigned int num_items)
{ {
volk_16i_convert_8i( reinterpret_cast< int8_t * >(dest), volk_16i_convert_8i(reinterpret_cast<int8_t *>(dest),
reinterpret_cast< const int16_t *>(src), 2*num_items ); reinterpret_cast<const int16_t *>(src), 2 * num_items);
} }
void convert_16ic_32fc( void *dest, const void *src, unsigned int num_items ) void convert_16ic_32fc(void *dest, const void *src, unsigned int num_items)
{ {
volk_16i_s32f_convert_32f( reinterpret_cast< float * >(dest), volk_16i_s32f_convert_32f(reinterpret_cast<float *>(dest),
reinterpret_cast< const int16_t *>(src), 1.0f, 2*num_items ); reinterpret_cast<const int16_t *>(src), 1.0f, 2 * num_items);
} }
void convert_32i_8i( void *dest, const void *src, unsigned int num_items ) void convert_32i_8i(void *dest, const void *src, unsigned int num_items)
{ {
convert_32i_generic<int8_t>( reinterpret_cast< int8_t *>(dest), convert_32i_generic<int8_t>(reinterpret_cast<int8_t *>(dest),
reinterpret_cast<const int32_t*>(src), num_items ); reinterpret_cast<const int32_t *>(src), num_items);
} }
void convert_32i_16i( void *dest, const void *src, unsigned int num_items ) void convert_32i_16i(void *dest, const void *src, unsigned int num_items)
{ {
convert_32i_generic<int16_t>( reinterpret_cast< int16_t *>(dest), convert_32i_generic<int16_t>(reinterpret_cast<int16_t *>(dest),
reinterpret_cast<const int32_t*>(src), num_items ); reinterpret_cast<const int32_t *>(src), num_items);
} }
void convert_32i_32f( void *dest, const void *src, unsigned int num_items ) void convert_32i_32f(void *dest, const void *src, unsigned int num_items)
{ {
convert_32i_generic<float>( reinterpret_cast< float *>(dest), convert_32i_generic<float>(reinterpret_cast<float *>(dest),
reinterpret_cast<const int32_t*>(src), num_items ); reinterpret_cast<const int32_t *>(src), num_items);
} }
void convert_32ic_8ic( void *dest, const void *src, unsigned int num_items ) void convert_32ic_8ic(void *dest, const void *src, unsigned int num_items)
{ {
convert_32i_generic<int8_t>( reinterpret_cast< int8_t *>(dest), convert_32i_generic<int8_t>(reinterpret_cast<int8_t *>(dest),
reinterpret_cast<const int32_t*>(src), 2*num_items ); reinterpret_cast<const int32_t *>(src), 2 * num_items);
} }
void convert_32ic_16ic( void *dest, const void *src, unsigned int num_items ) void convert_32ic_16ic(void *dest, const void *src, unsigned int num_items)
{ {
convert_32i_generic<int16_t>( reinterpret_cast< int16_t *>(dest), convert_32i_generic<int16_t>(reinterpret_cast<int16_t *>(dest),
reinterpret_cast<const int32_t*>(src), 2*num_items ); reinterpret_cast<const int32_t *>(src), 2 * num_items);
} }
void convert_32ic_32fc( void *dest, const void *src, unsigned int num_items ) void convert_32ic_32fc(void *dest, const void *src, unsigned int num_items)
{ {
convert_32i_generic<float>( reinterpret_cast< float *>(dest), convert_32i_generic<float>(reinterpret_cast<float *>(dest),
reinterpret_cast<const int32_t*>(src), 2*num_items ); reinterpret_cast<const int32_t *>(src), 2 * num_items);
} }
void convert_32f_8i( void *dest, const void *src, unsigned int num_items ) void convert_32f_8i(void *dest, const void *src, unsigned int num_items)
{ {
volk_32f_s32f_convert_8i( reinterpret_cast< int8_t * >(dest), volk_32f_s32f_convert_8i(reinterpret_cast<int8_t *>(dest),
reinterpret_cast< const float *>(src), 1.0f, num_items ); reinterpret_cast<const float *>(src), 1.0f, num_items);
} }
void convert_32f_16i( void *dest, const void *src, unsigned int num_items ) void convert_32f_16i(void *dest, const void *src, unsigned int num_items)
{ {
volk_32f_s32f_convert_16i( reinterpret_cast< int16_t * >(dest), volk_32f_s32f_convert_16i(reinterpret_cast<int16_t *>(dest),
reinterpret_cast< const float *>(src), 1.0f, num_items ); reinterpret_cast<const float *>(src), 1.0f, num_items);
} }
void convert_32fc_8ic( void *dest, const void *src, unsigned int num_items ) void convert_32fc_8ic(void *dest, const void *src, unsigned int num_items)
{ {
volk_32f_s32f_convert_8i( reinterpret_cast< int8_t * >(dest), volk_32f_s32f_convert_8i(reinterpret_cast<int8_t *>(dest),
reinterpret_cast< const float *>(src), 1.0f, 2*num_items ); reinterpret_cast<const float *>(src), 1.0f, 2 * num_items);
} }
void convert_32fc_16ic( void *dest, const void *src, unsigned int num_items ) void convert_32fc_16ic(void *dest, const void *src, unsigned int num_items)
{ {
volk_32f_s32f_convert_16i( reinterpret_cast< int16_t * >(dest), volk_32f_s32f_convert_16i(reinterpret_cast<int16_t *>(dest),
reinterpret_cast< const float *>(src), 1.0f, 2*num_items ); reinterpret_cast<const float *>(src), 1.0f, 2 * num_items);
} }
/*! /*!
@ -269,144 +267,135 @@ void convert_32fc_16ic( void *dest, const void *src, unsigned int num_items )
* *
* *
*/ */
item_type_converter_t make_vector_converter( std::string input_type, item_type_converter_t make_vector_converter(std::string input_type,
std::string output_type ) std::string output_type)
{ {
if( not item_type_valid( input_type ) or not item_type_valid( output_type ) ) if (not item_type_valid(input_type) or not item_type_valid(output_type))
{ {
throw std::runtime_error( "make_vector_converter: invalid item types : " throw std::runtime_error("make_vector_converter: invalid item types : " + input_type + " " + output_type);
+ input_type + " " + output_type );
} }
if( input_type == output_type ) if (input_type == output_type)
{ {
size_t input_size = item_type_size( input_type ); size_t input_size = item_type_size(input_type);
return std::bind( copy_converter, std::placeholders::_1, std::placeholders::_2, return std::bind(copy_converter, std::placeholders::_1, std::placeholders::_2,
std::placeholders::_3, input_size ); std::placeholders::_3, input_size);
} }
if( input_type == "i8" ) if (input_type == "i8")
{ {
if( output_type == "i16" ) if (output_type == "i16")
{ {
return std::bind( convert_8i_16i, std::placeholders::_1, return std::bind(convert_8i_16i, std::placeholders::_1,
std::placeholders::_2, std::placeholders::_3 ); std::placeholders::_2, std::placeholders::_3);
} }
else if( output_type == "f32" ) else if (output_type == "f32")
{ {
return std::bind( convert_8i_32f, std::placeholders::_1, return std::bind(convert_8i_32f, std::placeholders::_1,
std::placeholders::_2, std::placeholders::_3 ); std::placeholders::_2, std::placeholders::_3);
}
}
else if( input_type == "ic8" )
{
if( output_type == "ic16" )
{
return std::bind( convert_8ic_16ic, std::placeholders::_1,
std::placeholders::_2, std::placeholders::_3 );
}
else if( output_type == "fc32" )
{
return std::bind( convert_8ic_32fc, std::placeholders::_1,
std::placeholders::_2, std::placeholders::_3 );
} }
} }
else if( input_type == "i16" ) else if (input_type == "ic8")
{ {
if( output_type == "i8" ) if (output_type == "ic16")
{ {
return std::bind( convert_16i_8i, std::placeholders::_1, return std::bind(convert_8ic_16ic, std::placeholders::_1,
std::placeholders::_2, std::placeholders::_3 ); std::placeholders::_2, std::placeholders::_3);
} }
else if( output_type == "f32" ) else if (output_type == "fc32")
{ {
return std::bind( convert_16i_32f, std::placeholders::_1, return std::bind(convert_8ic_32fc, std::placeholders::_1,
std::placeholders::_2, std::placeholders::_3 ); std::placeholders::_2, std::placeholders::_3);
} }
} }
else if( input_type == "ic16" ) else if (input_type == "i16")
{ {
if( output_type == "ic8" ) if (output_type == "i8")
{ {
return std::bind( convert_16ic_8ic, std::placeholders::_1, return std::bind(convert_16i_8i, std::placeholders::_1,
std::placeholders::_2, std::placeholders::_3 ); std::placeholders::_2, std::placeholders::_3);
} }
else else if (output_type == "f32")
if( output_type == "fc32" )
{ {
return std::bind( convert_16ic_32fc, std::placeholders::_1, return std::bind(convert_16i_32f, std::placeholders::_1,
std::placeholders::_2, std::placeholders::_3 ); std::placeholders::_2, std::placeholders::_3);
} }
} }
else if( input_type == "i32" ) else if (input_type == "ic16")
{ {
if( output_type == "i8" ) if (output_type == "ic8")
{ {
return std::bind( convert_32i_8i, std::placeholders::_1, return std::bind(convert_16ic_8ic, std::placeholders::_1,
std::placeholders::_2, std::placeholders::_3 ); std::placeholders::_2, std::placeholders::_3);
} }
else if( output_type == "i16" ) else if (output_type == "fc32")
{ {
return std::bind( convert_32i_16i, std::placeholders::_1, return std::bind(convert_16ic_32fc, std::placeholders::_1,
std::placeholders::_2, std::placeholders::_3 ); std::placeholders::_2, std::placeholders::_3);
}
else if( output_type == "f32" )
{
return std::bind( convert_32i_32f, std::placeholders::_1,
std::placeholders::_2, std::placeholders::_3 );
} }
} }
else if( input_type == "ic32" ) else if (input_type == "i32")
{ {
if( output_type == "ic8" ) if (output_type == "i8")
{ {
return std::bind( convert_32ic_8ic, std::placeholders::_1, return std::bind(convert_32i_8i, std::placeholders::_1,
std::placeholders::_2, std::placeholders::_3 ); std::placeholders::_2, std::placeholders::_3);
} }
else else if (output_type == "i16")
if( output_type == "ic16" )
{ {
return std::bind( convert_32ic_16ic, std::placeholders::_1, return std::bind(convert_32i_16i, std::placeholders::_1,
std::placeholders::_2, std::placeholders::_3 ); std::placeholders::_2, std::placeholders::_3);
} }
else else if (output_type == "f32")
if( output_type == "fc32" )
{ {
return std::bind( convert_32ic_32fc, std::placeholders::_1, return std::bind(convert_32i_32f, std::placeholders::_1,
std::placeholders::_2, std::placeholders::_3 ); std::placeholders::_2, std::placeholders::_3);
} }
} }
else if( input_type == "f32" ) else if (input_type == "ic32")
{ {
if( output_type == "i8" ) if (output_type == "ic8")
{ {
return std::bind( convert_32f_8i, std::placeholders::_1, return std::bind(convert_32ic_8ic, std::placeholders::_1,
std::placeholders::_2, std::placeholders::_3 ); std::placeholders::_2, std::placeholders::_3);
} }
else if( output_type == "i16" ) else if (output_type == "ic16")
{ {
return std::bind( convert_32f_16i, std::placeholders::_1, return std::bind(convert_32ic_16ic, std::placeholders::_1,
std::placeholders::_2, std::placeholders::_3 ); std::placeholders::_2, std::placeholders::_3);
}
else if (output_type == "fc32")
{
return std::bind(convert_32ic_32fc, std::placeholders::_1,
std::placeholders::_2, std::placeholders::_3);
} }
} }
else if( input_type == "fc32" ) else if (input_type == "f32")
{ {
if( output_type == "ic8" ) if (output_type == "i8")
{ {
return std::bind( convert_32fc_8ic, std::placeholders::_1, return std::bind(convert_32f_8i, std::placeholders::_1,
std::placeholders::_2, std::placeholders::_3 ); std::placeholders::_2, std::placeholders::_3);
} }
else if( output_type == "ic16" ) else if (output_type == "i16")
{ {
return std::bind( convert_32fc_16ic, std::placeholders::_1, return std::bind(convert_32f_16i, std::placeholders::_1,
std::placeholders::_2, std::placeholders::_3 ); std::placeholders::_2, std::placeholders::_3);
}
}
else if (input_type == "fc32")
{
if (output_type == "ic8")
{
return std::bind(convert_32fc_8ic, std::placeholders::_1,
std::placeholders::_2, std::placeholders::_3);
}
else if (output_type == "ic16")
{
return std::bind(convert_32fc_16ic, std::placeholders::_1,
std::placeholders::_2, std::placeholders::_3);
} }
} }
throw std::runtime_error( "make_vector_converter: invalid conversion : " throw std::runtime_error("make_vector_converter: invalid conversion : " + input_type + " to " + output_type);
+ input_type + " to " + output_type );
} }

View File

@ -37,11 +37,11 @@
#include <functional> #include <functional>
#include <string> #include <string>
using item_type_converter_t = std::function< void( void *, const void *, unsigned ) > ; using item_type_converter_t = std::function<void(void *, const void *, unsigned)>;
/*! /*!
* \brief Convert a gnss-sdr item type string to internal * \brief Convert a gnss-sdr item type string to internal
*/ */
std::string external_item_type_to_internal( const std::string &external_item_type ); std::string external_item_type_to_internal(const std::string &external_item_type);
/*! /*!
@ -53,12 +53,12 @@ std::string external_item_type_to_internal( const std::string &external_item_typ
* where "i" denotes integer, "f" denotes float and "c" is for complex and * where "i" denotes integer, "f" denotes float and "c" is for complex and
* the number indicates the number of bits in the representation * the number indicates the number of bits in the representation
*/ */
bool item_type_valid( const std::string & item_type ); bool item_type_valid(const std::string &item_type);
/*! /*!
* \brief Return the size of the given item type, or zero if unknown * \brief Return the size of the given item type, or zero if unknown
*/ */
size_t item_type_size( const std::string & item_type ); size_t item_type_size(const std::string &item_type);
/*! /*!
* \brief Create a function to convert an array of input_type to an array of output_type * \brief Create a function to convert an array of input_type to an array of output_type
@ -83,7 +83,7 @@ size_t item_type_size( const std::string & item_type );
* *
* *
*/ */
item_type_converter_t make_vector_converter( std::string input_type, item_type_converter_t make_vector_converter(std::string input_type,
std::string output_type ); std::string output_type);
#endif #endif