diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/DabModulator.cpp | 6 | ||||
-rw-r--r-- | src/EtiReader.cpp | 3 | ||||
-rw-r--r-- | src/FrameMultiplexer.cpp | 12 | ||||
-rw-r--r-- | src/FrameMultiplexer.h | 16 | ||||
-rw-r--r-- | src/SubchannelSource.cpp | 18 | ||||
-rw-r--r-- | src/SubchannelSource.h | 18 |
6 files changed, 41 insertions, 32 deletions
diff --git a/src/DabModulator.cpp b/src/DabModulator.cpp index f63ecd7..6c28a2e 100644 --- a/src/DabModulator.cpp +++ b/src/DabModulator.cpp @@ -157,7 +157,7 @@ int DabModulator::process(Buffer* const dataIn, Buffer* dataOut) //////////////////////////////////////////////////////////////// auto cifPrbs = make_shared<PrbsGenerator>(864 * 8, 0x110); auto cifMux = make_shared<FrameMultiplexer>( - myFicSizeOut + 864 * 8, &myEtiReader.getSubchannels()); + myFicSizeOut + 864 * 8, myEtiReader.getSubchannels()); auto cifPart = make_shared<BlockPartitioner>(mode, myEtiReader.getFp()); @@ -269,9 +269,7 @@ int DabModulator::process(Buffer* const dataIn, Buffer* dataOut) //////////////////////////////////////////////////////////////// // Configuring subchannels //////////////////////////////////////////////////////////////// - std::vector<shared_ptr<SubchannelSource> > subchannels = - myEtiReader.getSubchannels(); - for (const auto& subchannel : subchannels) { + for (const auto& subchannel : myEtiReader.getSubchannels()) { //////////////////////////////////////////////////////////// // Data initialisation diff --git a/src/EtiReader.cpp b/src/EtiReader.cpp index e841f03..010124c 100644 --- a/src/EtiReader.cpp +++ b/src/EtiReader.cpp @@ -173,7 +173,8 @@ int EtiReader::process(const Buffer* dataIn) mySources.clear(); for (unsigned i = 0; i < eti_fc.NST; ++i) { - mySources.push_back(make_shared<SubchannelSource>(eti_stc[i])); + mySources.push_back( + make_shared<SubchannelSource>(eti_stc[i])); PDEBUG("Sstc %u:\n", i); PDEBUG(" Stc%i.scid: %i\n", i, eti_stc[i].SCID); PDEBUG(" Stc%i.sad: %u\n", i, eti_stc[i].getStartAddress()); diff --git a/src/FrameMultiplexer.cpp b/src/FrameMultiplexer.cpp index 0bea1d1..c8ee299 100644 --- a/src/FrameMultiplexer.cpp +++ b/src/FrameMultiplexer.cpp @@ -1,6 +1,11 @@ /* Copyright (C) 2005, 2006, 2007, 2008, 2009, 2010, 2011 Her Majesty the Queen in Right of Canada (Communications Research Center Canada) + + Copyright (C) 2016 + Matthias P. Braendli, matthias.braendli@mpb.li + + http://opendigitalradio.org */ /* This file is part of ODR-DabMod. @@ -33,7 +38,7 @@ typedef std::complex<float> complexf; FrameMultiplexer::FrameMultiplexer( size_t framesize, - const std::vector<std::shared_ptr<SubchannelSource> >* subchannels) : + const std::vector<std::shared_ptr<SubchannelSource> >& subchannels) : ModMux(), d_frameSize(framesize), mySubchannels(subchannels) @@ -77,12 +82,11 @@ int FrameMultiplexer::process(std::vector<Buffer*> dataIn, Buffer* dataOut) memcpy(out, (*in)->getData(), (*in)->getLength()); ++in; // Write subchannel - if (mySubchannels->size() != dataIn.size() - 1) { + if (mySubchannels.size() != dataIn.size() - 1) { throw std::out_of_range( "FrameMultiplexer detected subchannel size change!"); } - std::vector<std::shared_ptr<SubchannelSource> >::const_iterator subchannel = - mySubchannels->begin(); + auto subchannel = mySubchannels.begin(); while (in != dataIn.end()) { if ((*subchannel)->framesizeCu() * 8 != (*in)->getLength()) { throw std::out_of_range( diff --git a/src/FrameMultiplexer.h b/src/FrameMultiplexer.h index b1dd971..e01f4bf 100644 --- a/src/FrameMultiplexer.h +++ b/src/FrameMultiplexer.h @@ -1,6 +1,11 @@ /* Copyright (C) 2005, 2006, 2007, 2008, 2009, 2010, 2011 Her Majesty the Queen in Right of Canada (Communications Research Center Canada) + + Copyright (C) 2016 + Matthias P. Braendli, matthias.braendli@mpb.li + + http://opendigitalradio.org */ /* This file is part of ODR-DabMod. @@ -36,11 +41,12 @@ class FrameMultiplexer : public ModMux { public: - FrameMultiplexer(size_t frameSize, - const std::vector<std::shared_ptr<SubchannelSource> >* subchannels); + FrameMultiplexer( + size_t frameSize, + const std::vector<std::shared_ptr<SubchannelSource> >& subchannels); virtual ~FrameMultiplexer(); - FrameMultiplexer(const FrameMultiplexer&); - FrameMultiplexer& operator=(const FrameMultiplexer&); + FrameMultiplexer(const FrameMultiplexer&) = delete; + FrameMultiplexer& operator=(const FrameMultiplexer&) = delete; int process(std::vector<Buffer*> dataIn, Buffer* dataOut); @@ -48,7 +54,7 @@ public: protected: size_t d_frameSize; - const std::vector<std::shared_ptr<SubchannelSource> >* mySubchannels; + const std::vector<std::shared_ptr<SubchannelSource> >& mySubchannels; }; diff --git a/src/SubchannelSource.cpp b/src/SubchannelSource.cpp index f4b6b55..7632de5 100644 --- a/src/SubchannelSource.cpp +++ b/src/SubchannelSource.cpp @@ -59,7 +59,7 @@ #define P24 0xffffffff -const std::vector<PuncturingRule>& SubchannelSource::get_rules() +const std::vector<PuncturingRule>& SubchannelSource::get_rules() const { return d_puncturing_rules; } @@ -635,18 +635,18 @@ SubchannelSource::SubchannelSource(eti_STC &stc) : } } -size_t SubchannelSource::startAddress() +size_t SubchannelSource::startAddress() const { return d_start_address; } -size_t SubchannelSource::framesize() +size_t SubchannelSource::framesize() const { return d_framesize; } -size_t SubchannelSource::framesizeCu() +size_t SubchannelSource::framesizeCu() const { size_t framesizeCu = 0; @@ -1003,25 +1003,25 @@ size_t SubchannelSource::framesizeCu() } -size_t SubchannelSource::bitrate() +size_t SubchannelSource::bitrate() const { return d_framesize / 3; } -size_t SubchannelSource::protection() +size_t SubchannelSource::protection() const { return d_protection; } -size_t SubchannelSource::protectionForm() +size_t SubchannelSource::protectionForm() const { return (d_protection >> 5) & 1; } -size_t SubchannelSource::protectionLevel() +size_t SubchannelSource::protectionLevel() const { if (protectionForm()) { // Long form return (d_protection & 0x3) + 1; @@ -1030,7 +1030,7 @@ size_t SubchannelSource::protectionLevel() } -size_t SubchannelSource::protectionOption() +size_t SubchannelSource::protectionOption() const { if (protectionForm()) { // Long form return (d_protection >> 2) & 0x7; diff --git a/src/SubchannelSource.h b/src/SubchannelSource.h index f2f261b..a38c281 100644 --- a/src/SubchannelSource.h +++ b/src/SubchannelSource.h @@ -43,15 +43,15 @@ class SubchannelSource : public ModInput public: SubchannelSource(eti_STC &stc); - size_t startAddress(); - size_t framesize(); - size_t framesizeCu(); - size_t bitrate(); - size_t protection(); - size_t protectionForm(); - size_t protectionLevel(); - size_t protectionOption(); - const std::vector<PuncturingRule>& get_rules(); + size_t startAddress() const; + size_t framesize() const; + size_t framesizeCu() const; + size_t bitrate() const; + size_t protection() const; + size_t protectionForm() const; + size_t protectionLevel() const; + size_t protectionOption() const; + const std::vector<PuncturingRule>& get_rules() const; void loadSubchannelData(const Buffer& data); int process(Buffer* outputData); |