aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMatthias P. Braendli <matthias.braendli@mpb.li>2018-08-07 11:29:47 +0200
committerMatthias P. Braendli <matthias.braendli@mpb.li>2018-08-07 11:29:47 +0200
commitb6e9577aaed919975f32ee1a5a9821668089f2db (patch)
tree18d3c0ebdc5db92a7caa5931c8171787932f333c
parente68fa7c6cb9a718ec16cf849e5885e1ca9b3cf3d (diff)
downloaddabmod-b6e9577aaed919975f32ee1a5a9821668089f2db.tar.gz
dabmod-b6e9577aaed919975f32ee1a5a9821668089f2db.tar.bz2
dabmod-b6e9577aaed919975f32ee1a5a9821668089f2db.zip
Keep RC-modified settings across modulator restarts
-rw-r--r--src/ConfigParser.h2
-rw-r--r--src/DabModulator.cpp2
-rw-r--r--src/DabModulator.h4
-rw-r--r--src/FIRFilter.cpp2
-rw-r--r--src/FIRFilter.h4
-rw-r--r--src/GainControl.cpp6
-rw-r--r--src/GainControl.h10
-rw-r--r--src/GuardIntervalInserter.cpp4
-rw-r--r--src/GuardIntervalInserter.h4
-rw-r--r--src/MemlessPoly.cpp2
-rw-r--r--src/MemlessPoly.h4
-rw-r--r--src/OfdmGenerator.cpp9
-rw-r--r--src/OfdmGenerator.h12
-rw-r--r--src/TII.cpp2
-rw-r--r--src/TII.h4
15 files changed, 35 insertions, 36 deletions
diff --git a/src/ConfigParser.h b/src/ConfigParser.h
index 51afbc2..ee961fa 100644
--- a/src/ConfigParser.h
+++ b/src/ConfigParser.h
@@ -80,7 +80,7 @@ struct mod_settings_t {
float cfrErrorClip = 1.0f;
// Settings for the OFDM windowing
- unsigned ofdmWindowOverlap = 0;
+ size_t ofdmWindowOverlap = 0;
#if defined(HAVE_OUTPUT_UHD) || defined(HAVE_SOAPYSDR)
Output::SDRDeviceConfig sdr_device_config;
diff --git a/src/DabModulator.cpp b/src/DabModulator.cpp
index 62f98bf..ca958e3 100644
--- a/src/DabModulator.cpp
+++ b/src/DabModulator.cpp
@@ -59,7 +59,7 @@
#include "Log.h"
DabModulator::DabModulator(EtiSource& etiSource,
- const mod_settings_t& settings) :
+ mod_settings_t& settings) :
ModInput(),
m_settings(settings),
myEtiSource(etiSource),
diff --git a/src/DabModulator.h b/src/DabModulator.h
index e84ce96..355eeb3 100644
--- a/src/DabModulator.h
+++ b/src/DabModulator.h
@@ -50,7 +50,7 @@ class DabModulator : public ModInput, public ModMetadata
{
public:
DabModulator(EtiSource& etiSource,
- const mod_settings_t& settings);
+ mod_settings_t& settings);
int process(Buffer* dataOut);
const char* name() { return "DabModulator"; }
@@ -64,7 +64,7 @@ public:
protected:
void setMode(unsigned mode);
- const mod_settings_t& m_settings;
+ mod_settings_t& m_settings;
EtiSource& myEtiSource;
std::shared_ptr<Flowgraph> myFlowgraph;
diff --git a/src/FIRFilter.cpp b/src/FIRFilter.cpp
index 740d8ed..8b6fe58 100644
--- a/src/FIRFilter.cpp
+++ b/src/FIRFilter.cpp
@@ -71,7 +71,7 @@ static const std::array<float, 45> default_filter_taps({
-0.00110450468492});
-FIRFilter::FIRFilter(const std::string& taps_file) :
+FIRFilter::FIRFilter(std::string& taps_file) :
PipelinedModCodec(),
RemoteControllable("firfilter"),
m_taps_file(taps_file)
diff --git a/src/FIRFilter.h b/src/FIRFilter.h
index e03321a..8d2e707 100644
--- a/src/FIRFilter.h
+++ b/src/FIRFilter.h
@@ -51,7 +51,7 @@ typedef std::complex<float> complexf;
class FIRFilter : public PipelinedModCodec, public RemoteControllable
{
public:
- FIRFilter(const std::string& taps_file);
+ FIRFilter(std::string& taps_file);
FIRFilter(const FIRFilter& other) = delete;
FIRFilter& operator=(const FIRFilter& other) = delete;
virtual ~FIRFilter();
@@ -69,7 +69,7 @@ protected:
virtual int internal_process(Buffer* const dataIn, Buffer* dataOut) override;
void load_filter_taps(const std::string &tapsFile);
- std::string m_taps_file;
+ std::string& m_taps_file;
mutable std::mutex m_taps_mutex;
std::vector<float> m_taps;
diff --git a/src/GainControl.cpp b/src/GainControl.cpp
index 07660ff..9cde8b1 100644
--- a/src/GainControl.cpp
+++ b/src/GainControl.cpp
@@ -46,10 +46,10 @@ using namespace std;
static float var_variance;
GainControl::GainControl(size_t framesize,
- GainMode gainMode,
- float digGain,
+ GainMode& gainMode,
+ float& digGain,
float normalise,
- float varVariance) :
+ float& varVariance) :
PipelinedModCodec(),
RemoteControllable("gain"),
#ifdef __SSE__
diff --git a/src/GainControl.h b/src/GainControl.h
index b4579cd..e8965e9 100644
--- a/src/GainControl.h
+++ b/src/GainControl.h
@@ -51,10 +51,10 @@ class GainControl : public PipelinedModCodec, public RemoteControllable
{
public:
GainControl(size_t framesize,
- GainMode gainMode,
- float digGain,
+ GainMode& gainMode,
+ float& digGain,
float normalise,
- float varVariance);
+ float& varVariance);
virtual ~GainControl();
GainControl(const GainControl&) = delete;
@@ -80,8 +80,8 @@ class GainControl : public PipelinedModCodec, public RemoteControllable
float m_normalise;
// The following variables are accessed from the RC thread
- float m_var_variance_rc;
- GainMode m_gainmode;
+ float& m_var_variance_rc;
+ GainMode& m_gainmode;
mutable std::mutex m_mutex;
#ifdef __SSE__
diff --git a/src/GuardIntervalInserter.cpp b/src/GuardIntervalInserter.cpp
index 79692f5..6e1df4f 100644
--- a/src/GuardIntervalInserter.cpp
+++ b/src/GuardIntervalInserter.cpp
@@ -38,14 +38,14 @@ GuardIntervalInserter::GuardIntervalInserter(
size_t spacing,
size_t nullSize,
size_t symSize,
- size_t windowOverlap) :
+ size_t& windowOverlap) :
ModCodec(),
RemoteControllable("guardinterval"),
d_nbSymbols(nbSymbols),
d_spacing(spacing),
d_nullSize(nullSize),
d_symSize(symSize),
- d_windowOverlap(0)
+ d_windowOverlap(windowOverlap)
{
if (d_nullSize == 0) {
throw std::logic_error("NULL symbol must be present");
diff --git a/src/GuardIntervalInserter.h b/src/GuardIntervalInserter.h
index 7714c1a..02ba72c 100644
--- a/src/GuardIntervalInserter.h
+++ b/src/GuardIntervalInserter.h
@@ -50,7 +50,7 @@ class GuardIntervalInserter : public ModCodec, public RemoteControllable
size_t spacing,
size_t nullSize,
size_t symSize,
- size_t windowOverlap = 0);
+ size_t& windowOverlap);
int process(Buffer* const dataIn, Buffer* dataOut);
const char* name() { return "GuardIntervalInserter"; }
@@ -71,7 +71,7 @@ class GuardIntervalInserter : public ModCodec, public RemoteControllable
size_t d_symSize;
mutable std::mutex d_windowMutex;
- size_t d_windowOverlap;
+ size_t& d_windowOverlap;
std::vector<float> d_window;
};
diff --git a/src/MemlessPoly.cpp b/src/MemlessPoly.cpp
index c017fab..07e4c1a 100644
--- a/src/MemlessPoly.cpp
+++ b/src/MemlessPoly.cpp
@@ -51,7 +51,7 @@ using namespace std;
// Number of AM/AM coefs, identical to number of AM/PM coefs
#define NUM_COEFS 5
-MemlessPoly::MemlessPoly(const std::string& coefs_file, unsigned int num_threads) :
+MemlessPoly::MemlessPoly(std::string& coefs_file, unsigned int num_threads) :
PipelinedModCodec(),
RemoteControllable("memlesspoly"),
m_coefs_am(),
diff --git a/src/MemlessPoly.h b/src/MemlessPoly.h
index c9d4f56..43fdb2d 100644
--- a/src/MemlessPoly.h
+++ b/src/MemlessPoly.h
@@ -58,7 +58,7 @@ enum class dpd_type_t {
class MemlessPoly : public PipelinedModCodec, public RemoteControllable
{
public:
- MemlessPoly(const std::string& coefs_file, unsigned int num_threads);
+ MemlessPoly(std::string& coefs_file, unsigned int num_threads);
MemlessPoly(const MemlessPoly& other) = delete;
MemlessPoly& operator=(const MemlessPoly& other) = delete;
virtual ~MemlessPoly();
@@ -136,7 +136,7 @@ private:
static constexpr size_t lut_entries = 32;
std::array<complexf, lut_entries> m_lut; // Lookup table correction factors
- std::string m_coefs_file;
+ std::string& m_coefs_file;
mutable std::mutex m_coefs_mutex;
};
diff --git a/src/OfdmGenerator.cpp b/src/OfdmGenerator.cpp
index 9a824ec..d9c3608 100644
--- a/src/OfdmGenerator.cpp
+++ b/src/OfdmGenerator.cpp
@@ -40,9 +40,9 @@ static const size_t MAX_CLIP_STATS = 10;
OfdmGenerator::OfdmGenerator(size_t nbSymbols,
size_t nbCarriers,
size_t spacing,
- bool enableCfr,
- float cfrClip,
- float cfrErrorClip,
+ bool& enableCfr,
+ float& cfrClip,
+ float& cfrErrorClip,
bool inverse) :
ModCodec(), RemoteControllable("ofdm"),
myFftPlan(nullptr),
@@ -197,10 +197,9 @@ int OfdmGenerator::process(Buffer* const dataIn, Buffer* dataOut)
// The PAPRStats' clear() is not threadsafe, do not access it
// from the RC functions.
- if (myPaprClearRequest.load()) {
+ if (myPaprClearRequest.exchange(false)) {
myPaprBeforeCFR.clear();
myPaprAfterCFR.clear();
- myPaprClearRequest.store(false);
}
for (size_t i = 0; i < myNbSymbols; ++i) {
diff --git a/src/OfdmGenerator.h b/src/OfdmGenerator.h
index cccccf5..30fdff4 100644
--- a/src/OfdmGenerator.h
+++ b/src/OfdmGenerator.h
@@ -47,9 +47,9 @@ class OfdmGenerator : public ModCodec, public RemoteControllable
OfdmGenerator(size_t nbSymbols,
size_t nbCarriers,
size_t spacing,
- bool enableCfr,
- float cfrClip,
- float cfrErrorClip,
+ bool& enableCfr,
+ float& cfrClip,
+ float& cfrErrorClip,
bool inverse = true);
virtual ~OfdmGenerator();
OfdmGenerator(const OfdmGenerator&) = delete;
@@ -91,10 +91,10 @@ class OfdmGenerator : public ModCodec, public RemoteControllable
unsigned myZeroDst;
unsigned myZeroSize;
- bool myCfr; // Whether to enable crest factor reduction
+ bool& myCfr; // Whether to enable crest factor reduction
mutable std::mutex myCfrRcMutex;
- float myCfrClip;
- float myCfrErrorClip;
+ float& myCfrClip;
+ float& myCfrErrorClip;
fftwf_plan myCfrFft;
fftwf_complex *myCfrPostClip;
fftwf_complex *myCfrPostFft;
diff --git a/src/TII.cpp b/src/TII.cpp
index a9eee16..904f3ff 100644
--- a/src/TII.cpp
+++ b/src/TII.cpp
@@ -106,7 +106,7 @@ const int pattern_tm1_2_4[][8] = { // {{{
{1,1,1,0,1,0,0,0},
{1,1,1,1,0,0,0,0} }; // }}}
-TII::TII(unsigned int dabmode, const tii_config_t& tii_config) :
+TII::TII(unsigned int dabmode, tii_config_t& tii_config) :
ModCodec(),
RemoteControllable("tii"),
m_dabmode(dabmode),
diff --git a/src/TII.h b/src/TII.h
index 2ad4004..d8c785d 100644
--- a/src/TII.h
+++ b/src/TII.h
@@ -81,7 +81,7 @@ class TIIError : public std::runtime_error {
class TII : public ModCodec, public RemoteControllable
{
public:
- TII(unsigned int dabmode, const tii_config_t& tii_config);
+ TII(unsigned int dabmode, tii_config_t& tii_config);
int process(Buffer* dataIn, Buffer* dataOut);
const char* name();
@@ -105,7 +105,7 @@ class TII : public ModCodec, public RemoteControllable
unsigned int m_dabmode;
// Remote-controllable settings
- tii_config_t m_conf;
+ tii_config_t& m_conf;
// Internal flag when to insert TII
bool m_insert = true;