1
0
mirror of https://github.com/gnss-sdr/gnss-sdr synced 2025-10-29 06:27:44 +00:00

Faster local carrier generation

This commit is contained in:
Carles Fernandez
2015-05-05 16:14:46 +02:00
parent b4cfef1a44
commit 90ae04ee19
2 changed files with 61 additions and 27 deletions

View File

@@ -32,43 +32,24 @@
*/
#include "gnss_signal_processing.h"
#include <gnuradio/fxpt.h> // fixed point sine and cosine
#include <gnuradio/fxpt_nco.h>
void complex_exp_gen(std::complex<float>* _dest, double _f, double _fs, unsigned int _samps)
{
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++)
{
gr::fxpt::sincos(phase_i, &sin_f, &cos_f);
_dest[i] = std::complex<float>(cos_f, sin_f);
phase_i += phase_step_i;
}
gr::fxpt_nco d_nco;
d_nco.set_freq(-(GPS_TWO_PI * _f) / _fs);
d_nco.sincos(_dest, _samps, 1);
}
void complex_exp_gen_conj(std::complex<float>* _dest, double _f, double _fs, unsigned int _samps)
{
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++)
{
gr::fxpt::sincos(phase_i, &sin_f, &cos_f);
_dest[i] = std::complex<float>(cos_f, -sin_f);
phase_i += phase_step_i;
}
gr::fxpt_nco d_nco;
d_nco.set_freq(-(GPS_TWO_PI * _f) / _fs);
d_nco.sincos(_dest, _samps, 1);
}
void hex_to_binary_converter(int * _dest, char _from)
{
switch(_from)