diff options
author | Matthias P. Braendli <matthias.braendli@mpb.li> | 2017-12-21 04:24:24 +0100 |
---|---|---|
committer | Matthias P. Braendli <matthias.braendli@mpb.li> | 2017-12-21 04:24:24 +0100 |
commit | 0cceefe1774263690dce352cf41c3fff3bf85135 (patch) | |
tree | 4b823a452a699e7f692b5c54bd06d3f643a0a29e /src | |
parent | e6ea4d1a11f0ecda6f007a39930302688511632e (diff) | |
download | dabmod-0cceefe1774263690dce352cf41c3fff3bf85135.tar.gz dabmod-0cceefe1774263690dce352cf41c3fff3bf85135.tar.bz2 dabmod-0cceefe1774263690dce352cf41c3fff3bf85135.zip |
Simplify GuardIntervalInserter slightly
Diffstat (limited to 'src')
-rw-r--r-- | src/GuardIntervalInserter.cpp | 26 | ||||
-rw-r--r-- | src/GuardIntervalInserter.h | 18 |
2 files changed, 13 insertions, 31 deletions
diff --git a/src/GuardIntervalInserter.cpp b/src/GuardIntervalInserter.cpp index 80ba900..a2542f7 100644 --- a/src/GuardIntervalInserter.cpp +++ b/src/GuardIntervalInserter.cpp @@ -21,16 +21,12 @@ #include "GuardIntervalInserter.h" #include "PcDebug.h" - - -#include <sys/types.h> #include <string.h> #include <stdexcept> #include <complex> typedef std::complex<float> complexf; - GuardIntervalInserter::GuardIntervalInserter(size_t nbSymbols, size_t spacing, size_t nullSize, @@ -43,19 +39,6 @@ GuardIntervalInserter::GuardIntervalInserter(size_t nbSymbols, { PDEBUG("GuardIntervalInserter::GuardIntervalInserter(%zu, %zu, %zu, %zu)" " @ %p\n", nbSymbols, spacing, nullSize, symSize, this); - - if (d_nullSize) { - myHasNull = true; - } else { - myHasNull = false; - } -} - - -GuardIntervalInserter::~GuardIntervalInserter() -{ - PDEBUG("GuardIntervalInserter::~GuardIntervalInserter() @ %p\n", this); - } @@ -71,7 +54,7 @@ int GuardIntervalInserter::process(Buffer* const dataIn, Buffer* dataOut) complexf* out = reinterpret_cast<complexf*>(dataOut->getData()); size_t sizeIn = dataIn->getLength() / sizeof(complexf); - if (sizeIn != (d_nbSymbols + (myHasNull ? 1 : 0)) * d_spacing) { + if (sizeIn != (d_nbSymbols + (d_nullSize ? 1 : 0)) * d_spacing) { PDEBUG("Nb symbols: %zu\n", d_nbSymbols); PDEBUG("Spacing: %zu\n", d_spacing); PDEBUG("Null size: %zu\n", d_nullSize); @@ -81,8 +64,8 @@ int GuardIntervalInserter::process(Buffer* const dataIn, Buffer* dataOut) "GuardIntervalInserter::process input size not valid!"); } - // Null symbol - if (myHasNull) { + // Handle Null symbol separately because it is longer + if (d_nullSize) { // end - (nullSize - spacing) = 2 * spacing - nullSize memcpy(out, &in[2 * d_spacing - d_nullSize], (d_nullSize - d_spacing) * sizeof(complexf)); @@ -90,9 +73,10 @@ int GuardIntervalInserter::process(Buffer* const dataIn, Buffer* dataOut) in += d_spacing; out += d_nullSize; } + // Data symbols for (size_t i = 0; i < d_nbSymbols; ++i) { - // end - (nullSize - spacing) = 2 * spacing - nullSize + // end - (symSize - spacing) = 2 * spacing - symSize memcpy(out, &in[2 * d_spacing - d_symSize], (d_symSize - d_spacing) * sizeof(complexf)); memcpy(&out[d_symSize - d_spacing], in, d_spacing * sizeof(complexf)); diff --git a/src/GuardIntervalInserter.h b/src/GuardIntervalInserter.h index 70a8fcd..e6b3b64 100644 --- a/src/GuardIntervalInserter.h +++ b/src/GuardIntervalInserter.h @@ -25,20 +25,19 @@ # include <config.h> #endif - #include "ModPlugin.h" +#include <stdint.h> -#include <sys/types.h> - - +/* The GuardIntervalInserter prepends the cyclic prefix to all + * symbols in the transmission frame. */ class GuardIntervalInserter : public ModCodec { public: - GuardIntervalInserter(size_t nbSymbols, size_t spacing, size_t nullSize, size_t symSize); - virtual ~GuardIntervalInserter(); - GuardIntervalInserter(const GuardIntervalInserter&); - GuardIntervalInserter& operator=(const GuardIntervalInserter&); - + GuardIntervalInserter( + size_t nbSymbols, + size_t spacing, + size_t nullSize, + size_t symSize); int process(Buffer* const dataIn, Buffer* dataOut); const char* name() { return "GuardIntervalInserter"; } @@ -48,6 +47,5 @@ protected: size_t d_spacing; size_t d_nullSize; size_t d_symSize; - bool myHasNull; }; |