1
0
mirror of https://github.com/gnss-sdr/gnss-sdr synced 2025-01-12 02:10:34 +00:00

About 40% of tracking speed improvement by extending the early local code replica and using memcpy to generate prompt and late replicas.

git-svn-id: https://svn.code.sf.net/p/gnss-sdr/code/trunk@219 64b25241-fba3-4117-9849-534c7e92360d
This commit is contained in:
Javier Arribas 2012-07-31 15:10:20 +00:00
parent fb82c2246d
commit 690d7c66e7
4 changed files with 73 additions and 32 deletions

View File

@ -265,22 +265,38 @@ void Gps_L1_Ca_Dll_Fll_Pll_Tracking_cc::update_local_code()
double tcode_chips;
double rem_code_phase_chips;
double code_phase_step_chips;
int early_late_spc_samples;
int epl_loop_length_samples;
int associated_chip_index;
int code_length_chips = (int)GPS_L1_CA_CODE_LENGTH_CHIPS;
code_phase_step_chips = d_code_freq_hz / d_fs_in;
rem_code_phase_chips = d_rem_code_phase_samples * (d_code_freq_hz / d_fs_in);
// unified loop for E, P, L code vectors
tcode_chips = -rem_code_phase_chips;
for (int i=0; i<d_current_prn_length_samples; i++)
{
associated_chip_index = 1 + round(fmod(tcode_chips - d_early_late_spc_chips, code_length_chips));
d_early_code[i] = d_ca_code[associated_chip_index];
associated_chip_index = 1 + round(fmod(tcode_chips, code_length_chips));
d_prompt_code[i] = d_ca_code[associated_chip_index];
associated_chip_index = 1 + round(fmod(tcode_chips + d_early_late_spc_chips, code_length_chips));
d_late_code[i] = d_ca_code[associated_chip_index];
tcode_chips = tcode_chips + code_phase_step_chips;
}
// Alternative EPL code generation (40% of speed improvement!)
early_late_spc_samples=round(d_early_late_spc_chips/code_phase_step_chips);
epl_loop_length_samples=d_current_prn_length_samples+early_late_spc_samples*2;
for (int i=0; i<epl_loop_length_samples; i++)
{
associated_chip_index = 1 + round(fmod(tcode_chips - d_early_late_spc_chips, code_length_chips));
d_early_code[i]=d_ca_code[associated_chip_index];
tcode_chips = tcode_chips + code_phase_step_chips;
}
memcpy(d_prompt_code,&d_early_code[early_late_spc_samples],d_current_prn_length_samples* sizeof(gr_complex));
memcpy(d_late_code,&d_early_code[early_late_spc_samples*2],d_current_prn_length_samples* sizeof(gr_complex));
// for (int i=0; i<d_current_prn_length_samples; i++)
// {
// associated_chip_index = 1 + round(fmod(tcode_chips - d_early_late_spc_chips, code_length_chips));
// d_early_code[i] = d_ca_code[associated_chip_index];
// associated_chip_index = 1 + round(fmod(tcode_chips, code_length_chips));
// d_prompt_code[i] = d_ca_code[associated_chip_index];
// associated_chip_index = 1 + round(fmod(tcode_chips + d_early_late_spc_chips, code_length_chips));
// d_late_code[i] = d_ca_code[associated_chip_index];
// tcode_chips = tcode_chips + code_phase_step_chips;
// }
}

View File

