summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMatthias P. Braendli <matthias.braendli@mpb.li>2018-01-28 07:19:54 +0100
committerMatthias P. Braendli <matthias.braendli@mpb.li>2018-01-28 07:19:54 +0100
commita1995ea7ffd6783a8445e72f12fcc92d09287c2b (patch)
tree301a50e2a6bfbfee546fb3467f2d5f701e462e2d
parentaddfba670d14c837084894f8cc5a64f47f296051 (diff)
downloaddabmod-a1995ea7ffd6783a8445e72f12fcc92d09287c2b.tar.gz
dabmod-a1995ea7ffd6783a8445e72f12fcc92d09287c2b.tar.bz2
dabmod-a1995ea7ffd6783a8445e72f12fcc92d09287c2b.zip
Make blocks assume FP is 0 at initialisation
-rw-r--r--src/BlockPartitioner.cpp27
-rw-r--r--src/BlockPartitioner.h8
-rw-r--r--src/DabModulator.cpp5
-rw-r--r--src/TII.cpp14
-rw-r--r--src/TII.h6
5 files changed, 14 insertions, 46 deletions
diff --git a/src/BlockPartitioner.cpp b/src/BlockPartitioner.cpp
index 5767650..fbb130e 100644
--- a/src/BlockPartitioner.cpp
+++ b/src/BlockPartitioner.cpp
@@ -34,8 +34,7 @@
#include <stdint.h>
#include <assert.h>
-
-BlockPartitioner::BlockPartitioner(unsigned mode, unsigned phase) :
+BlockPartitioner::BlockPartitioner(unsigned mode) :
ModMux(),
ModMetadata(),
d_mode(mode)
@@ -72,14 +71,8 @@ BlockPartitioner::BlockPartitioner(unsigned mode, unsigned phase) :
"BlockPartitioner::BlockPartitioner invalid mode");
break;
}
- d_cifNb = 0;
- // For Synchronisation purpose, count nb of CIF to drop
- d_cifPhase = phase % d_cifCount;
- d_metaPhase = phase % d_cifCount;
- d_cifSize = 864 * 8;
}
-
// dataIn[0] -> FIC
// dataIn[1] -> CIF
int BlockPartitioner::process(std::vector<Buffer*> dataIn, Buffer* dataOut)
@@ -111,15 +104,6 @@ int BlockPartitioner::process(std::vector<Buffer*> dataIn, Buffer* dataOut)
"BlockPartitioner::process input 1 size not valid!");
}
- // Synchronize CIF phase
- if (d_cifPhase != 0) {
- if (++d_cifPhase == d_cifCount) {
- d_cifPhase = 0;
- }
- // Drop CIF
- return 0;
- }
-
uint8_t* fic = reinterpret_cast<uint8_t*>(dataIn[0]->getData());
uint8_t* cif = reinterpret_cast<uint8_t*>(dataIn[1]->getData());
uint8_t* out = reinterpret_cast<uint8_t*>(dataOut->getData());
@@ -141,15 +125,6 @@ int BlockPartitioner::process(std::vector<Buffer*> dataIn, Buffer* dataOut)
meta_vec_t BlockPartitioner::process_metadata(const meta_vec_t& metadataIn)
{
- // Synchronize CIF phase
- if (d_metaPhase != 0) {
- if (++d_metaPhase == d_cifCount) {
- d_metaPhase = 0;
- }
- // Drop this metadata
- return {};
- }
-
if (d_cifNb == 1) {
d_meta.clear();
}
diff --git a/src/BlockPartitioner.h b/src/BlockPartitioner.h
index a4656a1..bbdeb16 100644
--- a/src/BlockPartitioner.h
+++ b/src/BlockPartitioner.h
@@ -37,7 +37,7 @@
class BlockPartitioner : public ModMux, public ModMetadata
{
public:
- BlockPartitioner(unsigned mode, unsigned phase);
+ BlockPartitioner(unsigned mode);
int process(std::vector<Buffer*> dataIn, Buffer* dataOut);
const char* name() { return "BlockPartitioner"; }
@@ -49,10 +49,8 @@ protected:
int d_mode;
size_t d_ficSize;
size_t d_cifCount;
- size_t d_cifNb;
- size_t d_cifPhase;
- size_t d_metaPhase;
- size_t d_cifSize;
+ size_t d_cifNb = 0;
+ const size_t d_cifSize = 864 * 8;
size_t d_outputFramesize;
size_t d_outputFramecount;
diff --git a/src/DabModulator.cpp b/src/DabModulator.cpp
index 2f547b4..4655b82 100644
--- a/src/DabModulator.cpp
+++ b/src/DabModulator.cpp
@@ -135,7 +135,7 @@ int DabModulator::process(Buffer* dataOut)
////////////////////////////////////////////////////////////////
auto cifPrbs = make_shared<PrbsGenerator>(864 * 8, 0x110);
auto cifMux = make_shared<FrameMultiplexer>(myEtiSource);
- auto cifPart = make_shared<BlockPartitioner>(mode, myEtiSource.getFp());
+ auto cifPart = make_shared<BlockPartitioner>(mode);
auto cifMap = make_shared<QpskSymbolMapper>(myNbCarriers);
auto cifRef = make_shared<PhaseReference>(mode);
@@ -175,8 +175,7 @@ int DabModulator::process(Buffer* dataOut)
try {
tii = make_shared<TII>(
m_settings.dabMode,
- m_settings.tiiConfig,
- myEtiSource.getFp());
+ m_settings.tiiConfig);
rcs.enrol(tii.get());
tiiRef = make_shared<PhaseReference>(mode);
}
diff --git a/src/TII.cpp b/src/TII.cpp
index 3c5823b..8ec4c35 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, unsigned phase) :
+TII::TII(unsigned int dabmode, const tii_config_t& tii_config) :
ModCodec(),
RemoteControllable("tii"),
m_dabmode(dabmode),
@@ -122,7 +122,6 @@ TII::TII(unsigned int dabmode, const tii_config_t& tii_config, unsigned phase) :
switch (m_dabmode) {
case 1:
m_carriers = 1536;
- m_insert = (phase & 0x40) ? false : true;
if (not(0 <= m_conf.pattern and m_conf.pattern <= 69) ) {
throw TIIError("TII::TII pattern not valid!");
@@ -130,7 +129,6 @@ TII::TII(unsigned int dabmode, const tii_config_t& tii_config, unsigned phase) :
break;
case 2:
m_carriers = 384;
- m_insert = (phase & 0x01) ? false : true;
if (not(0 <= m_conf.pattern and m_conf.pattern <= 69) ) {
throw TIIError("TII::TII pattern not valid!");
@@ -198,16 +196,14 @@ int TII::process(Buffer* dataIn, Buffer* dataOut)
* > is 1:48 for all Modes, so that the signal power in a TII symbol is
* > 16 dB below the signal power of the other symbols.
*
- * We need to normalise to the square root of 48 because we touch I and
- * Q separately.
+ * This is because we only enable 32 out of 1536 carriers, not because
+ * every carrier is lower power.
*/
- const float normalise_factor = 0.14433756729740644112f; // = 1/sqrt(48)
-
for (size_t i = 0; i < m_enabled_carriers.size(); i++) {
// See header file for an explanation of the old variant
if (m_enabled_carriers[i]) {
- out[i] = normalise_factor * (m_conf.old_variant ? in[i+1] : in[i]);
- out[i+1] = normalise_factor * in[i+1];
+ out[i] = (m_conf.old_variant ? in[i+1] : in[i]);
+ out[i+1] = in[i+1];
}
}
}
diff --git a/src/TII.h b/src/TII.h
index b86dbbf..9a34288 100644
--- a/src/TII.h
+++ b/src/TII.h
@@ -83,7 +83,7 @@ class TIIError : public std::runtime_error {
class TII : public ModCodec, public RemoteControllable
{
public:
- TII(unsigned int dabmode, const tii_config_t& tii_config, unsigned phase);
+ TII(unsigned int dabmode, const tii_config_t& tii_config);
int process(Buffer* dataIn, Buffer* dataOut);
const char* name();
@@ -110,9 +110,9 @@ class TII : public ModCodec, public RemoteControllable
tii_config_t m_conf;
// Internal flag when to insert TII
- bool m_insert;
+ bool m_insert = true;
- size_t m_carriers;
+ size_t m_carriers = 0;
std::string m_name;