mirror of
https://github.com/gnss-sdr/gnss-sdr
synced 2025-10-22 02:57:41 +00:00
Fix for volk_32f_index_max issues
This now also works for VOLK <= 1.2.2
This commit is contained in:
@@ -416,11 +416,11 @@ int galileo_e5a_noncoherentIQ_acquisition_caf_cc::general_work(int noutput_items
|
||||
|
||||
// initialize acquisition algorithm
|
||||
int doppler;
|
||||
unsigned int indext = 0;
|
||||
unsigned int indext_IA = 0;
|
||||
unsigned int indext_IB = 0;
|
||||
unsigned int indext_QA = 0;
|
||||
unsigned int indext_QB = 0;
|
||||
uint32_t indext = 0;
|
||||
uint32_t indext_IA = 0;
|
||||
uint32_t indext_IB = 0;
|
||||
uint32_t indext_QA = 0;
|
||||
uint32_t indext_QB = 0;
|
||||
float magt = 0.0;
|
||||
float magt_IA = 0.0;
|
||||
float magt_IB = 0.0;
|
||||
@@ -467,7 +467,12 @@ int galileo_e5a_noncoherentIQ_acquisition_caf_cc::general_work(int noutput_items
|
||||
|
||||
// Search maximum
|
||||
volk_32fc_magnitude_squared_32f(d_magnitudeIA, d_ifft->get_outbuf(), d_fft_size);
|
||||
#if VOLK_GT_122
|
||||
volk_32f_index_max_32u(&indext_IA, d_magnitudeIA, d_fft_size);
|
||||
#else
|
||||
volk_32f_index_max_16u(&indext_IA, d_magnitudeIA, d_fft_size);
|
||||
#endif
|
||||
|
||||
// Normalize the maximum value to correct the scale factor introduced by FFTW
|
||||
magt_IA = d_magnitudeIA[indext_IA] / (fft_normalization_factor * fft_normalization_factor);
|
||||
|
||||
@@ -478,7 +483,11 @@ int galileo_e5a_noncoherentIQ_acquisition_caf_cc::general_work(int noutput_items
|
||||
d_fft_if->get_outbuf(), d_fft_code_Q_A, d_fft_size);
|
||||
d_ifft->execute();
|
||||
volk_32fc_magnitude_squared_32f(d_magnitudeQA, d_ifft->get_outbuf(), d_fft_size);
|
||||
#if VOLK_GT_122
|
||||
volk_32f_index_max_32u(&indext_QA, d_magnitudeQA, d_fft_size);
|
||||
#else
|
||||
volk_32f_index_max_16u(&indext_QA, d_magnitudeQA, d_fft_size);
|
||||
#endif
|
||||
magt_QA = d_magnitudeQA[indext_QA] / (fft_normalization_factor * fft_normalization_factor);
|
||||
}
|
||||
if (d_sampled_ms > 1) // If Integration time > 1 code
|
||||
@@ -488,7 +497,11 @@ int galileo_e5a_noncoherentIQ_acquisition_caf_cc::general_work(int noutput_items
|
||||
d_fft_if->get_outbuf(), d_fft_code_I_B, d_fft_size);
|
||||
d_ifft->execute();
|
||||
volk_32fc_magnitude_squared_32f(d_magnitudeIB, d_ifft->get_outbuf(), d_fft_size);
|
||||
#if VOLK_GT_122
|
||||
volk_32f_index_max_32u(&indext_IB, d_magnitudeIB, d_fft_size);
|
||||
#else
|
||||
volk_32f_index_max_16u(&indext_IB, d_magnitudeIB, d_fft_size);
|
||||
#endif
|
||||
magt_IB = d_magnitudeIB[indext_IB] / (fft_normalization_factor * fft_normalization_factor);
|
||||
|
||||
if (d_both_signal_components == true)
|
||||
@@ -498,7 +511,11 @@ int galileo_e5a_noncoherentIQ_acquisition_caf_cc::general_work(int noutput_items
|
||||
d_fft_if->get_outbuf(), d_fft_code_Q_B, d_fft_size);
|
||||
d_ifft->execute();
|
||||
volk_32fc_magnitude_squared_32f(d_magnitudeQB, d_ifft->get_outbuf(), d_fft_size);
|
||||
#if VOLK_GT_122
|
||||
volk_32f_index_max_32u(&indext_QB, d_magnitudeQB, d_fft_size);
|
||||
#else
|
||||
volk_32f_index_max_16u(&indext_QB, d_magnitudeQB, d_fft_size);
|
||||
#endif
|
||||
magt_QB = d_magnitudeIB[indext_QB] / (fft_normalization_factor * fft_normalization_factor);
|
||||
}
|
||||
}
|
||||
@@ -535,7 +552,11 @@ int galileo_e5a_noncoherentIQ_acquisition_caf_cc::general_work(int noutput_items
|
||||
}
|
||||
}
|
||||
}
|
||||
#if VOLK_GT_122
|
||||
volk_32f_index_max_32u(&indext, d_magnitudeIA, d_fft_size);
|
||||
#else
|
||||
volk_32f_index_max_16u(&indext, d_magnitudeIA, d_fft_size);
|
||||
#endif
|
||||
magt = d_magnitudeIA[indext] / (fft_normalization_factor * fft_normalization_factor);
|
||||
}
|
||||
else
|
||||
@@ -564,7 +585,11 @@ int galileo_e5a_noncoherentIQ_acquisition_caf_cc::general_work(int noutput_items
|
||||
}
|
||||
}
|
||||
}
|
||||
#if VOLK_GT_122
|
||||
volk_32f_index_max_32u(&indext, d_magnitudeIB, d_fft_size);
|
||||
#else
|
||||
volk_32f_index_max_16u(&indext, d_magnitudeIB, d_fft_size);
|
||||
#endif
|
||||
magt = d_magnitudeIB[indext] / (fft_normalization_factor * fft_normalization_factor);
|
||||
}
|
||||
}
|
||||
@@ -582,7 +607,11 @@ int galileo_e5a_noncoherentIQ_acquisition_caf_cc::general_work(int noutput_items
|
||||
d_magnitudeIA[i] += d_magnitudeQA[i];
|
||||
}
|
||||
}
|
||||
#if VOLK_GT_122
|
||||
volk_32f_index_max_32u(&indext, d_magnitudeIA, d_fft_size);
|
||||
#else
|
||||
volk_32f_index_max_16u(&indext, d_magnitudeIA, d_fft_size);
|
||||
#endif
|
||||
magt = d_magnitudeIA[indext] / (fft_normalization_factor * fft_normalization_factor);
|
||||
}
|
||||
|
||||
@@ -720,7 +749,11 @@ int galileo_e5a_noncoherentIQ_acquisition_caf_cc::general_work(int noutput_items
|
||||
}
|
||||
|
||||
// Recompute the maximum doppler peak
|
||||
#if VOLK_GT_122
|
||||
volk_32f_index_max_32u(&indext, d_CAF_vector, d_num_doppler_bins);
|
||||
#else
|
||||
volk_32f_index_max_16u(&indext, d_CAF_vector, d_num_doppler_bins);
|
||||
#endif
|
||||
doppler = -static_cast<int>(d_doppler_max) + d_doppler_step * indext;
|
||||
d_gnss_synchro->Acq_doppler_hz = static_cast<double>(doppler);
|
||||
// Dump if required, appended at the end of the file
|
||||
|
@@ -287,7 +287,11 @@ int galileo_pcps_8ms_acquisition_cc::general_work(int noutput_items,
|
||||
|
||||
// Search maximum
|
||||
volk_32fc_magnitude_squared_32f(d_magnitude, d_ifft->get_outbuf(), d_fft_size);
|
||||
#if VOLK_GT_122
|
||||
volk_32f_index_max_32u(&indext_A, d_magnitude, d_fft_size);
|
||||
#else
|
||||
volk_32f_index_max_16u(&indext_A, d_magnitude, d_fft_size);
|
||||
#endif
|
||||
|
||||
// Normalize the maximum value to correct the scale factor introduced by FFTW
|
||||
magt_A = d_magnitude[indext_A] / (fft_normalization_factor * fft_normalization_factor);
|
||||
@@ -303,7 +307,11 @@ int galileo_pcps_8ms_acquisition_cc::general_work(int noutput_items,
|
||||
|
||||
// Search maximum
|
||||
volk_32fc_magnitude_squared_32f(d_magnitude, d_ifft->get_outbuf(), d_fft_size);
|
||||
#if VOLK_GT_122
|
||||
volk_32f_index_max_32u(&indext_B, d_magnitude, d_fft_size);
|
||||
#else
|
||||
volk_32f_index_max_16u(&indext_B, d_magnitude, d_fft_size);
|
||||
#endif
|
||||
|
||||
// Normalize the maximum value to correct the scale factor introduced by FFTW
|
||||
magt_B = d_magnitude[indext_B] / (fft_normalization_factor * fft_normalization_factor);
|
||||
|
@@ -311,7 +311,11 @@ int pcps_acquisition_cc::general_work(int noutput_items,
|
||||
|
||||
// Search maximum
|
||||
volk_32fc_magnitude_squared_32f(d_magnitude, d_ifft->get_outbuf() + offset, effective_fft_size);
|
||||
#if VOLK_GT_122
|
||||
volk_32f_index_max_32u(&indext, d_magnitude, effective_fft_size);
|
||||
#else
|
||||
volk_32f_index_max_16u(&indext, d_magnitude, effective_fft_size);
|
||||
#endif
|
||||
|
||||
// Normalize the maximum value to correct the scale factor introduced by FFTW
|
||||
magt = d_magnitude[indext] / (static_cast<float>( effective_fft_size ) *
|
||||
|
@@ -220,7 +220,11 @@ double pcps_acquisition_fine_doppler_cc::search_maximum()
|
||||
|
||||
for (int i=0;i<d_num_doppler_points;i++)
|
||||
{
|
||||
#if VOLK_GT_122
|
||||
volk_32f_index_max_32u(&tmp_intex_t, d_grid_data[i], d_fft_size);
|
||||
#else
|
||||
volk_32f_index_max_16u(&tmp_intex_t, d_grid_data[i], d_fft_size);
|
||||
#endif
|
||||
if (d_grid_data[i][tmp_intex_t] > magt)
|
||||
{
|
||||
magt = d_grid_data[i][tmp_intex_t];
|
||||
@@ -353,7 +357,11 @@ int pcps_acquisition_fine_doppler_cc::estimate_Doppler(gr_vector_const_void_star
|
||||
volk_32fc_magnitude_squared_32f(p_tmp_vector, fft_operator->get_outbuf(), fft_size_extended);
|
||||
|
||||
uint32_t tmp_index_freq = 0;
|
||||
#if VOLK_GT_122
|
||||
volk_32f_index_max_32u(&tmp_index_freq, p_tmp_vector, fft_size_extended);
|
||||
#else
|
||||
volk_32f_index_max_16u(&tmp_index_freq, p_tmp_vector, fft_size_extended);
|
||||
#endif
|
||||
|
||||
//case even
|
||||
int counter = 0;
|
||||
|
@@ -267,7 +267,11 @@ double pcps_assisted_acquisition_cc::search_maximum()
|
||||
|
||||
for (int i=0;i<d_num_doppler_points;i++)
|
||||
{
|
||||
#if VOLK_GT_122
|
||||
volk_32f_index_max_32u_a(&tmp_intex_t,d_grid_data[i],d_fft_size);
|
||||
#else
|
||||
volk_32f_index_max_16u_a(&tmp_intex_t,d_grid_data[i],d_fft_size);
|
||||
#endif
|
||||
if (d_grid_data[i][tmp_intex_t] > magt)
|
||||
{
|
||||
magt = d_grid_data[i][index_time];
|
||||
|
@@ -326,11 +326,19 @@ int pcps_cccwsr_acquisition_cc::general_work(int noutput_items,
|
||||
}
|
||||
|
||||
volk_32fc_magnitude_squared_32f(d_magnitude, d_correlation_plus, d_fft_size);
|
||||
#if VOLK_GT_122
|
||||
volk_32f_index_max_32u(&indext_plus, d_magnitude, d_fft_size);
|
||||
#else
|
||||
volk_32f_index_max_16u(&indext_plus, d_magnitude, d_fft_size);
|
||||
#endif
|
||||
magt_plus = d_magnitude[indext_plus] / (fft_normalization_factor * fft_normalization_factor);
|
||||
|
||||
volk_32fc_magnitude_squared_32f(d_magnitude, d_correlation_minus, d_fft_size);
|
||||
#if VOLK_GT_122
|
||||
volk_32f_index_max_32u(&indext_minus, d_magnitude, d_fft_size);
|
||||
#else
|
||||
volk_32f_index_max_16u(&indext_minus, d_magnitude, d_fft_size);
|
||||
#endif
|
||||
magt_minus = d_magnitude[indext_minus] / (fft_normalization_factor * fft_normalization_factor);
|
||||
|
||||
if (magt_plus >= magt_minus)
|
||||
|
@@ -237,7 +237,11 @@ void pcps_multithread_acquisition_cc::acquisition_core()
|
||||
|
||||
// Search maximum
|
||||
volk_32fc_magnitude_squared_32f(d_magnitude, d_ifft->get_outbuf(), d_fft_size);
|
||||
#if VOLK_GT_122
|
||||
volk_32f_index_max_32u(&indext, d_magnitude, d_fft_size);
|
||||
#else
|
||||
volk_32f_index_max_16u(&indext, d_magnitude, d_fft_size);
|
||||
#endif
|
||||
|
||||
// Normalize the maximum value to correct the scale factor introduced by FFTW
|
||||
magt = d_magnitude[indext] / (fft_normalization_factor * fft_normalization_factor);
|
||||
|
@@ -424,7 +424,11 @@ void pcps_opencl_acquisition_cc::acquisition_core_volk()
|
||||
|
||||
// Search maximum
|
||||
volk_32fc_magnitude_squared_32f(d_magnitude, d_ifft->get_outbuf(), d_fft_size);
|
||||
#if VOLK_GT_122
|
||||
volk_32f_index_max_32u(&indext, d_magnitude, d_fft_size);
|
||||
#else
|
||||
volk_32f_index_max_16u(&indext, d_magnitude, d_fft_size);
|
||||
#endif
|
||||
|
||||
// Normalize the maximum value to correct the scale factor introduced by FFTW
|
||||
magt = d_magnitude[indext] / (fft_normalization_factor * fft_normalization_factor);
|
||||
@@ -586,7 +590,11 @@ void pcps_opencl_acquisition_cc::acquisition_core_opencl()
|
||||
|
||||
// Search maximum
|
||||
// @TODO: find an efficient way to search the maximum with OpenCL in the GPU.
|
||||
#if VOLK_GT_122
|
||||
volk_32f_index_max_32u(&indext, d_magnitude, d_fft_size);
|
||||
#else
|
||||
volk_32f_index_max_16u(&indext, d_magnitude, d_fft_size);
|
||||
#endif
|
||||
|
||||
// Normalize the maximum value to correct the scale factor introduced by FFTW
|
||||
magt = d_magnitude[indext] / (fft_normalization_factor * fft_normalization_factor);
|
||||
|
@@ -398,7 +398,11 @@ int pcps_quicksync_acquisition_cc::general_work(int noutput_items,
|
||||
introduced by FFTW*/
|
||||
//volk_32f_s32f_multiply_32f_a(d_magnitude_folded,d_magnitude_folded,
|
||||
// (1 / (fft_normalization_factor * fft_normalization_factor)), d_fft_size);
|
||||
#if VOLK_GT_122
|
||||
volk_32f_index_max_32u(&indext, d_magnitude_folded, d_fft_size);
|
||||
#else
|
||||
volk_32f_index_max_16u(&indext, d_magnitude_folded, d_fft_size);
|
||||
#endif
|
||||
|
||||
magt = d_magnitude_folded[indext] / (fft_normalization_factor * fft_normalization_factor);
|
||||
|
||||
@@ -451,7 +455,11 @@ int pcps_quicksync_acquisition_cc::general_work(int noutput_items,
|
||||
}
|
||||
/*Obtain maximun value of correlation given the possible delay selected */
|
||||
volk_32fc_magnitude_squared_32f(d_corr_output_f, complex_acumulator, d_folding_factor);
|
||||
#if VOLK_GT_122
|
||||
volk_32f_index_max_32u(&indext, d_corr_output_f, d_folding_factor);
|
||||
#else
|
||||
volk_32f_index_max_16u(&indext, d_corr_output_f, d_folding_factor);
|
||||
#endif
|
||||
|
||||
/*Now save the real code phase in the gnss_syncro block for use in other stages*/
|
||||
d_gnss_synchro->Acq_delay_samples = static_cast<double>(d_possible_delay[indext]);
|
||||
|
@@ -328,7 +328,11 @@ int pcps_tong_acquisition_cc::general_work(int noutput_items,
|
||||
volk_32f_x2_add_32f(d_grid_data[doppler_index], d_magnitude, d_grid_data[doppler_index], d_fft_size);
|
||||
|
||||
// Search maximum
|
||||
#if VOLK_GT_122
|
||||
volk_32f_index_max_32u(&indext, d_grid_data[doppler_index], d_fft_size);
|
||||
#else
|
||||
volk_32f_index_max_16u(&indext, d_grid_data[doppler_index], d_fft_size);
|
||||
#endif
|
||||
|
||||
magt = d_grid_data[doppler_index][indext];
|
||||
|
||||
|
Reference in New Issue
Block a user