diff options
author | Matthias P. Braendli <matthias.braendli@mpb.li> | 2018-01-07 11:11:12 +0100 |
---|---|---|
committer | Matthias P. Braendli <matthias.braendli@mpb.li> | 2018-01-07 11:11:12 +0100 |
commit | 1e76247e059021ea52309ebd258b6eed033d6aee (patch) | |
tree | 29ef4aa7ae5826050fb4a36dce947e24977366f9 | |
parent | 39a70386994b1ab8876bd020d3755ce609903c48 (diff) | |
download | dabmod-1e76247e059021ea52309ebd258b6eed033d6aee.tar.gz dabmod-1e76247e059021ea52309ebd258b6eed033d6aee.tar.bz2 dabmod-1e76247e059021ea52309ebd258b6eed033d6aee.zip |
Remove calculateTimestamp
-rw-r--r-- | src/ConfigParser.h | 1 | ||||
-rw-r--r-- | src/DabMod.cpp | 38 | ||||
-rw-r--r-- | src/EtiReader.cpp | 20 | ||||
-rw-r--r-- | src/EtiReader.h | 11 | ||||
-rw-r--r-- | src/OutputFile.cpp | 10 | ||||
-rw-r--r-- | src/OutputFile.h | 5 | ||||
-rw-r--r-- | src/TimestampDecoder.cpp | 70 | ||||
-rw-r--r-- | src/TimestampDecoder.h | 19 | ||||
-rw-r--r-- | src/output/SDR.cpp | 5 | ||||
-rw-r--r-- | src/output/SDR.h | 3 |
10 files changed, 12 insertions, 170 deletions
diff --git a/src/ConfigParser.h b/src/ConfigParser.h index 3f64883..0463470 100644 --- a/src/ConfigParser.h +++ b/src/ConfigParser.h @@ -58,7 +58,6 @@ struct mod_settings_t { float gainmodeVariance = 4.0f; // To handle the timestamp offset of the modulator - unsigned tist_delay_stages = 1; // because GainControl is pipelined double tist_offset_s = 0.0; bool loop = false; diff --git a/src/DabMod.cpp b/src/DabMod.cpp index 9880938..31fa76d 100644 --- a/src/DabMod.cpp +++ b/src/DabMod.cpp @@ -269,12 +269,6 @@ int launch_modulator(int argc, char* argv[]) throw std::runtime_error("Configuration error"); } - // When using the FIRFilter, increase the modulator offset pipelining delay - // by the correct amount - if (not mod_settings.filterTapsFilename.empty()) { - mod_settings.tist_delay_stages += FIRFILTER_PIPELINE_DELAY; - } - printModSettings(mod_settings); modulator_data m; @@ -295,7 +289,7 @@ int launch_modulator(int argc, char* argv[]) set_thread_name("modulator"); if (mod_settings.inputTransport == "edi") { - EdiReader ediReader(mod_settings.tist_offset_s, mod_settings.tist_delay_stages); + EdiReader ediReader(mod_settings.tist_offset_s); EdiDecoder::ETIDecoder ediInput(ediReader, false); if (mod_settings.edi_max_delay_ms > 0.0f) { // setMaxDelay wants number of AF packets, which correspond to 24ms ETI frames @@ -320,17 +314,6 @@ int launch_modulator(int argc, char* argv[]) flowgraph.connect(modulator, output); } - if (false -#if defined(HAVE_OUTPUT_UHD) - or mod_settings.useUHDOutput -#endif -#if defined(HAVE_SOAPYSDR) - or mod_settings.useSoapyOutput -#endif - ) { - ((Output::SDR*)output.get())->setETISource(modulator->getEtiSource()); - } - size_t framecount = 0; while (running) { @@ -400,7 +383,7 @@ int launch_modulator(int argc, char* argv[]) m.flowgraph = &flowgraph; m.data.setLength(6144); - EtiReader etiReader(mod_settings.tist_offset_s, mod_settings.tist_delay_stages); + EtiReader etiReader(mod_settings.tist_offset_s); m.etiReader = &etiReader; auto input = make_shared<InputMemory>(&m.data); @@ -414,23 +397,6 @@ int launch_modulator(int argc, char* argv[]) flowgraph.connect(modulator, output); } - if (false -#if defined(HAVE_OUTPUT_UHD) - or mod_settings.useUHDOutput -#endif -#if defined(HAVE_SOAPYSDR) - or mod_settings.useSoapyOutput -#endif - ) { - ((Output::SDR*)output.get())->setETISource(modulator->getEtiSource()); - } - - // TODO remove - auto output_as_file = dynamic_pointer_cast<OutputFile>(output); - if (output_as_file) { - output_as_file->setETISource(modulator->getEtiSource()); - } - inputReader->PrintInfo(); run_modulator_state_t st = run_modulator(m); diff --git a/src/EtiReader.cpp b/src/EtiReader.cpp index dc5df84..17f4953 100644 --- a/src/EtiReader.cpp +++ b/src/EtiReader.cpp @@ -54,10 +54,9 @@ enum ETI_READER_STATE { EtiReader::EtiReader( - double& tist_offset_s, - unsigned tist_delay_stages) : + double& tist_offset_s) : state(EtiReaderStateSync), - myTimestampDecoder(tist_offset_s, tist_delay_stages), + myTimestampDecoder(tist_offset_s), eti_fc_valid(false) { rcs.enrol(&myTimestampDecoder); @@ -292,11 +291,6 @@ bool EtiReader::sourceContainsTimestamp() /* See ETS 300 799, Annex C.2.2 */ } -void EtiReader::calculateTimestamp(struct frame_timestamp& ts) -{ - myTimestampDecoder.calculateTimestamp(ts); -} - uint32_t EtiReader::getPPSOffset() { if (!sourceContainsTimestamp()) { @@ -311,9 +305,8 @@ uint32_t EtiReader::getPPSOffset() } EdiReader::EdiReader( - double& tist_offset_s, - unsigned tist_delay_stages) : - m_timestamp_decoder(tist_offset_s, tist_delay_stages) + double& tist_offset_s) : + m_timestamp_decoder(tist_offset_s) { rcs.enrol(&m_timestamp_decoder); } @@ -361,11 +354,6 @@ bool EdiReader::sourceContainsTimestamp() return m_fc.tsta != 0xFFFFFF; } -void EdiReader::calculateTimestamp(struct frame_timestamp& ts) -{ - m_timestamp_decoder.calculateTimestamp(ts); -} - bool EdiReader::isFrameReady() { return m_frameReady; diff --git a/src/EtiReader.h b/src/EtiReader.h index f3a9764..8270592 100644 --- a/src/EtiReader.h +++ b/src/EtiReader.h @@ -59,7 +59,6 @@ public: /* Returns true if we have valid time stamps in the ETI*/ virtual bool sourceContainsTimestamp() = 0; - virtual void calculateTimestamp(struct frame_timestamp& ts) = 0; /* Return the FIC source to be used for modulation */ virtual std::shared_ptr<FicSource>& getFic(void); @@ -75,9 +74,7 @@ protected: class EtiReader : public EtiSource { public: - EtiReader( - double& tist_offset_s, - unsigned tist_delay_stages); + EtiReader(double& tist_offset_s); virtual unsigned getMode(); virtual unsigned getFp(); @@ -88,7 +85,6 @@ public: int loadEtiData(const Buffer& dataIn); virtual bool sourceContainsTimestamp(); - virtual void calculateTimestamp(struct frame_timestamp& ts); virtual const std::vector<std::shared_ptr<SubchannelSource> > getSubchannels() const; @@ -118,14 +114,11 @@ private: class EdiReader : public EtiSource, public EdiDecoder::DataCollector { public: - EdiReader( - double& tist_offset_s, - unsigned tist_delay_stages); + EdiReader(double& tist_offset_s); virtual unsigned getMode(); virtual unsigned getFp(); virtual bool sourceContainsTimestamp(); - virtual void calculateTimestamp(struct frame_timestamp& ts); virtual const std::vector<std::shared_ptr<SubchannelSource> > getSubchannels() const; virtual bool isFrameReady(void); diff --git a/src/OutputFile.cpp b/src/OutputFile.cpp index 481e858..1c2f5ed 100644 --- a/src/OutputFile.cpp +++ b/src/OutputFile.cpp @@ -85,18 +85,8 @@ meta_vec_t OutputFile::process_metadata(const meta_vec_t& metadataIn) } } - if (myEtiSource) { - frame_timestamp ts; - myEtiSource->calculateTimestamp(ts); - ss << " ETI FCT=" << ts.fct; - } - etiLog.level(debug) << "Output File got metadata: " << ss.str(); return {}; } -void OutputFile::setETISource(EtiSource *etiSource) -{ - myEtiSource = etiSource; -} diff --git a/src/OutputFile.h b/src/OutputFile.h index a586921..fedea40 100644 --- a/src/OutputFile.h +++ b/src/OutputFile.h @@ -50,12 +50,7 @@ public: virtual meta_vec_t process_metadata( const meta_vec_t& metadataIn) override; - void setETISource(EtiSource *etiSource); - protected: - // TODO remove - EtiSource *myEtiSource = nullptr; - std::string myFilename; struct FILEDeleter{ void operator()(FILE* fd){ if (fd) fclose(fd); }}; diff --git a/src/TimestampDecoder.cpp b/src/TimestampDecoder.cpp index 6cf2875..523551c 100644 --- a/src/TimestampDecoder.cpp +++ b/src/TimestampDecoder.cpp @@ -37,10 +37,9 @@ //#define MDEBUG(fmt, args...) fprintf (LOG, "*****" fmt , ## args) #define MDEBUG(fmt, args...) PDEBUG(fmt, ## args) -TimestampDecoder::TimestampDecoder(double& offset_s, unsigned tist_delay_stages) : +TimestampDecoder::TimestampDecoder(double& offset_s) : RemoteControllable("tist"), - timestamp_offset(offset_s), - m_tist_delay_stages(tist_delay_stages) + timestamp_offset(offset_s) { // Properly initialise temp_time memset(&temp_time, 0, sizeof(temp_time)); @@ -54,71 +53,6 @@ TimestampDecoder::TimestampDecoder(double& offset_s, unsigned tist_delay_stages) timestamp_offset << " offset"; } -void TimestampDecoder::calculateTimestamp(frame_timestamp& ts) -{ - std::shared_ptr<frame_timestamp> ts_queued = - std::make_shared<frame_timestamp>(); - - /* Push new timestamp into queue */ - ts_queued->timestamp_valid = full_timestamp_received; - ts_queued->timestamp_sec = time_secs; - ts_queued->timestamp_pps = time_pps; - ts_queued->fct = latestFCT; - ts_queued->fp = latestFP; - - ts_queued->timestamp_refresh = offset_changed; - offset_changed = false; - - MDEBUG("time_secs=%d, time_pps=%f\n", time_secs, - (double)time_pps / 16384000.0); - *ts_queued += timestamp_offset; - - queue_timestamps.push(ts_queued); - - /* Here, the queue size is one more than the pipeline delay, because - * we've just added a new element in the queue. - * - * Therefore, use <= and not < for comparison - */ - if (queue_timestamps.size() <= m_tist_delay_stages) { - //fprintf(stderr, "* %zu %u ", queue_timestamps.size(), m_tist_delay_stages); - /* Return invalid timestamp until the queue is full */ - ts.timestamp_valid = false; - ts.timestamp_sec = 0; - ts.timestamp_pps = 0; - ts.timestamp_refresh = false; - ts.fct = -1; - } - else { - //fprintf(stderr, ". %zu ", queue_timestamps.size()); - /* Return timestamp from queue */ - ts_queued = queue_timestamps.front(); - queue_timestamps.pop(); - /*fprintf(stderr, "ts_queued v:%d, sec:%d, pps:%f, ref:%d\n", - ts_queued->timestamp_valid, - ts_queued->timestamp_sec, - ts_queued->timestamp_pps_offset, - ts_queued->timestamp_refresh);*/ - ts = *ts_queued; - /*fprintf(stderr, "ts v:%d, sec:%d, pps:%f, ref:%d\n\n", - ts.timestamp_valid, - ts.timestamp_sec, - ts.timestamp_pps_offset, - ts.timestamp_refresh);*/ - } - - MDEBUG("Timestamp queue size %zu, delay_calc %u\n", - queue_timestamps.size(), - m_tist_delay_stages); - - if (queue_timestamps.size() > m_tist_delay_stages) { - etiLog.level(error) << "Error: Timestamp queue is too large : size " << - queue_timestamps.size() << "! This should not happen !"; - } - - //ts.print("calc2 "); -} - std::shared_ptr<frame_timestamp> TimestampDecoder::getTimestamp() { std::shared_ptr<frame_timestamp> ts = diff --git a/src/TimestampDecoder.h b/src/TimestampDecoder.h index 0953f76..000156d 100644 --- a/src/TimestampDecoder.h +++ b/src/TimestampDecoder.h @@ -2,7 +2,7 @@ Copyright (C) 2005, 2006, 2007, 2008, 2009, 2010 Her Majesty the Queen in Right of Canada (Communications Research Center Canada) - Copyright (C) 2017 + Copyright (C) 2018 Matthias P. Braendli, matthias.braendli@mpb.li http://opendigitalradio.org @@ -119,15 +119,8 @@ class TimestampDecoder : public RemoteControllable public: /* offset_s: The modulator adds this offset to the TIST to define time of * frame transmission - * - * tist_delay_stages: Specifies by how many stages the timestamp must - * be delayed. (e.g. The FIRFilter is pipelined, therefore we must - * increase tist_delay_stages by one if the filter is used */ - TimestampDecoder(double& offset_s, unsigned tist_delay_stages); - - /* Calculate the timestamp for the current frame. */ - void calculateTimestamp(frame_timestamp& ts); + TimestampDecoder(double& offset_s); std::shared_ptr<frame_timestamp> getTimestamp(void); @@ -185,7 +178,6 @@ class TimestampDecoder : public RemoteControllable uint32_t latestFP = 0; uint32_t time_pps = 0; double& timestamp_offset; - unsigned m_tist_delay_stages; int inhibit_second_update = 0; bool offset_changed = false; @@ -196,12 +188,5 @@ class TimestampDecoder : public RemoteControllable /* Disable timstamps until full time has been received */ bool full_timestamp_received = false; - - /* when pipelining, we must shift the calculated timestamps - * through this queue. Otherwise, it would not be possible to - * synchronise two modulators if only one uses (for instance) the - * FIRFilter (1 stage pipeline) - */ - std::queue<std::shared_ptr<frame_timestamp> > queue_timestamps; }; diff --git a/src/output/SDR.cpp b/src/output/SDR.cpp index d7d777f..5290e5d 100644 --- a/src/output/SDR.cpp +++ b/src/output/SDR.cpp @@ -217,11 +217,6 @@ const char* SDR::name() return m_name.c_str(); } -void SDR::setETISource(EtiSource *etiSource) -{ - m_eti_source = etiSource; -} - void SDR::sleep_through_frame() { struct timespec now; diff --git a/src/output/SDR.h b/src/output/SDR.h index ea787c3..8affaf9 100644 --- a/src/output/SDR.h +++ b/src/output/SDR.h @@ -55,8 +55,6 @@ class SDR : public ModOutput, public ModMetadata, public RemoteControllable { virtual const char* name() override; - void setETISource(EtiSource *etiSource); - /*********** REMOTE CONTROL ***************/ /* Base function to set parameters. */ @@ -85,7 +83,6 @@ class SDR : public ModOutput, public ModMetadata, public RemoteControllable { std::shared_ptr<DPDFeedbackServer> m_dpd_feedback_server; - EtiSource *m_eti_source = nullptr; bool sourceContainsTimestamp = false; bool last_tx_time_initialised = false; uint32_t last_tx_second = 0; |