mirror of
https://github.com/gnss-sdr/gnss-sdr
synced 2025-10-31 23:33:03 +00:00
bug found in PRN resampler code. Disabled optimization
This commit is contained in:
@@ -86,15 +86,14 @@ void gps_l2c_m_code_gen_complex_sampled(std::complex<float>* _dest, unsigned int
|
||||
signed int _samplesPerCode, _codeValueIndex;
|
||||
float _ts;
|
||||
float _tc;
|
||||
const signed int _codeFreqBasis = GPS_L2_M_CODE_RATE_HZ; //Hz
|
||||
const signed int _codeLength = GPS_L2_M_CODE_LENGTH_CHIPS;
|
||||
|
||||
//--- Find number of samples per spreading code ----------------------------
|
||||
_samplesPerCode = static_cast<int>(static_cast<double>(_fs) / (static_cast<double>(_codeFreqBasis) / static_cast<double>(_codeLength)));
|
||||
_samplesPerCode = static_cast<int>(static_cast<double>(_fs) / (static_cast<double>(GPS_L2_M_CODE_RATE_HZ) / static_cast<double>(_codeLength)));
|
||||
|
||||
//--- Find time constants --------------------------------------------------
|
||||
_ts = 1.0 / static_cast<float>(_fs); // Sampling period in sec
|
||||
_tc = 1.0 / static_cast<float>(_codeFreqBasis); // C/A chip period in sec
|
||||
_tc = 1.0 / static_cast<float>(GPS_L2_M_CODE_RATE_HZ); // C/A chip period in sec
|
||||
|
||||
float aux;
|
||||
|
||||
@@ -108,9 +107,9 @@ void gps_l2c_m_code_gen_complex_sampled(std::complex<float>* _dest, unsigned int
|
||||
// millisecond).
|
||||
//TODO: Check this formula! Seems to start with an extra sample
|
||||
|
||||
// _codeValueIndex = ceil((_ts * ((float)i + 1)) / _tc) - 1;
|
||||
aux = (_ts * (i + 1)) / _tc;
|
||||
_codeValueIndex = static_cast<int>(static_cast<long>(aux)) - 1;
|
||||
_codeValueIndex = ceil((_ts * ((float)i + 1)) / _tc) - 1;
|
||||
//aux = (_ts * (i + 1)) / _tc;
|
||||
//_codeValueIndex = static_cast<int>(static_cast<long>(aux)) - 1;
|
||||
|
||||
//--- Make the digitized version of the C/A code -----------------------
|
||||
// The "upsampled" code is made by selecting values form the CA code
|
||||
@@ -123,7 +122,7 @@ void gps_l2c_m_code_gen_complex_sampled(std::complex<float>* _dest, unsigned int
|
||||
}
|
||||
else
|
||||
{
|
||||
_dest[i] = std::complex<float>(1.0 - 2.0 * _code[_codeValueIndex], 0);; //repeat the chip -> upsample
|
||||
_dest[i] = std::complex<float>(1.0 - 2.0 * _code[_codeValueIndex], 0); //repeat the chip -> upsample
|
||||
}
|
||||
}
|
||||
delete[] _code;
|
||||
|
||||
Reference in New Issue
Block a user