1
0
mirror of https://github.com/JvanKatwijk/qt-dab.git synced 2025-10-06 00:02:40 +02:00

typos in rtlsdr-win and sdrplay-v3

This commit is contained in:
Jan
2025-09-13 19:46:04 +02:00
parent b0416c45d4
commit 0ca039f40e
9 changed files with 58 additions and 34 deletions

View File

@@ -92,9 +92,11 @@
// teller = 0;
// totalErrorLines = 0;
// totalRepairs = 0;
stopWorking. store (false);
}
mp4Processor::~mp4Processor () {
stop ();
}
/**
* \brief addtoFrame
@@ -111,6 +113,9 @@ int16_t nbits = 24 * bitRate;
int16_t nbytes = nbits / 8;
uint8_t temp = 0;
if (stopWorking)
return;
locker. lock ();
for (int i = 0; i < nbytes; i ++) { // in bytes
temp = 0;
for (int j = 0; j < 8; j ++)
@@ -125,8 +130,10 @@ uint8_t temp = 0;
/**
* we take the last five blocks to look at
*/
if (blocksInBuffer < 5)
if (blocksInBuffer < 5) {
locker. unlock ();
return;
}
//
// The buffer is filled enough, let's process
/// first, we show the number of successful frames
@@ -140,12 +147,14 @@ uint8_t temp = 0;
// do not need to apply a RS before testing
if (!fc. checkAndCorrect (&frameBytes [blockFillIndex * nbytes])) {
blocksInBuffer = 4;
locker. unlock ();
return;
}
//
if (!handleRS (frameBytes. data (), blockFillIndex * nbytes,
outVector, frameErrors, rsErrors)) {
blocksInBuffer = 4;
locker. unlock ();
return;
}
@@ -156,6 +165,7 @@ uint8_t temp = 0;
successFrames = 0;
rsErrors = 0;
} // end of ... >= 5
locker. unlock ();
}
//
// when handling a superframe we want to be sure that the fc is correct
@@ -409,5 +419,8 @@ uint8_t buffer [count];
}
void mp4Processor::stop () {
stopWorking. store (true);
locker. lock ();
locker. unlock ();
}

View File

@@ -67,7 +67,10 @@ private:
#else
faadDecoder aacDecoder;
#endif
firecodeChecker fc;
std::atomic<bool> stopWorking;
std::mutex locker;
bool handleRS (const uint8_t *frameBytes,
int16_t base,
std::vector<uint8_t> &outVector,
@@ -103,7 +106,6 @@ private:
std::vector<uint8_t> outVector;
int16_t RSDims;
int16_t au_start [10];
firecodeChecker fc;
signals:
void show_frameErrors (int);
void show_rsErrors (int);

View File

@@ -29,7 +29,6 @@
// Driver program for the selected backend. Embodying that in a
// separate class makes the "Backend" class simpler.
static bool running = false;
backendDriver::backendDriver (RadioInterface *mr,
logger *theLogger,
@@ -73,25 +72,26 @@ static bool running = false;
}
else
theProcessor. reset (new frameProcessor ()); // should not happen
running = true;
running. store (true);;
}
backendDriver::~backendDriver() {
running = false;
running. store (false);
theProcessor. reset ();
}
//
void backendDriver::addtoFrame (const std::vector<uint8_t> &theData) {
if (running)
if (running. load ())
theProcessor -> addtoFrame (theData);
}
//
// Note that asking the processor to stop is - if configured -
// in a different thread.
void backendDriver::stop () {
running = false;
running. store (false);
theProcessor -> stop ();
theProcessor. reset ();
}

View File

@@ -46,6 +46,7 @@ public:
void addtoFrame (const std::vector<uint8_t> &outData);
void stop ();
private:
std::atomic<bool> running;
logger *theLogger;
QScopedPointer<frameProcessor> theProcessor;
};

View File

