1
0
mirror of https://github.com/f4exb/sdrangel.git synced 2025-09-10 10:47:48 -04:00

Compare commits

...

6 Commits

Author SHA1 Message Date
f4exb
4b38488b51 WDSP: extend parameters range of noise blanker 2024-07-22 05:27:44 +02:00
Edouard Griffiths
4ee2eb532a
Merge pull request #2217 from f4exb/fix-sonar
More Sonar bug fixes
2024-07-22 05:26:20 +02:00
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
f4exb
28262ca5fb More Sonar bug fixes 2024-07-21 14:20:48 +02:00
19 changed files with 103 additions and 59 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[])
{
if ((nbSymbolBits > 16) || (nbSymbolBits < 1)) {
return;
}
std::vector<std::vector<float>> mags = convert_to_snr_gen(params, nbSymbolBits, mags_);
// statistics to decide soft probabilities.
// 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 zoX = 1<<(nbSymbolBits-1);
int zoY = nbSymbolBits;
int *zeroi = new int[zoX*zoY];
int *onei = new int[zoX*zoY];
std::vector<int> zeroi(zoX*zoY);
std::vector<int> onei(zoX*zoY);
for (int biti = 0; biti < nbSymbolBits; biti++)
{

View File

@ -370,9 +370,9 @@ void LDPC::ft8_crc(int msg1[], int msglen, int out[14])
// the new FT8 polynomial for 14-bit CRC, 0x2757,
// with leading 1 bit.
int div[] = {1, 1, 0, 0, 1, 1, 1, 0, 1, 0, 1, 0, 1, 1, 1};
// append 14 zeros.
int *msg = (int *)malloc(sizeof(int) * (msglen + 14));
for (int i = 0; i < msglen + 14; i++)
{
if (i < msglen)
@ -396,7 +396,7 @@ void LDPC::ft8_crc(int msg1[], int msglen, int out[14])
}
}
for (int i = 0; i < 14; i++)
for (int i = 0; i < msglen + 14; i++)
{
out[i] = msg[msglen + i];
}

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

View File

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

View File

@ -77,18 +77,29 @@ public:
template <typename TYPE, typename ALG>
class LDPCDecoder
{
TYPE *bnl, *pty, *inp, *out;
uint16_t *pos;
uint8_t *cnc;
private:
TYPE *bnl = nullptr;
TYPE *pty = nullptr;
TYPE *inp = nullptr;
TYPE *out = nullptr;
uint16_t *pos = nullptr;
uint8_t *cnc = nullptr;
ALG alg;
int M, N, K, R, q, CNL, LT;
bool initialized;
int M = 0;
int N = 0;
int K = 0;
int R = 0;
int q = 0;
int CNL = 0;
int LT = 0;
bool initialized = false;
void reset()
{
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 +118,7 @@ class LDPCDecoder
}
return false;
}
void update(TYPE *data, TYPE *parity)
{
TYPE *bl = bnl;
@ -135,10 +147,12 @@ class LDPCDecoder
}
}
}
public:
LDPCDecoder() : initialized(false)
LDPCDecoder()
{
}
void init(LDPCInterface *it)
{
if (initialized) {

View File

@ -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
nullptr, "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", nullptr, nullptr, nullptr
},
{// Short frames
nullptr, "C1", "C2", "C3", "C4", "C5", "C6", "C7",
"C8", "C9", "C10", nullptr, "C5", "C6", "C7", "C9",
"C10", nullptr, "C6", "C7", "C8", "C9", "C10", nullptr,
"C7", "C8", "C8", "C10", nullptr, nullptr, nullptr, nullptr
}};
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++;

View File

@ -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)

View File

