1
0
mirror of https://github.com/gnss-sdr/gnss-sdr synced 2025-11-03 16:53:04 +00:00

Correlator class now takes profit of the GNU Radio memory alignment, used by Volk SIMD functions

git-svn-id: https://svn.code.sf.net/p/gnss-sdr/code/trunk@218 64b25241-fba3-4117-9849-534c7e92360d
This commit is contained in:
Javier Arribas
2012-07-31 12:35:07 +00:00
parent b849b20a8c
commit fb82c2246d
6 changed files with 34 additions and 29 deletions

View File

@@ -389,8 +389,8 @@ 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);
d_Late,
is_unaligned());
// 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)
{

View File

@@ -386,7 +386,8 @@ 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);
d_Late,
is_unaligned());
// 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)

View File

@@ -424,7 +424,8 @@ int Gps_L1_Ca_Tcp_Connector_Tracking_cc::general_work (int noutput_items, gr_vec
d_late_code,
d_Early,
d_Prompt,
d_Late);
d_Late,
is_unaligned());
// 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)

View File

@@ -73,37 +73,40 @@ void Correlator::Carrier_wipeoff_and_EPL_generic(int signal_length_samples,const
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)
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_aligned)
{
gr_complex* bb_signal;
gr_complex* input_aligned;
//gr_complex* carrier_aligned;
// signal_length_samples=next_power_2(signal_length_samples);
//std::cout<<"length="<<signal_length_samples<<std::endl;
//long int new_length=next_power_2(signal_length_samples);
//todo: do something if posix_memalign fails
if (posix_memalign((void**)&bb_signal, 16, signal_length_samples * sizeof(gr_complex)) == 0) {};
if (posix_memalign((void**)&input_aligned, 16, signal_length_samples * sizeof(gr_complex)) == 0){};
//posix_memalign((void**)&carrier_aligned, 16, new_length*sizeof(gr_complex));
memcpy(input_aligned,input,signal_length_samples * sizeof(gr_complex));
//memcpy(carrier_aligned,carrier,signal_length_samples*sizeof(gr_complex));
if (input_vector_aligned==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_a_manual(bb_signal, input_aligned, carrier, signal_length_samples, volk_32fc_x2_multiply_32fc_a_best_arch.c_str());
//volk_32fc_x2_dot_prod_32fc_a_manual(E_out, bb_signal, E_code, signal_length_samples * sizeof(gr_complex), volk_32fc_x2_dot_prod_32fc_a_best_arch.c_str());
//volk_32fc_x2_dot_prod_32fc_a_manual(P_out, bb_signal, P_code, signal_length_samples * sizeof(gr_complex), volk_32fc_x2_dot_prod_32fc_a_best_arch.c_str());
//volk_32fc_x2_dot_prod_32fc_a_manual(L_out, bb_signal, L_code, signal_length_samples * sizeof(gr_complex), volk_32fc_x2_dot_prod_32fc_a_best_arch.c_str());
//volk_32fc_x2_multiply_32fc_a_manual(bb_signal, input_aligned, carrier, signal_length_samples, volk_32fc_x2_multiply_32fc_a_best_arch.c_str());
//volk_32fc_x2_dot_prod_32fc_a_manual(E_out, bb_signal, E_code, signal_length_samples * sizeof(gr_complex), volk_32fc_x2_dot_prod_32fc_a_best_arch.c_str());
//volk_32fc_x2_dot_prod_32fc_a_manual(P_out, bb_signal, P_code, signal_length_samples * sizeof(gr_complex), volk_32fc_x2_dot_prod_32fc_a_best_arch.c_str());
//volk_32fc_x2_dot_prod_32fc_a_manual(L_out, bb_signal, L_code, signal_length_samples * sizeof(gr_complex), volk_32fc_x2_dot_prod_32fc_a_best_arch.c_str());
volk_32fc_x2_multiply_32fc_a(bb_signal, input_aligned, carrier, signal_length_samples);
}else{
//use directly the input vector
volk_32fc_x2_multiply_32fc_a(bb_signal, input, carrier, signal_length_samples);
}
volk_32fc_x2_multiply_32fc_a(bb_signal, input_aligned, carrier, signal_length_samples);
volk_32fc_x2_dot_prod_32fc_a(E_out, bb_signal, E_code, signal_length_samples * sizeof(gr_complex));
volk_32fc_x2_dot_prod_32fc_a(P_out, bb_signal, P_code, signal_length_samples * sizeof(gr_complex));
volk_32fc_x2_dot_prod_32fc_a(L_out, bb_signal, L_code, signal_length_samples * sizeof(gr_complex));
free(bb_signal);
free(input_aligned);
//free(carrier_aligned);
if (input_vector_aligned==false)
{
free(input_aligned);
}
}
void Correlator::cpu_arch_test_volk_32fc_x2_dot_prod_32fc_a()

View File

@@ -50,7 +50,7 @@ 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);
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_aligned);
Correlator();
~Correlator();
private: