1
0
mirror of https://github.com/f4exb/sdrangel.git synced 2025-07-30 12:42:25 -04:00

Compare commits

...

3 Commits

Author SHA1 Message Date
f4exb
0a9a2ba136 More Sonar fixes (3) 2024-07-22 04:25:43 +02:00
f4exb
3799746ac0 More Sonar fixes (2) 2024-07-22 00:34:26 +02:00
f4exb
189d5a6a01 More Sonar fixes 2024-07-21 23:15:32 +02:00
5 changed files with 35 additions and 44 deletions

View File

@ -1938,6 +1938,10 @@ void FT8::soft_decode(const FFTEngine::ffts_t &c79, float ll174[])
// //
void FT8::soft_decode_mags(FT8Params& params, const std::vector<std::vector<float>>& mags_, int nbSymbolBits, float ll174[]) void FT8::soft_decode_mags(FT8Params& params, const std::vector<std::vector<float>>& mags_, int nbSymbolBits, float ll174[])
{ {
if ((nbSymbolBits > 16) || (nbSymbolBits < 1)) {
return;
}
std::vector<std::vector<float>> mags = convert_to_snr_gen(params, nbSymbolBits, mags_); std::vector<std::vector<float>> mags = convert_to_snr_gen(params, nbSymbolBits, mags_);
// statistics to decide soft probabilities. // statistics to decide soft probabilities.
// distribution of strongest tones, and // distribution of strongest tones, and
@ -1949,8 +1953,8 @@ void FT8::soft_decode_mags(FT8Params& params, const std::vector<std::vector<floa
int lli = 0; int lli = 0;
int zoX = 1<<(nbSymbolBits-1); int zoX = 1<<(nbSymbolBits-1);
int zoY = nbSymbolBits; int zoY = nbSymbolBits;
int *zeroi = new int[zoX*zoY]; std::vector<int> zeroi(zoX*zoY);
int *onei = new int[zoX*zoY]; std::vector<int> onei(zoX*zoY);
for (int biti = 0; biti < nbSymbolBits; biti++) for (int biti = 0; biti < nbSymbolBits; biti++)
{ {
@ -2006,9 +2010,6 @@ void FT8::soft_decode_mags(FT8Params& params, const std::vector<std::vector<floa
ll174[lli++] = ll; ll174[lli++] = ll;
} }
} }
delete[] zeroi;
delete[] onei;
} }
// //

View File

@ -30,9 +30,11 @@ namespace ldpctool {
template <typename TYPE> template <typename TYPE>
class LDPCEncoder class LDPCEncoder
{ {
LDPCInterface *ldpc; LDPCInterface *ldpc = nullptr;
int N, K, R; int N = 2;
bool initialized; int K = 1;
int R = 1;
bool initialized = false;
TYPE one() TYPE one()
{ {
@ -43,11 +45,7 @@ class LDPCEncoder
return b < TYPE(0) ? -a : b > TYPE(0) ? a : TYPE(0); return b < TYPE(0) ? -a : b > TYPE(0) ? a : TYPE(0);
} }
public: public:
LDPCEncoder() : LDPCEncoder()
N(2),
K(1),
R(1),
initialized(false)
{ {
} }

View File

@ -78,12 +78,21 @@ template <typename TYPE, typename ALG>
class LDPCDecoder class LDPCDecoder
{ {
private: private:
TYPE *bnl, *pty, *inp, *out; TYPE *bnl = nullptr;
uint16_t *pos; TYPE *pty = nullptr;
uint8_t *cnc; TYPE *inp = nullptr;
TYPE *out = nullptr;
uint16_t *pos = nullptr;
uint8_t *cnc = nullptr;
ALG alg; ALG alg;
int M, N, K, R, q, CNL, LT; int M = 0;
bool initialized; int N = 0;
int K = 0;
int R = 0;
int q = 0;
int CNL = 0;
int LT = 0;
bool initialized = false;
void reset() void reset()
{ {
@ -140,21 +149,7 @@ private:
} }
public: public:
LDPCDecoder() : LDPCDecoder()
bnl(nullptr),
pty(nullptr),
inp(nullptr),
out(nullptr),
pos(nullptr),
cnc(nullptr),
M(0),
N(0),
K(0),
R(0),
q(0),
CNL(0),
LT(0),
initialized(false)
{ {
} }

View File

@ -125,16 +125,16 @@ int main(int argc, char **argv)
// DVB-S2 MODCOD definitions // DVB-S2 MODCOD definitions
static const char *mc_tabnames[2][32] = { // [shortframes][modcod] static const char *mc_tabnames[2][32] = { // [shortframes][modcod]
{// Normal frames {// Normal frames
0, "B1", "B2", "B3", "B4", "B5", "B6", "B7", nullptr, "B1", "B2", "B3", "B4", "B5", "B6", "B7",
"B8", "B9", "B10", "B11", "B5", "B6", "B7", "B9", "B8", "B9", "B10", "B11", "B5", "B6", "B7", "B9",
"B10", "B11", "B6", "B7", "B8", "B9", "B10", "B11", "B10", "B11", "B6", "B7", "B8", "B9", "B10", "B11",
"B7", "B8", "B8", "B10", "B11", 0, 0, 0 "B7", "B8", "B8", "B10", "B11", nullptr, nullptr, nullptr
}, },
{// Short frames {// Short frames
0, "C1", "C2", "C3", "C4", "C5", "C6", "C7", nullptr, "C1", "C2", "C3", "C4", "C5", "C6", "C7",
"C8", "C9", "C10", 0, "C5", "C6", "C7", "C9", "C8", "C9", "C10", nullptr, "C5", "C6", "C7", "C9",
"C10", 0, "C6", "C7", "C8", "C9", "C10", 0, "C10", nullptr, "C6", "C7", "C8", "C9", "C10", nullptr,
"C7", "C8", "C8", "C10", 0, 0, 0, 0 "C7", "C8", "C8", "C10", nullptr, nullptr, nullptr, nullptr
}}; }};
const char *tabname = mc_tabnames[shortframes][modcod]; const char *tabname = mc_tabnames[shortframes][modcod];

View File

@ -50,19 +50,16 @@ struct IEEE_802_15_4_MacFrame
uint16_t m_frameControl; uint16_t m_frameControl;
uint8_t m_sequenceNumber; uint8_t m_sequenceNumber;
uint16_t m_destPANID; uint16_t m_destPANID;
uint16_t m_destShortAddress; uint16_t m_destShortAddress = 0;
ieee_802_15_4_address m_destAddress; ieee_802_15_4_address m_destAddress;
uint16_t m_sourcePANID; uint16_t m_sourcePANID;
uint16_t m_sourceShortAddress; uint16_t m_sourceShortAddress = 0;
ieee_802_15_4_address m_sourceAddress; ieee_802_15_4_address m_sourceAddress;
uint8_t m_payload[IEEE_802_15_4_MAC_PAYLOAD_MAX_LENGTH]; uint8_t m_payload[IEEE_802_15_4_MAC_PAYLOAD_MAX_LENGTH];
uint8_t m_payloadLength; uint8_t m_payloadLength;
IEEE_802_15_4_MacFrame() IEEE_802_15_4_MacFrame()
{ {
m_destShortAddress = 0;
m_sourceShortAddress = 0;
if (false) if (false)
{ {
// Example ACK frame // Example ACK frame