@ -116,7 +116,7 @@
<number>4</number>
</property>
<property name="maximum">
<double>2.000000000000000</double>
<double>10.000000000000000</double>
</property>
<property name="singleStep">
<double>0.000100000000000</double>
@ -125,7 +125,7 @@
<enum>QAbstractSpinBox::DefaultStepType</enum>
</property>
<property name="value">
<double>0.100000000000000</double>
<double>0.500000000000000</double>
</property>
</widget>
</item>
@ -152,13 +152,13 @@
<number>4</number>
</property>
<property name="maximum">
<double>2.000000000000000</double>
<double>10.000000000000000</double>
</property>
<property name="singleStep">
<double>0.000100000000000</double>
</property>
<property name="value">
<double>0.100000000000000</double>
<double>0.500000000000000</double>
</property>
</widget>
</item>
@ -168,13 +168,13 @@
<string>Noise blanking threshold multiplier</string>
</property>
<property name="minimum">
<number>15</number>
<number>2</number>
</property>
<property name="maximum">
<number>500</number>
<number>50</number>
</property>
<property name="value">
<number>30</number>
<number>10</number>
</property>
</widget>
</item>
@ -187,13 +187,13 @@
<number>4</number>
</property>
<property name="maximum">
<double>2.000000000000000</double>
<double>10.000000000000000</double>
</property>
<property name="singleStep">
<double>0.000100000000000</double>
</property>
<property name="value">
<double>0.100000000000000</double>
<double>0.500000000000000</double>
</property>
</widget>
</item>

View File

@ -50,10 +50,10 @@ struct IEEE_802_15_4_MacFrame
uint16_t m_frameControl;
uint8_t m_sequenceNumber;
uint16_t m_destPANID;
uint16_t m_destShortAddress;
uint16_t m_destShortAddress = 0;
ieee_802_15_4_address m_destAddress;
uint16_t m_sourcePANID;
uint16_t m_sourceShortAddress;
uint16_t m_sourceShortAddress = 0;
ieee_802_15_4_address m_sourceAddress;
uint8_t m_payload[IEEE_802_15_4_MAC_PAYLOAD_MAX_LENGTH];
uint8_t m_payloadLength;

View File

@ -14,7 +14,7 @@ except ImportError:
import _thread as thread
import time
from datetime import datetime
from datetime import datetime, timezone
from optparse import OptionParser
import sdrangel
@ -50,7 +50,7 @@ class SuperScannerAPIError(SuperScannerError):
# ======================================================================
def log_with_timestamp(message):
t = datetime.utcnow()
t = datetime.now(timezone.utc)
print(f'{t.isoformat()} {message}')
# ======================================================================

View File

