From 626cfba78e2885200450ff8b4f4cf09ff6d0b830 Mon Sep 17 00:00:00 2001 From: "Matthias P. Braendli" Date: Sun, 24 Dec 2017 04:06:10 +0100 Subject: Fix TII insertion for positive frequency carriers --- src/TII.cpp | 15 ++------------- src/TII.h | 3 +++ 2 files changed, 5 insertions(+), 13 deletions(-) (limited to 'src') diff --git a/src/TII.cpp b/src/TII.cpp index af64c9f..446d9c6 100644 --- a/src/TII.cpp +++ b/src/TII.cpp @@ -197,10 +197,6 @@ int TII::process(Buffer* dataIn, Buffer* dataOut) complexf* in = reinterpret_cast(dataIn->getData()); complexf* out = reinterpret_cast(dataOut->getData()); - if ((m_enabled_carriers.size() % 2) != 0) { - throw std::logic_error("odd number of enabled carriers"); - } - /* Normalise the TII carrier power according to ETSI TR 101 496-3 * Clause 5.4.2.2 Paragraph 7: * @@ -213,13 +209,10 @@ int TII::process(Buffer* dataIn, Buffer* dataOut) */ const float normalise_factor = 0.14433756729740644112f; // = 1/sqrt(48) - for (size_t i = 0; i < m_enabled_carriers.size(); i+=2) { + for (size_t i = 0; i < m_enabled_carriers.size(); i++) { // See header file for an explanation of the old variant if (m_enabled_carriers[i]) { out[i] = normalise_factor * (m_conf.old_variant ? in[i+1] : in[i]); - } - - if (m_enabled_carriers[i+1]) { out[i+1] = normalise_factor * in[i+1]; } } @@ -239,10 +232,6 @@ void TII::enable_carrier(int k) { } m_enabled_carriers[ix] = true; - // NULL frequency is never enabled. - if (ix > 1 and (ix-1 != 768)) { - m_enabled_carriers[ix-1] = true; - } } void TII::prepare_pattern() { @@ -287,7 +276,7 @@ void TII::prepare_pattern() { } } - for (int k = 384; k <= 768; k++) { + for (int k = 385; k <= 768; k++) { for (int b = 0; b < 8; b++) { if ( k == 385 + 2 * comb + 48 * b and pattern_tm1_2_4[m_conf.pattern][b]) { diff --git a/src/TII.h b/src/TII.h index fe67978..4c5c605 100644 --- a/src/TII.h +++ b/src/TII.h @@ -122,6 +122,9 @@ class TII : public ModCodec, public RemoteControllable // m_enabled_carriers is read by modulator thread, and written // to by RC thread. mutable boost::mutex m_enabled_carriers_mutex; + + // m_enabled_carriers is true only for the first carrier in the + // active pair std::vector m_enabled_carriers; }; -- cgit v1.2.3