@ -265,23 +265,35 @@ void Gps_L1_Ca_Dll_Pll_Tracking_cc::start_tracking()
void Gps_L1_Ca_Dll_Pll_Tracking_cc::update_local_code()
{
float tcode_chips;
float rem_code_phase_chips;
double tcode_chips;
double rem_code_phase_chips;
int associated_chip_index;
int code_length_chips = (int)GPS_L1_CA_CODE_LENGTH_CHIPS;
double code_phase_step_chips;
int early_late_spc_samples;
int epl_loop_length_samples;
// unified loop for E, P, L code vectors
code_phase_step_chips = ((double)d_code_freq_hz) / ((double)d_fs_in);
rem_code_phase_chips = d_rem_code_phase_samples * (d_code_freq_hz / d_fs_in);
tcode_chips = -rem_code_phase_chips;
for (int i=0; i<d_current_prn_length_samples; i++)
{
associated_chip_index = 1 + round(fmod(tcode_chips - d_early_late_spc_chips, code_length_chips));
// Alternative EPL code generation (40% of speed improvement!)
early_late_spc_samples=round(d_early_late_spc_chips/code_phase_step_chips);
epl_loop_length_samples=d_current_prn_length_samples+early_late_spc_samples*2;
for (int i=0; i<epl_loop_length_samples; i++)
{
associated_chip_index = 1 + round(fmod(tcode_chips - d_early_late_spc_chips, code_length_chips));
d_early_code[i] = d_ca_code[associated_chip_index];
associated_chip_index = 1 + round(fmod(tcode_chips, code_length_chips));
d_prompt_code[i] = d_ca_code[associated_chip_index];
associated_chip_index = 1 + round(fmod(tcode_chips+d_early_late_spc_chips, code_length_chips));
d_late_code[i] = d_ca_code[associated_chip_index];
//associated_chip_index = 1 + round(fmod(tcode_chips, code_length_chips));
//d_prompt_code[i] = d_ca_code[associated_chip_index];
//associated_chip_index = 1 + round(fmod(tcode_chips+d_early_late_spc_chips, code_length_chips));
//d_late_code[i] = d_ca_code[associated_chip_index];
tcode_chips = tcode_chips + d_code_phase_step_chips;
}
}
memcpy(d_prompt_code,&d_early_code[early_late_spc_samples],d_current_prn_length_samples* sizeof(gr_complex));
memcpy(d_late_code,&d_early_code[early_late_spc_samples*2],d_current_prn_length_samples* sizeof(gr_complex));
}

View File

@ -133,9 +133,9 @@ private:
long d_if_freq;
long d_fs_in;
float d_early_late_spc_chips;
double d_early_late_spc_chips;
float d_code_phase_step_chips;
double d_code_phase_step_chips;
gr_complex* d_ca_code;

View File

@ -289,23 +289,36 @@ void Gps_L1_Ca_Tcp_Connector_Tracking_cc::start_tracking()
void Gps_L1_Ca_Tcp_Connector_Tracking_cc::update_local_code()
{
float tcode_chips;
float rem_code_phase_chips;
double tcode_chips;
double rem_code_phase_chips;
int associated_chip_index;
int code_length_chips = (int)GPS_L1_CA_CODE_LENGTH_CHIPS;
double code_phase_step_chips;
int early_late_spc_samples;
int epl_loop_length_samples;
// unified loop for E, P, L code vectors
code_phase_step_chips = ((double)d_code_freq_hz) / ((double)d_fs_in);
rem_code_phase_chips = d_rem_code_phase_samples * (d_code_freq_hz / d_fs_in);
tcode_chips = -rem_code_phase_chips;
for (int i=0; i<d_current_prn_length_samples; i++)
{
associated_chip_index = 1 + round(fmod(tcode_chips - d_early_late_spc_chips, code_length_chips));
// Alternative EPL code generation (40% of speed improvement!)
early_late_spc_samples=round(d_early_late_spc_chips/code_phase_step_chips);
epl_loop_length_samples=d_current_prn_length_samples+early_late_spc_samples*2;
for (int i=0; i<epl_loop_length_samples; i++)
{
associated_chip_index = 1 + round(fmod(tcode_chips - d_early_late_spc_chips, code_length_chips));
d_early_code[i] = d_ca_code[associated_chip_index];
associated_chip_index = 1 + round(fmod(tcode_chips, code_length_chips));
d_prompt_code[i] = d_ca_code[associated_chip_index];
associated_chip_index = 1 + round(fmod(tcode_chips+d_early_late_spc_chips, code_length_chips));
d_late_code[i] = d_ca_code[associated_chip_index];
//associated_chip_index = 1 + round(fmod(tcode_chips, code_length_chips));
//d_prompt_code[i] = d_ca_code[associated_chip_index];
//associated_chip_index = 1 + round(fmod(tcode_chips+d_early_late_spc_chips, code_length_chips));
//d_late_code[i] = d_ca_code[associated_chip_index];
tcode_chips = tcode_chips + d_code_phase_step_chips;
}
}
memcpy(d_prompt_code,&d_early_code[early_late_spc_samples],d_current_prn_length_samples* sizeof(gr_complex));
memcpy(d_late_code,&d_early_code[early_late_spc_samples*2],d_current_prn_length_samples* sizeof(gr_complex));
}