mirror of
https://github.com/gnss-sdr/gnss-sdr
synced 2025-01-27 17:34:53 +00:00
Better VOLK usage. Memory alignment, calling dispatchers instead of
aligned/unaligned versions. Code cleaning.
This commit is contained in:
parent
47f9929aa8
commit
fd6a8e3cff
@ -124,24 +124,16 @@ galileo_e1_dll_pll_veml_tracking_cc::galileo_e1_dll_pll_veml_tracking_cc(
|
||||
|
||||
// Initialization of local code replica
|
||||
// Get space for a vector with the sinboc(1,1) replica sampled 2x/chip
|
||||
d_ca_code = new gr_complex[(int)(2*Galileo_E1_B_CODE_LENGTH_CHIPS + 4)];
|
||||
|
||||
/* If an array is partitioned for more than one thread to operate on,
|
||||
* having the sub-array boundaries unaligned to cache lines could lead
|
||||
* to performance degradation. Here we allocate memory
|
||||
* (gr_comlex array of size 2*d_vector_length) aligned to cache of 16 bytes
|
||||
*/
|
||||
d_ca_code = (gr_complex*)volk_malloc((2 * Galileo_E1_B_CODE_LENGTH_CHIPS + 4) * sizeof(gr_complex), volk_get_alignment());
|
||||
|
||||
d_very_early_code = (gr_complex*)volk_malloc(2 * d_vector_length * sizeof(gr_complex), volk_get_alignment());
|
||||
d_early_code = (gr_complex*)volk_malloc(2 * d_vector_length * sizeof(gr_complex), volk_get_alignment());
|
||||
d_prompt_code = (gr_complex*)volk_malloc(2 * d_vector_length * sizeof(gr_complex), volk_get_alignment());
|
||||
d_late_code = (gr_complex*)volk_malloc(2 * d_vector_length * sizeof(gr_complex), volk_get_alignment());
|
||||
d_very_late_code = (gr_complex*)volk_malloc(2 * d_vector_length * sizeof(gr_complex), volk_get_alignment());
|
||||
|
||||
d_carr_sign = (gr_complex*)volk_malloc(2*d_vector_length * sizeof(gr_complex), volk_get_alignment());
|
||||
|
||||
// correlator outputs (scalar)
|
||||
|
||||
d_Very_Early = (gr_complex*)volk_malloc(sizeof(gr_complex), volk_get_alignment());
|
||||
d_Early = (gr_complex*)volk_malloc(sizeof(gr_complex), volk_get_alignment());
|
||||
d_Prompt = (gr_complex*)volk_malloc(sizeof(gr_complex), volk_get_alignment());
|
||||
@ -296,8 +288,8 @@ galileo_e1_dll_pll_veml_tracking_cc::~galileo_e1_dll_pll_veml_tracking_cc()
|
||||
volk_free(d_Prompt);
|
||||
volk_free(d_Late);
|
||||
volk_free(d_Very_Late);
|
||||
volk_free(d_ca_code);
|
||||
|
||||
delete[] d_ca_code;
|
||||
delete[] d_Prompt_buffer;
|
||||
}
|
||||
|
||||
@ -356,8 +348,7 @@ int galileo_e1_dll_pll_veml_tracking_cc::general_work (int noutput_items,gr_vect
|
||||
d_Early,
|
||||
d_Prompt,
|
||||
d_Late,
|
||||
d_Very_Late,
|
||||
is_unaligned());
|
||||
d_Very_Late);
|
||||
|
||||
// ################## PLL ##########################################################
|
||||
// PLL discriminator
|
||||
|
@ -127,20 +127,13 @@ Galileo_E1_Tcp_Connector_Tracking_cc::Galileo_E1_Tcp_Connector_Tracking_cc(
|
||||
|
||||
// Initialization of local code replica
|
||||
// Get space for a vector with the sinboc(1,1) replica sampled 2x/chip
|
||||
d_ca_code = new gr_complex[(int)(2*Galileo_E1_B_CODE_LENGTH_CHIPS + 4)];
|
||||
|
||||
/* If an array is partitioned for more than one thread to operate on,
|
||||
* having the sub-array boundaries unaligned to cache lines could lead
|
||||
* to performance degradation. Here we allocate memory
|
||||
* (gr_comlex array of size 2*d_vector_length) aligned to cache of 16 bytes
|
||||
*/
|
||||
d_ca_code = (gr_complex*)volk_malloc(((2 * Galileo_E1_B_CODE_LENGTH_CHIPS + 4)) * sizeof(gr_complex), volk_get_alignment());
|
||||
|
||||
d_very_early_code = (gr_complex*)volk_malloc(2 * d_vector_length * sizeof(gr_complex), volk_get_alignment());
|
||||
d_early_code = (gr_complex*)volk_malloc(2 * d_vector_length * sizeof(gr_complex), volk_get_alignment());
|
||||
d_prompt_code = (gr_complex*)volk_malloc(2 * d_vector_length * sizeof(gr_complex), volk_get_alignment());
|
||||
d_late_code = (gr_complex*)volk_malloc(2 * d_vector_length * sizeof(gr_complex), volk_get_alignment());
|
||||
d_very_late_code = (gr_complex*)volk_malloc(2 * d_vector_length * sizeof(gr_complex), volk_get_alignment());
|
||||
|
||||
d_carr_sign = (gr_complex*)volk_malloc(2 * d_vector_length * sizeof(gr_complex), volk_get_alignment());
|
||||
|
||||
// correlator outputs (scalar)
|
||||
@ -291,8 +284,8 @@ Galileo_E1_Tcp_Connector_Tracking_cc::~Galileo_E1_Tcp_Connector_Tracking_cc()
|
||||
volk_free(d_Prompt);
|
||||
volk_free(d_Late);
|
||||
volk_free(d_Very_Late);
|
||||
volk_free(d_ca_code);
|
||||
|
||||
delete[] d_ca_code;
|
||||
delete[] d_Prompt_buffer;
|
||||
|
||||
d_tcp_com.close_tcp_connection(d_port);
|
||||
@ -352,8 +345,7 @@ int Galileo_E1_Tcp_Connector_Tracking_cc::general_work (int noutput_items, gr_ve
|
||||
d_Early,
|
||||
d_Prompt,
|
||||
d_Late,
|
||||
d_Very_Late,
|
||||
is_unaligned());
|
||||
d_Very_Late);
|
||||
|
||||
// ################## TCP CONNECTOR ##########################################################
|
||||
//! Variable used for control
|
||||
|
@ -130,25 +130,16 @@ Galileo_E5a_Dll_Pll_Tracking_cc::Galileo_E5a_Dll_Pll_Tracking_cc(
|
||||
|
||||
// Initialization of local code replica
|
||||
// Get space for a vector with the E5a primary code replicas sampled 1x/chip
|
||||
d_codeQ = new gr_complex[(int)Galileo_E5a_CODE_LENGTH_CHIPS + 2];
|
||||
d_codeI = new gr_complex[(int)Galileo_E5a_CODE_LENGTH_CHIPS + 2];
|
||||
|
||||
/* If an array is partitioned for more than one thread to operate on,
|
||||
* having the sub-array boundaries unaligned to cache lines could lead
|
||||
* to performance degradation. Here we allocate memory
|
||||
* (gr_comlex array of size 2*d_vector_length) aligned to cache of 16 bytes
|
||||
*/
|
||||
d_codeQ = (gr_complex*)volk_malloc((Galileo_E5a_CODE_LENGTH_CHIPS + 2)* sizeof(gr_complex), volk_get_alignment());
|
||||
d_codeI = (gr_complex*)volk_malloc((Galileo_E5a_CODE_LENGTH_CHIPS + 2)* sizeof(gr_complex), volk_get_alignment());
|
||||
|
||||
d_early_code = (gr_complex*)volk_malloc(2 * d_vector_length * sizeof(gr_complex), volk_get_alignment());
|
||||
d_late_code = (gr_complex*)volk_malloc(2 * d_vector_length * sizeof(gr_complex), volk_get_alignment());
|
||||
d_prompt_code = (gr_complex*)volk_malloc(2 * d_vector_length * sizeof(gr_complex), volk_get_alignment());
|
||||
|
||||
d_prompt_data_code = (gr_complex*)volk_malloc(2 * d_vector_length * sizeof(gr_complex), volk_get_alignment());
|
||||
|
||||
d_carr_sign = (gr_complex*)volk_malloc(2 * d_vector_length * sizeof(gr_complex), volk_get_alignment());
|
||||
|
||||
// correlator outputs (scalar)
|
||||
|
||||
// correlator outputs (complex number)
|
||||
d_Early = (gr_complex*)volk_malloc(sizeof(gr_complex), volk_get_alignment());
|
||||
d_Prompt = (gr_complex*)volk_malloc(sizeof(gr_complex), volk_get_alignment());
|
||||
d_Late = (gr_complex*)volk_malloc(sizeof(gr_complex), volk_get_alignment());
|
||||
@ -161,15 +152,11 @@ Galileo_E5a_Dll_Pll_Tracking_cc::Galileo_E5a_Dll_Pll_Tracking_cc(
|
||||
d_rem_code_phase_samples = 0.0;
|
||||
// define residual carrier phase
|
||||
d_rem_carr_phase_rad = 0.0;
|
||||
|
||||
//Filter error vars
|
||||
d_code_error_filt_secs = 0.0;
|
||||
|
||||
|
||||
// sample synchronization
|
||||
d_sample_counter = 0;
|
||||
d_acq_sample_stamp = 0;
|
||||
|
||||
d_last_seg = 0;
|
||||
d_first_transition = false;
|
||||
|
||||
@ -187,29 +174,27 @@ Galileo_E5a_Dll_Pll_Tracking_cc::Galileo_E5a_Dll_Pll_Tracking_cc(
|
||||
d_carrier_lock_fail_counter = 0;
|
||||
d_carrier_lock_threshold = CARRIER_LOCK_THRESHOLD;
|
||||
|
||||
systemName["G"] = std::string("GPS");
|
||||
systemName["R"] = std::string("GLONASS");
|
||||
systemName["S"] = std::string("SBAS");
|
||||
systemName["E"] = std::string("Galileo");
|
||||
systemName["C"] = std::string("Compass");
|
||||
|
||||
}
|
||||
|
||||
|
||||
Galileo_E5a_Dll_Pll_Tracking_cc::~Galileo_E5a_Dll_Pll_Tracking_cc ()
|
||||
{
|
||||
d_dump_file.close();
|
||||
|
||||
|
||||
volk_free(d_prompt_code);
|
||||
volk_free(d_late_code);
|
||||
volk_free(d_early_code);
|
||||
volk_free(d_carr_sign);
|
||||
|
||||
volk_free(d_prompt_data_code);
|
||||
volk_free(d_Prompt_data);
|
||||
volk_free(d_Early);
|
||||
volk_free(d_Prompt);
|
||||
volk_free(d_Late);
|
||||
volk_free(d_Prompt_data);
|
||||
volk_free(d_codeQ);
|
||||
volk_free(d_codeI);
|
||||
|
||||
delete[] d_codeQ;
|
||||
delete[] d_codeI;
|
||||
delete[] d_Prompt_buffer;
|
||||
}
|
||||
|
||||
@ -458,7 +443,7 @@ int Galileo_E5a_Dll_Pll_Tracking_cc::general_work (int noutput_items, gr_vector_
|
||||
acq_trk_shif_correction_samples = d_current_prn_length_samples - fmod((float)acq_to_trk_delay_samples, (float)d_current_prn_length_samples);
|
||||
samples_offset = round(d_acq_code_phase_samples + acq_trk_shif_correction_samples);
|
||||
d_sample_counter = d_sample_counter + samples_offset; //count for the processed samples
|
||||
std::cout<<" samples_offset="<<samples_offset<<"\r\n";
|
||||
DLOG(INFO) << " samples_offset=" << samples_offset;
|
||||
d_state = 2; // start in Ti = 1 code, until secondary code lock.
|
||||
|
||||
// make an output to not stop the rest of the processing blocks
|
||||
@ -524,8 +509,7 @@ int Galileo_E5a_Dll_Pll_Tracking_cc::general_work (int noutput_items, gr_vector_
|
||||
&single_early,
|
||||
&single_prompt,
|
||||
&single_late,
|
||||
d_Prompt_data,
|
||||
is_unaligned());
|
||||
d_Prompt_data);
|
||||
|
||||
// Accumulate results (coherent integration since there are no bit transitions in pilot signal)
|
||||
*d_Early += single_early * sec_sign_Q;
|
||||
@ -597,10 +581,6 @@ int Galileo_E5a_Dll_Pll_Tracking_cc::general_work (int noutput_items, gr_vector_
|
||||
// keep alignment parameters for the next input buffer
|
||||
double T_chip_seconds;
|
||||
double T_prn_seconds;
|
||||
// float T_prn_samples;
|
||||
// float K_blk_samples;
|
||||
//double T_chip_seconds;
|
||||
// double T_prn_seconds;
|
||||
double T_prn_samples;
|
||||
double K_blk_samples;
|
||||
// Compute the next buffer length based in the new period of the PRN sequence and the code phase error estimation
|
||||
@ -632,8 +612,6 @@ int Galileo_E5a_Dll_Pll_Tracking_cc::general_work (int noutput_items, gr_vector_
|
||||
// Change loop parameters ==========================================
|
||||
d_code_loop_filter.set_pdi(d_current_ti_ms * GALILEO_E5a_CODE_PERIOD);
|
||||
d_carrier_loop_filter.set_pdi(d_current_ti_ms * GALILEO_E5a_CODE_PERIOD);
|
||||
// d_code_loop_filter.initialize();
|
||||
// d_carrier_loop_filter.initialize();
|
||||
d_code_loop_filter.set_DLL_BW(d_dll_bw_hz);
|
||||
d_carrier_loop_filter.set_PLL_BW(d_pll_bw_hz);
|
||||
}
|
||||
@ -708,7 +686,6 @@ int Galileo_E5a_Dll_Pll_Tracking_cc::general_work (int noutput_items, gr_vector_
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
// make an output to not stop the rest of the processing blocks
|
||||
current_synchro_data.Prompt_I = 0.0;
|
||||
current_synchro_data.Prompt_Q = 0.0;
|
||||
|
@ -122,13 +122,8 @@ Gps_L1_Ca_Dll_Fll_Pll_Tracking_cc::Gps_L1_Ca_Dll_Fll_Pll_Tracking_cc(
|
||||
d_code_loop_filter.set_DLL_BW(dll_bw_hz);
|
||||
|
||||
// Get space for a vector with the C/A code replica sampled 1x/chip
|
||||
d_ca_code = new gr_complex[(int)GPS_L1_CA_CODE_LENGTH_CHIPS + 2];
|
||||
d_ca_code = (gr_complex*)volk_malloc((GPS_L1_CA_CODE_LENGTH_CHIPS + 2) * sizeof(gr_complex), volk_get_alignment());
|
||||
|
||||
/* If an array is partitioned for more than one thread to operate on,
|
||||
* having the sub-array boundaries unaligned to cache lines could lead
|
||||
* to performance degradation. Here we allocate memory
|
||||
* (gr_complex array of size 2*d_vector_length) aligned to cache of N bytes (machine dependent!)
|
||||
*/
|
||||
// Get space for the resampled early / prompt / late local replicas
|
||||
d_early_code = (gr_complex*)volk_malloc(2*d_vector_length * sizeof(gr_complex), volk_get_alignment());
|
||||
d_prompt_code = (gr_complex*)volk_malloc(2*d_vector_length * sizeof(gr_complex), volk_get_alignment());
|
||||
@ -312,8 +307,8 @@ void Gps_L1_Ca_Dll_Fll_Pll_Tracking_cc::update_local_carrier()
|
||||
Gps_L1_Ca_Dll_Fll_Pll_Tracking_cc::~Gps_L1_Ca_Dll_Fll_Pll_Tracking_cc()
|
||||
{
|
||||
d_dump_file.close();
|
||||
delete[] d_ca_code;
|
||||
|
||||
volk_free(d_ca_code);
|
||||
volk_free(d_prompt_code);
|
||||
volk_free(d_late_code);
|
||||
volk_free(d_early_code);
|
||||
@ -321,6 +316,7 @@ Gps_L1_Ca_Dll_Fll_Pll_Tracking_cc::~Gps_L1_Ca_Dll_Fll_Pll_Tracking_cc()
|
||||
volk_free(d_Early);
|
||||
volk_free(d_Prompt);
|
||||
volk_free(d_Late);
|
||||
|
||||
delete[] d_Prompt_buffer;
|
||||
}
|
||||
|
||||
@ -389,8 +385,7 @@ int Gps_L1_Ca_Dll_Fll_Pll_Tracking_cc::general_work (int noutput_items, gr_vecto
|
||||
d_late_code,
|
||||
d_Early,
|
||||
d_Prompt,
|
||||
d_Late,
|
||||
is_unaligned());
|
||||
d_Late);
|
||||
// check for samples consistency (this should be done before in the receiver / here only if the source is a file)
|
||||
if (std::isnan((*d_Prompt).real()) == true or std::isnan((*d_Prompt).imag()) == true )// or std::isinf(in[i].real())==true or std::isinf(in[i].imag())==true)
|
||||
{
|
||||
|
@ -119,13 +119,8 @@ Gps_L1_Ca_Dll_Pll_Optim_Tracking_cc::Gps_L1_Ca_Dll_Pll_Optim_Tracking_cc(
|
||||
|
||||
// Initialization of local code replica
|
||||
// Get space for a vector with the C/A code replica sampled 1x/chip
|
||||
d_ca_code = new gr_complex[(int)GPS_L1_CA_CODE_LENGTH_CHIPS + 2];
|
||||
d_ca_code = (gr_complex*)volk_malloc((GPS_L1_CA_CODE_LENGTH_CHIPS + 2) * sizeof(gr_complex), volk_get_alignment());
|
||||
|
||||
/* If an array is partitioned for more than one thread to operate on,
|
||||
* having the sub-array boundaries unaligned to cache lines could lead
|
||||
* to performance degradation. Here we allocate memory
|
||||
* (gr_complex array of size 2*d_vector_length) aligned to cache of N bytes (machine dependent!)
|
||||
*/
|
||||
// Get space for the resampled early / prompt / late local replicas
|
||||
d_early_code = (gr_complex*)volk_malloc(2 * d_vector_length * sizeof(gr_complex), volk_get_alignment());
|
||||
d_prompt_code = (gr_complex*)volk_malloc(2 * d_vector_length * sizeof(gr_complex), volk_get_alignment());
|
||||
@ -385,8 +380,7 @@ int Gps_L1_Ca_Dll_Pll_Optim_Tracking_cc::general_work (int noutput_items, gr_vec
|
||||
d_late_code,
|
||||
d_Early,
|
||||
d_Prompt,
|
||||
d_Late,
|
||||
is_unaligned());
|
||||
d_Late);
|
||||
#else
|
||||
d_correlator.Carrier_wipeoff_and_EPL_volk(d_current_prn_length_samples,
|
||||
in,
|
||||
@ -396,8 +390,7 @@ int Gps_L1_Ca_Dll_Pll_Optim_Tracking_cc::general_work (int noutput_items, gr_vec
|
||||
d_late_code,
|
||||
d_Early,
|
||||
d_Prompt,
|
||||
d_Late,
|
||||
is_unaligned());
|
||||
d_Late);
|
||||
#endif
|
||||
// ################## PLL ##########################################################
|
||||
// PLL discriminator
|
||||
|
@ -117,13 +117,8 @@ Gps_L1_Ca_Dll_Pll_Tracking_cc::Gps_L1_Ca_Dll_Pll_Tracking_cc(
|
||||
|
||||
// Initialization of local code replica
|
||||
// Get space for a vector with the C/A code replica sampled 1x/chip
|
||||
d_ca_code = new gr_complex[(int)GPS_L1_CA_CODE_LENGTH_CHIPS + 2];
|
||||
d_ca_code = (gr_complex*)volk_malloc((GPS_L1_CA_CODE_LENGTH_CHIPS + 2) * sizeof(gr_complex), volk_get_alignment());
|
||||
|
||||
/* If an array is partitioned for more than one thread to operate on,
|
||||
* having the sub-array boundaries unaligned to cache lines could lead
|
||||
* to performance degradation. Here we allocate memory
|
||||
* (gr_complex array of size 2*d_vector_length) aligned to cache of N bytes (machine dependent!)
|
||||
*/
|
||||
// Get space for the resampled early / prompt / late local replicas
|
||||
d_early_code = (gr_complex*)volk_malloc(2 * d_vector_length * sizeof(gr_complex), volk_get_alignment());
|
||||
d_prompt_code = (gr_complex*)volk_malloc(2 * d_vector_length * sizeof(gr_complex), volk_get_alignment());
|
||||
@ -319,8 +314,8 @@ Gps_L1_Ca_Dll_Pll_Tracking_cc::~Gps_L1_Ca_Dll_Pll_Tracking_cc()
|
||||
volk_free(d_Early);
|
||||
volk_free(d_Prompt);
|
||||
volk_free(d_Late);
|
||||
volk_free(d_ca_code);
|
||||
|
||||
delete[] d_ca_code;
|
||||
delete[] d_Prompt_buffer;
|
||||
}
|
||||
|
||||
@ -377,8 +372,7 @@ int Gps_L1_Ca_Dll_Pll_Tracking_cc::general_work (int noutput_items, gr_vector_in
|
||||
d_late_code,
|
||||
d_Early,
|
||||
d_Prompt,
|
||||
d_Late,
|
||||
is_unaligned());
|
||||
d_Late);
|
||||
|
||||
// check for samples consistency (this should be done before in the receiver / here only if the source is a file)
|
||||
if (std::isnan((*d_Prompt).real()) == true or std::isnan((*d_Prompt).imag()) == true ) // or std::isinf(in[i].real())==true or std::isinf(in[i].imag())==true)
|
||||
|
@ -126,14 +126,9 @@ Gps_L1_Ca_Tcp_Connector_Tracking_cc::Gps_L1_Ca_Tcp_Connector_Tracking_cc(
|
||||
|
||||
// Initialization of local code replica
|
||||
// Get space for a vector with the C/A code replica sampled 1x/chip
|
||||
d_ca_code = new gr_complex[(int)GPS_L1_CA_CODE_LENGTH_CHIPS + 2];
|
||||
d_carr_sign = new gr_complex[d_vector_length*2];
|
||||
d_ca_code = (gr_complex*)volk_malloc((GPS_L1_CA_CODE_LENGTH_CHIPS + 2) * sizeof(gr_complex), volk_get_alignment());
|
||||
d_carr_sign = (gr_complex*)volk_malloc(2 * d_vector_length * sizeof(gr_complex), volk_get_alignment());
|
||||
|
||||
/* If an array is partitioned for more than one thread to operate on,
|
||||
* having the sub-array boundaries unaligned to cache lines could lead
|
||||
* to performance degradation. Here we allocate memory
|
||||
* (gr_comlex array of size 2*d_vector_length) aligned to cache of 16 bytes
|
||||
*/
|
||||
// Get space for the resampled early / prompt / late local replicas
|
||||
d_early_code = (gr_complex*)volk_malloc(2 * d_vector_length * sizeof(gr_complex), volk_get_alignment());
|
||||
d_prompt_code = (gr_complex*)volk_malloc(2 * d_vector_length * sizeof(gr_complex), volk_get_alignment());
|
||||
@ -336,8 +331,8 @@ Gps_L1_Ca_Tcp_Connector_Tracking_cc::~Gps_L1_Ca_Tcp_Connector_Tracking_cc()
|
||||
volk_free(d_Early);
|
||||
volk_free(d_Prompt);
|
||||
volk_free(d_Late);
|
||||
volk_free(d_ca_code);
|
||||
|
||||
delete[] d_ca_code;
|
||||
delete[] d_Prompt_buffer;
|
||||
|
||||
d_tcp_com.close_tcp_connection(d_port);
|
||||
@ -405,8 +400,7 @@ int Gps_L1_Ca_Tcp_Connector_Tracking_cc::general_work (int noutput_items, gr_vec
|
||||
d_late_code,
|
||||
d_Early,
|
||||
d_Prompt,
|
||||
d_Late,
|
||||
is_unaligned());
|
||||
d_Late);
|
||||
|
||||
// check for samples consistency (this should be done before in the receiver / here only if the source is a file)
|
||||
if (std::isnan((*d_Prompt).real()) == true or std::isnan((*d_Prompt).imag()) == true )// or std::isinf(in[i].real())==true or std::isinf(in[i].imag())==true)
|
||||
|
@ -79,234 +79,75 @@ void Correlator::Carrier_wipeoff_and_EPL_generic(int signal_length_samples, cons
|
||||
|
||||
|
||||
|
||||
void Correlator::Carrier_wipeoff_and_EPL_volk(int signal_length_samples, const gr_complex* input, gr_complex* carrier, gr_complex* E_code, gr_complex* P_code, gr_complex* L_code, gr_complex* E_out, gr_complex* P_out, gr_complex* L_out, bool input_vector_unaligned)
|
||||
void Correlator::Carrier_wipeoff_and_EPL_volk(int signal_length_samples, const gr_complex* input, gr_complex* carrier, gr_complex* E_code, gr_complex* P_code, gr_complex* L_code, gr_complex* E_out, gr_complex* P_out, gr_complex* L_out)
|
||||
{
|
||||
gr_complex* bb_signal;
|
||||
//gr_complex* input_aligned;
|
||||
gr_complex* bb_signal = (gr_complex*)volk_malloc(signal_length_samples * sizeof(gr_complex), volk_get_alignment());
|
||||
|
||||
//todo: do something if posix_memalign fails
|
||||
if (posix_memalign((void**)&bb_signal, 16, signal_length_samples * sizeof(gr_complex)) == 0) {};
|
||||
volk_32fc_x2_multiply_32fc(bb_signal, input, carrier, signal_length_samples);
|
||||
volk_32fc_x2_dot_prod_32fc(E_out, bb_signal, E_code, signal_length_samples);
|
||||
volk_32fc_x2_dot_prod_32fc(P_out, bb_signal, P_code, signal_length_samples);
|
||||
volk_32fc_x2_dot_prod_32fc(L_out, bb_signal, L_code, signal_length_samples);
|
||||
|
||||
if (input_vector_unaligned == true)
|
||||
{
|
||||
//todo: do something if posix_memalign fails
|
||||
//if (posix_memalign((void**)&input_aligned, 16, signal_length_samples * sizeof(gr_complex)) == 0){};
|
||||
//memcpy(input_aligned,input,signal_length_samples * sizeof(gr_complex));
|
||||
|
||||
volk_32fc_x2_multiply_32fc_u(bb_signal, input, carrier, signal_length_samples);
|
||||
}
|
||||
else
|
||||
{
|
||||
/*
|
||||
* todo: There is a problem with the aligned version of volk_32fc_x2_multiply_32fc_a.
|
||||
* It crashes even if the is_aligned() work function returns true. Im keeping the unaligned version in both cases..
|
||||
*/
|
||||
//use directly the input vector
|
||||
volk_32fc_x2_multiply_32fc_u(bb_signal, input, carrier, signal_length_samples);
|
||||
volk_free(bb_signal);
|
||||
}
|
||||
|
||||
volk_32fc_x2_dot_prod_32fc_a(E_out, bb_signal, E_code, signal_length_samples);
|
||||
volk_32fc_x2_dot_prod_32fc_a(P_out, bb_signal, P_code, signal_length_samples);
|
||||
volk_32fc_x2_dot_prod_32fc_a(L_out, bb_signal, L_code, signal_length_samples);
|
||||
|
||||
free(bb_signal);
|
||||
//if (input_vector_unaligned==false)
|
||||
//void Correlator::Carrier_wipeoff_and_EPL_volk_IQ(int prn_length_samples,int integration_time ,const gr_complex* input, gr_complex* carrier, gr_complex* E_code, gr_complex* P_code, gr_complex* L_code, gr_complex* P_data_code, gr_complex* E_out, gr_complex* P_out, gr_complex* L_out, gr_complex* P_data_out)
|
||||
//{
|
||||
// free(input_aligned);
|
||||
//}
|
||||
}
|
||||
|
||||
//void Correlator::Carrier_wipeoff_and_EPL_volk_IQ(int prn_length_samples,int integration_time ,const gr_complex* input, gr_complex* carrier, gr_complex* E_code, gr_complex* P_code, gr_complex* L_code, gr_complex* P_data_code, gr_complex* E_out, gr_complex* P_out, gr_complex* L_out, gr_complex* P_data_out, bool input_vector_unaligned)
|
||||
//{
|
||||
// gr_complex* bb_signal;
|
||||
// //gr_complex* input_aligned;
|
||||
//
|
||||
// //todo: do something if posix_memalign fails
|
||||
// if (posix_memalign((void**)&bb_signal, 16, integration_time * prn_length_samples * sizeof(gr_complex)) == 0) {};
|
||||
//
|
||||
// if (input_vector_unaligned == true)
|
||||
// {
|
||||
// //todo: do something if posix_memalign fails
|
||||
// //if (posix_memalign((void**)&input_aligned, 16, signal_length_samples * sizeof(gr_complex)) == 0){};
|
||||
// //memcpy(input_aligned,input,signal_length_samples * sizeof(gr_complex));
|
||||
//
|
||||
// volk_32fc_x2_multiply_32fc_u(bb_signal, input, carrier, integration_time * prn_length_samples);
|
||||
// }
|
||||
// else
|
||||
// {
|
||||
// /*
|
||||
// * todo: There is a problem with the aligned version of volk_32fc_x2_multiply_32fc_a.
|
||||
// * It crashes even if the is_aligned() work function returns true. Im keeping the unaligned version in both cases..
|
||||
// */
|
||||
// //use directly the input vector
|
||||
// volk_32fc_x2_multiply_32fc_u(bb_signal, input, carrier, integration_time * prn_length_samples);
|
||||
// }
|
||||
//
|
||||
// volk_32fc_x2_dot_prod_32fc_a(E_out, bb_signal, E_code, integration_time * prn_length_samples);
|
||||
// volk_32fc_x2_dot_prod_32fc_a(P_out, bb_signal, P_code, integration_time * prn_length_samples);
|
||||
// volk_32fc_x2_dot_prod_32fc_a(L_out, bb_signal, L_code, integration_time * prn_length_samples);
|
||||
// gr_complex* bb_signal = (gr_complex*)volk_malloc(signal_length_samples * sizeof(gr_complex), volk_get_alignment());
|
||||
// volk_32fc_x2_multiply_32fc(bb_signal, input, carrier, integration_time * prn_length_samples);
|
||||
// volk_32fc_x2_dot_prod_32fc(E_out, bb_signal, E_code, integration_time * prn_length_samples);
|
||||
// volk_32fc_x2_dot_prod_32fc(P_out, bb_signal, P_code, integration_time * prn_length_samples);
|
||||
// volk_32fc_x2_dot_prod_32fc(L_out, bb_signal, L_code, integration_time * prn_length_samples);
|
||||
// // Vector of Prompts of I code
|
||||
// for (int i = 0; i < integration_time; i++)
|
||||
// {
|
||||
// volk_32fc_x2_dot_prod_32fc_a(&P_data_out[i], &bb_signal[i*prn_length_samples], P_data_code, prn_length_samples);
|
||||
// volk_32fc_x2_dot_prod_32fc(&P_data_out[i], &bb_signal[i*prn_length_samples], P_data_code, prn_length_samples);
|
||||
// }
|
||||
//
|
||||
// free(bb_signal);
|
||||
//
|
||||
// volk_free(bb_signal);
|
||||
//}
|
||||
void Correlator::Carrier_wipeoff_and_EPL_volk_IQ(int signal_length_samples ,const gr_complex* input, gr_complex* carrier, gr_complex* E_code, gr_complex* P_code, gr_complex* L_code, gr_complex* P_data_code, gr_complex* E_out, gr_complex* P_out, gr_complex* L_out, gr_complex* P_data_out, bool input_vector_unaligned)
|
||||
{
|
||||
gr_complex* bb_signal;
|
||||
//gr_complex* input_aligned;
|
||||
|
||||
bb_signal=(gr_complex*)volk_malloc(signal_length_samples * sizeof(gr_complex),volk_get_alignment());
|
||||
|
||||
if (input_vector_unaligned == true)
|
||||
void Correlator::Carrier_wipeoff_and_EPL_volk_IQ(int signal_length_samples ,const gr_complex* input, gr_complex* carrier, gr_complex* E_code, gr_complex* P_code, gr_complex* L_code, gr_complex* P_data_code, gr_complex* E_out, gr_complex* P_out, gr_complex* L_out, gr_complex* P_data_out)
|
||||
{
|
||||
//todo: do something if posix_memalign fails
|
||||
//if (posix_memalign((void**)&input_aligned, 16, signal_length_samples * sizeof(gr_complex)) == 0){};
|
||||
//memcpy(input_aligned,input,signal_length_samples * sizeof(gr_complex));
|
||||
gr_complex* bb_signal = (gr_complex*)volk_malloc(signal_length_samples * sizeof(gr_complex), volk_get_alignment());
|
||||
|
||||
volk_32fc_x2_multiply_32fc_u(bb_signal, input, carrier, signal_length_samples);
|
||||
}
|
||||
else
|
||||
{
|
||||
/*
|
||||
* todo: There is a problem with the aligned version of volk_32fc_x2_multiply_32fc_a.
|
||||
* It crashes even if the is_aligned() work function returns true. Im keeping the unaligned version in both cases..
|
||||
*/
|
||||
//use directly the input vector
|
||||
volk_32fc_x2_multiply_32fc_u(bb_signal, input, carrier, signal_length_samples);
|
||||
volk_32fc_x2_multiply_32fc(bb_signal, input, carrier, signal_length_samples);
|
||||
volk_32fc_x2_dot_prod_32fc(E_out, bb_signal, E_code, signal_length_samples);
|
||||
volk_32fc_x2_dot_prod_32fc(P_out, bb_signal, P_code, signal_length_samples);
|
||||
volk_32fc_x2_dot_prod_32fc(L_out, bb_signal, L_code, signal_length_samples);
|
||||
volk_32fc_x2_dot_prod_32fc(P_data_out, bb_signal, P_data_code, signal_length_samples);
|
||||
|
||||
volk_free(bb_signal);
|
||||
}
|
||||
|
||||
volk_32fc_x2_dot_prod_32fc_a(E_out, bb_signal, E_code, signal_length_samples);
|
||||
volk_32fc_x2_dot_prod_32fc_a(P_out, bb_signal, P_code, signal_length_samples);
|
||||
volk_32fc_x2_dot_prod_32fc_a(L_out, bb_signal, L_code, signal_length_samples);
|
||||
volk_32fc_x2_dot_prod_32fc_a(P_data_out, bb_signal, P_data_code, signal_length_samples);
|
||||
|
||||
void Correlator::Carrier_wipeoff_and_VEPL_volk(int signal_length_samples, const gr_complex* input, gr_complex* carrier, gr_complex* VE_code, gr_complex* E_code, gr_complex* P_code, gr_complex* L_code, gr_complex* VL_code, gr_complex* VE_out, gr_complex* E_out, gr_complex* P_out, gr_complex* L_out, gr_complex* VL_out)
|
||||
{
|
||||
gr_complex* bb_signal = (gr_complex*)volk_malloc(signal_length_samples * sizeof(gr_complex), volk_get_alignment());
|
||||
|
||||
free(bb_signal);
|
||||
volk_32fc_x2_multiply_32fc(bb_signal, input, carrier, signal_length_samples);
|
||||
volk_32fc_x2_dot_prod_32fc(VE_out, bb_signal, VE_code, signal_length_samples);
|
||||
volk_32fc_x2_dot_prod_32fc(E_out, bb_signal, E_code, signal_length_samples);
|
||||
volk_32fc_x2_dot_prod_32fc(P_out, bb_signal, P_code, signal_length_samples);
|
||||
volk_32fc_x2_dot_prod_32fc(L_out, bb_signal, L_code, signal_length_samples);
|
||||
volk_32fc_x2_dot_prod_32fc(VL_out, bb_signal, VL_code, signal_length_samples);
|
||||
|
||||
volk_free(bb_signal);
|
||||
}
|
||||
|
||||
|
||||
|
||||
Correlator::Correlator ()
|
||||
{}
|
||||
|
||||
|
||||
Correlator::~Correlator ()
|
||||
{}
|
||||
|
||||
|
||||
#ifndef GENERIC_ARCH
|
||||
void Correlator::Carrier_wipeoff_and_EPL_volk_custom(int signal_length_samples, const gr_complex* input, gr_complex* carrier,gr_complex* E_code, gr_complex* P_code, gr_complex* L_code, gr_complex* E_out, gr_complex* P_out, gr_complex* L_out, bool input_vector_unaligned)
|
||||
void Correlator::Carrier_wipeoff_and_EPL_volk_custom(int signal_length_samples, const gr_complex* input, gr_complex* carrier,gr_complex* E_code, gr_complex* P_code, gr_complex* L_code, gr_complex* E_out, gr_complex* P_out, gr_complex* L_out)
|
||||
{
|
||||
volk_cw_epl_corr_u(input, carrier, E_code, P_code, L_code, E_out, P_out, L_out, signal_length_samples);
|
||||
}
|
||||
#endif
|
||||
|
||||
void Correlator::Carrier_wipeoff_and_VEPL_volk(int signal_length_samples, const gr_complex* input, gr_complex* carrier, gr_complex* VE_code, gr_complex* E_code, gr_complex* P_code, gr_complex* L_code, gr_complex* VL_code, gr_complex* VE_out, gr_complex* E_out, gr_complex* P_out, gr_complex* L_out, gr_complex* VL_out, bool input_vector_unaligned)
|
||||
{
|
||||
gr_complex* bb_signal;
|
||||
//gr_complex* input_aligned;
|
||||
|
||||
bb_signal=(gr_complex*)volk_malloc(signal_length_samples * sizeof(gr_complex),volk_get_alignment());
|
||||
|
||||
if (input_vector_unaligned == false)
|
||||
{
|
||||
//todo: do something if posix_memalign fails
|
||||
//if (posix_memalign((void**)&input_aligned, 16, signal_length_samples * sizeof(gr_complex)) == 0){};
|
||||
//memcpy(input_aligned,input,signal_length_samples * sizeof(gr_complex));
|
||||
|
||||
volk_32fc_x2_multiply_32fc_u(bb_signal, input, carrier, signal_length_samples);
|
||||
}
|
||||
else
|
||||
{
|
||||
//use directly the input vector
|
||||
volk_32fc_x2_multiply_32fc_u(bb_signal, input, carrier, signal_length_samples);
|
||||
}
|
||||
volk_32fc_x2_dot_prod_32fc_a(VE_out, bb_signal, VE_code, signal_length_samples);
|
||||
volk_32fc_x2_dot_prod_32fc_a(E_out, bb_signal, E_code, signal_length_samples);
|
||||
volk_32fc_x2_dot_prod_32fc_a(P_out, bb_signal, P_code, signal_length_samples);
|
||||
volk_32fc_x2_dot_prod_32fc_a(L_out, bb_signal, L_code, signal_length_samples);
|
||||
volk_32fc_x2_dot_prod_32fc_a(VL_out, bb_signal, VL_code, signal_length_samples);
|
||||
|
||||
free(bb_signal);
|
||||
//if (input_vector_unaligned == false)
|
||||
//{
|
||||
//free(input_aligned);
|
||||
//}
|
||||
}
|
||||
|
||||
/*
|
||||
void Correlator::cpu_arch_test_volk_32fc_x2_dot_prod_32fc_a()
|
||||
{
|
||||
//
|
||||
//struct volk_func_desc desc=volk_32fc_x2_dot_prod_32fc_a_get_func_desc();
|
||||
volk_func_desc_t desc = volk_32fc_x2_dot_prod_32fc_get_func_desc();
|
||||
|
||||
std::vector<std::string> arch_list;
|
||||
|
||||
for(int i = 0; i < desc.n_archs; ++i)
|
||||
{
|
||||
//if(!(archs[i+1] & volk_get_lvarch())) continue; //this arch isn't available on this pc
|
||||
arch_list.push_back(std::string(desc.indices[i]));
|
||||
}
|
||||
|
||||
|
||||
//first let's get a list of available architectures for the test
|
||||
if(arch_list.size() < 2)
|
||||
{
|
||||
std::cout << "no architectures to test" << std::endl;
|
||||
this->volk_32fc_x2_dot_prod_32fc_a_best_arch = "generic";
|
||||
}
|
||||
else
|
||||
{
|
||||
std::cout << "Detected architectures in this machine for volk_32fc_x2_dot_prod_32fc_a:" << std::endl;
|
||||
for (unsigned int i=0; i < arch_list.size(); ++i)
|
||||
{
|
||||
std::cout << "Arch " << i << ":" << arch_list.at(i) << std::endl;
|
||||
}
|
||||
// TODO: Make a test to find the best architecture
|
||||
this->volk_32fc_x2_dot_prod_32fc_a_best_arch = arch_list.at(arch_list.size() - 1);
|
||||
}
|
||||
|
||||
std::cout << "Selected architecture for volk_32fc_x2_dot_prod_32fc_a is " << this->volk_32fc_x2_dot_prod_32fc_a_best_arch << std::endl;
|
||||
}
|
||||
|
||||
|
||||
void Correlator::cpu_arch_test_volk_32fc_x2_multiply_32fc_a()
|
||||
{
|
||||
//
|
||||
volk_func_desc_t desc = volk_32fc_x2_multiply_32fc_a_get_func_desc();
|
||||
std::vector<std::string> arch_list;
|
||||
|
||||
for(int i = 0; i < desc.n_archs; ++i)
|
||||
{
|
||||
//if(!(archs[i+1] & volk_get_lvarch())) continue; //this arch isn't available on this pc
|
||||
arch_list.push_back(std::string(desc.indices[i]));
|
||||
}
|
||||
|
||||
this->volk_32fc_x2_multiply_32fc_a_best_arch = "generic";
|
||||
//first let's get a list of available architectures for the test
|
||||
if(arch_list.size() < 2)
|
||||
{
|
||||
std::cout << "no architectures to test" << std::endl;
|
||||
}
|
||||
else
|
||||
{
|
||||
std::cout << "Detected architectures in this machine for volk_32fc_x2_multiply_32fc_a:" << std::endl;
|
||||
for (unsigned int i=0; i < arch_list.size(); ++i)
|
||||
{
|
||||
std::cout << "Arch " << i << ":" << arch_list.at(i) << std::endl;
|
||||
if (arch_list.at(i).find("sse") != std::string::npos)
|
||||
{
|
||||
// TODO: Make a test to find the best architecture
|
||||
this->volk_32fc_x2_multiply_32fc_a_best_arch = arch_list.at(i);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
std::cout << "Selected architecture for volk_32fc_x2_multiply_32fc_a_best_arch is " << this->volk_32fc_x2_multiply_32fc_a_best_arch << std::endl;
|
||||
}
|
||||
*/
|
||||
|
||||
Correlator::Correlator ()
|
||||
{
|
||||
//cpu_arch_test_volk_32fc_x2_dot_prod_32fc_a();
|
||||
//cpu_arch_test_volk_32fc_x2_multiply_32fc_a();
|
||||
}
|
||||
|
||||
Correlator::~Correlator ()
|
||||
{}
|
||||
|
@ -54,22 +54,18 @@ class Correlator
|
||||
{
|
||||
public:
|
||||
void Carrier_wipeoff_and_EPL_generic(int signal_length_samples, const gr_complex* input, gr_complex* carrier, gr_complex* E_code, gr_complex* P_code, gr_complex* L_code, gr_complex* E_out, gr_complex* P_out, gr_complex* L_out);
|
||||
void Carrier_wipeoff_and_EPL_volk(int signal_length_samples, const gr_complex* input, gr_complex* carrier, gr_complex* E_code, gr_complex* P_code, gr_complex* L_code, gr_complex* E_out, gr_complex* P_out, gr_complex* L_out, bool input_vector_unaligned);
|
||||
void Carrier_wipeoff_and_VEPL_volk(int signal_length_samples, const gr_complex* input, gr_complex* carrier, gr_complex* VE_code, gr_complex* E_code, gr_complex* P_code, gr_complex* L_code, gr_complex* VL_code, gr_complex* VE_out, gr_complex* E_out, gr_complex* P_out, gr_complex* L_out, gr_complex* VL_out, bool input_vector_unaligned);
|
||||
// void Carrier_wipeoff_and_EPL_volk_IQ(int prn_length_samples,int integration_time ,const gr_complex* input, gr_complex* carrier, gr_complex* E_code, gr_complex* P_code, gr_complex* L_code, gr_complex* P_data_code, gr_complex* E_out, gr_complex* P_out, gr_complex* L_out, gr_complex* P_data_out, bool input_vector_unaligned);
|
||||
void Carrier_wipeoff_and_EPL_volk_IQ(int signal_length_samples, const gr_complex* input, gr_complex* carrier, gr_complex* E_code, gr_complex* P_code, gr_complex* L_code, gr_complex* P_data_code, gr_complex* E_out, gr_complex* P_out, gr_complex* L_out, gr_complex* P_data_out, bool input_vector_unaligned);
|
||||
void Carrier_wipeoff_and_EPL_volk(int signal_length_samples, const gr_complex* input, gr_complex* carrier, gr_complex* E_code, gr_complex* P_code, gr_complex* L_code, gr_complex* E_out, gr_complex* P_out, gr_complex* L_out);
|
||||
void Carrier_wipeoff_and_VEPL_volk(int signal_length_samples, const gr_complex* input, gr_complex* carrier, gr_complex* VE_code, gr_complex* E_code, gr_complex* P_code, gr_complex* L_code, gr_complex* VL_code, gr_complex* VE_out, gr_complex* E_out, gr_complex* P_out, gr_complex* L_out, gr_complex* VL_out);
|
||||
// void Carrier_wipeoff_and_EPL_volk_IQ(int prn_length_samples,int integration_time ,const gr_complex* input, gr_complex* carrier, gr_complex* E_code, gr_complex* P_code, gr_complex* L_code, gr_complex* P_data_code, gr_complex* E_out, gr_complex* P_out, gr_complex* L_out, gr_complex* P_data_out);
|
||||
void Carrier_wipeoff_and_EPL_volk_IQ(int signal_length_samples, const gr_complex* input, gr_complex* carrier, gr_complex* E_code, gr_complex* P_code, gr_complex* L_code, gr_complex* P_data_code, gr_complex* E_out, gr_complex* P_out, gr_complex* L_out, gr_complex* P_data_out);
|
||||
Correlator();
|
||||
~Correlator();
|
||||
#ifndef GENERIC_ARCH
|
||||
void Carrier_wipeoff_and_EPL_volk_custom(int signal_length_samples, const gr_complex* input, gr_complex* carrier, gr_complex* E_code, gr_complex* P_code, gr_complex* L_code, gr_complex* E_out, gr_complex* P_out, gr_complex* L_out, bool input_vector_unaligned);
|
||||
void Carrier_wipeoff_and_EPL_volk_custom(int signal_length_samples, const gr_complex* input, gr_complex* carrier, gr_complex* E_code, gr_complex* P_code, gr_complex* L_code, gr_complex* E_out, gr_complex* P_out, gr_complex* L_out);
|
||||
#endif
|
||||
|
||||
private:
|
||||
std::string volk_32fc_x2_multiply_32fc_a_best_arch;
|
||||
std::string volk_32fc_x2_dot_prod_32fc_a_best_arch;
|
||||
unsigned long next_power_2(unsigned long v);
|
||||
void cpu_arch_test_volk_32fc_x2_dot_prod_32fc_a();
|
||||
void cpu_arch_test_volk_32fc_x2_multiply_32fc_a();
|
||||
};
|
||||
#endif
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user