aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--src/OfdmGenerator.cpp6
-rw-r--r--src/TII.cpp15
2 files changed, 18 insertions, 3 deletions
diff --git a/src/OfdmGenerator.cpp b/src/OfdmGenerator.cpp
index 57e0e0e..26ad7a4 100644
--- a/src/OfdmGenerator.cpp
+++ b/src/OfdmGenerator.cpp
@@ -207,12 +207,18 @@ int OfdmGenerator::process(Buffer* const dataIn, Buffer* dataOut)
myFftIn[0][0] = 0;
myFftIn[0][1] = 0;
+ /* For TM I this is:
+ * ZeroDst=769 ZeroSize=511
+ * PosSrc=0 PosDst=1 PosSize=768
+ * NegSrc=768 NegDst=1280 NegSize=768
+ */
memset(&myFftIn[myZeroDst], 0, myZeroSize * sizeof(FFT_TYPE));
memcpy(&myFftIn[myPosDst], &in[myPosSrc],
myPosSize * sizeof(FFT_TYPE));
memcpy(&myFftIn[myNegDst], &in[myNegSrc],
myNegSize * sizeof(FFT_TYPE));
+
if (myCfr) {
reference.resize(mySpacing);
memcpy(reference.data(), myFftIn, mySpacing * sizeof(FFT_TYPE));
diff --git a/src/TII.cpp b/src/TII.cpp
index 09a4920..a9eee16 100644
--- a/src/TII.cpp
+++ b/src/TII.cpp
@@ -230,8 +230,16 @@ int TII::process(Buffer* dataIn, Buffer* dataOut)
return 1;
}
-void TII::enable_carrier(int k) {
- int ix = m_carriers/2 + k;
+void TII::enable_carrier(int k)
+{
+ /* The OFDMGenerator shifts all positive frequencies by one,
+ * i.e. index 0 is not the DC component, it's the first positive
+ * frequency. Because this is different from the definition of k
+ * from the spec, we need to compensate this here.
+ *
+ * Positive frequencies are k > 0
+ */
+ int ix = m_carriers/2 + k + (k>=0 ? -1 : 0);
if (ix < 0 or ix+1 >= (ssize_t)m_Acp.size()) {
throw TIIError("TII::enable_carrier invalid k!");
@@ -240,7 +248,8 @@ void TII::enable_carrier(int k) {
m_Acp[ix] = true;
}
-void TII::prepare_pattern() {
+void TII::prepare_pattern()
+{
int comb = m_conf.comb; // Convert from unsigned to signed
std::lock_guard<std::mutex> lock(m_enabled_carriers_mutex);