- 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:
+5
-45
@@ -1,6 +1,7 @@
|
|||||||
#include <cmath>
|
#include <cmath>
|
||||||
#include "Receiver.h"
|
#include "Receiver.h"
|
||||||
#include "MinMaxLemire.h"
|
#include "MinMaxLemire.h"
|
||||||
|
#include "radio/Interpolation.hpp"
|
||||||
#include <radio/Frame.hpp>
|
#include <radio/Frame.hpp>
|
||||||
|
|
||||||
#if 0
|
#if 0
|
||||||
@@ -54,8 +55,6 @@ Receiver::Receiver(LogHandler *pLogHandler)
|
|||||||
, m_pSymMapper(0)
|
, m_pSymMapper(0)
|
||||||
, m_pPolyphaseInterpolator(0)
|
, m_pPolyphaseInterpolator(0)
|
||||||
, m_pLagrangeInterpolator(0)
|
, m_pLagrangeInterpolator(0)
|
||||||
, m_pFarrowInterpolator(0)
|
|
||||||
|
|
||||||
{
|
{
|
||||||
m_stateArm_I = nullptr;
|
m_stateArm_I = nullptr;
|
||||||
m_stateArm_Q = nullptr;
|
m_stateArm_Q = nullptr;
|
||||||
@@ -895,13 +894,6 @@ void Receiver::free()
|
|||||||
}
|
}
|
||||||
m_pLagrangeInterpolator = nullptr;
|
m_pLagrangeInterpolator = nullptr;
|
||||||
|
|
||||||
if (m_pFarrowInterpolator)
|
|
||||||
{
|
|
||||||
FarrowPPIPCpxFree(m_pFarrowInterpolator);
|
|
||||||
delete m_pFarrowInterpolator;
|
|
||||||
}
|
|
||||||
m_pFarrowInterpolator = nullptr;
|
|
||||||
|
|
||||||
NCO_Free(&m_nco_ddc);
|
NCO_Free(&m_nco_ddc);
|
||||||
NCO_Free(&m_nco_cpr);
|
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)
|
if (RCF_TYPE == RCF_TYPE_POLYPHASE_FARROW)
|
||||||
{
|
{
|
||||||
// Matched filtering and interpolation
|
// Matched filtering and interpolation
|
||||||
FarrowPPIPCpxFeed(m_pFarrowInterpolator, 1, pIF[n]);
|
m_farrow.feed(toComplexScalar(pIF[n]), 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
do
|
do
|
||||||
@@ -1115,7 +1107,8 @@ void Receiver::processBaseband(cpx_t *pIF, uint32_t len)
|
|||||||
|
|
||||||
if (RCF_TYPE == RCF_TYPE_POLYPHASE_FARROW)
|
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
|
// AGC Blind process samples
|
||||||
@@ -1336,31 +1329,6 @@ cpx_t Receiver::processMatchedFilter(cpx_t x, int32_t m, radio_float_t mu)
|
|||||||
return y;
|
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()
|
void Receiver::initDDC()
|
||||||
{
|
{
|
||||||
NCO_Init(&m_nco_ddc, m_params.ddc_freq/m_params.samplerate, 0);
|
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
|
// Fixed at symbol duration 2/fs
|
||||||
// -> RCF_ROLLOFF and symbol rate parameter have no influence
|
// -> RCF_ROLLOFF and symbol rate parameter have no influence
|
||||||
if (m_pFarrowInterpolator)
|
m_farrow.load("/home/jens/farrow_coeff.dat");
|
||||||
{
|
|
||||||
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);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
+2
-7
@@ -16,6 +16,7 @@
|
|||||||
|
|
||||||
#include <radio/FirComplex.hpp>
|
#include <radio/FirComplex.hpp>
|
||||||
#include <radio/Equalizer.hpp>
|
#include <radio/Equalizer.hpp>
|
||||||
|
#include <radio/Interpolation.hpp>
|
||||||
|
|
||||||
using namespace Radio;
|
using namespace Radio;
|
||||||
|
|
||||||
@@ -95,12 +96,6 @@ enum str_state
|
|||||||
str_state_track
|
str_state_track
|
||||||
};
|
};
|
||||||
|
|
||||||
typedef struct _ml_farrow_coef_hdr_t
|
|
||||||
{
|
|
||||||
uint32_t M;
|
|
||||||
uint32_t N;
|
|
||||||
} ml_farrow_coef_hdr_t;
|
|
||||||
|
|
||||||
typedef struct _minmax_t
|
typedef struct _minmax_t
|
||||||
{
|
{
|
||||||
float min, max;
|
float min, max;
|
||||||
@@ -316,7 +311,7 @@ private:
|
|||||||
// Interpolators
|
// Interpolators
|
||||||
ppip_cpx_t *m_pPolyphaseInterpolator;
|
ppip_cpx_t *m_pPolyphaseInterpolator;
|
||||||
lgip_cpx_t *m_pLagrangeInterpolator;
|
lgip_cpx_t *m_pLagrangeInterpolator;
|
||||||
ppip_farrow_cpx_t *m_pFarrowInterpolator;
|
Interpolation::Farrow m_farrow;
|
||||||
|
|
||||||
// NCOs
|
// NCOs
|
||||||
nco_t m_nco_ddc, m_nco_cpr;
|
nco_t m_nco_ddc, m_nco_cpr;
|
||||||
|
|||||||
Reference in New Issue
Block a user