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

Remove all warnings raised by bugprone-* clang-tidy checks in acquisition blocks

This commit is contained in:
Carles Fernandez 2020-07-10 12:52:58 +02:00
parent f2ccad7327
commit 5ad319e133
No known key found for this signature in database
GPG Key ID: 4C583C52B0C3877D
12 changed files with 59 additions and 59 deletions

View File

@ -79,7 +79,7 @@ galileo_e5a_noncoherentIQ_acquisition_caf_cc::galileo_e5a_noncoherentIQ_acquisit
d_samples_per_code = samples_per_code;
d_max_dwells = max_dwells;
d_well_count = 0;
d_doppler_max = doppler_max;
d_doppler_max = static_cast<int>(doppler_max);
if (Zero_padding_ > 0)
{
d_sampled_ms = 1;
@ -88,7 +88,7 @@ galileo_e5a_noncoherentIQ_acquisition_caf_cc::galileo_e5a_noncoherentIQ_acquisit
{
d_sampled_ms = sampled_ms;
}
d_fft_size = sampled_ms * d_samples_per_ms;
d_fft_size = static_cast<int>(sampled_ms) * d_samples_per_ms;
d_mag = 0;
d_input_power = 0.0;
d_num_doppler_bins = 0;
@ -228,8 +228,8 @@ void galileo_e5a_noncoherentIQ_acquisition_caf_cc::init()
// Count the number of bins
d_num_doppler_bins = 0;
for (int doppler = static_cast<int>(-d_doppler_max);
doppler <= static_cast<int>(d_doppler_max);
for (int doppler = -d_doppler_max;
doppler <= d_doppler_max;
doppler += d_doppler_step)
{
d_num_doppler_bins++;
@ -237,10 +237,10 @@ void galileo_e5a_noncoherentIQ_acquisition_caf_cc::init()
// Create the carrier Doppler wipeoff signals
d_grid_doppler_wipeoffs = std::vector<std::vector<gr_complex>>(d_num_doppler_bins, std::vector<gr_complex>(d_fft_size));
for (unsigned int doppler_index = 0; doppler_index < d_num_doppler_bins; doppler_index++)
for (int doppler_index = 0; doppler_index < d_num_doppler_bins; doppler_index++)
{
int doppler = -static_cast<int>(d_doppler_max) + d_doppler_step * doppler_index;
float phase_step_rad = static_cast<float>(TWO_PI) * doppler / static_cast<float>(d_fs_in);
int doppler = -d_doppler_max + d_doppler_step * doppler_index;
float phase_step_rad = static_cast<float>(TWO_PI) * static_cast<float>(doppler) / static_cast<float>(d_fs_in);
std::array<float, 1> _phase{};
volk_gnsssdr_s32f_sincos_32fc(d_grid_doppler_wipeoffs[doppler_index].data(), -phase_step_rad, _phase.data(), d_fft_size);
}
@ -331,7 +331,7 @@ int galileo_e5a_noncoherentIQ_acquisition_caf_cc::general_work(int noutput_items
case 1:
{
const auto *in = reinterpret_cast<const gr_complex *>(input_items[0]); // Get the input samples pointer
unsigned int buff_increment;
int buff_increment;
if ((ninput_items[0] + d_buffer_count) <= d_fft_size)
{
buff_increment = ninput_items[0];
@ -342,7 +342,7 @@ int galileo_e5a_noncoherentIQ_acquisition_caf_cc::general_work(int noutput_items
}
memcpy(&d_inbuffer[d_buffer_count], in, sizeof(gr_complex) * buff_increment);
// If buffer will be full in next iteration
if (d_buffer_count >= (d_fft_size - d_gr_stream_buffer))
if (d_buffer_count >= static_cast<int>(d_fft_size - d_gr_stream_buffer))
{
d_state = 2;
}
@ -390,7 +390,7 @@ int galileo_e5a_noncoherentIQ_acquisition_caf_cc::general_work(int noutput_items
d_input_power /= static_cast<float>(d_fft_size);
// 2- Doppler frequency search loop
for (unsigned int doppler_index = 0; doppler_index < d_num_doppler_bins; doppler_index++)
for (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;
@ -470,7 +470,7 @@ int galileo_e5a_noncoherentIQ_acquisition_caf_cc::general_work(int noutput_items
{
d_CAF_vector_Q[doppler_index] = d_magnitudeQA[indext_QA];
}
for (unsigned int i = 0; i < d_fft_size; i++)
for (int i = 0; i < d_fft_size; i++)
{
d_magnitudeIA[i] += d_magnitudeQA[i];
}
@ -481,7 +481,7 @@ int galileo_e5a_noncoherentIQ_acquisition_caf_cc::general_work(int noutput_items
{
d_CAF_vector_Q[doppler_index] = d_magnitudeQB[indext_QB];
}
for (unsigned int i = 0; i < d_fft_size; i++)
for (int i = 0; i < d_fft_size; i++)
{
d_magnitudeIA[i] += d_magnitudeQB[i];
}
@ -505,7 +505,7 @@ int galileo_e5a_noncoherentIQ_acquisition_caf_cc::general_work(int noutput_items
{
d_CAF_vector_Q[doppler_index] = d_magnitudeQA[indext_QA];
}
for (unsigned int i = 0; i < d_fft_size; i++)
for (int i = 0; i < d_fft_size; i++)
{
d_magnitudeIB[i] += d_magnitudeQA[i];
}
@ -516,7 +516,7 @@ int galileo_e5a_noncoherentIQ_acquisition_caf_cc::general_work(int noutput_items
{
d_CAF_vector_Q[doppler_index] = d_magnitudeQB[indext_QB];
}
for (unsigned int i = 0; i < d_fft_size; i++)
for (int i = 0; i < d_fft_size; i++)
{
d_magnitudeIB[i] += d_magnitudeQB[i];
}
@ -539,7 +539,7 @@ int galileo_e5a_noncoherentIQ_acquisition_caf_cc::general_work(int noutput_items
d_CAF_vector_Q[doppler_index] = d_magnitudeQA[indext_QA];
}
// NON-Coherent integration of only 1 code
for (unsigned int i = 0; i < d_fft_size; i++)
for (int i = 0; i < d_fft_size; i++)
{
d_magnitudeIA[i] += d_magnitudeQA[i];
}
@ -605,7 +605,7 @@ int galileo_e5a_noncoherentIQ_acquisition_caf_cc::general_work(int noutput_items
std::array<float, 1> accum{};
CAF_bins_half = d_CAF_window_hz / (2 * d_doppler_step);
float weighting_factor;
weighting_factor = 0.5 / static_cast<float>(CAF_bins_half);
weighting_factor = 0.5F / static_cast<float>(CAF_bins_half);
// weighting_factor = 0;
// std::cout << "weighting_factor " << weighting_factor << '\n';
// Initialize first iterations
@ -614,37 +614,37 @@ int galileo_e5a_noncoherentIQ_acquisition_caf_cc::general_work(int noutput_items
d_CAF_vector[doppler_index] = 0;
for (int i = 0; i < CAF_bins_half + doppler_index + 1; i++)
{
d_CAF_vector[doppler_index] += d_CAF_vector_I[i] * (1 - weighting_factor * static_cast<unsigned int>((doppler_index - i)));
d_CAF_vector[doppler_index] += d_CAF_vector_I[i] * (1.0F - weighting_factor * static_cast<float>((doppler_index - i)));
}
d_CAF_vector[doppler_index] /= 1 + CAF_bins_half + doppler_index - weighting_factor * CAF_bins_half * (CAF_bins_half + 1) / 2 - weighting_factor * doppler_index * (doppler_index + 1) / 2; // triangles = [n*(n+1)/2]
d_CAF_vector[doppler_index] /= static_cast<float>(1.0F + static_cast<float>(CAF_bins_half + doppler_index) - weighting_factor * static_cast<float>(CAF_bins_half) * ((static_cast<float>(CAF_bins_half) + 1.0F) / 2.0F) - weighting_factor * static_cast<float>(doppler_index) * (static_cast<float>(doppler_index) + 1.0F) / 2.0F); // triangles = [n*(n+1)/2]
if (d_both_signal_components)
{
accum[0] = 0;
for (int i = 0; i < CAF_bins_half + doppler_index + 1; i++)
{
accum[0] += d_CAF_vector_Q[i] * (1 - weighting_factor * static_cast<unsigned int>(abs(doppler_index - i)));
accum[0] += static_cast<float>(d_CAF_vector_Q[i] * (1.0F - weighting_factor * static_cast<float>(abs(doppler_index - i))));
}
accum[0] /= 1 + CAF_bins_half + doppler_index - weighting_factor * CAF_bins_half * (CAF_bins_half + 1) / 2 - weighting_factor * doppler_index * (doppler_index + 1) / 2; // triangles = [n*(n+1)/2]
accum[0] /= static_cast<float>(1.0F + static_cast<float>(CAF_bins_half + doppler_index) - weighting_factor * static_cast<float>(CAF_bins_half) * static_cast<float>(CAF_bins_half + 1) / 2.0F - weighting_factor * static_cast<float>(doppler_index) * static_cast<float>(doppler_index + 1) / 2.0F); // triangles = [n*(n+1)/2]
d_CAF_vector[doppler_index] += accum[0];
}
}
// Body loop
for (unsigned int doppler_index = CAF_bins_half; doppler_index < d_num_doppler_bins - CAF_bins_half; doppler_index++)
for (int doppler_index = CAF_bins_half; doppler_index < d_num_doppler_bins - CAF_bins_half; doppler_index++)
{
d_CAF_vector[doppler_index] = 0;
for (int i = doppler_index - CAF_bins_half; i < static_cast<int>(doppler_index + CAF_bins_half + 1); i++)
{
d_CAF_vector[doppler_index] += d_CAF_vector_I[i] * (1 - weighting_factor * static_cast<unsigned int>((doppler_index - i)));
d_CAF_vector[doppler_index] += d_CAF_vector_I[i] * (1.0F - weighting_factor * static_cast<float>((doppler_index - i)));
}
d_CAF_vector[doppler_index] /= 1 + 2 * CAF_bins_half - 2 * weighting_factor * CAF_bins_half * (CAF_bins_half + 1) / 2;
d_CAF_vector[doppler_index] /= static_cast<float>(1.0F + 2.0F * static_cast<float>(CAF_bins_half) - 2.0F * weighting_factor * static_cast<float>(CAF_bins_half) * static_cast<float>(CAF_bins_half + 1) / 2.0F);
if (d_both_signal_components)
{
accum[0] = 0;
for (int i = doppler_index - CAF_bins_half; i < static_cast<int>(doppler_index + CAF_bins_half + 1); i++)
{
accum[0] += d_CAF_vector_Q[i] * (1 - weighting_factor * static_cast<unsigned int>((doppler_index - i)));
accum[0] += static_cast<float>(d_CAF_vector_Q[i] * (1 - weighting_factor * static_cast<float>((doppler_index - i))));
}
accum[0] /= 1 + 2 * CAF_bins_half - 2 * weighting_factor * CAF_bins_half * (CAF_bins_half + 1) / 2;
accum[0] /= static_cast<float>(1.0F + 2.0F * static_cast<float>(CAF_bins_half) - 2.0F * weighting_factor * static_cast<float>(CAF_bins_half) * static_cast<float>(CAF_bins_half + 1) / 2.0F);
d_CAF_vector[doppler_index] += accum[0];
}
}
@ -654,24 +654,24 @@ int galileo_e5a_noncoherentIQ_acquisition_caf_cc::general_work(int noutput_items
d_CAF_vector[doppler_index] = 0;
for (int i = doppler_index - CAF_bins_half; i < static_cast<int>(d_num_doppler_bins); i++)
{
d_CAF_vector[doppler_index] += d_CAF_vector_I[i] * (1 - weighting_factor * (abs(doppler_index - i)));
d_CAF_vector[doppler_index] += d_CAF_vector_I[i] * (1.0F - weighting_factor * static_cast<float>(abs(doppler_index - i)));
}
d_CAF_vector[doppler_index] /= 1 + CAF_bins_half + (d_num_doppler_bins - doppler_index - 1) - weighting_factor * CAF_bins_half * (CAF_bins_half + 1) / 2 - weighting_factor * (d_num_doppler_bins - doppler_index - 1) * (d_num_doppler_bins - doppler_index) / 2;
d_CAF_vector[doppler_index] /= static_cast<float>(1.0F + static_cast<float>(CAF_bins_half) + static_cast<float>(d_num_doppler_bins - doppler_index - 1) - weighting_factor * static_cast<float>(CAF_bins_half) * (static_cast<float>(CAF_bins_half) + 1.0F) / 2.0F - weighting_factor * static_cast<float>(d_num_doppler_bins - doppler_index - 1) * static_cast<float>(d_num_doppler_bins - doppler_index) / 2.0F);
if (d_both_signal_components)
{
accum[0] = 0;
for (int i = doppler_index - CAF_bins_half; i < static_cast<int>(d_num_doppler_bins); i++)
{
accum[0] += d_CAF_vector_Q[i] * (1 - weighting_factor * (abs(doppler_index - i)));
accum[0] += static_cast<float>(d_CAF_vector_Q[i] * (1.0F - weighting_factor * static_cast<float>(abs(doppler_index - i))));
}
accum[0] /= 1 + CAF_bins_half + (d_num_doppler_bins - doppler_index - 1) - weighting_factor * CAF_bins_half * (CAF_bins_half + 1) / 2 - weighting_factor * (d_num_doppler_bins - doppler_index - 1) * (d_num_doppler_bins - doppler_index) / 2;
accum[0] /= static_cast<float>(1.0F + static_cast<float>(CAF_bins_half) + static_cast<float>(d_num_doppler_bins - doppler_index - 1) - weighting_factor * static_cast<float>(CAF_bins_half) * static_cast<float>(CAF_bins_half + 1.0) / 2.0 - weighting_factor * static_cast<float>(d_num_doppler_bins - doppler_index - 1) * static_cast<float>(d_num_doppler_bins - doppler_index) / 2.0);
d_CAF_vector[doppler_index] += accum[0];
}
}
// Recompute the maximum doppler peak
volk_gnsssdr_32f_index_max_32u(&indext, d_CAF_vector.data(), d_num_doppler_bins);
doppler = -static_cast<int>(d_doppler_max) + d_doppler_step * indext;
doppler = -d_doppler_max + d_doppler_step * static_cast<int>(indext);
d_gnss_synchro->Acq_doppler_hz = static_cast<double>(doppler);
// Dump if required, appended at the end of the file
if (d_dump)

View File

@ -241,19 +241,19 @@ private:
int d_state;
int d_samples_per_ms;
int d_sampled_ms;
unsigned int d_sampled_ms;
int d_samples_per_code;
int d_CAF_window_hz;
unsigned int d_channel;
unsigned int d_buffer_count;
int d_buffer_count;
unsigned int d_gr_stream_buffer;
unsigned int d_doppler_resolution;
unsigned int d_doppler_max;
unsigned int d_doppler_step;
int d_doppler_resolution;
int d_doppler_max;
int d_doppler_step;
unsigned int d_max_dwells;
unsigned int d_well_count;
unsigned int d_fft_size;
unsigned int d_num_doppler_bins;
int d_fft_size;
int d_num_doppler_bins;
unsigned int d_code_phase;
bool d_bit_transition_flag;

View File

@ -54,8 +54,8 @@ galileo_pcps_8ms_acquisition_cc::galileo_pcps_8ms_acquisition_cc(
int32_t samples_per_code,
bool dump,
const std::string &dump_filename) : gr::block("galileo_pcps_8ms_acquisition_cc",
gr::io_signature::make(1, 1, sizeof(gr_complex) * sampled_ms * samples_per_ms),
gr::io_signature::make(0, 0, sizeof(gr_complex) * sampled_ms * samples_per_ms))
gr::io_signature::make(1, 1, static_cast<int>(sizeof(gr_complex) * sampled_ms * samples_per_ms)),
gr::io_signature::make(0, 0, static_cast<int>(sizeof(gr_complex) * sampled_ms * samples_per_ms)))
{
this->message_port_register_out(pmt::mp("events"));
d_sample_counter = 0ULL; // SAMPLE COUNTER

View File

@ -321,7 +321,7 @@ void pcps_acquisition::update_grid_doppler_wipeoffs()
for (uint32_t doppler_index = 0; doppler_index < d_num_doppler_bins; doppler_index++)
{
int32_t doppler = -static_cast<int32_t>(d_acq_parameters.doppler_max) + d_doppler_center + d_doppler_step * doppler_index;
update_local_carrier(d_grid_doppler_wipeoffs[doppler_index], d_doppler_bias + doppler);
update_local_carrier(d_grid_doppler_wipeoffs[doppler_index], static_cast<float>(d_doppler_bias + doppler));
}
}

View File

@ -70,7 +70,7 @@ pcps_acquisition_fine_doppler_cc::pcps_acquisition_fine_doppler_cc(const Acq_Con
d_sample_counter = 0ULL; // SAMPLE COUNTER
d_active = false;
d_fs_in = conf_.fs_in;
d_samples_per_ms = conf_.samples_per_ms;
d_samples_per_ms = static_cast<int>(conf_.samples_per_ms);
d_config_doppler_max = conf_.doppler_max;
d_fft_size = d_samples_per_ms;
// HS Acquisition
@ -212,7 +212,7 @@ void pcps_acquisition_fine_doppler_cc::reset_grid()
for (int i = 0; i < d_num_doppler_points; i++)
{
// todo: use memset here
for (unsigned int j = 0; j < d_fft_size; j++)
for (int j = 0; j < d_fft_size; j++)
{
d_grid_data[i][j] = 0.0;
}
@ -228,10 +228,10 @@ void pcps_acquisition_fine_doppler_cc::update_carrier_wipeoff()
d_grid_doppler_wipeoffs = volk_gnsssdr::vector<volk_gnsssdr::vector<std::complex<float>>>(d_num_doppler_points, volk_gnsssdr::vector<std::complex<float>>(d_fft_size));
for (int doppler_index = 0; doppler_index < d_num_doppler_points; doppler_index++)
{
doppler_hz = d_doppler_step * doppler_index - d_config_doppler_max;
doppler_hz = static_cast<int>(d_doppler_step) * doppler_index - d_config_doppler_max;
// doppler search steps
// compute the carrier doppler wipe-off signal and store it
phase_step_rad = static_cast<float>(TWO_PI) * doppler_hz / static_cast<float>(d_fs_in);
phase_step_rad = static_cast<float>(TWO_PI) * static_cast<float>(doppler_hz) / static_cast<float>(d_fs_in);
float _phase[1];
_phase[0] = 0;
volk_gnsssdr_s32f_sincos_32fc(d_grid_doppler_wipeoffs[doppler_index].data(), -phase_step_rad, _phase, d_fft_size);
@ -239,7 +239,7 @@ void pcps_acquisition_fine_doppler_cc::update_carrier_wipeoff()
}
double pcps_acquisition_fine_doppler_cc::compute_CAF()
float pcps_acquisition_fine_doppler_cc::compute_CAF()
{
float firstPeak = 0.0;
int index_doppler = 0;

View File

@ -195,7 +195,7 @@ private:
int compute_and_accumulate_grid(gr_vector_const_void_star& input_items);
int estimate_Doppler();
float estimate_input_power(gr_vector_const_void_star& input_items);
double compute_CAF();
float compute_CAF();
void reset_grid();
void update_carrier_wipeoff();
bool start();
@ -234,11 +234,11 @@ private:
int d_gnuradio_forecast_samples;
int d_config_doppler_max;
int d_num_doppler_points;
int d_doppler_step;
int d_well_count;
int d_n_samples_in_buffer;
int d_fft_size;
unsigned int d_doppler_step;
unsigned int d_channel;
unsigned int d_fft_size;
unsigned int d_code_phase;
unsigned int d_dump_channel;

View File

@ -228,7 +228,7 @@ void pcps_assisted_acquisition_cc::redefine_grid()
}
double pcps_assisted_acquisition_cc::search_maximum()
float pcps_assisted_acquisition_cc::search_maximum()
{
float magt = 0.0;
float fft_normalization_factor;
@ -252,7 +252,7 @@ double pcps_assisted_acquisition_cc::search_maximum()
magt = magt / (fft_normalization_factor * fft_normalization_factor);
// 5- Compute the test statistics and compare to the threshold
d_test_statistics = 2 * d_fft_size * magt / (d_input_power * d_well_count);
d_test_statistics = 2.0F * d_fft_size * magt / (d_input_power * d_well_count);
// 4- record the maximum peak and the associated synchronization parameters
d_gnss_synchro->Acq_delay_samples = static_cast<double>(index_time);

View File

@ -195,7 +195,7 @@ private:
int32_t compute_and_accumulate_grid(gr_vector_const_void_star& input_items);
float estimate_input_power(gr_vector_const_void_star& input_items);
double search_maximum();
float search_maximum();
void get_assistance();
void reset_grid();
void redefine_grid();

View File

@ -59,8 +59,8 @@ pcps_cccwsr_acquisition_cc::pcps_cccwsr_acquisition_cc(
int32_t samples_per_code,
bool dump,
const std::string &dump_filename) : gr::block("pcps_cccwsr_acquisition_cc",
gr::io_signature::make(1, 1, sizeof(gr_complex) * sampled_ms * samples_per_ms),
gr::io_signature::make(0, 0, sizeof(gr_complex) * sampled_ms * samples_per_ms))
gr::io_signature::make(1, 1, static_cast<int>(sizeof(gr_complex) * sampled_ms * samples_per_ms)),
gr::io_signature::make(0, 0, static_cast<int>(sizeof(gr_complex) * sampled_ms * samples_per_ms)))
{
this->message_port_register_out(pmt::mp("events"));
d_sample_counter = 0ULL; // SAMPLE COUNTER

View File

@ -79,8 +79,8 @@ pcps_opencl_acquisition_cc::pcps_opencl_acquisition_cc(
bool bit_transition_flag,
bool dump,
const std::string &dump_filename) : gr::block("pcps_opencl_acquisition_cc",
gr::io_signature::make(1, 1, sizeof(gr_complex) * sampled_ms * samples_per_ms),
gr::io_signature::make(0, 0, sizeof(gr_complex) * sampled_ms * samples_per_ms))
gr::io_signature::make(1, 1, static_cast<int>(sizeof(gr_complex) * sampled_ms * samples_per_ms)),
gr::io_signature::make(0, 0, static_cast<int>(sizeof(gr_complex) * sampled_ms * samples_per_ms)))
{
this->message_port_register_out(pmt::mp("events"));
d_sample_counter = 0ULL; // SAMPLE COUNTER

View File

@ -61,8 +61,8 @@ pcps_quicksync_acquisition_cc::pcps_quicksync_acquisition_cc(
bool bit_transition_flag,
bool dump,
const std::string& dump_filename) : gr::block("pcps_quicksync_acquisition_cc",
gr::io_signature::make(1, 1, (sizeof(gr_complex) * sampled_ms * samples_per_ms)),
gr::io_signature::make(0, 0, (sizeof(gr_complex) * sampled_ms * samples_per_ms)))
gr::io_signature::make(1, 1, static_cast<int>(sizeof(gr_complex) * sampled_ms * samples_per_ms)),
gr::io_signature::make(0, 0, static_cast<int>(sizeof(gr_complex) * sampled_ms * samples_per_ms)))
{
this->message_port_register_out(pmt::mp("events"));
d_sample_counter = 0ULL; // SAMPLE COUNTER

View File

@ -77,8 +77,8 @@ pcps_tong_acquisition_cc::pcps_tong_acquisition_cc(
uint32_t tong_max_dwells,
bool dump,
const std::string &dump_filename) : gr::block("pcps_tong_acquisition_cc",
gr::io_signature::make(1, 1, sizeof(gr_complex) * sampled_ms * samples_per_ms),
gr::io_signature::make(0, 0, sizeof(gr_complex) * sampled_ms * samples_per_ms))
gr::io_signature::make(1, 1, static_cast<int>(sizeof(gr_complex) * sampled_ms * samples_per_ms)),
gr::io_signature::make(0, 0, static_cast<int>(sizeof(gr_complex) * sampled_ms * samples_per_ms)))
{
this->message_port_register_out(pmt::mp("events"));
d_sample_counter = 0ULL; // SAMPLE COUNTER