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 --- doc/example.ini | 8 ++++++-- src/TII.cpp | 15 ++------------- src/TII.h | 3 +++ 3 files changed, 11 insertions(+), 15 deletions(-) diff --git a/doc/example.ini b/doc/example.ini index d356ee1..ec0525c 100644 --- a/doc/example.ini +++ b/doc/example.ini @@ -318,8 +318,12 @@ offset=0.002 ; DAB modes I and II are supported, and must be set explicitly in ; this file. Reading DAB mode from ETI is not supported. enable=0 -comb=16 -pattern=3 +; comb is also known as sub-identifier. +comb=1 +; pattern is also known as main-identifier. If you run several transmitters +; in SFN, it is better to use the same pattern for all, and vary the comb. +; Otherwise identification of the transmitters may be more difficult. +pattern=11 ; There are two variants of TII being used. The old variant that uses the wrong ; phase on the second carrier in each carrier pairs and is therefore not ; conforming to the specification. Modern analysers can decode both variants, 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