- Use C++ Farrow interpolation

git-svn-id: http://moon:8086/svn/software/trunk/projects/mpsk_rx_gui@92 b431acfa-c32f-4a4a-93f1-934dc6c82436
This commit is contained in:
2014-12-20 20:55:28 +00:00
parent 8943af5976
commit 1b4d8e9f54
2 changed files with 7 additions and 52 deletions
+5 -45
View File
@@ -1,6 +1,7 @@
#include <cmath>
#include "Receiver.h"
#include "MinMaxLemire.h"
#include "radio/Interpolation.hpp"
#include <radio/Frame.hpp>
#if 0
@@ -54,8 +55,6 @@ Receiver::Receiver(LogHandler *pLogHandler)
, m_pSymMapper(0)
, m_pPolyphaseInterpolator(0)
, m_pLagrangeInterpolator(0)
, m_pFarrowInterpolator(0)
{
m_stateArm_I = nullptr;
m_stateArm_Q = nullptr;
@@ -895,13 +894,6 @@ void Receiver::free()
}
m_pLagrangeInterpolator = nullptr;
if (m_pFarrowInterpolator)
{
FarrowPPIPCpxFree(m_pFarrowInterpolator);
delete m_pFarrowInterpolator;
}
m_pFarrowInterpolator = nullptr;
NCO_Free(&m_nco_ddc);
NCO_Free(&m_nco_cpr);
@@ -1096,7 +1088,7 @@ void Receiver::processBaseband(cpx_t *pIF, uint32_t len)
if (RCF_TYPE == RCF_TYPE_POLYPHASE_FARROW)
{
// Matched filtering and interpolation
FarrowPPIPCpxFeed(m_pFarrowInterpolator, 1, pIF[n]);
m_farrow.feed(toComplexScalar(pIF[n]), 1);
}
do
@@ -1115,7 +1107,8 @@ void Receiver::processBaseband(cpx_t *pIF, uint32_t len)
if (RCF_TYPE == RCF_TYPE_POLYPHASE_FARROW)
{
IQ_mf = FarrowPPIPCpxInterpolate(m_pFarrowInterpolator, !TimingCorrectorIsStuff(&m_timing_corrector), TimingCorrectorGetMu(&m_timing_corrector));
ComplexScalar __IQ_mf = m_farrow.process(TimingCorrectorGetMu(&m_timing_corrector), !TimingCorrectorIsStuff(&m_timing_corrector));
IQ_mf = toCpx(__IQ_mf);
}
// AGC Blind process samples
@@ -1336,31 +1329,6 @@ cpx_t Receiver::processMatchedFilter(cpx_t x, int32_t m, radio_float_t mu)
return y;
}
int Receiver::Farrow_open_coeff(ppip_farrow_cpx_t *pObj, const char *filename)
{
int i;
FILE *pFile;
ml_farrow_coef_hdr_t hdr;
radio_float_t *pCoeff;
pFile = fopen(filename, "rb");
if (!pFile)
{
m_log.log("Can't open %s\n", filename);
return -1;
}
fread(&hdr, sizeof(hdr), 1, pFile);
FarrowPPIPCpxInit(pObj, hdr.M, hdr.N);
// pCoeff = (radio_float_t*)malloc(hdr.M*hdr.N*sizeof(radio_float_t));
for (i=0; i < (int)hdr.M; i++)
{
fread(pObj->ppCoeff[i], sizeof(radio_float_t), hdr.N, pFile);
pCoeff = pObj->ppCoeff[i];
}
return 0;
}
void Receiver::initDDC()
{
NCO_Init(&m_nco_ddc, m_params.ddc_freq/m_params.samplerate, 0);
@@ -1457,15 +1425,7 @@ void Receiver::initFilterRcf()
{
// Fixed at symbol duration 2/fs
// -> RCF_ROLLOFF and symbol rate parameter have no influence
if (m_pFarrowInterpolator)
{
FarrowPPIPCpxFree(m_pFarrowInterpolator);
delete m_pFarrowInterpolator;
}
m_pFarrowInterpolator = new ppip_farrow_cpx_t();
Farrow_open_coeff(m_pFarrowInterpolator, "/home/jens/farrow_coeff.dat");
m_log.log("Farrow filter coefficients loaded (L=%d, M=%d, N=%d)", m_pFarrowInterpolator->L, m_pFarrowInterpolator->M, m_pFarrowInterpolator->N);
m_farrow.load("/home/jens/farrow_coeff.dat");
}
}