1
0
mirror of https://github.com/f4exb/sdrangel.git synced 2024-11-22 16:08:39 -05:00

WDSP: use double precision for meter results

This commit is contained in:
f4exb 2024-07-13 03:53:57 +02:00
parent fb08489f5a
commit c99f2e1914
5 changed files with 17 additions and 17 deletions

View File

@ -86,7 +86,7 @@ RXA* RXA::create_rxa (
rxa->inbuff = new float[1 * rxa->dsp_insize * 2]; // (float *) malloc0 (1 * ch.dsp_insize * sizeof (complex)); rxa->inbuff = new float[1 * rxa->dsp_insize * 2]; // (float *) malloc0 (1 * ch.dsp_insize * sizeof (complex));
rxa->outbuff = new float[1 * rxa->dsp_outsize * 2]; // (float *) malloc0 (1 * ch.dsp_outsize * sizeof (complex)); rxa->outbuff = new float[1 * rxa->dsp_outsize * 2]; // (float *) malloc0 (1 * ch.dsp_outsize * sizeof (complex));
rxa->midbuff = new float[2 * rxa->dsp_size * 2]; // (float *) malloc0 (2 * ch.dsp_size * sizeof (complex)); rxa->midbuff = new float[2 * rxa->dsp_size * 2]; // (float *) malloc0 (2 * ch.dsp_size * sizeof (complex));
memset(rxa->meter, 0, sizeof(float)*RXA_METERTYPE_LAST); std::fill(rxa->meter, rxa->meter + RXA_METERTYPE_LAST, 0);
// Noise blanker (ANB or "NB") // Noise blanker (ANB or "NB")
rxa->anb.p = ANB::create_anb( rxa->anb.p = ANB::create_anb(
@ -161,7 +161,7 @@ RXA* RXA::create_rxa (
rxa->pmtupdate, // locks for meter access rxa->pmtupdate, // locks for meter access
RXA_ADC_AV, // index for average value RXA_ADC_AV, // index for average value
RXA_ADC_PK, // index for peak value RXA_ADC_PK, // index for peak value
-1, // index for gain value -1, // index for gain value - disabled
0); // pointer for gain computation 0); // pointer for gain computation
// Notched bandpass section // Notched bandpass section
@ -235,7 +235,7 @@ RXA* RXA::create_rxa (
rxa->pmtupdate, // locks for meter access rxa->pmtupdate, // locks for meter access
RXA_S_AV, // index for average value RXA_S_AV, // index for average value
RXA_S_PK, // index for peak value RXA_S_PK, // index for peak value
-1, // index for gain value -1, // index for gain value - disabled
0); // pointer for gain computation 0); // pointer for gain computation
// AM squelch capture (for other modes than FM) // AM squelch capture (for other modes than FM)

View File

@ -98,7 +98,7 @@ public:
}; };
int mode; int mode;
float meter[RXA_METERTYPE_LAST]; double meter[RXA_METERTYPE_LAST];
QRecursiveMutex *pmtupdate[RXA_METERTYPE_LAST]; QRecursiveMutex *pmtupdate[RXA_METERTYPE_LAST];
struct struct
{ {

View File

@ -127,7 +127,7 @@ public:
int mode; int mode;
float f_low; float f_low;
float f_high; float f_high;
float meter[TXA_METERTYPE_LAST]; double meter[TXA_METERTYPE_LAST];
QRecursiveMutex *pmtupdate[TXA_METERTYPE_LAST]; QRecursiveMutex *pmtupdate[TXA_METERTYPE_LAST];
std::atomic<long> upslew; std::atomic<long> upslew;
struct struct

View File

@ -48,7 +48,7 @@ METER* METER::create_meter (
int rate, int rate,
double tau_av, double tau_av,
double tau_decay, double tau_decay,
float* result, double* result,
QRecursiveMutex** pmtupdate, QRecursiveMutex** pmtupdate,
int enum_av, int enum_av,
int enum_pk, int enum_pk,
@ -119,9 +119,9 @@ void METER::xmeter (METER *a)
} }
else else
{ {
if (a->enum_av >= 0) a->result[a->enum_av] = - 400.0; if (a->enum_av >= 0) a->result[a->enum_av] = -400.0;
if (a->enum_pk >= 0) a->result[a->enum_pk] = - 400.0; if (a->enum_pk >= 0) a->result[a->enum_pk] = -400.0;
if (a->enum_gain >= 0) a->result[a->enum_gain] = + 0.0; if (a->enum_gain >= 0) a->result[a->enum_gain] = 0.0;
} }
a->mtupdate.unlock(); a->mtupdate.unlock();
} }
@ -149,9 +149,9 @@ void METER::setSize_meter (METER *a, int size)
* * * *
********************************************************************************************************/ ********************************************************************************************************/
float METER::GetMeter (RXA& rxa, int mt) double METER::GetMeter (RXA& rxa, int mt)
{ {
float val; double val;
rxa.pmtupdate[mt]->lock(); rxa.pmtupdate[mt]->lock();
val = rxa.meter[mt]; val = rxa.meter[mt];
rxa.pmtupdate[mt]->unlock(); rxa.pmtupdate[mt]->unlock();
@ -164,9 +164,9 @@ float METER::GetMeter (RXA& rxa, int mt)
* * * *
********************************************************************************************************/ ********************************************************************************************************/
float METER::GetMeter (TXA& txa, int mt) double METER::GetMeter (TXA& txa, int mt)
{ {
float val; double val;
txa.pmtupdate[mt]->lock(); txa.pmtupdate[mt]->lock();
val = txa.meter[mt]; val = txa.meter[mt];
txa.pmtupdate[mt]->unlock(); txa.pmtupdate[mt]->unlock();

View File

@ -49,7 +49,7 @@ public:
double tau_peak_decay; double tau_peak_decay;
double mult_average; double mult_average;
double mult_peak; double mult_peak;
float* result; double* result;
int enum_av; int enum_av;
int enum_pk; int enum_pk;
int enum_gain; int enum_gain;
@ -66,7 +66,7 @@ public:
int rate, int rate,
double tau_av, double tau_av,
double tau_decay, double tau_decay,
float* result, double* result,
QRecursiveMutex** pmtupdate, QRecursiveMutex** pmtupdate,
int enum_av, int enum_av,
int enum_pk, int enum_pk,
@ -80,9 +80,9 @@ public:
static void setSamplerate_meter (METER *a, int rate); static void setSamplerate_meter (METER *a, int rate);
static void setSize_meter (METER *a, int size); static void setSize_meter (METER *a, int size);
// RXA Properties // RXA Properties
static float GetMeter (RXA& rxa, int mt); static double GetMeter (RXA& rxa, int mt);
// TXA Properties // TXA Properties
static float GetMeter (TXA& txa, int mt); static double GetMeter (TXA& txa, int mt);
private: private:
static void calc_meter (METER *a); static void calc_meter (METER *a);