summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--doc/example.ini10
-rw-r--r--src/ConfigParser.cpp2
-rw-r--r--src/ConfigParser.h1
-rw-r--r--src/DabMod.cpp2
-rw-r--r--src/DabModulator.cpp6
-rw-r--r--src/DabModulator.h4
-rw-r--r--src/GainControl.cpp5
-rw-r--r--src/GainControl.h3
8 files changed, 24 insertions, 9 deletions
diff --git a/doc/example.ini b/doc/example.ini
index 36a6c2f..0659813 100644
--- a/doc/example.ini
+++ b/doc/example.ini
@@ -83,14 +83,18 @@ loop=0
; for some power amplifier. The output samples are limited to a magnitude
; of 32768.
;
-; Mode 'var' uses the method specified in ETSI 300 798. This method
+; Mode 'var' uses the method specified in ETSI 300 798 Clause 5.3. This method
; normalizes to 4 times the standard deviation for an approximation of the RMS
; power. So around 6/100000 samples will be truncated and will introduce some
; really minor distortion. But this mode also maximizes the output power. This
; is the gain mode recommended for real world operation as it is based on a DAB
-; standard; the only difference is that ODR-DabMod uses a better resolution
-; with 16 bits instead of 8 bits.
+; standard; the only difference is that ODR-DabMod internally calculates this with
+; 32-bit floats instead of 8 bits.
gainmode=var
+;
+; In mode var, you can choose to normalise the samples to something else than
+; 4 times the standard deviation.
+;normalise_variance=4
; Transmission mode
; If not defined, take the mode from ETI
diff --git a/src/ConfigParser.cpp b/src/ConfigParser.cpp
index a1e6e34..393f58a 100644
--- a/src/ConfigParser.cpp
+++ b/src/ConfigParser.cpp
@@ -154,6 +154,8 @@ static void parse_configfile(
// modulator parameters:
const string gainMode_setting = pt.get("modulator.gainmode", "var");
mod_settings.gainMode = parse_gainmode(gainMode_setting);
+ mod_settings.gainmodeVariance = pt.get("modulator.normalise_variance",
+ mod_settings.gainmodeVariance);
mod_settings.dabMode = pt.get("modulator.mode", mod_settings.dabMode);
mod_settings.clockRate = pt.get("modulator.dac_clk_rate", (size_t)0);
diff --git a/src/ConfigParser.h b/src/ConfigParser.h
index fe48f01..02b798a 100644
--- a/src/ConfigParser.h
+++ b/src/ConfigParser.h
@@ -58,6 +58,7 @@ struct mod_settings_t {
float digitalgain = 1.0f;
float normalise = 1.0f;
GainMode gainMode = GainMode::GAIN_VAR;
+ float gainmodeVariance = 4.0f;
// To handle the timestamp offset of the modulator
unsigned tist_delay_stages = 0;
diff --git a/src/DabMod.cpp b/src/DabMod.cpp
index 7fc395e..301b078 100644
--- a/src/DabMod.cpp
+++ b/src/DabMod.cpp
@@ -307,6 +307,7 @@ int launch_modulator(int argc, char* argv[])
mod_settings.gainMode,
mod_settings.digitalgain,
mod_settings.normalise,
+ mod_settings.gainmodeVariance,
mod_settings.filterTapsFilename);
if (format_converter) {
@@ -410,6 +411,7 @@ int launch_modulator(int argc, char* argv[])
mod_settings.gainMode,
mod_settings.digitalgain,
mod_settings.normalise,
+ mod_settings.gainmodeVariance,
mod_settings.filterTapsFilename);
if (format_converter) {
diff --git a/src/DabModulator.cpp b/src/DabModulator.cpp
index 678d175..c41b8fc 100644
--- a/src/DabModulator.cpp
+++ b/src/DabModulator.cpp
@@ -3,7 +3,7 @@
Her Majesty the Queen in Right of Canada (Communications Research
Center Canada)
- Copyright (C) 2016
+ Copyright (C) 2017
Matthias P. Braendli, matthias.braendli@mpb.li
http://opendigitalradio.org
@@ -60,6 +60,7 @@ DabModulator::DabModulator(
unsigned outputRate, unsigned clockRate,
unsigned dabMode, GainMode gainMode,
float& digGain, float normalise,
+ float gainmodeVariance,
const std::string& filterTapsFilename
) :
ModInput(),
@@ -69,6 +70,7 @@ DabModulator::DabModulator(
myGainMode(gainMode),
myDigGain(digGain),
myNormalise(normalise),
+ myGainmodeVariance(gainmodeVariance),
myEtiSource(etiSource),
myFlowgraph(NULL),
myFilterTapsFilename(filterTapsFilename),
@@ -201,7 +203,7 @@ int DabModulator::process(Buffer* dataOut)
(1 + myNbSymbols), myNbCarriers, mySpacing);
auto cifGain = make_shared<GainControl>(
- mySpacing, myGainMode, myDigGain, myNormalise);
+ mySpacing, myGainMode, myDigGain, myNormalise, myGainmodeVariance);
rcs.enrol(cifGain.get());
diff --git a/src/DabModulator.h b/src/DabModulator.h
index d768875..c9bdbe1 100644
--- a/src/DabModulator.h
+++ b/src/DabModulator.h
@@ -3,7 +3,7 @@
Her Majesty the Queen in Right of Canada (Communications Research
Center Canada)
- Copyright (C) 2016
+ Copyright (C) 2017
Matthias P. Braendli, matthias.braendli@mpb.li
http://opendigitalradio.org
@@ -54,6 +54,7 @@ public:
unsigned outputRate, unsigned clockRate,
unsigned dabMode, GainMode gainMode,
float& digGain, float normalise,
+ float gainmodeVariance,
const std::string& filterTapsFilename);
DabModulator(const DabModulator& other) = delete;
DabModulator& operator=(const DabModulator& other) = delete;
@@ -74,6 +75,7 @@ protected:
GainMode myGainMode;
float& myDigGain;
float myNormalise;
+ float myGainmodeVariance;
EtiSource& myEtiSource;
Flowgraph* myFlowgraph;
OutputMemory* myOutput;
diff --git a/src/GainControl.cpp b/src/GainControl.cpp
index 81ae06e..9eb1678 100644
--- a/src/GainControl.cpp
+++ b/src/GainControl.cpp
@@ -48,7 +48,8 @@ static float var_variance;
GainControl::GainControl(size_t framesize,
GainMode mode,
float& digGain,
- float normalise) :
+ float normalise,
+ float varVariance) :
PipelinedModCodec(),
RemoteControllable("gain"),
#ifdef __SSE__
@@ -58,7 +59,7 @@ GainControl::GainControl(size_t framesize,
#endif
m_digGain(digGain),
m_normalise(normalise),
- m_var_variance_rc(4.0f),
+ m_var_variance_rc(varVariance),
m_gainmode(mode),
m_mutex()
{
diff --git a/src/GainControl.h b/src/GainControl.h
index 8935fc3..e8f1be9 100644
--- a/src/GainControl.h
+++ b/src/GainControl.h
@@ -53,7 +53,8 @@ class GainControl : public PipelinedModCodec, public RemoteControllable
GainControl(size_t framesize,
GainMode mode,
float& digGain,
- float normalise);
+ float normalise,
+ float varVariance);
virtual ~GainControl();
GainControl(const GainControl&);