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

Replace C-style cast by C++ casts

This commit is contained in:
Carles Fernandez 2017-08-19 02:33:54 +02:00
parent fe17181af3
commit 7ac3f282fa
36 changed files with 465 additions and 465 deletions

View File

@ -457,7 +457,7 @@ int rtklib_pvt_cc::work (int noutput_items, gr_vector_const_void_star &input_ite
unsigned int gal_channel = 0;
gnss_observables_map.clear();
Gnss_Synchro **in = (Gnss_Synchro **) &input_items[0]; //Get the input pointer
const Gnss_Synchro **in = reinterpret_cast<const Gnss_Synchro **>(&input_items[0]); // Get the input buffer pointer
// ############ 1. READ PSEUDORANGES ####
for (unsigned int i = 0; i < d_nchannels; i++)

View File

@ -390,7 +390,7 @@ int galileo_e5a_noncoherentIQ_acquisition_caf_cc::general_work(int noutput_items
}
case 1:
{
const gr_complex *in = (const gr_complex *)input_items[0]; //Get the input samples pointer
const gr_complex *in = reinterpret_cast<const gr_complex *>(input_items[0]); //Get the input samples pointer
unsigned int buff_increment;
if (ninput_items[0] + d_buffer_count <= d_fft_size)
{
@ -414,7 +414,7 @@ int galileo_e5a_noncoherentIQ_acquisition_caf_cc::general_work(int noutput_items
case 2:
{
// Fill last part of the buffer and reset counter
const gr_complex *in = (const gr_complex *)input_items[0]; //Get the input samples pointer
const gr_complex *in = reinterpret_cast<const gr_complex *>(input_items[0]); //Get the input samples pointer
if (d_buffer_count < d_fft_size)
{
memcpy(&d_inbuffer[d_buffer_count], in, sizeof(gr_complex)*(d_fft_size-d_buffer_count));

View File

@ -210,7 +210,6 @@ int galileo_pcps_8ms_acquisition_cc::general_work(int noutput_items,
gr_vector_int &ninput_items, gr_vector_const_void_star &input_items,
gr_vector_void_star &output_items __attribute__((unused)))
{
int acquisition_message = -1; //0=STOP_CHANNEL 1=ACQ_SUCCEES 2=ACQ_FAIL
switch (d_state)
@ -247,7 +246,7 @@ int galileo_pcps_8ms_acquisition_cc::general_work(int noutput_items,
float magt = 0.0;
float magt_A = 0.0;
float magt_B = 0.0;
const gr_complex *in = (const gr_complex *)input_items[0]; //Get the input samples pointer
const gr_complex *in = reinterpret_cast<const gr_complex *>(input_items[0]); //Get the input samples pointer
float fft_normalization_factor = static_cast<float>(d_fft_size) * static_cast<float>(d_fft_size);
d_input_power = 0.0;
d_mag = 0.0;
@ -271,7 +270,6 @@ int galileo_pcps_8ms_acquisition_cc::general_work(int noutput_items,
for (unsigned int doppler_index = 0; doppler_index < d_num_doppler_bins; doppler_index++)
{
// doppler search steps
doppler = -static_cast<int>(d_doppler_max) + d_doppler_step * doppler_index;
volk_32fc_x2_multiply_32fc(d_fft_if->get_inbuf(), in,

View File

@ -256,6 +256,7 @@ void pcps_acquisition_cc::send_positive_acquisition()
}
void pcps_acquisition_cc::send_negative_acquisition()
{
// 6.2- Declare negative acquisition using a message port
@ -274,6 +275,7 @@ void pcps_acquisition_cc::send_negative_acquisition()
}
int pcps_acquisition_cc::general_work(int noutput_items,
gr_vector_int &ninput_items, gr_vector_const_void_star &input_items,
gr_vector_void_star &output_items __attribute__((unused)))
@ -318,7 +320,7 @@ int pcps_acquisition_cc::general_work(int noutput_items,
int doppler;
uint32_t indext = 0;
float magt = 0.0;
const gr_complex *in = (const gr_complex *)input_items[0]; //Get the input samples pointer
const gr_complex *in = reinterpret_cast<const gr_complex *>(input_items[0]);
int effective_fft_size = ( d_bit_transition_flag ? d_fft_size/2 : d_fft_size );

View File

@ -56,7 +56,6 @@ pcps_acquisition_fine_doppler_cc_sptr pcps_make_acquisition_fine_doppler_cc(
}
pcps_acquisition_fine_doppler_cc::pcps_acquisition_fine_doppler_cc(
int max_dwells, unsigned int sampled_ms, int doppler_max, int doppler_min, long freq,
long fs_in, int samples_per_ms, bool dump,
@ -108,6 +107,7 @@ pcps_acquisition_fine_doppler_cc::pcps_acquisition_fine_doppler_cc(
d_channel = 0;
}
void pcps_acquisition_fine_doppler_cc::set_doppler_step(unsigned int doppler_step)
{
d_doppler_step = doppler_step;
@ -123,6 +123,7 @@ void pcps_acquisition_fine_doppler_cc::set_doppler_step(unsigned int doppler_ste
update_carrier_wipeoff();
}
void pcps_acquisition_fine_doppler_cc::free_grid_memory()
{
for (int i = 0; i < d_num_doppler_points; i++)
@ -134,6 +135,7 @@ void pcps_acquisition_fine_doppler_cc::free_grid_memory()
delete d_grid_doppler_wipeoffs;
}
pcps_acquisition_fine_doppler_cc::~pcps_acquisition_fine_doppler_cc()
{
volk_gnsssdr_free(d_carrier);
@ -149,16 +151,15 @@ pcps_acquisition_fine_doppler_cc::~pcps_acquisition_fine_doppler_cc()
}
void pcps_acquisition_fine_doppler_cc::set_local_code(std::complex<float> * code)
{
memcpy(d_fft_if->get_inbuf(), code, sizeof(gr_complex) * d_fft_size);
d_fft_if->execute(); // We need the FFT of local code
//Conjugate the local code
volk_32fc_conjugate_32fc(d_fft_codes, d_fft_if->get_outbuf(), d_fft_size);
}
void pcps_acquisition_fine_doppler_cc::init()
{
d_gnss_synchro->Flag_valid_acquisition = false;
@ -171,9 +172,9 @@ void pcps_acquisition_fine_doppler_cc::init()
d_gnss_synchro->Acq_samplestamp_samples = 0;
d_input_power = 0.0;
d_state = 0;
}
void pcps_acquisition_fine_doppler_cc::forecast (int noutput_items,
gr_vector_int &ninput_items_required)
{
@ -216,6 +217,7 @@ void pcps_acquisition_fine_doppler_cc::update_carrier_wipeoff()
}
}
double pcps_acquisition_fine_doppler_cc::search_maximum()
{
float magt = 0.0;
@ -266,9 +268,10 @@ double pcps_acquisition_fine_doppler_cc::search_maximum()
return d_test_statistics;
}
float pcps_acquisition_fine_doppler_cc::estimate_input_power(gr_vector_const_void_star &input_items)
{
const gr_complex *in = (const gr_complex *)input_items[0]; //Get the input samples pointer
const gr_complex *in = reinterpret_cast<const gr_complex *>(input_items[0]); //Get the input samples pointer
// Compute the input signal power estimation
float power = 0;
volk_32fc_magnitude_squared_32f(d_magnitude, in, d_fft_size);
@ -277,6 +280,7 @@ float pcps_acquisition_fine_doppler_cc::estimate_input_power(gr_vector_const_voi
return power;
}
int pcps_acquisition_fine_doppler_cc::compute_and_accumulate_grid(gr_vector_const_void_star &input_items)
{
// initialize acquisition algorithm
@ -288,8 +292,6 @@ int pcps_acquisition_fine_doppler_cc::compute_and_accumulate_grid(gr_vector_cons
<< d_threshold << ", doppler_max: " << d_config_doppler_max
<< ", doppler_step: " << d_doppler_step;
// 2- Doppler frequency search loop
float* p_tmp_vector = static_cast<float*>(volk_gnsssdr_malloc(d_fft_size * sizeof(float), volk_gnsssdr_get_alignment()));
@ -314,16 +316,15 @@ int pcps_acquisition_fine_doppler_cc::compute_and_accumulate_grid(gr_vector_cons
volk_32fc_magnitude_squared_32f(p_tmp_vector, d_ifft->get_outbuf(), d_fft_size);
const float* old_vector = d_grid_data[doppler_index];
volk_32f_x2_add_32f(d_grid_data[doppler_index], old_vector, p_tmp_vector, d_fft_size);
}
volk_gnsssdr_free(p_tmp_vector);
return d_fft_size;
}
int pcps_acquisition_fine_doppler_cc::estimate_Doppler(gr_vector_const_void_star &input_items)
{
// Direct FFT
int zero_padding_factor = 2;
int fft_size_extended = d_fft_size * zero_padding_factor;
@ -346,7 +347,7 @@ int pcps_acquisition_fine_doppler_cc::estimate_Doppler(gr_vector_const_void_star
}
//2. Perform code wipe-off
const gr_complex *in = (const gr_complex *)input_items[0]; //Get the input samples pointer
const gr_complex *in = reinterpret_cast<const gr_complex *>(input_items[0]); //Get the input samples pointer
volk_32fc_x2_multiply_32fc(fft_operator->get_inbuf(), in, code_replica, d_fft_size);
@ -419,7 +420,6 @@ int pcps_acquisition_fine_doppler_cc::estimate_Doppler(gr_vector_const_void_star
// d_dump_file.close();
}
// free memory!!
delete fft_operator;
volk_gnsssdr_free(code_replica);
@ -432,7 +432,6 @@ int pcps_acquisition_fine_doppler_cc::general_work(int noutput_items,
gr_vector_int &ninput_items __attribute__((unused)), gr_vector_const_void_star &input_items,
gr_vector_void_star &output_items __attribute__((unused)))
{
/*!
* TODO: High sensitivity acquisition algorithm:
* State Mechine:
@ -479,9 +478,6 @@ int pcps_acquisition_fine_doppler_cc::general_work(int noutput_items,
d_state = 5; //negative acquisition
}
break;
case 3: // Fine doppler estimation
//DLOG(INFO) <<"S3"<<std::endl;
DLOG(INFO) << "Performing fine Doppler estimation";

View File

@ -282,7 +282,7 @@ int pcps_acquisition_sc::general_work(int noutput_items,
int doppler;
uint32_t indext = 0;
float magt = 0.0;
const lv_16sc_t *in = (const lv_16sc_t *)input_items[0]; //Get the input samples pointer
const lv_16sc_t *in = reinterpret_cast<const lv_16sc_t *>(input_items[0]); //Get the input samples pointer
int effective_fft_size = ( d_bit_transition_flag ? d_fft_size/2 : d_fft_size );
//TODO: optimize the signal processing chain to not use gr_complex. This is a temporary solution

View File

@ -314,7 +314,7 @@ double pcps_assisted_acquisition_cc::search_maximum()
float pcps_assisted_acquisition_cc::estimate_input_power(gr_vector_const_void_star &input_items)
{
const gr_complex *in = (const gr_complex *)input_items[0]; //Get the input samples pointer
const gr_complex *in = reinterpret_cast<const gr_complex *>(input_items[0]); //Get the input samples pointer
// 1- Compute the input signal power estimation
float* p_tmp_vector = static_cast<float*>(volk_gnsssdr_malloc(d_fft_size * sizeof(float), volk_gnsssdr_get_alignment()));
@ -332,7 +332,7 @@ float pcps_assisted_acquisition_cc::estimate_input_power(gr_vector_const_void_st
int pcps_assisted_acquisition_cc::compute_and_accumulate_grid(gr_vector_const_void_star &input_items)
{
// initialize acquisition algorithm
const gr_complex *in = (const gr_complex *)input_items[0]; //Get the input samples pointer
const gr_complex *in = reinterpret_cast<const gr_complex *>(input_items[0]); //Get the input samples pointer
DLOG(INFO) << "Channel: " << d_channel
<< " , doing acquisition of satellite: " << d_gnss_synchro->System << " "

View File

@ -260,7 +260,7 @@ int pcps_cccwsr_acquisition_cc::general_work(int noutput_items,
float magt = 0.0;
float magt_plus = 0.0;
float magt_minus = 0.0;
const gr_complex *in = (const gr_complex *)input_items[0]; //Get the input samples pointer
const gr_complex *in = reinterpret_cast<const gr_complex *>(input_items[0]); //Get the input samples pointer
float fft_normalization_factor = static_cast<float>(d_fft_size) * static_cast<float>(d_fft_size);
d_sample_counter += d_fft_size; // sample counter

View File

@ -302,7 +302,7 @@ int pcps_quicksync_acquisition_cc::general_work(int noutput_items,
int doppler;
uint32_t indext = 0;
float magt = 0.0;
const gr_complex *in = (const gr_complex *)input_items[0]; //Get the input samples pointer
const gr_complex *in = reinterpret_cast<const gr_complex *>(input_items[0]); //Get the input samples pointer
gr_complex* in_temp = static_cast<gr_complex*>(volk_gnsssdr_malloc(d_samples_per_code * d_folding_factor * sizeof(gr_complex), volk_gnsssdr_get_alignment()));
gr_complex* in_temp_folded = static_cast<gr_complex*>(volk_gnsssdr_malloc(d_fft_size * sizeof(gr_complex), volk_gnsssdr_get_alignment()));

View File

@ -280,7 +280,7 @@ int pcps_tong_acquisition_cc::general_work(int noutput_items,
int doppler;
uint32_t indext = 0;
float magt = 0.0;
const gr_complex *in = (const gr_complex *)input_items[0]; //Get the input samples pointer
const gr_complex *in = reinterpret_cast<const gr_complex *>(input_items[0]); //Get the input samples pointer
float fft_normalization_factor = static_cast<float>(d_fft_size) * static_cast<float>(d_fft_size);
d_input_power = 0.0;
d_mag = 0.0;

View File

@ -55,8 +55,8 @@ int interleaved_byte_to_complex_byte::work(int noutput_items,
gr_vector_const_void_star &input_items,
gr_vector_void_star &output_items)
{
const int8_t *in = (const int8_t *) input_items[0];
lv_8sc_t *out = (lv_8sc_t *) output_items[0];
const int8_t *in = reinterpret_cast<const int8_t *>(input_items[0]);
lv_8sc_t *out = reinterpret_cast<lv_8sc_t *>(output_items[0]);
// This could be put into a Volk kernel
int8_t real_part;
int8_t imag_part;

View File

@ -55,8 +55,8 @@ int interleaved_byte_to_complex_short::work(int noutput_items,
gr_vector_const_void_star &input_items,
gr_vector_void_star &output_items)
{
const int8_t *in = (const int8_t *) input_items[0];
lv_16sc_t *out = (lv_16sc_t *) output_items[0];
const int8_t *in = reinterpret_cast<const int8_t *>(input_items[0]);
lv_16sc_t *out = reinterpret_cast<lv_16sc_t *>(output_items[0]);
// This could be put into a Volk kernel
int8_t real_part;
int8_t imag_part;
@ -65,7 +65,7 @@ int interleaved_byte_to_complex_short::work(int noutput_items,
// lv_cmake(r, i) defined at volk/volk_complex.h
real_part = *in++;
imag_part = *in++;
*out++ = lv_cmake((int16_t)real_part, (int16_t)imag_part);
*out++ = lv_cmake(static_cast<int16_t>(real_part), static_cast<int16_t>(imag_part));
}
return noutput_items;
}

View File

@ -55,8 +55,8 @@ int interleaved_short_to_complex_short::work(int noutput_items,
gr_vector_const_void_star &input_items,
gr_vector_void_star &output_items)
{
const int16_t *in = (const int16_t *) input_items[0];
lv_16sc_t *out = (lv_16sc_t *) output_items[0];
const int16_t *in = reinterpret_cast<const int16_t *>(input_items[0]);
lv_16sc_t *out = reinterpret_cast<lv_16sc_t *>(output_items[0]);
// This could be put into a Volk kernel
int16_t real_part;
int16_t imag_part;

View File

@ -56,8 +56,8 @@ pulse_blanking_cc::pulse_blanking_cc(double Pfa) : gr::block("pulse_blanking_cc"
int pulse_blanking_cc::general_work (int noutput_items __attribute__((unused)), gr_vector_int &ninput_items __attribute__((unused)),
gr_vector_const_void_star &input_items, gr_vector_void_star &output_items)
{
const gr_complex *in = (const gr_complex *) input_items[0];
gr_complex *out = (gr_complex *) output_items[0];
const gr_complex *in = reinterpret_cast<const gr_complex *>(input_items[0]);
gr_complex *out = reinterpret_cast<gr_complex *>(output_items[0]);
// 1- (optional) Compute the input signal power estimation
//float mean;

View File

@ -50,6 +50,7 @@ direct_resampler_conditioner_cb_sptr direct_resampler_make_conditioner_cb(
sample_freq_out));
}
direct_resampler_conditioner_cb::direct_resampler_conditioner_cb(
double sample_freq_in, double sample_freq_out) :
gr::block("direct_resampler_make_conditioner_cb", gr::io_signature::make(1,
@ -72,15 +73,16 @@ direct_resampler_conditioner_cb::direct_resampler_conditioner_cb(
set_output_multiple(1);
}
direct_resampler_conditioner_cb::~direct_resampler_conditioner_cb()
{
}
void direct_resampler_conditioner_cb::forecast(int noutput_items,
gr_vector_int &ninput_items_required)
{
int nreqd = std::max(static_cast<unsigned>(1), static_cast<int>(static_cast<double>(noutput_items + 1)
* sample_freq_in() / sample_freq_out()) + history() - 1);
unsigned ninputs = ninput_items_required.size();
@ -91,13 +93,13 @@ void direct_resampler_conditioner_cb::forecast(int noutput_items,
}
}
int direct_resampler_conditioner_cb::general_work(int noutput_items,
gr_vector_int &ninput_items, gr_vector_const_void_star &input_items,
gr_vector_void_star &output_items)
{
const lv_8sc_t *in = (const lv_8sc_t *)input_items[0];
lv_8sc_t *out = (lv_8sc_t *)output_items[0];
const lv_8sc_t *in = reinterpret_cast<const lv_8sc_t *>(input_items[0]);
lv_8sc_t *out = reinterpret_cast<lv_8sc_t *>(output_items[0]);
int lcv = 0;
int count = 0;

View File

@ -43,7 +43,6 @@ using google::LogMessage;
direct_resampler_conditioner_cc_sptr direct_resampler_make_conditioner_cc(
double sample_freq_in, double sample_freq_out)
{
return direct_resampler_conditioner_cc_sptr(
new direct_resampler_conditioner_cc(sample_freq_in,
sample_freq_out));
@ -101,8 +100,8 @@ int direct_resampler_conditioner_cc::general_work(int noutput_items,
gr_vector_int &ninput_items, gr_vector_const_void_star &input_items,
gr_vector_void_star &output_items)
{
const gr_complex *in = (const gr_complex *)input_items[0];
gr_complex *out = (gr_complex *)output_items[0];
const gr_complex *in = reinterpret_cast<const gr_complex *>(input_items[0]);
gr_complex *out = reinterpret_cast<gr_complex *>(output_items[0]);
int lcv = 0;
int count = 0;

View File

@ -43,12 +43,12 @@ using google::LogMessage;
direct_resampler_conditioner_cs_sptr direct_resampler_make_conditioner_cs(
double sample_freq_in, double sample_freq_out)
{
return direct_resampler_conditioner_cs_sptr(
new direct_resampler_conditioner_cs(sample_freq_in,
sample_freq_out));
}
direct_resampler_conditioner_cs::direct_resampler_conditioner_cs(
double sample_freq_in, double sample_freq_out) :
gr::block("direct_resampler_make_conditioner_cs", gr::io_signature::make(1,
@ -71,15 +71,16 @@ direct_resampler_conditioner_cs::direct_resampler_conditioner_cs(
set_output_multiple(1);
}
direct_resampler_conditioner_cs::~direct_resampler_conditioner_cs()
{
}
void direct_resampler_conditioner_cs::forecast(int noutput_items,
gr_vector_int &ninput_items_required)
{
int nreqd = std::max(static_cast<unsigned>(1), static_cast<int>(static_cast<double>(noutput_items + 1)
* sample_freq_in() / sample_freq_out()) + history() - 1);
unsigned ninputs = ninput_items_required.size();
@ -90,13 +91,13 @@ void direct_resampler_conditioner_cs::forecast(int noutput_items,
}
}
int direct_resampler_conditioner_cs::general_work(int noutput_items,
gr_vector_int &ninput_items, gr_vector_const_void_star &input_items,
gr_vector_void_star &output_items)
{
const lv_16sc_t *in = (const lv_16sc_t *)input_items[0];
lv_16sc_t *out = (lv_16sc_t *)output_items[0];
const lv_16sc_t *in = reinterpret_cast<const lv_16sc_t *>(input_items[0]);
lv_16sc_t *out = reinterpret_cast<lv_16sc_t *>(output_items[0]);
int lcv = 0;
int count = 0;

View File

@ -40,12 +40,14 @@ struct byte_2bit_struct
signed sample_3:2; // <- 2 bits wide only
};
union byte_and_samples
{
int8_t byte;
byte_2bit_struct samples;
};
bool systemIsBigEndian()
{
union
@ -57,6 +59,7 @@ bool systemIsBigEndian()
return test_int.c[0] == 1;
}
bool systemBytesAreBigEndian()
{
byte_and_samples b;
@ -65,6 +68,7 @@ bool systemBytesAreBigEndian()
else return true;
}
void swapEndianness( int8_t const *in, std::vector< int8_t > &out, size_t item_size, unsigned int ninput_items )
{
unsigned int i;
@ -84,6 +88,7 @@ void swapEndianness( int8_t const *in, std::vector< int8_t > &out, size_t item_s
}
}
unpack_2bit_samples_sptr make_unpack_2bit_samples( bool big_endian_bytes,
size_t item_size,
bool big_endian_items,
@ -97,6 +102,7 @@ unpack_2bit_samples_sptr make_unpack_2bit_samples( bool big_endian_bytes,
);
}
unpack_2bit_samples::unpack_2bit_samples( bool big_endian_bytes,
size_t item_size,
bool big_endian_items,
@ -111,7 +117,6 @@ unpack_2bit_samples::unpack_2bit_samples( bool big_endian_bytes,
swap_endian_items_(false),
reverse_interleaving_(reverse_interleaving)
{
bool big_endian_system = systemIsBigEndian();
// Only swap the item bytes if the item size > 1 byte and the system
@ -122,18 +127,19 @@ unpack_2bit_samples::unpack_2bit_samples( bool big_endian_bytes,
bool big_endian_bytes_system = systemBytesAreBigEndian();
swap_endian_bytes_ = ( big_endian_bytes_system != big_endian_bytes_ );
}
unpack_2bit_samples::~unpack_2bit_samples()
{}
int unpack_2bit_samples::work(int noutput_items,
gr_vector_const_void_star &input_items,
gr_vector_void_star &output_items)
{
signed char const *in = (signed char const *)input_items[0];
int8_t *out = (int8_t*)output_items[0];
signed char const *in = reinterpret_cast<signed char const *>(input_items[0]);
int8_t *out = reinterpret_cast<int8_t*>(output_items[0]);
size_t ninput_bytes = noutput_items/4;
size_t ninput_items = ninput_bytes/item_size_;
@ -164,31 +170,28 @@ int unpack_2bit_samples::work(int noutput_items,
// Read packed input sample (1 byte = 4 samples)
raw_byte.byte = in[i];
out[n++] = (int8_t)( 2*raw_byte.samples.sample_3 + 1 );
out[n++] = (int8_t)( 2*raw_byte.samples.sample_2 + 1 );
out[n++] = (int8_t)( 2*raw_byte.samples.sample_1 + 1 );
out[n++] = (int8_t)( 2*raw_byte.samples.sample_0 + 1 );
out[n++] = static_cast<int8_t>( 2*raw_byte.samples.sample_3 + 1 );
out[n++] = static_cast<int8_t>( 2*raw_byte.samples.sample_2 + 1 );
out[n++] = static_cast<int8_t>( 2*raw_byte.samples.sample_1 + 1 );
out[n++] = static_cast<int8_t>( 2*raw_byte.samples.sample_0 + 1 );
}
}
else
{
for(unsigned int i = 0; i < ninput_bytes; ++i )
{
// Read packed input sample (1 byte = 4 samples)
raw_byte.byte = in[i];
out[n++] = (int8_t)( 2*raw_byte.samples.sample_0 + 1 );
out[n++] = (int8_t)( 2*raw_byte.samples.sample_1 + 1 );
out[n++] = (int8_t)( 2*raw_byte.samples.sample_2 + 1 );
out[n++] = (int8_t)( 2*raw_byte.samples.sample_3 + 1 );
out[n++] = static_cast<int8_t>( 2*raw_byte.samples.sample_0 + 1 );
out[n++] = static_cast<int8_t>( 2*raw_byte.samples.sample_1 + 1 );
out[n++] = static_cast<int8_t>( 2*raw_byte.samples.sample_2 + 1 );
out[n++] = static_cast<int8_t>( 2*raw_byte.samples.sample_3 + 1 );
}
}
}
else
{
if( swap_endian_bytes_ )
{
for(unsigned int i = 0; i < ninput_bytes; ++i)
@ -196,25 +199,23 @@ int unpack_2bit_samples::work(int noutput_items,
// Read packed input sample (1 byte = 4 samples)
raw_byte.byte = in[i];
out[n++] = (int8_t)( 2*raw_byte.samples.sample_2 + 1 );
out[n++] = (int8_t)( 2*raw_byte.samples.sample_3 + 1 );
out[n++] = (int8_t)( 2*raw_byte.samples.sample_0 + 1 );
out[n++] = (int8_t)( 2*raw_byte.samples.sample_1 + 1 );
out[n++] = static_cast<int8_t>( 2*raw_byte.samples.sample_2 + 1 );
out[n++] = static_cast<int8_t>( 2*raw_byte.samples.sample_3 + 1 );
out[n++] = static_cast<int8_t>( 2*raw_byte.samples.sample_0 + 1 );
out[n++] = static_cast<int8_t>( 2*raw_byte.samples.sample_1 + 1 );
}
}
else
{
for(unsigned int i = 0; i < ninput_bytes; ++i )
{
// Read packed input sample (1 byte = 4 samples)
raw_byte.byte = in[i];
out[n++] = (int8_t)( 2*raw_byte.samples.sample_1 + 1 );
out[n++] = (int8_t)( 2*raw_byte.samples.sample_0 + 1 );
out[n++] = (int8_t)( 2*raw_byte.samples.sample_3 + 1 );
out[n++] = (int8_t)( 2*raw_byte.samples.sample_2 + 1 );
out[n++] = static_cast<int8_t>( 2*raw_byte.samples.sample_1 + 1 );
out[n++] = static_cast<int8_t>( 2*raw_byte.samples.sample_0 + 1 );
out[n++] = static_cast<int8_t>( 2*raw_byte.samples.sample_3 + 1 );
out[n++] = static_cast<int8_t>( 2*raw_byte.samples.sample_2 + 1 );
}
}
}

View File

@ -47,21 +47,24 @@ unpack_byte_2bit_cpx_samples_sptr make_unpack_byte_2bit_cpx_samples()
return unpack_byte_2bit_cpx_samples_sptr(new unpack_byte_2bit_cpx_samples());
}
unpack_byte_2bit_cpx_samples::unpack_byte_2bit_cpx_samples() : sync_interpolator("unpack_byte_2bit_cpx_samples",
gr::io_signature::make(1, 1, sizeof(signed char)),
gr::io_signature::make(1, 1, sizeof(short)),
4)
{}
unpack_byte_2bit_cpx_samples::~unpack_byte_2bit_cpx_samples()
{}
int unpack_byte_2bit_cpx_samples::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];
short *out = (short*)output_items[0];
const signed char *in = reinterpret_cast<const signed char *>(input_items[0]);
short *out = reinterpret_cast<short *>(output_items[0]);
byte_2bit_struct sample;
int n = 0;
@ -91,16 +94,16 @@ int unpack_byte_2bit_cpx_samples::work(int noutput_items,
signed char c = in[i];
//I[n]
sample.two_bit_sample = (c >> 4) & 3;
out[n++] = (2*(short)sample.two_bit_sample + 1);
out[n++] = (2 * static_cast<short>(sample.two_bit_sample) + 1);
//Q[n]
sample.two_bit_sample = (c >> 6) & 3;
out[n++] = (2*(short)sample.two_bit_sample + 1);
out[n++] = (2 * static_cast<short>(sample.two_bit_sample) + 1);
//I[n+1]
sample.two_bit_sample = c & 3;
out[n++] = (2*(short)sample.two_bit_sample + 1);
out[n++] = (2 * static_cast<short>(sample.two_bit_sample) + 1);
//Q[n+1]
sample.two_bit_sample = (c >> 2) & 3;
out[n++] = (2*(short)sample.two_bit_sample + 1);
out[n++] = (2 * static_cast<short>(sample.two_bit_sample) + 1);
}
return noutput_items;
}

View File

@ -59,8 +59,8 @@ int unpack_byte_2bit_samples::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];
float *out = (float*)output_items[0];
const signed char *in = reinterpret_cast<const signed char *>(input_items[0]);
float *out = reinterpret_cast<float *>(output_items[0]);
byte_2bit_struct sample;
int n = 0;

View File

@ -55,8 +55,8 @@ int unpack_intspir_1bit_samples::work(int noutput_items,
gr_vector_const_void_star &input_items,
gr_vector_void_star &output_items)
{
const signed int *in = (const signed int *)input_items[0];
float *out = (float*)output_items[0];
const signed int *in = reinterpret_cast<const signed int *>(input_items[0]);
float *out = reinterpret_cast<float*>(output_items[0]);
int n = 0;
int channel = 1;

View File

@ -284,8 +284,8 @@ int galileo_e1b_telemetry_decoder_cc::general_work (int noutput_items __attribut
int corr_value = 0;
int preamble_diff = 0;
Gnss_Synchro **out = (Gnss_Synchro **) &output_items[0];
const Gnss_Synchro **in = (const Gnss_Synchro **) &input_items[0]; //Get the input samples pointer
Gnss_Synchro **out = reinterpret_cast<Gnss_Synchro **>(&output_items[0]); // Get the output buffer pointer
const Gnss_Synchro **in = reinterpret_cast<const Gnss_Synchro **>(&input_items[0]); // Get the input buffer pointer
Gnss_Synchro current_symbol; //structure to save the synchronization information and send the output object to the next block
//1. Copy the current tracking output

View File

@ -175,7 +175,6 @@ void galileo_e5a_telemetry_decoder_cc::decode_word(double *page_symbols,int fram
std::cout << "New Galileo E5a F/NAV message received: UTC model parameters from satellite " << d_satellite << std::endl;
this->message_port_pub(pmt::mp("telemetry"), pmt::make_any(tmp_obj));
}
}
@ -246,8 +245,9 @@ galileo_e5a_telemetry_decoder_cc::~galileo_e5a_telemetry_decoder_cc()
int galileo_e5a_telemetry_decoder_cc::general_work (int noutput_items __attribute__((unused)), gr_vector_int &ninput_items __attribute__((unused)),
gr_vector_const_void_star &input_items, gr_vector_void_star &output_items)
{
const Gnss_Synchro *in = (const Gnss_Synchro *) input_items[0]; // input
Gnss_Synchro *out = (Gnss_Synchro *) output_items[0]; // output
Gnss_Synchro *out = reinterpret_cast<Gnss_Synchro *>(output_items[0]); // Get the output buffer pointer
const Gnss_Synchro *in = reinterpret_cast<const Gnss_Synchro *>(input_items[0]); // Get the input buffer pointer
/* Terminology: Prompt: output from tracking Prompt correlator (Prompt samples)
* Symbol: encoded navigation bits. 1 symbol = 20 samples in E5a
* Bit: decoded navigation bits forming words as described in Galileo ICD

View File

@ -48,6 +48,7 @@ gps_l1_ca_make_telemetry_decoder_cc(Gnss_Satellite satellite, bool dump)
return gps_l1_ca_telemetry_decoder_cc_sptr(new gps_l1_ca_telemetry_decoder_cc(satellite, dump));
}
gps_l1_ca_telemetry_decoder_cc::gps_l1_ca_telemetry_decoder_cc(
Gnss_Satellite satellite,
bool dump) :
@ -68,7 +69,7 @@ gps_l1_ca_telemetry_decoder_cc::gps_l1_ca_telemetry_decoder_cc(
//memcpy((unsigned short int*)this->d_preambles_bits, (unsigned short int*)preambles_bits, GPS_CA_PREAMBLE_LENGTH_BITS*sizeof(unsigned short int));
// preamble bits to sampled symbols
d_preambles_symbols = (signed int*)malloc(sizeof(signed int) * GPS_CA_PREAMBLE_LENGTH_SYMBOLS);
d_preambles_symbols = static_cast<signed int*>(malloc(sizeof(signed int) * GPS_CA_PREAMBLE_LENGTH_SYMBOLS));
int n = 0;
for (int i = 0; i < GPS_CA_PREAMBLE_LENGTH_BITS; i++)
{
@ -150,14 +151,11 @@ bool gps_l1_ca_telemetry_decoder_cc::gps_word_parityCheck(unsigned int gpsword)
int gps_l1_ca_telemetry_decoder_cc::general_work (int noutput_items __attribute__((unused)), gr_vector_int &ninput_items __attribute__((unused)),
gr_vector_const_void_star &input_items, gr_vector_void_star &output_items)
{
int corr_value = 0;
int preamble_diff_ms = 0;
Gnss_Synchro **out = (Gnss_Synchro **) &output_items[0];
// ########### Output the tracking data to navigation and PVT ##########
const Gnss_Synchro **in = (const Gnss_Synchro **) &input_items[0]; //Get the input samples pointer
Gnss_Synchro **out = reinterpret_cast<Gnss_Synchro **>(&output_items[0]); // Get the output buffer pointer
const Gnss_Synchro **in = reinterpret_cast<const Gnss_Synchro **>(&input_items[0]); // Get the input buffer pointer
Gnss_Synchro current_symbol; //structure to save the synchronization information and send the output object to the next block
//1. Copy the current tracking output
@ -186,8 +184,8 @@ int gps_l1_ca_telemetry_decoder_cc::general_work (int noutput_items __attribute_
}
if (corr_value >= GPS_CA_PREAMBLE_LENGTH_SYMBOLS) break;
}
}
//******* frame sync ******************
if (abs(corr_value) == GPS_CA_PREAMBLE_LENGTH_SYMBOLS)
{
@ -365,7 +363,6 @@ int gps_l1_ca_telemetry_decoder_cc::general_work (int noutput_items __attribute_
current_symbol.TOW_at_current_symbol_s = d_TOW_at_current_symbol;
current_symbol.Flag_valid_word = flag_TOW_set;
if (flag_PLL_180_deg_phase_locked == true)
{
//correct the accumulated phase for the Costas loop phase shift, if required
@ -403,6 +400,7 @@ int gps_l1_ca_telemetry_decoder_cc::general_work (int noutput_items __attribute_
return 1;
}
void gps_l1_ca_telemetry_decoder_cc::set_satellite(Gnss_Satellite satellite)
{
d_satellite = Gnss_Satellite(satellite.get_system(), satellite.get_PRN());

View File

@ -93,8 +93,8 @@ int gps_l2c_telemetry_decoder_cc::general_work (int noutput_items __attribute__(
gr_vector_const_void_star &input_items, gr_vector_void_star &output_items)
{
// get pointers on in- and output gnss-synchro objects
const Gnss_Synchro *in = (const Gnss_Synchro *) input_items[0]; // input
Gnss_Synchro *out = (Gnss_Synchro *) output_items[0]; // output
Gnss_Synchro *out = reinterpret_cast<Gnss_Synchro *>(output_items[0]); // Get the output buffer pointer
const Gnss_Synchro *in = reinterpret_cast<const Gnss_Synchro *>(input_items[0]); // Get the input buffer pointer
bool flag_new_cnav_frame = false;
cnav_msg_t msg;

View File

@ -98,8 +98,8 @@ int sbas_l1_telemetry_decoder_cc::general_work (int noutput_items __attribute__(
{
VLOG(FLOW) << "general_work(): " << "noutput_items=" << noutput_items << "\toutput_items real size=" << output_items.size() << "\tninput_items size=" << ninput_items.size() << "\tinput_items real size=" << input_items.size() << "\tninput_items[0]=" << ninput_items[0];
// get pointers on in- and output gnss-synchro objects
const Gnss_Synchro *in = (const Gnss_Synchro *) input_items[0]; // input
Gnss_Synchro *out = (Gnss_Synchro *) output_items[0]; // output
Gnss_Synchro *out = reinterpret_cast<Gnss_Synchro *>(output_items[0]); // Get the output buffer pointer
const Gnss_Synchro *in = reinterpret_cast<const Gnss_Synchro *>(input_items[0]); // Get the input buffer pointer
Gnss_Synchro current_symbol; //structure to save the synchronization information and send the output object to the next block
//1. Copy the current tracking output

View File

@ -286,8 +286,8 @@ int galileo_e1_dll_pll_veml_tracking_cc::general_work (int noutput_items __attri
double code_error_filt_chips = 0.0;
// Block input data and block output stream pointers
const gr_complex* in = (gr_complex*) input_items[0];
Gnss_Synchro **out = (Gnss_Synchro **) &output_items[0];
const gr_complex* in = reinterpret_cast<const gr_complex *>(input_items[0]);
Gnss_Synchro **out = reinterpret_cast<Gnss_Synchro **>(&output_items[0]);
// GNSS_SYNCHRO OBJECT to interchange data between tracking->telemetry_decoder
Gnss_Synchro current_synchro_data = Gnss_Synchro();

View File

@ -282,8 +282,8 @@ int Galileo_E1_Tcp_Connector_Tracking_cc::general_work (int noutput_items __attr
// GNSS_SYNCHRO OBJECT to interchange data between tracking->telemetry_decoder
Gnss_Synchro current_synchro_data = Gnss_Synchro();
// Block input data and block output stream pointers
const gr_complex* in = (gr_complex*) input_items[0];
Gnss_Synchro **out = (Gnss_Synchro **) &output_items[0];
const gr_complex* in = reinterpret_cast<const gr_complex *>(input_items[0]);
Gnss_Synchro **out = reinterpret_cast<Gnss_Synchro **>(&output_items[0]);
if (d_enable_tracking == true)
{
// Fill the acquisition data

View File

@ -388,7 +388,7 @@ int Galileo_E5a_Dll_Pll_Tracking_cc::general_work (int noutput_items __attribute
double code_error_filt_chips;
// GNSS_SYNCHRO OBJECT to interchange data between tracking->telemetry_decoder
Gnss_Synchro **out = (Gnss_Synchro **) &output_items[0]; //block output streams pointer
Gnss_Synchro **out = reinterpret_cast<Gnss_Synchro **>(&output_items[0]); //block output streams pointer
// GNSS_SYNCHRO OBJECT to interchange data between tracking->telemetry_decoder
Gnss_Synchro current_synchro_data;
@ -404,7 +404,6 @@ int Galileo_E5a_Dll_Pll_Tracking_cc::general_work (int noutput_items __attribute
{
case 0:
{
d_Early = gr_complex(0,0);
d_Prompt = gr_complex(0,0);
d_Late = gr_complex(0,0);
@ -438,7 +437,7 @@ int Galileo_E5a_Dll_Pll_Tracking_cc::general_work (int noutput_items __attribute
case 2:
{
// Block input data and block output stream pointers
const gr_complex* in = (gr_complex*) input_items[0]; //PRN start block alignment
const gr_complex* in = reinterpret_cast<const gr_complex *>(input_items[0]); //PRN start block alignment
gr_complex sec_sign_Q;
gr_complex sec_sign_I;
// Secondary code Chip

View File

@ -331,8 +331,8 @@ int gps_l1_ca_dll_pll_c_aid_tracking_cc::general_work (int noutput_items __attri
gr_vector_const_void_star &input_items, gr_vector_void_star &output_items)
{
// Block input data and block output stream pointers
const gr_complex* in = (gr_complex*) input_items[0]; //PRN start block alignment
Gnss_Synchro **out = (Gnss_Synchro **) &output_items[0];
const gr_complex* in = reinterpret_cast<const gr_complex *>(input_items[0]);
Gnss_Synchro **out = reinterpret_cast<Gnss_Synchro **>(&output_items[0]);
// GNSS_SYNCHRO OBJECT to interchange data between tracking->telemetry_decoder
Gnss_Synchro current_synchro_data = Gnss_Synchro();

View File

@ -335,7 +335,7 @@ int gps_l1_ca_dll_pll_c_aid_tracking_fpga_sc::general_work(
int samples_offset;
// Block input data and block output stream pointers
Gnss_Synchro **out = (Gnss_Synchro **) &output_items[0];
Gnss_Synchro **out = reinterpret_cast<Gnss_Synchro **>(&output_items[0]);
Gnss_Synchro current_synchro_data = Gnss_Synchro();

View File

@ -335,8 +335,8 @@ int gps_l1_ca_dll_pll_c_aid_tracking_sc::general_work (int noutput_items __attri
gr_vector_const_void_star &input_items, gr_vector_void_star &output_items)
{
// Block input data and block output stream pointers
const lv_16sc_t* in = (lv_16sc_t*) input_items[0]; //PRN start block alignment
Gnss_Synchro **out = (Gnss_Synchro **) &output_items[0];
const lv_16sc_t* in = reinterpret_cast<const lv_16sc_t*>(input_items[0]); //PRN start block alignment
Gnss_Synchro **out = reinterpret_cast<Gnss_Synchro **>(&output_items[0]);
// GNSS_SYNCHRO OBJECT to interchange data between tracking->telemetry_decoder
Gnss_Synchro current_synchro_data = Gnss_Synchro();

View File

@ -305,8 +305,8 @@ int Gps_L1_Ca_Dll_Pll_Tracking_cc::general_work (int noutput_items __attribute__
double code_error_filt_chips = 0.0;
// Block input data and block output stream pointers
const gr_complex* in = (gr_complex*) input_items[0]; //PRN start block alignment
Gnss_Synchro **out = (Gnss_Synchro **) &output_items[0];
const gr_complex* in = reinterpret_cast<const gr_complex *>(input_items[0]);
Gnss_Synchro **out = reinterpret_cast<Gnss_Synchro **>(&output_items[0]);
// GNSS_SYNCHRO OBJECT to interchange data between tracking->telemetry_decoder
Gnss_Synchro current_synchro_data = Gnss_Synchro();

View File

@ -301,8 +301,8 @@ int Gps_L1_Ca_Dll_Pll_Tracking_GPU_cc::general_work (int noutput_items __attribu
gr_vector_const_void_star &input_items, gr_vector_void_star &output_items)
{
// Block input data and block output stream pointers
const gr_complex* in = (gr_complex*) input_items[0]; //PRN start block alignment
Gnss_Synchro **out = (Gnss_Synchro **) &output_items[0];
const gr_complex* in = reinterpret_cast<const gr_complex *>(input_items[0]);
Gnss_Synchro **out = reinterpret_cast<Gnss_Synchro **>(&output_items[0]);
// GNSS_SYNCHRO OBJECT to interchange data between tracking->telemetry_decoder
Gnss_Synchro current_synchro_data = Gnss_Synchro();
@ -539,6 +539,7 @@ int Gps_L1_Ca_Dll_Pll_Tracking_GPU_cc::general_work (int noutput_items __attribu
return 1; //output tracking result ALWAYS even in the case of d_enable_tracking==false
}
void Gps_L1_Ca_Dll_Pll_Tracking_GPU_cc::set_channel(unsigned int channel)
{
d_channel = channel;

View File

@ -189,6 +189,7 @@ Gps_L1_Ca_Tcp_Connector_Tracking_cc::Gps_L1_Ca_Tcp_Connector_Tracking_cc(
d_code_phase_step_chips = 0.0;
}
void Gps_L1_Ca_Tcp_Connector_Tracking_cc::start_tracking()
{
/*
@ -315,8 +316,8 @@ int Gps_L1_Ca_Tcp_Connector_Tracking_cc::general_work (int noutput_items __attri
Gnss_Synchro current_synchro_data = Gnss_Synchro();
// Block input data and block output stream pointers
const gr_complex* in = (gr_complex*) input_items[0];
Gnss_Synchro **out = (Gnss_Synchro **) &output_items[0];
const gr_complex* in = reinterpret_cast<const gr_complex *>(input_items[0]);
Gnss_Synchro **out = reinterpret_cast<Gnss_Synchro **>(&output_items[0]);
if (d_enable_tracking == true)
{
@ -345,7 +346,6 @@ int Gps_L1_Ca_Tcp_Connector_Tracking_cc::general_work (int noutput_items __attri
return 1;
}
// Update the prn length based on code freq (variable) and
// sampling frequency (fixed)
// variable code PRN sample block size

View File

@ -310,8 +310,8 @@ int gps_l2_m_dll_pll_tracking_cc::general_work (int noutput_items __attribute__(
Gnss_Synchro current_synchro_data = Gnss_Synchro();
// Block input data and block output stream pointers
const gr_complex* in = (gr_complex*) input_items[0]; //PRN start block alignment
Gnss_Synchro **out = (Gnss_Synchro **) &output_items[0];
const gr_complex* in = reinterpret_cast<const gr_complex *>(input_items[0]);
Gnss_Synchro **out = reinterpret_cast<Gnss_Synchro **>(&output_items[0]);
if (d_enable_tracking == true)
{