From 5dc40e77349e450299d3d7e3228023761840cbc3 Mon Sep 17 00:00:00 2001 From: Sergiy G Date: Tue, 31 Oct 2017 13:38:00 +0200 Subject: Attenuate TII by 16dB as requested by spec --- src/TII.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'src') diff --git a/src/TII.cpp b/src/TII.cpp index 8a8bd86..4ed1a91 100644 --- a/src/TII.cpp +++ b/src/TII.cpp @@ -202,11 +202,11 @@ int TII::process(Buffer* dataIn, Buffer* dataOut) // setting exactly the same phase of the signal for lower adjacent // frequency if (m_enabled_carriers[i]) { - out[i] = m_conf.old_variant ? in[i+1] : in[i]; + out[i] = (m_conf.old_variant ? in[i+1] : in[i])/((float)48.0); } if (m_enabled_carriers[i+1]) { - out[i+1] = in[i+1]; + out[i+1] = in[i+1]/((float)48.0); } } } -- cgit v1.2.3 From d4bb768d0b84f2369bcc22b7846a917717adb353 Mon Sep 17 00:00:00 2001 From: "Matthias P. Braendli" Date: Fri, 10 Nov 2017 09:26:28 +0100 Subject: Fix FIRFilter use-after-free on teardown --- src/FIRFilter.h | 1 + 1 file changed, 1 insertion(+) (limited to 'src') diff --git a/src/FIRFilter.h b/src/FIRFilter.h index fb6b4d6..a63bfb9 100644 --- a/src/FIRFilter.h +++ b/src/FIRFilter.h @@ -53,6 +53,7 @@ class FIRFilter : public PipelinedModCodec, public RemoteControllable { public: FIRFilter(const std::string& taps_file); + virtual ~FIRFilter() = default; const char* name() { return "FIRFilter"; } -- cgit v1.2.3 From a3a56518db976400e87d102a6c9c73ee1f375f07 Mon Sep 17 00:00:00 2001 From: "Matthias P. Braendli" Date: Fri, 10 Nov 2017 09:27:26 +0100 Subject: Avoid invalid warning about timestamp irregularity --- src/TimestampDecoder.h | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) (limited to 'src') diff --git a/src/TimestampDecoder.h b/src/TimestampDecoder.h index e0dee2a..943b241 100644 --- a/src/TimestampDecoder.h +++ b/src/TimestampDecoder.h @@ -69,7 +69,7 @@ struct frame_timestamp this->timestamp_sec += lrintf(offset_secs); this->timestamp_pps += lrintf(offset_pps * 16384000.0); - while (this->timestamp_pps > 16384000) + while (this->timestamp_pps >= 16384000) { this->timestamp_pps -= 16384000; this->timestamp_sec += 1; @@ -216,4 +216,3 @@ class TimestampDecoder : public RemoteControllable }; - -- cgit v1.2.3 From 42dfe5fa6d74068f92a443b6dbcce2472f7c124b Mon Sep 17 00:00:00 2001 From: "Matthias P. Braendli" Date: Fri, 3 Nov 2017 15:02:40 +0100 Subject: Do not setenv TZ twice (cherry picked from commit 34afa3a0632817c30e4e5427ee67138d59c4ede3) --- src/DabMod.cpp | 4 ---- 1 file changed, 4 deletions(-) (limited to 'src') diff --git a/src/DabMod.cpp b/src/DabMod.cpp index 2caba5d..af3adde 100644 --- a/src/DabMod.cpp +++ b/src/DabMod.cpp @@ -258,10 +258,6 @@ int launch_modulator(int argc, char* argv[]) return EXIT_FAILURE; } - // Set timezone to UTC - setenv("TZ", "", 1); - tzset(); - mod_settings_t mod_settings; parse_args(argc, argv, mod_settings); -- cgit v1.2.3 From cc7d726ac3fb3683999f01f2881b6931e645c4d6 Mon Sep 17 00:00:00 2001 From: "Matthias P. Braendli" Date: Sat, 18 Nov 2017 03:20:36 +0100 Subject: Correct TII power --- src/TII.cpp | 24 +++++++++++++++++++----- 1 file changed, 19 insertions(+), 5 deletions(-) (limited to 'src') diff --git a/src/TII.cpp b/src/TII.cpp index 4ed1a91..4710ed4 100644 --- a/src/TII.cpp +++ b/src/TII.cpp @@ -197,16 +197,30 @@ 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: + * + * > The ratio of carriers in a TII symbol to a normal DAB symbol + * > 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. + * + * We need to normalise to the square root of 48 because we touch I and + * Q separately. + */ + const float normalise_factor = 0.14433756729740644112f; // = 1/sqrt(48) + for (size_t i = 0; i < m_enabled_carriers.size(); i+=2) { - //BAD implementation: - // setting exactly the same phase of the signal for lower adjacent - // frequency + // See header file for an explanation of the old variant if (m_enabled_carriers[i]) { - out[i] = (m_conf.old_variant ? in[i+1] : in[i])/((float)48.0); + out[i] = normalise_factor * (m_conf.old_variant ? in[i+1] : in[i]); } if (m_enabled_carriers[i+1]) { - out[i+1] = in[i+1]/((float)48.0); + out[i+1] = normalise_factor * in[i+1]; } } } -- cgit v1.2.3