From 2a002d2b9c5649c616e3ef06212cdea705b85fb1 Mon Sep 17 00:00:00 2001 From: Jens Ahrensfeld Date: Fri, 17 Jun 2022 10:05:00 +0000 Subject: [PATCH] - use Farrow block git-svn-id: http://moon:8086/svn/software/trunk/projects/mpsk_rx_gui@1018 b431acfa-c32f-4a4a-93f1-934dc6c82436 --- Source/Receiver.cpp | 26 ++++++++++++-------------- Source/Receiver.hpp | 9 +++++---- 2 files changed, 17 insertions(+), 18 deletions(-) diff --git a/Source/Receiver.cpp b/Source/Receiver.cpp index 92a5a38..a666046 100644 --- a/Source/Receiver.cpp +++ b/Source/Receiver.cpp @@ -46,6 +46,8 @@ Receiver::Receiver(LogHandler *pLogHandler) , m_pSymbolBuffer(0) , m_ReceiverEnable(false) , m_pDataListener(0) + , m_timingGenerator() + , m_farrow(m_timingGenerator) , m_frameReceiver(this) , m_pSymMapper(0) { @@ -100,6 +102,7 @@ void Receiver::setBufSize(uint32 size) } m_bufsize = size; init(); + m_bb_buffer.resize(size); } uint32 Receiver::getNumSoftSym() @@ -205,6 +208,9 @@ void Receiver::init() // Gardner Symbol Timing Recovery initSTR(); + // Interpolation + m_farrow.buffer_out_add(&m_bb_buffer); + // Symbol demapper initSymbolMapper(); @@ -455,40 +461,32 @@ void Receiver::processBaseband(CVec const &iq, uint32_t len) // Blind AGC gain adjustment // @2 x symbolrate - Processor::Buffer &next_buf_in = m_farrow.getInputBuffer(); + auto *next_buf_in = dynamic_cast*>(m_farrow.buffer_in()); for (n = 0; n < len; n++) { // AGC Blind gain adjustments ComplexScalar iq_agc = toComplexScalar(CpxScaleRealS(toCpx(iq[n]), AGC_GetWeight(&agcBlind))); - next_buf_in.write(&iq_agc, 1); + next_buf_in->write(&iq_agc, 1); } // Matched filtering and symbol timing recovery // @2 x symbolrate - Processor::Buffer *buf_ip = nullptr; if (RCF_TYPE == RCF_TYPE_POLYPHASE_FARROW) { // Farrow interpolation - m_farrow.process(m_timingGenerator); - buf_ip = &m_farrow.getOutputBuffer(); + m_farrow.process(); } if (RCF_TYPE == RCF_TYPE_POLYPHASE_DISCRETE) { // Polyphase interpolation -// m_polyPhase.process(m_timingGenerator); -// buf_ip = &m_polyPhase.getOutputBuffer(); - } - - if (buf_ip == nullptr) - { - return; +// m_polyPhase.process(); } // Further BB processing // @2 x symbolrate - while(buf_ip->len()) + while(m_bb_buffer.len()) { - ComplexScalar iq_mf = buf_ip->readAt(0); + ComplexScalar iq_mf = m_bb_buffer.readAt(0); // ----------------------------------------------------- // Carrier Derotator diff --git a/Source/Receiver.hpp b/Source/Receiver.hpp index be3d51e..1c01b66 100644 --- a/Source/Receiver.hpp +++ b/Source/Receiver.hpp @@ -360,6 +360,9 @@ private: // Filter Interpolation::DownSampler m_firArmDown; + // Gardner Symbol Timing Recovery + TimingGeneratorGardner m_timingGenerator; + // Interpolators Interpolation::PolyPhase m_polyPhase; Interpolation::Farrow m_farrow; @@ -372,9 +375,6 @@ private: lead_lag_filter_t m_loop_filter_str; lead_lag_filter_t m_loop_filter_cpr; - // Gardner Symbol Timing Recovery - TimingGeneratorGardner m_timingGenerator; - // AGC // Blind agc_t agcBlind; @@ -398,7 +398,8 @@ private: FrameReceiver m_frameReceiver; params_t m_params; - + Processor::Buffer m_bb_buffer; + void timerCallback(); void processBaseband(CVec const &iq, uint32_t len); void minMaxInit(minmax_t *pObj, radio_float_t min_initial, radio_float_t max_initial)