@ -143,7 +143,7 @@ void SigMFFileRecord::setFileName(const QString& fileName)
}
m_initialBytesCount = (uint64_t) m_sampleFile.size();
m_sampleStart = m_initialBytesCount / ((1<<m_log2RecordSampleSize)/4); // sizeof(Sample);
if (!m_metaFile.open(QIODevice::WriteOnly | QIODevice::Append))
{
qWarning() << "SigMFFileRecord::setFileName: failed to open file: " << m_metaFile.fileName();
@ -218,7 +218,7 @@ bool SigMFFileRecord::stopRecording()
{
if (m_recordOn)
{
qDebug("SigMFFileRecord::stopRecording: file previous capture");
qDebug("SigMFFileRecord::stopRecording: file previous capture");
makeCapture();
m_recordOn = false;
if (m_sampleFile.error())

View File

@ -370,7 +370,13 @@ void WFIR::WindowData(double *Data, int N, TWindowType WindowType, double Alpha,
if (WindowType != wtKAISER && WindowType != wtFLATTOP)
{
for (j = M / 2; j < N - M / 2; j++)
{
if (j >= N + 2) {
break;
}
WinCoeff[j] = 1.0;
}
}
// This will set the gain of the window to 1. Only the Flattop window has unity gain by design.

View File

@ -29,8 +29,8 @@ warren@wpratt.com
#include "anb.hpp"
#include "RXA.hpp"
#define MAX_TAU (0.002) // maximum transition time, signal<->zero
#define MAX_ADVTIME (0.002) // maximum deadtime (zero output) in advance of detected noise
#define MAX_TAU (0.01) // maximum transition time, signal<->zero (slew time)
#define MAX_ADVTIME (0.01) // maximum deadtime (zero output) in advance of detected noise
#define MAX_SAMPLERATE (1536000)
namespace WDSP {

View File

@ -117,7 +117,6 @@ void CFCOMP::calc_comp (CFCOMP *a)
a->G[i] = sary[3 * i + 1];
a->E[i] = sary[3 * i + 2];
}
delete[] (sary);
a->fp[0] = 0.0;
a->fp[a->nfreqs + 1] = fmax;
a->gp[0] = a->G[0];

View File

@ -230,7 +230,7 @@ void EMNR::interpM (double* res, double x, int nvals, double* xvals, double* yva
}
else
{
int idx = 0;
int idx = 1;
double xllow, xlhigh, frac;
while ((x >= xvals[idx]) && (idx < nvals - 1))

View File

@ -317,10 +317,15 @@ float *FIR::fir_read (int N, const char *filename, int rtype, float scale)
void FIR::analytic (int N, float* in, float* out)
{
if (N < 1) {
return;
}
int i;
double inv_N = 1.0 / (double) N;
double two_inv_N = 2.0 * inv_N;
float* x = new float[N * 2]; // (float *) malloc0 (N * sizeof (complex));
fftwf_plan pfor = fftwf_plan_dft_1d (
N,
(fftwf_complex *) in,
@ -328,6 +333,7 @@ void FIR::analytic (int N, float* in, float* out)
FFTW_FORWARD,
FFTW_PATIENT
);
fftwf_plan prev = fftwf_plan_dft_1d (
N,
(fftwf_complex *) x,
@ -335,20 +341,24 @@ void FIR::analytic (int N, float* in, float* out)
FFTW_BACKWARD,
FFTW_PATIENT
);
fftwf_execute (pfor);
x[0] *= inv_N;
x[1] *= inv_N;
for (i = 1; i < N / 2; i++)
{
x[2 * i + 0] *= two_inv_N;
x[2 * i + 1] *= two_inv_N;
}
x[N + 0] *= inv_N;
x[N + 1] *= inv_N;
memset (&x[N + 2], 0, (N - 2) * sizeof (float));
fftwf_execute (prev);
fftwf_destroy_plan (prev);
fftwf_destroy_plan (pfor);
delete[] x;
}

View File

@ -27,10 +27,10 @@ warren@wpratt.com
#include "comm.hpp"
#define MAX_ADV_SLEW_TIME (0.002)
#define MAX_ADV_TIME (0.002)
#define MAX_HANG_SLEW_TIME (0.002)
#define MAX_HANG_TIME (0.002)
#define MAX_ADV_SLEW_TIME (0.01) // Slew time
#define MAX_ADV_TIME (0.01) // Lead time
#define MAX_HANG_SLEW_TIME (0.01) // Slew time
#define MAX_HANG_TIME (0.01) // Lag time
#define MAX_SEQ_TIME (0.025)
#define MAX_SAMPLERATE (1536000.0)

View File

@ -60,8 +60,8 @@ void RESAMPLE::calc_resample (RESAMPLE *a)
a->L = a->out_rate / x;
a->M = a->in_rate / x;
a->L <= 0 ? 1 : a->L;
a->M <= 0 ? 1 : a->M;
a->L = a->L <= 0 ? 1 : a->L;
a->M = a->M <= 0 ? 1 : a->M;
if (a->in_rate < a->out_rate)
min_rate = a->in_rate;

View File

@ -64,8 +64,8 @@ RESAMPLEF* RESAMPLEF::create_resampleF ( int run, int size, float* in, float* ou
a->L = out_rate / x;
a->M = in_rate / x;
a->L <= 0 ? 1 : a->L;
a->M <= 0 ? 1 : a->M;
a->L = a->L <= 0 ? 1 : a->L;
a->M = a->M <= 0 ? 1 : a->M;
if (in_rate < out_rate)
min_rate = in_rate;