1
0
mirror of https://github.com/gnss-sdr/gnss-sdr synced 2025-04-12 22:03:20 +00:00

Optimizations in PCPS Acquisition module:

- Improved speed for normalization in the FFTW results
- Complex multiplications now use the SIMD instructions with VOLK library
- Carrier wipeoff now uses the GNU Radio fixed point NCO (gr_fxpt) 

git-svn-id: https://svn.code.sf.net/p/gnss-sdr/code/trunk@241 64b25241-fba3-4117-9849-534c7e92360d
This commit is contained in:
Javier Arribas 2012-09-04 14:29:07 +00:00
parent 03208cb76f
commit 0703dd2af3
2 changed files with 39 additions and 11 deletions

View File

@ -38,6 +38,7 @@
#include <sstream>
#include <glog/log_severity.h>
#include <glog/logging.h>
#include <volk/volk.h>
using google::LogMessage;
@ -124,7 +125,7 @@ void pcps_acquisition_cc::init()
for (unsigned int i = 0; i < d_fft_size; i++)
{
d_fft_codes[i] = std::complex<float>(conj(d_fft_if->get_outbuf()[i]));
d_fft_codes[i] = d_fft_codes[i] / (float)d_fft_size; //to correct the scale factor introduced by FFTW
//d_fft_codes[i] = d_fft_codes[i] / (float)d_fft_size; //to correct the scale factor introduced by FFTW
}
}
@ -176,6 +177,8 @@ int pcps_acquisition_cc::general_work(int noutput_items,
unsigned int i;
float fft_normalization_factor;
DLOG(INFO) << "Channel: " << d_channel
<< " , doing acquisition of satellite: " << d_gnss_synchro->System << " "<< d_gnss_synchro->PRN
<< " ,sample stamp: " << d_sample_counter << ", threshold: "
@ -203,16 +206,23 @@ int pcps_acquisition_cc::general_work(int noutput_items,
//3- Perform the FFT-based circular convolution (parallel time search)
d_fft_if->execute();
for (i = 0; i < d_fft_size; i++)
{
d_ifft->get_inbuf()[i] = (d_fft_if->get_outbuf()[i]
* d_fft_codes[i]) / (float)d_fft_size;
}
// Using plain C++ operations
// for (i = 0; i < d_fft_size; i++)
// {
// d_ifft->get_inbuf()[i] = (d_fft_if->get_outbuf()[i]
// * d_fft_codes[i]) / (float)d_fft_size;
// }
// Using SIMD operations with VOLK library
volk_32fc_x2_multiply_32fc_a(d_ifft->get_inbuf(), d_fft_if->get_outbuf(), d_fft_codes, d_fft_size);
d_ifft->execute();
// Search maximum
indext = 0;
magt = 0;
fft_normalization_factor=(float)d_fft_size*(float)d_fft_size;
for (i = 0; i < d_fft_size; i++)
{
tmp_magt = std::norm(d_ifft->get_outbuf()[i]);
@ -223,6 +233,9 @@ int pcps_acquisition_cc::general_work(int noutput_items,
}
}
// Normalize the maximum value to correct the scale factor introduced by FFTW
magt=magt/(fft_normalization_factor*fft_normalization_factor);
// Record results to files
if (d_dump)
{

View File

@ -32,17 +32,32 @@
*/
#include "gnss_signal_processing.h"
#include <gr_fxpt.h>
void complex_exp_gen(std::complex<float>* _dest, double _f, double _fs, unsigned int _samps)
{
double phase = 0;
const double phase_step = (GPS_TWO_PI * _f) / _fs;
//old
//double phase = 0;
//const double phase_step = (GPS_TWO_PI * _f) / _fs;
//new Fixed Point NCO (faster)
int phase_i=0;
int phase_step_i;
float phase_step_f =(float)((GPS_TWO_PI * _f) / _fs);
phase_step_i=gr_fxpt::float_to_fixed(phase_step_f);
float sin_f,cos_f;
for(unsigned int i = 0; i < _samps; i++)
{
_dest[i] = std::complex<float>(cos(phase), sin(phase));
phase += phase_step;
//old
//_dest[i] = std::complex<float>(cos(phase), sin(phase));
//phase += phase_step;
//new Fixed Point NCO (faster)
gr_fxpt::sincos(phase_i,&sin_f,&cos_f);
_dest[i] = std::complex<float>(cos_f, sin_f);
phase_i += phase_step_i;
}
}