[hamradio-commits] [gnss-sdr] 49/60: code cleaning
Carles Fernandez
carles_fernandez-guest at moszumanska.debian.org
Sun Mar 22 11:15:44 UTC 2015
This is an automated email from the git hooks/post-receive script.
carles_fernandez-guest pushed a commit to branch next
in repository gnss-sdr.
commit cb1fd9e7273e282cc21d8e88a67b5d7bf9884809
Author: Carles Fernandez <carles.fernandez at gmail.com>
Date: Tue Mar 17 00:22:20 2015 +0100
code cleaning
---
.../libs/galileo_e1_signal_processing.cc | 65 +++++++---------
.../libs/galileo_e5_signal_processing.cc | 90 +++++++++-------------
src/algorithms/libs/gnss_signal_processing.cc | 8 +-
.../observables/adapters/galileo_e1_observables.cc | 8 +-
.../observables/adapters/gps_l1_ca_observables.cc | 6 +-
.../observables/adapters/hybrid_observables.cc | 8 +-
6 files changed, 79 insertions(+), 106 deletions(-)
diff --git a/src/algorithms/libs/galileo_e1_signal_processing.cc b/src/algorithms/libs/galileo_e1_signal_processing.cc
index fd0c479..b41de39 100644
--- a/src/algorithms/libs/galileo_e1_signal_processing.cc
+++ b/src/algorithms/libs/galileo_e1_signal_processing.cc
@@ -34,14 +34,11 @@
#include <string>
-void
-galileo_e1_code_gen_int(int* _dest, char _Signal[3], signed int _prn,
- unsigned int _chip_shift)
+void galileo_e1_code_gen_int(int* _dest, char _Signal[3], signed int _prn, unsigned int _chip_shift)
{
std::string _galileo_signal = _Signal;
signed int prn = _prn - 1;
int index = 0;
- //int* dest = _dest;
/* A simple error check */
if ((_prn < 1) || (_prn > 50))
@@ -53,8 +50,7 @@ galileo_e1_code_gen_int(int* _dest, char _Signal[3], signed int _prn,
{
for (size_t i = 0; i < Galileo_E1_B_PRIMARY_CODE[prn].length(); i++)
{
- hex_to_binary_converter(&_dest[index],
- Galileo_E1_B_PRIMARY_CODE[prn].at(i));
+ hex_to_binary_converter(&_dest[index], Galileo_E1_B_PRIMARY_CODE[prn].at(i));
index = index + 4;
}
@@ -63,9 +59,8 @@ galileo_e1_code_gen_int(int* _dest, char _Signal[3], signed int _prn,
{
for (size_t i = 0; i < Galileo_E1_C_PRIMARY_CODE[prn].length(); i++)
{
- hex_to_binary_converter(&_dest[index],
- Galileo_E1_C_PRIMARY_CODE[prn].at(i));
- index = index +4;
+ hex_to_binary_converter(&_dest[index], Galileo_E1_C_PRIMARY_CODE[prn].at(i));
+ index = index + 4;
}
}
else
@@ -76,29 +71,26 @@ galileo_e1_code_gen_int(int* _dest, char _Signal[3], signed int _prn,
-void
-galileo_e1_sinboc_11_gen(std::complex<float>* _dest, int* _prn,
- unsigned int _length_out)
+void galileo_e1_sinboc_11_gen(std::complex<float>* _dest, int* _prn, unsigned int _length_out)
{
const unsigned int _length_in = Galileo_E1_B_CODE_LENGTH_CHIPS;
unsigned int _period = (unsigned int) (_length_out / _length_in);
for (unsigned int i = 0; i < _length_in; i++)
{
for (unsigned int j = 0; j < (_period / 2); j++)
- _dest[i * _period + j] = std::complex<float>((float) _prn[i],
- 0.0);
-
+ {
+ _dest[i * _period + j] = std::complex<float>((float) _prn[i], 0.0);
+ }
for (unsigned int j = (_period / 2); j < _period; j++)
- _dest[i * _period + j] = std::complex<float>((float) (-_prn[i]),
- 0.0);
+ {
+ _dest[i * _period + j] = std::complex<float>((float) (- _prn[i]), 0.0);
+ }
}
}
-void
-galileo_e1_sinboc_61_gen(std::complex<float>* _dest, int* _prn,
- unsigned int _length_out)
+void galileo_e1_sinboc_61_gen(std::complex<float>* _dest, int* _prn, unsigned int _length_out)
{
const unsigned int _length_in = Galileo_E1_B_CODE_LENGTH_CHIPS;
unsigned int _period = (unsigned int) (_length_out / _length_in);
@@ -106,26 +98,27 @@ galileo_e1_sinboc_61_gen(std::complex<float>* _dest, int* _prn,
for (unsigned int i = 0; i < _length_in; i++)
{
for (unsigned int j = 0; j < _period; j += 2)
- _dest[i * _period + j] = std::complex<float>((float) _prn[i],
- 0.0);
+ {
+ _dest[i * _period + j] = std::complex<float>((float) _prn[i], 0.0);
+ }
for (unsigned int j = 1; j < _period; j += 2)
- _dest[i * _period + j] = std::complex<float>((float) (-_prn[i]),
- 0.0);
+ {
+ _dest[i * _period + j] = std::complex<float>((float) (- _prn[i]), 0.0);
+ }
}
}
-void
-galileo_e1_gen(std::complex<float>* _dest, int* _prn, char _Signal[3])
+void galileo_e1_gen(std::complex<float>* _dest, int* _prn, char _Signal[3])
{
std::string _galileo_signal = _Signal;
const unsigned int _codeLength = 12 * Galileo_E1_B_CODE_LENGTH_CHIPS;
const float alpha = sqrt(10.0 / 11.0);
const float beta = sqrt(1.0 / 11.0);
- std::complex<float> sinboc_11[12*4092]; // _codeLength not accepted by Clang
- std::complex<float> sinboc_61[12*4092];
+ std::complex<float> sinboc_11[12 * 4092]; // _codeLength not accepted by Clang
+ std::complex<float> sinboc_61[12 * 4092];
galileo_e1_sinboc_11_gen(sinboc_11, _prn, _codeLength); //generate sinboc(1,1) 12 samples per chip
galileo_e1_sinboc_61_gen(sinboc_61, _prn, _codeLength); //generate sinboc(6,1) 12 samples per chip
@@ -150,14 +143,11 @@ galileo_e1_gen(std::complex<float>* _dest, int* _prn, char _Signal[3])
-void
-galileo_e1_code_gen_complex_sampled(std::complex<float>* _dest, char _Signal[3],
+void galileo_e1_code_gen_complex_sampled(std::complex<float>* _dest, char _Signal[3],
bool _cboc, unsigned int _prn, signed int _fs, unsigned int _chip_shift,
bool _secondary_flag)
{
-
// This function is based on the GNU software GPS for MATLAB in Kay Borre's book
-
std::string _galileo_signal = _Signal;
unsigned int _samplesPerCode;
const int _codeFreqBasis = Galileo_E1_CODE_CHIP_RATE_HZ; //Hz
@@ -183,8 +173,7 @@ galileo_e1_code_gen_complex_sampled(std::complex<float>* _dest, char _Signal[3],
}
else
{
- galileo_e1_sinboc_11_gen(_signal_E1, primary_code_E1_chips,
- _codeLength); //generate sinboc(1,1) 2 samples per chip
+ galileo_e1_sinboc_11_gen(_signal_E1, primary_code_E1_chips, _codeLength); //generate sinboc(1,1) 2 samples per chip
}
if (_fs != _samplesPerChip * _codeFreqBasis)
@@ -223,17 +212,15 @@ galileo_e1_code_gen_complex_sampled(std::complex<float>* _dest, char _Signal[3],
for (unsigned int i = 0; i < _samplesPerCode; i++)
{
- _dest[(i+delay)%_samplesPerCode] = _signal_E1[i];
+ _dest[(i + delay) % _samplesPerCode] = _signal_E1[i];
}
delete[] _signal_E1;
}
-void
-galileo_e1_code_gen_complex_sampled(std::complex<float>* _dest, char _Signal[3],
+void galileo_e1_code_gen_complex_sampled(std::complex<float>* _dest, char _Signal[3],
bool _cboc, unsigned int _prn, signed int _fs, unsigned int _chip_shift)
{
- galileo_e1_code_gen_complex_sampled(_dest, _Signal, _cboc, _prn,
- _fs, _chip_shift, false);
+ galileo_e1_code_gen_complex_sampled(_dest, _Signal, _cboc, _prn, _fs, _chip_shift, false);
}
diff --git a/src/algorithms/libs/galileo_e5_signal_processing.cc b/src/algorithms/libs/galileo_e5_signal_processing.cc
index 336b06c..adf1dfb 100644
--- a/src/algorithms/libs/galileo_e5_signal_processing.cc
+++ b/src/algorithms/libs/galileo_e5_signal_processing.cc
@@ -35,71 +35,63 @@
void galileo_e5_a_code_gen_complex_primary(std::complex<float>* _dest, signed int _prn, char _Signal[3])
{
- unsigned int prn=_prn-1;
- unsigned int index=0;
+ unsigned int prn = _prn - 1;
+ unsigned int index = 0;
int a[4];
if ((_prn < 1) || (_prn > 50))
{
return;
}
- if (_Signal[0]=='5' && _Signal[1]=='Q')
+ if (_Signal[0] == '5' && _Signal[1] == 'Q')
{
- for (size_t i = 0; i < Galileo_E5a_Q_PRIMARY_CODE[prn].length()-1; i++)
+ for (size_t i = 0; i < Galileo_E5a_Q_PRIMARY_CODE[prn].length() - 1; i++)
{
- hex_to_binary_converter(a,
- Galileo_E5a_Q_PRIMARY_CODE[prn].at(i));
- _dest[index]=std::complex<float>(0.0,float(a[0]));
- _dest[index+1]=std::complex<float>(0.0,float(a[1]));
- _dest[index+2]=std::complex<float>(0.0,float(a[2]));
- _dest[index+3]=std::complex<float>(0.0,float(a[3]));
+ hex_to_binary_converter(a, Galileo_E5a_Q_PRIMARY_CODE[prn].at(i));
+ _dest[index] = std::complex<float>(0.0, float(a[0]));
+ _dest[index + 1] = std::complex<float>(0.0, float(a[1]));
+ _dest[index + 2] = std::complex<float>(0.0, float(a[2]));
+ _dest[index + 3] = std::complex<float>(0.0, float(a[3]));
index = index + 4;
}
// last 2 bits are filled up zeros
- hex_to_binary_converter(a,
- Galileo_E5a_Q_PRIMARY_CODE[prn].at(Galileo_E5a_Q_PRIMARY_CODE[prn].length()-1));
- _dest[index]=std::complex<float>(float(0.0),a[0]);
- _dest[index+1]=std::complex<float>(float(0.0),a[1]);
+ hex_to_binary_converter(a, Galileo_E5a_Q_PRIMARY_CODE[prn].at(Galileo_E5a_Q_PRIMARY_CODE[prn].length() - 1));
+ _dest[index] = std::complex<float>(float(0.0), a[0]);
+ _dest[index + 1] = std::complex<float>(float(0.0), a[1]);
}
- else if (_Signal[0]=='5' && _Signal[1]=='I')
+ else if (_Signal[0] == '5' && _Signal[1] == 'I')
{
- for (size_t i = 0; i < Galileo_E5a_I_PRIMARY_CODE[prn].length()-1; i++)
+ for (size_t i = 0; i < Galileo_E5a_I_PRIMARY_CODE[prn].length() - 1; i++)
{
- hex_to_binary_converter(a,
- Galileo_E5a_I_PRIMARY_CODE[prn].at(i));
- _dest[index]=std::complex<float>(float(a[0]),0.0);
- _dest[index+1]=std::complex<float>(float(a[1]),0.0);
- _dest[index+2]=std::complex<float>(float(a[2]),0.0);
- _dest[index+3]=std::complex<float>(float(a[3]),0.0);
+ hex_to_binary_converter(a, Galileo_E5a_I_PRIMARY_CODE[prn].at(i));
+ _dest[index] = std::complex<float>(float(a[0]), 0.0);
+ _dest[index + 1] = std::complex<float>(float(a[1]), 0.0);
+ _dest[index + 2] = std::complex<float>(float(a[2]), 0.0);
+ _dest[index + 3] = std::complex<float>(float(a[3]), 0.0);
index = index + 4;
}
// last 2 bits are filled up zeros
- hex_to_binary_converter(a,
- Galileo_E5a_I_PRIMARY_CODE[prn].at(Galileo_E5a_I_PRIMARY_CODE[prn].length()-1));
- _dest[index]=std::complex<float>(float(a[0]),0.0);
- _dest[index+1]=std::complex<float>(float(a[1]),0.0);
+ hex_to_binary_converter(a, Galileo_E5a_I_PRIMARY_CODE[prn].at(Galileo_E5a_I_PRIMARY_CODE[prn].length() - 1));
+ _dest[index] = std::complex<float>(float(a[0]), 0.0);
+ _dest[index + 1] = std::complex<float>(float(a[1]), 0.0);
}
- else if (_Signal[0]=='5' && _Signal[1]=='X')
+ else if (_Signal[0] == '5' && _Signal[1] == 'X')
{
int b[4];
- for (size_t i = 0; i < Galileo_E5a_I_PRIMARY_CODE[prn].length()-1; i++)
+ for (size_t i = 0; i < Galileo_E5a_I_PRIMARY_CODE[prn].length() - 1; i++)
{
- hex_to_binary_converter(a,
- Galileo_E5a_I_PRIMARY_CODE[prn].at(i));
- hex_to_binary_converter(b,
- Galileo_E5a_Q_PRIMARY_CODE[prn].at(i));
- _dest[index]=std::complex<float>(float(a[0]),float(b[0]));
- _dest[index+1]=std::complex<float>(float(a[1]),float(b[1]));
- _dest[index+2]=std::complex<float>(float(a[2]),float(b[2]));
- _dest[index+3]=std::complex<float>(float(a[3]),float(b[3]));
+ hex_to_binary_converter(a, Galileo_E5a_I_PRIMARY_CODE[prn].at(i));
+ hex_to_binary_converter(b, Galileo_E5a_Q_PRIMARY_CODE[prn].at(i));
+ _dest[index] = std::complex<float>(float(a[0]),float(b[0]));
+ _dest[index + 1] = std::complex<float>(float(a[1]),float(b[1]));
+ _dest[index + 2] = std::complex<float>(float(a[2]),float(b[2]));
+ _dest[index + 3] = std::complex<float>(float(a[3]),float(b[3]));
index = index + 4;
}
// last 2 bits are filled up zeros
- hex_to_binary_converter(a,
- Galileo_E5a_I_PRIMARY_CODE[prn].at(Galileo_E5a_I_PRIMARY_CODE[prn].length()-1));
- hex_to_binary_converter(b,
- Galileo_E5a_Q_PRIMARY_CODE[prn].at(Galileo_E5a_Q_PRIMARY_CODE[prn].length()-1));
- _dest[index]=std::complex<float>(float(a[0]),float(b[0]));
- _dest[index+1]=std::complex<float>(float(a[1]),float(b[1]));
+ hex_to_binary_converter(a, Galileo_E5a_I_PRIMARY_CODE[prn].at(Galileo_E5a_I_PRIMARY_CODE[prn].length() - 1));
+ hex_to_binary_converter(b, Galileo_E5a_Q_PRIMARY_CODE[prn].at(Galileo_E5a_Q_PRIMARY_CODE[prn].length() - 1));
+ _dest[index] = std::complex<float>(float(a[0]), float(b[0]));
+ _dest[index + 1] = std::complex<float>(float(a[1]), float(b[1]));
}
}
@@ -107,39 +99,33 @@ void galileo_e5_a_code_gen_complex_sampled(std::complex<float>* _dest, char _Sig
unsigned int _prn, signed int _fs, unsigned int _chip_shift)
{
// This function is based on the GNU software GPS for MATLAB in the Kay Borre book
-
unsigned int _samplesPerCode;
unsigned int delay;
unsigned int _codeLength = Galileo_E5a_CODE_LENGTH_CHIPS;
const int _codeFreqBasis = Galileo_E5a_CODE_CHIP_RATE_HZ; //Hz
-
std::complex<float>* _code;
- _code=new std::complex<float>[_codeLength];
+ _code = new std::complex<float>[_codeLength];
galileo_e5_a_code_gen_complex_primary(_code , _prn , _Signal);
_samplesPerCode = round(_fs / (_codeFreqBasis / _codeLength));
- delay = ((_codeLength - _chip_shift)
- % _codeLength) * _samplesPerCode / _codeLength;
-
+ delay = ((_codeLength - _chip_shift) % _codeLength) * _samplesPerCode / _codeLength;
if (_fs != _codeFreqBasis)
{
std::complex<float>* _resampled_signal;
if (posix_memalign((void**)&_resampled_signal, 16, _samplesPerCode * sizeof(gr_complex)) == 0){};
- resampler(_code, _resampled_signal, _codeFreqBasis, _fs,
- _codeLength, _samplesPerCode); //resamples code to fs
+ resampler(_code, _resampled_signal, _codeFreqBasis, _fs, _codeLength, _samplesPerCode); //resamples code to fs
delete[] _code;
_code = _resampled_signal;
}
for (unsigned int i = 0; i < _samplesPerCode; i++)
{
- _dest[(i+delay)%_samplesPerCode] = _code[i];
+ _dest[(i + delay) % _samplesPerCode] = _code[i];
}
free(_code);
-
}
diff --git a/src/algorithms/libs/gnss_signal_processing.cc b/src/algorithms/libs/gnss_signal_processing.cc
index 118ae91..9de66ca 100644
--- a/src/algorithms/libs/gnss_signal_processing.cc
+++ b/src/algorithms/libs/gnss_signal_processing.cc
@@ -178,9 +178,9 @@ void resampler(std::complex<float>* _from, std::complex<float>* _dest, float _fs
{
unsigned int _codeValueIndex;
//--- Find time constants --------------------------------------------------
- const float _t_in = 1/_fs_in; // Incoming sampling period in sec
- const float _t_out = 1/_fs_out; // Out sampling period in sec
- for (unsigned int i=0; i<_length_out-1; i++)
+ const float _t_in = 1 / _fs_in; // Incoming sampling period in sec
+ const float _t_out = 1 / _fs_out; // Out sampling period in sec
+ for (unsigned int i = 0; i < _length_out - 1; i++)
{
//=== Digitizing =======================================================
//--- compute index array to read sampled values -------------------------
@@ -189,5 +189,5 @@ void resampler(std::complex<float>* _from, std::complex<float>* _dest, float _fs
_dest[i] = _from[_codeValueIndex];
}
//--- Correct the last index (due to number rounding issues) -----------
- _dest[_length_out-1] = _from[_length_in - 1];
+ _dest[_length_out - 1] = _from[_length_in - 1];
}
diff --git a/src/algorithms/observables/adapters/galileo_e1_observables.cc b/src/algorithms/observables/adapters/galileo_e1_observables.cc
index 602c1af..d402662 100644
--- a/src/algorithms/observables/adapters/galileo_e1_observables.cc
+++ b/src/algorithms/observables/adapters/galileo_e1_observables.cc
@@ -72,8 +72,8 @@ GalileoE1Observables::~GalileoE1Observables()
void GalileoE1Observables::connect(gr::top_block_sptr top_block)
{
- if(top_block) { /* top_block is not null */};
- // Nothing to connect internally
+ if(top_block) { /* top_block is not null */};
+ // Nothing to connect internally
DLOG(INFO) << "nothing to connect internally";
}
@@ -81,8 +81,8 @@ void GalileoE1Observables::connect(gr::top_block_sptr top_block)
void GalileoE1Observables::disconnect(gr::top_block_sptr top_block)
{
- if(top_block) { /* top_block is not null */};
- // Nothing to disconnect
+ if(top_block) { /* top_block is not null */};
+ // Nothing to disconnect
}
diff --git a/src/algorithms/observables/adapters/gps_l1_ca_observables.cc b/src/algorithms/observables/adapters/gps_l1_ca_observables.cc
index 5464799..c970362 100644
--- a/src/algorithms/observables/adapters/gps_l1_ca_observables.cc
+++ b/src/algorithms/observables/adapters/gps_l1_ca_observables.cc
@@ -73,7 +73,7 @@ GpsL1CaObservables::~GpsL1CaObservables()
void GpsL1CaObservables::connect(gr::top_block_sptr top_block)
{
if(top_block) { /* top_block is not null */};
- // Nothing to connect internally
+ // Nothing to connect internally
DLOG(INFO) << "nothing to connect internally";
}
@@ -81,8 +81,8 @@ void GpsL1CaObservables::connect(gr::top_block_sptr top_block)
void GpsL1CaObservables::disconnect(gr::top_block_sptr top_block)
{
- if(top_block) { /* top_block is not null */};
- // Nothing to disconnect
+ if(top_block) { /* top_block is not null */};
+ // Nothing to disconnect
}
diff --git a/src/algorithms/observables/adapters/hybrid_observables.cc b/src/algorithms/observables/adapters/hybrid_observables.cc
index 1eb677a..e9fb49f 100644
--- a/src/algorithms/observables/adapters/hybrid_observables.cc
+++ b/src/algorithms/observables/adapters/hybrid_observables.cc
@@ -72,8 +72,8 @@ HybridObservables::~HybridObservables()
void HybridObservables::connect(gr::top_block_sptr top_block)
{
- if(top_block) { /* top_block is not null */};
- // Nothing to connect internally
+ if(top_block) { /* top_block is not null */};
+ // Nothing to connect internally
DLOG(INFO) << "nothing to connect internally";
}
@@ -81,8 +81,8 @@ void HybridObservables::connect(gr::top_block_sptr top_block)
void HybridObservables::disconnect(gr::top_block_sptr top_block)
{
- if(top_block) { /* top_block is not null */};
- // Nothing to disconnect
+ if(top_block) { /* top_block is not null */};
+ // Nothing to disconnect
}
--
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-hamradio/gnss-sdr.git
More information about the pkg-hamradio-commits
mailing list