- moved blind AGC out of da big loop
git-svn-id: http://moon:8086/svn/software/trunk/projects/mpsk_rx_gui@1005 b431acfa-c32f-4a4a-93f1-934dc6c82436
This commit is contained in:
+35
-34
@@ -416,16 +416,16 @@ void Receiver::processBaseband(CVec const &iq, uint32_t len)
|
|||||||
static cpx_t IQ_hard_last;
|
static cpx_t IQ_hard_last;
|
||||||
|
|
||||||
uint32_t n;
|
uint32_t n;
|
||||||
static cpx_t IQ_mf;
|
static cpx_t IQ_mf = {0,0};
|
||||||
cpx_t IQ_agc;
|
cpx_t IQ_agc = {0,0};
|
||||||
cpx_t IQ_cpr;
|
cpx_t IQ_cpr = {0,0};
|
||||||
cpx_t IQ_cma;
|
cpx_t IQ_cma = {0,0};
|
||||||
cpx_t IQ_dfeOn;
|
cpx_t IQ_dfeOn = {0,0};
|
||||||
cpx_t IQ_dfeOff;
|
cpx_t IQ_dfeOff = {0,0};
|
||||||
cpx_t IQ_eq_in;
|
cpx_t IQ_eq_in = {0,0};
|
||||||
cpx_t IQ_eq;
|
cpx_t IQ_eq = {0,0};
|
||||||
cpx_t IQ_soft;
|
cpx_t IQ_soft = {0,0};
|
||||||
cpx_t IQ_hard;
|
cpx_t IQ_hard = {0,0};
|
||||||
radio_float_t e_cma;
|
radio_float_t e_cma;
|
||||||
radio_float_t e_dfe_on;
|
radio_float_t e_dfe_on;
|
||||||
radio_float_t e_dfe_off;
|
radio_float_t e_dfe_off;
|
||||||
@@ -452,21 +452,41 @@ void Receiver::processBaseband(CVec const &iq, uint32_t len)
|
|||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
// Blind AGC
|
||||||
|
// @2 x symbolrate
|
||||||
|
// AGC Blind Training
|
||||||
|
Processor::Buffer<ComplexScalar> &next_buf_in = m_farrow.getInputBuffer();
|
||||||
|
if (m_params.agc_mode != agc_mode_disabled)
|
||||||
|
{
|
||||||
|
for (n = 0; n < len; n++)
|
||||||
|
{
|
||||||
|
// AGC Blind process samples
|
||||||
|
ComplexScalar iq_agc = toComplexScalar(CpxScaleRealS(toCpx(iq[n]), AGC_GetWeight(&agcBlind)));
|
||||||
|
AGC_Process(&agcBlind, CpxMagS(toCpx(iq_agc)), m_params.agcMu[m_params.agcMu_index], 1.0);
|
||||||
|
next_buf_in.write(&iq_agc, 1);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
for (n = 0; n < len; n++)
|
||||||
|
{
|
||||||
|
ComplexScalar iq_agc = toComplexScalar(CpxScaleRealS(toCpx(iq[n]), AGC_GetWeight(&agcBlind)));
|
||||||
|
next_buf_in.write(&iq_agc, 1);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// Matched filtering and symbol timing recovery
|
// Matched filtering and symbol timing recovery
|
||||||
// @2 x symbolrate
|
// @2 x symbolrate
|
||||||
|
|
||||||
Processor::Buffer<ComplexScalar> *buf_ip = nullptr;
|
Processor::Buffer<ComplexScalar> *buf_ip = nullptr;
|
||||||
if (RCF_TYPE == RCF_TYPE_POLYPHASE_FARROW)
|
if (RCF_TYPE == RCF_TYPE_POLYPHASE_FARROW)
|
||||||
{
|
{
|
||||||
// Farrow interpolation
|
// Farrow interpolation
|
||||||
m_farrow.feed(iq, len);
|
|
||||||
m_farrow.process(m_timingGenerator);
|
m_farrow.process(m_timingGenerator);
|
||||||
buf_ip = &m_farrow.getOutputBuffer();
|
buf_ip = &m_farrow.getOutputBuffer();
|
||||||
}
|
}
|
||||||
if (RCF_TYPE == RCF_TYPE_POLYPHASE_DISCRETE)
|
if (RCF_TYPE == RCF_TYPE_POLYPHASE_DISCRETE)
|
||||||
{
|
{
|
||||||
// Polyphase interpolation
|
// Polyphase interpolation
|
||||||
// m_polyPhase.feed(iq, len);
|
|
||||||
// m_polyPhase.process(m_timingGenerator);
|
// m_polyPhase.process(m_timingGenerator);
|
||||||
// buf_ip = &m_polyPhase.getOutputBuffer();
|
// buf_ip = &m_polyPhase.getOutputBuffer();
|
||||||
}
|
}
|
||||||
@@ -480,13 +500,10 @@ void Receiver::processBaseband(CVec const &iq, uint32_t len)
|
|||||||
// @2 x symbolrate
|
// @2 x symbolrate
|
||||||
while(buf_ip->len())
|
while(buf_ip->len())
|
||||||
{
|
{
|
||||||
IQ_mf = toCpx(buf_ip->readAt(0));
|
ComplexScalar iq_mf = buf_ip->readAt(0);
|
||||||
|
|
||||||
// AGC Blind process samples
|
|
||||||
IQ_agc = CpxScaleRealS(IQ_mf, AGC_GetWeight(&agcBlind));
|
|
||||||
|
|
||||||
// Carrier Derotator
|
// Carrier Derotator
|
||||||
IQ_cpr = toCpx(m_nco_cpr.mixComplexS(toComplexScalar(IQ_agc), ComplexScalar(1,1)));
|
IQ_cpr = toCpx(m_nco_cpr.mixComplexS(iq_mf, ComplexScalar(1,1)));
|
||||||
m_nco_cpr.process(m_dOmega_vco, m_params.CPR_phase);
|
m_nco_cpr.process(m_dOmega_vco, m_params.CPR_phase);
|
||||||
|
|
||||||
IQ_eq_in = IQ_cpr;
|
IQ_eq_in = IQ_cpr;
|
||||||
@@ -495,22 +512,6 @@ void Receiver::processBaseband(CVec const &iq, uint32_t len)
|
|||||||
// @1 x symbolrate
|
// @1 x symbolrate
|
||||||
if (ClockIsTick(&m_symClock, 1))
|
if (ClockIsTick(&m_symClock, 1))
|
||||||
{
|
{
|
||||||
// AGC Blind Training
|
|
||||||
if (m_params.agc_mode != agc_mode_disabled)
|
|
||||||
{
|
|
||||||
if (m_params.agcMu_index == agc_state_acquisition)
|
|
||||||
{
|
|
||||||
// AGC_Process(&agcBlind, CpxMagS(IQ_eq_in), m_params.agcMu[m_params.agcMu_index], 1.0);
|
|
||||||
e_agc = m_pSymMapper->R2_cma - CpxMagS(m_trackers[0]);
|
|
||||||
AGC_Train(&agcBlind, e_agc, m_params.agcMu[m_params.agcMu_index]);
|
|
||||||
}
|
|
||||||
if (m_params.agcMu_index == agc_state_track)
|
|
||||||
{
|
|
||||||
e_agc = m_pSymMapper->R2_cma - CpxMagS(m_trackers[0]);
|
|
||||||
// e_agc = CpxMagS(IQ_hard_last) - CpxMagS(IQ_eq_in);
|
|
||||||
AGC_Train(&agcBlind, e_agc, m_params.agcMu[m_params.agcMu_index]);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
#ifndef DISABLE_UNUSED_STATISTICS
|
#ifndef DISABLE_UNUSED_STATISTICS
|
||||||
minMaxProcess(&m_statistics.ddcMinMax, IQ_eq_in);
|
minMaxProcess(&m_statistics.ddcMinMax, IQ_eq_in);
|
||||||
#endif
|
#endif
|
||||||
|
|||||||
Reference in New Issue
Block a user