diff options
author | andreas128 <Andreas> | 2017-06-07 21:11:20 +0100 |
---|---|---|
committer | andreas128 <Andreas> | 2017-06-07 21:11:20 +0100 |
commit | e37567081d00778aea70ab42ad294679dff328be (patch) | |
tree | c2dfbfb8f6f0a9cd942a28713cf850fcf62a8984 /src/DabModulator.cpp | |
parent | 02aa4b6c14506b72eb2fe9d3f4e99b751e2e91c8 (diff) | |
parent | 418eb33d0948bb12b7b2ed2179d43ad66258aa72 (diff) | |
download | dabmod-e37567081d00778aea70ab42ad294679dff328be.tar.gz dabmod-e37567081d00778aea70ab42ad294679dff328be.tar.bz2 dabmod-e37567081d00778aea70ab42ad294679dff328be.zip |
Merge branch 'next_memless' into next
Diffstat (limited to 'src/DabModulator.cpp')
-rw-r--r-- | src/DabModulator.cpp | 52 |
1 files changed, 40 insertions, 12 deletions
diff --git a/src/DabModulator.cpp b/src/DabModulator.cpp index c41b8fc..4e0bc33 100644 --- a/src/DabModulator.cpp +++ b/src/DabModulator.cpp @@ -47,6 +47,7 @@ #include "Resampler.h" #include "ConvEncoder.h" #include "FIRFilter.h" +#include "MemlessPoly.h" #include "TII.h" #include "PuncturingEncoder.h" #include "TimeInterleaver.h" @@ -61,7 +62,8 @@ DabModulator::DabModulator( unsigned dabMode, GainMode gainMode, float& digGain, float normalise, float gainmodeVariance, - const std::string& filterTapsFilename + const std::string& filterTapsFilename, + const std::string& polyCoefFilename ) : ModInput(), myOutputRate(outputRate), @@ -74,6 +76,7 @@ DabModulator::DabModulator( myEtiSource(etiSource), myFlowgraph(NULL), myFilterTapsFilename(filterTapsFilename), + myPolyCoefFilename(polyCoefFilename), myTiiConfig(tiiConfig) { PDEBUG("DabModulator::DabModulator(%u, %u, %u, %zu) @ %p\n", @@ -203,7 +206,8 @@ int DabModulator::process(Buffer* dataOut) (1 + myNbSymbols), myNbCarriers, mySpacing); auto cifGain = make_shared<GainControl>( - mySpacing, myGainMode, myDigGain, myNormalise, myGainmodeVariance); + mySpacing, myGainMode, myDigGain, myNormalise, + myGainmodeVariance); rcs.enrol(cifGain.get()); @@ -215,6 +219,19 @@ int DabModulator::process(Buffer* dataOut) cifFilter = make_shared<FIRFilter>(myFilterTapsFilename); rcs.enrol(cifFilter.get()); } + + shared_ptr<MemlessPoly> cifPoly; + if (not myPolyCoefFilename.empty()) { + cifPoly = make_shared<MemlessPoly>(myPolyCoefFilename); + etiLog.level(debug) << myPolyCoefFilename << "\n"; + etiLog.level(debug) << cifPoly->m_coefs[0] << " " << + cifPoly->m_coefs[1] << " "<< cifPoly->m_coefs[2] << " "<< + cifPoly->m_coefs[3] << " "<< cifPoly->m_coefs[4] << " "<< + cifPoly->m_coefs[5] << " "<< cifPoly->m_coefs[6] << " "<< + cifPoly->m_coefs[7] << "\n"; + rcs.enrol(cifPoly.get()); + } + auto myOutput = make_shared<OutputMemory>(dataOut); shared_ptr<Resampler> cifRes; @@ -306,7 +323,8 @@ int DabModulator::process(Buffer* dataOut) auto subchConv = make_shared<ConvEncoder>(subchSizeIn); // Configuring puncturing encoder - auto subchPunc = make_shared<PuncturingEncoder>(subchannel->framesizeCu()); + auto subchPunc = + make_shared<PuncturingEncoder>(subchannel->framesizeCu()); for (const auto& rule : subchannel->get_rules()) { PDEBUG(" Adding rule:\n"); @@ -342,34 +360,44 @@ int DabModulator::process(Buffer* dataOut) if (useCicEq) { myFlowgraph->connect(cifSig, cifCicEq); myFlowgraph->connect(cifCicEq, cifOfdm); - } else { + } + else { myFlowgraph->connect(cifSig, cifOfdm); } myFlowgraph->connect(cifOfdm, cifGain); myFlowgraph->connect(cifGain, cifGuard); + auto cifOut = cifPoly ? + static_pointer_cast<ModPlugin>(cifPoly) : + static_pointer_cast<ModPlugin>(myOutput); + if (cifFilter) { myFlowgraph->connect(cifGuard, cifFilter); if (cifRes) { myFlowgraph->connect(cifFilter, cifRes); - myFlowgraph->connect(cifRes, myOutput); - } else { - myFlowgraph->connect(cifFilter, myOutput); + myFlowgraph->connect(cifRes, cifOut); + } + else { + myFlowgraph->connect(cifFilter, cifOut); } } - else { //no filtering + else { if (cifRes) { myFlowgraph->connect(cifGuard, cifRes); - myFlowgraph->connect(cifRes, myOutput); - } else { - myFlowgraph->connect(cifGuard, myOutput); + myFlowgraph->connect(cifRes, cifOut); } + else { + myFlowgraph->connect(cifGuard, cifOut); + } + } + if (cifPoly) { + myFlowgraph->connect(cifPoly, myOutput); } } //////////////////////////////////////////////////////////////////// - // Proccessing data + // Processing data //////////////////////////////////////////////////////////////////// return myFlowgraph->run(); } |