@@ -105,10 +105,7 @@
if (!running. load () &&
!this -> isRunning ())
return;
running. store (false);
driver. stop ();
while (this -> isRunning())
usleep (1000);
stopRunning ();
#endif
}
@@ -116,7 +113,7 @@ int32_t Backend::process (int16_t *softBits, int16_t cnt) {
(void)cnt;
#ifdef __THREADED_BACKEND__
while (!freeSlots. tryAcquire (1, 200))
if (!running. load ())
if (!running. load ())
return 0;
memcpy (theData [nextIn]. data (), softBits,
fragmentSize * sizeof (int16_t));
@@ -153,33 +150,37 @@ void Backend::processSegment (int16_t *softBits_in) {
// and the energy dispersal
for (uint16_t i = 0; i < bitRate * 24; i ++)
hardBits [i] ^= disperseVector [i];
locker. lock ();
driver. addtoFrame (hardBits);
locker. unlock ();
#ifdef __THREADED_BACKEND__
if (running. load ())
#endif
driver. addtoFrame (hardBits);
}
#ifdef __THREADED_BACKEND__
void Backend::run() {
while (running. load()) {
while (!usedSlots. tryAcquire (1, 200))
void Backend::run () {
while (running. load ()) {
while (!usedSlots. tryAcquire (1, 200)) {
if (!running. load ()) {
return;
}
processSegment (theData [nextOut]. data());
}
locker. lock ();
if (running. load ())
processSegment (theData [nextOut]. data());
locker. unlock ();
}
}
#endif
// It might take a msec for the task to stop
void Backend::stopRunning() {
void Backend::stopRunning () {
#ifdef __THREADED_BACKEND__
// we want to be certain that after calling the "stop" the
// backend interpreter does not start with processing new data
locker. lock ();
driver. stop ();
locker. unlock ();
running. store (false);
while (this -> isRunning())
locker. unlock ();
while (!this -> isFinished ())
usleep (1000);
#endif
}

View File

@@ -28,7 +28,7 @@
#include "rtl-sdr.h"
#include "xml-filewriter.h"
#include "device-exceptions.h"
#include "logger.h"
#include "errorlog.h"
#include "settings-handler.h"
#define CORRF 0.005
@@ -306,6 +306,7 @@ void rtlsdrHandler_win::set_ExternalGain (const QString &gain) {
QString t = QString ("cannot set gain to ") + gain;
theErrorLogger -> add ("RTLSDR", t);
}
}
//
void rtlsdrHandler_win::set_autogain (int dummy) {
(void)dummy;

View File

@@ -941,7 +941,7 @@ ULONG APIkeyValue_length = 255;
"failed to locate API registry entry, error = %d\n",
(int)GetLastError());
theErrorLogger -> add (recorderVersion,
errorMessage ((int)GetLastError ()));
errorMessage ((int)GetLastError ()). c_str ());
}
else {
RegQueryValueEx (APIkey,

View File

@@ -33,6 +33,7 @@
#include "freq-interleaver.h"
#include "dab-params.h"
#include "dab-constants.h"
#include <math.h>
/**
* \brief ofdmDecoder
* The class ofdmDecoder is
@@ -40,6 +41,7 @@
* will extract the Tu samples, do an FFT and extract the
* carriers and map them on (soft) bits
*/
#define ALPHA 0.01f
static inline
Complex normalize (const Complex &V) {
@@ -230,6 +232,7 @@ float sum = 0;
normalize (conj (phaseReference [index]));
conjVector [index] = fftBin;
DABFLOAT binAbsLevel = jan_abs (fftBin);
Complex prevBin = phaseReference [index];
//
// updates
@@ -259,7 +262,8 @@ float sum = 0;
if (this -> decoder == DECODER_1) {
DABFLOAT corrector =
1.5 * meanLevelVector [index] / sigmaSQ_Vector [index];
corrector /= (1 / snr + 2);
corrector /= (1 / snr + 1);
// corrector /= (1 / snr + 2);
Complex R1 = corrector * normalize (fftBin) *
(DABFLOAT)(sqrt (jan_abs (fftBin) *
sqrt (jan_abs (phaseReference [index]))));
@@ -294,9 +298,11 @@ float sum = 0;
sum += jan_abs (R1);
}
else {
softbits [i] = - real (fftBin) / binAbsLevel * MAX_VITERBI;
softbits [i] = - real (fftBin) / binAbsLevel *
1.5 * MAX_VITERBI;
softbits [carriers + i]
= - imag (fftBin) / binAbsLevel * MAX_VITERBI;
= - imag (fftBin) / binAbsLevel *
1.5 * MAX_VITERBI;
}
}
meanValue = compute_avg (meanValue, sum /carriers, 0.1);

View File

@@ -56,8 +56,8 @@ public:
equalizer () {
I_avg = 1.0f; // meanII
Q_avg = 1.0;
IQ_avg = 0.0f; // meanIQ
Q_out = 0.1f; // meanQQ
IQ_avg = 1.0f; // meanIQ
Q_out = 1.0f; // meanQQ
Alpha_ = 1.0 / 2048000.0;
}
~equalizer () {}