aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/GainControl.cpp23
-rw-r--r--src/GainControl.h1
-rw-r--r--src/TII.cpp9
3 files changed, 21 insertions, 12 deletions
diff --git a/src/GainControl.cpp b/src/GainControl.cpp
index c111de3..d90da45 100644
--- a/src/GainControl.cpp
+++ b/src/GainControl.cpp
@@ -127,21 +127,25 @@ int GainControl::internal_process(Buffer* const dataIn, Buffer* dataOut)
if ((sizeIn % m_frameSize) != 0) {
PDEBUG("%zu != %zu\n", sizeIn, m_frameSize);
- throw std::runtime_error(
- "GainControl::process input size not valid!");
+ throw std::runtime_error("GainControl::process input size not valid!");
}
const auto constantGain4 = _mm_set1_ps(constantGain);
for (size_t i = 0; i < sizeIn; i += m_frameSize) {
- gain128.m = computeGain(in, m_frameSize);
+ // Do not apply gain computation to the NULL symbol, which either
+ // is blank or contains TII. Apply the gain calculation from the next
+ // symbol on the NULL symbol to get consistent TII power.
+ if (i > 0) {
+ gain128.m = computeGain(in, m_frameSize);
+ }
+ else {
+ gain128.m = computeGain(in + m_frameSize, m_frameSize);
+ }
gain128.m = _mm_mul_ps(gain128.m, constantGain4);
PDEBUG("********** Gain: %10f **********\n", gain128.f[0]);
- ////////////////////////////////////////////////////////////////////////
- // Applying gain to output data
- ////////////////////////////////////////////////////////////////////////
for (size_t sample = 0; sample < m_frameSize; ++sample) {
out[sample] = _mm_mul_ps(in[sample], gain128.m);
}
@@ -163,7 +167,12 @@ int GainControl::internal_process(Buffer* const dataIn, Buffer* dataOut)
}
for (size_t i = 0; i < sizeIn; i += m_frameSize) {
- gain = constantGain * computeGain(in, m_frameSize);
+ // Do not apply gain computation to the NULL symbol, which either
+ // is blank or contains TII. Apply the gain calculation from the next
+ // symbol on the NULL symbol to get consistent TII power.
+ gain = constantGain * (i > 0 ?
+ computeGain(in, m_frameSize) :
+ computeGain(in + m_frameSize, m_frameSize));
PDEBUG("********** Gain: %10f **********\n", gain);
diff --git a/src/GainControl.h b/src/GainControl.h
index f0fd6b6..f024fa2 100644
--- a/src/GainControl.h
+++ b/src/GainControl.h
@@ -38,6 +38,7 @@
#include <complex>
#include <string>
#include <mutex>
+
#ifdef __SSE__
# include <xmmintrin.h>
#endif
diff --git a/src/TII.cpp b/src/TII.cpp
index 2d7429f..b329cdb 100644
--- a/src/TII.cpp
+++ b/src/TII.cpp
@@ -189,8 +189,6 @@ int TII::process(Buffer* dataIn, Buffer* dataOut)
complexf* in = reinterpret_cast<complexf*>(dataIn->getData());
complexf* out = reinterpret_cast<complexf*>(dataOut->getData());
- constexpr float normalisation = 0.144337f; // 1/sqrt(48);
-
/* Normalise the TII carrier power according to ETSI TR 101 496-3
* Clause 5.4.2.2 Paragraph 7:
*
@@ -198,7 +196,8 @@ int TII::process(Buffer* dataIn, Buffer* dataOut)
* > is 1:48 for all Modes, so that the signal power in a TII symbol is
* > 16 dB below the signal power of the other symbols.
*
- * Divide by sqrt(48) because I and Q are separately normalised.
+ * This is because we only enable 32 out of 1536 carriers, not because
+ * every carrier is lower power.
*/
for (size_t i = 0; i < m_Acp.size(); i++) {
/* See header file for an explanation of the old variant.
@@ -219,8 +218,8 @@ int TII::process(Buffer* dataIn, Buffer* dataOut)
* and fuse the two conditionals together:
*/
if (m_Acp[i]) {
- out[i] = in[i] * normalisation;
- out[i+1] = (m_conf.old_variant ? in[i+1] : in[i]) * normalisation;
+ out[i] = in[i];
+ out[i+1] = (m_conf.old_variant ? in[i+1] : in[i]);
}
}
}