1
0
mirror of https://github.com/f4exb/sdrangel.git synced 2026-07-25 03:24:18 -04:00

More Sonar bug fixes

This commit is contained in:
f4exb
2024-07-21 14:20:48 +02:00
parent 02babd5ff8
commit 28262ca5fb
16 changed files with 85 additions and 32 deletions
+2 -2
View File
@@ -90,8 +90,8 @@ private:
// Top area of each buffer is not used by writer, as it's used by the reader
// for copying the last few samples of the previous buffer, so it can
// be processed contiguously
const int m_buffers = 3;
const int m_bufferSize = 200000;
static const int m_buffers = 3;
static const int m_bufferSize = 200000;
Real *m_sampleBuffer[3]; //!< Each buffer is m_bufferSize samples
QSemaphore m_bufferWrite[3]; //!< Semaphore to control write access to the buffers
QSemaphore m_bufferRead[3]; //!< Semaphore to control read access from the buffers
@@ -43,9 +43,14 @@ class LDPCEncoder
return b < TYPE(0) ? -a : b > TYPE(0) ? a : TYPE(0);
}
public:
LDPCEncoder() : initialized(false)
LDPCEncoder() :
N(2),
K(1),
R(1),
initialized(false)
{
}
void init(LDPCInterface *it)
{
if (initialized)
@@ -77,6 +77,7 @@ public:
template <typename TYPE, typename ALG>
class LDPCDecoder
{
private:
TYPE *bnl, *pty, *inp, *out;
uint16_t *pos;
uint8_t *cnc;
@@ -89,6 +90,7 @@ class LDPCDecoder
for (int i = 0; i < LT; ++i)
bnl[i] = alg.zero();
}
bool bad(TYPE *data, TYPE *parity, int blocks)
{
for (int i = 0; i < q; ++i) {
@@ -107,6 +109,7 @@ class LDPCDecoder
}
return false;
}
void update(TYPE *data, TYPE *parity)
{
TYPE *bl = bnl;
@@ -135,10 +138,26 @@ class LDPCDecoder
}
}
}
public:
LDPCDecoder() : initialized(false)
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)
{
}
void init(LDPCInterface *it)
{
if (initialized) {
@@ -124,16 +124,18 @@ int main(int argc, char **argv)
// DVB-S2 MODCOD definitions
static const char *mc_tabnames[2][32] = { // [shortframes][modcod]
{// Normal frames
0, "B1", "B2", "B3", "B4", "B5", "B6", "B7",
"B8", "B9", "B10", "B11", "B5", "B6", "B7", "B9",
"B10", "B11", "B6", "B7", "B8", "B9", "B10", "B11",
"B7", "B8", "B8", "B10", "B11", 0, 0, 0},
{// Short frames
0, "C1", "C2", "C3", "C4", "C5", "C6", "C7",
"C8", "C9", "C10", 0, "C5", "C6", "C7", "C9",
"C10", 0, "C6", "C7", "C8", "C9", "C10", 0,
"C7", "C8", "C8", "C10", 0, 0, 0, 0}};
{// Normal frames
0, "B1", "B2", "B3", "B4", "B5", "B6", "B7",
"B8", "B9", "B10", "B11", "B5", "B6", "B7", "B9",
"B10", "B11", "B6", "B7", "B8", "B9", "B10", "B11",
"B7", "B8", "B8", "B10", "B11", 0, 0, 0
},
{// Short frames
0, "C1", "C2", "C3", "C4", "C5", "C6", "C7",
"C8", "C9", "C10", 0, "C5", "C6", "C7", "C9",
"C10", 0, "C6", "C7", "C8", "C9", "C10", 0,
"C7", "C8", "C8", "C10", 0, 0, 0, 0
}};
const char *tabname = mc_tabnames[shortframes][modcod];
if (!tabname)
@@ -188,8 +190,16 @@ int main(int argc, char **argv)
int blocks = j + ldpctool::SIMD_WIDTH > BLOCKS ? BLOCKS - j : ldpctool::SIMD_WIDTH;
for (int n = 0; n < blocks; ++n)
{
for (int i = 0; i < CODE_LEN; ++i)
{
if (((j + n) * CODE_LEN + i) >= BLOCKS * CODE_LEN) {
break;
}
reinterpret_cast<ldpctool::code_type *>(simd + i)[n] = code[(j + n) * CODE_LEN + i];
}
}
int count = decode(simd, simd + DATA_LEN, max_trials, blocks);
num_decodes++;
@@ -155,14 +155,12 @@ RadioAstronomy::~RadioAstronomy()
m_deviceAPI->removeChannelSinkAPI(this);
m_deviceAPI->removeChannelSink(this);
if (m_basebandSink->isRunning()) {
if ((m_basebandSink->isRunning()) || (m_worker->isRunning())) {
stop();
}
delete m_basebandSink;
if (m_worker->isRunning()) {
stop();
}
delete m_worker;
m_worker->deleteLater();
m_basebandSink->deleteLater();
}
void RadioAstronomy::setDeviceAPI(DeviceAPI *deviceAPI)
@@ -60,6 +60,9 @@ struct IEEE_802_15_4_MacFrame
IEEE_802_15_4_MacFrame()
{
m_destShortAddress = 0;
m_sourceShortAddress = 0;
if (false)
{
// Example ACK frame