summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorMatthias P. Braendli <matthias.braendli@mpb.li>2017-12-24 04:06:10 +0100
committerMatthias P. Braendli <matthias.braendli@mpb.li>2017-12-24 04:06:10 +0100
commit626cfba78e2885200450ff8b4f4cf09ff6d0b830 (patch)
tree8c99d6ec4af5dbd68b3e0ab27700562227b47b1b /src
parent215e8143e3feefd69a76d0b6eaf36ed42a7a904f (diff)
downloaddabmod-626cfba78e2885200450ff8b4f4cf09ff6d0b830.tar.gz
dabmod-626cfba78e2885200450ff8b4f4cf09ff6d0b830.tar.bz2
dabmod-626cfba78e2885200450ff8b4f4cf09ff6d0b830.zip
Fix TII insertion for positive frequency carriers
Diffstat (limited to 'src')
-rw-r--r--src/TII.cpp15
-rw-r--r--src/TII.h3
2 files changed, 5 insertions, 13 deletions
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<complexf*>(dataIn->getData());
complexf* out = reinterpret_cast<complexf*>(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<bool> m_enabled_carriers;
};