summaryrefslogtreecommitdiffstats
path: root/src/GuardIntervalInserter.cpp
diff options
context:
space:
mode:
authorMatthias P. Braendli <matthias.braendli@mpb.li>2017-12-21 04:24:24 +0100
committerMatthias P. Braendli <matthias.braendli@mpb.li>2017-12-21 04:24:24 +0100
commit0cceefe1774263690dce352cf41c3fff3bf85135 (patch)
tree4b823a452a699e7f692b5c54bd06d3f643a0a29e /src/GuardIntervalInserter.cpp
parente6ea4d1a11f0ecda6f007a39930302688511632e (diff)
downloaddabmod-0cceefe1774263690dce352cf41c3fff3bf85135.tar.gz
dabmod-0cceefe1774263690dce352cf41c3fff3bf85135.tar.bz2
dabmod-0cceefe1774263690dce352cf41c3fff3bf85135.zip
Simplify GuardIntervalInserter slightly
Diffstat (limited to 'src/GuardIntervalInserter.cpp')
-rw-r--r--src/GuardIntervalInserter.cpp26
1 files changed, 5 insertions, 21 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));