- added wav IQ data
- closed the loop git-svn-id: http://moon:8086/svn/software/trunk/libsrc/cpp@967 b431acfa-c32f-4a4a-93f1-934dc6c82436
This commit is contained in:
Binary file not shown.
@@ -6,7 +6,9 @@
|
||||
#include <wav/wav.h>
|
||||
|
||||
#include <string.h>
|
||||
#include <iostream>
|
||||
|
||||
using namespace std;
|
||||
using namespace Radio;
|
||||
|
||||
CVec wavLoad(const char *pName)
|
||||
@@ -24,6 +26,7 @@ CVec wavLoad(const char *pName)
|
||||
pWav[1] = (float*)malloc(BLOCK_SIZE*sizeof(float));
|
||||
|
||||
size_t remain = wav.m_numSamples;
|
||||
size_t k=0;
|
||||
while(remain)
|
||||
{
|
||||
size_t size = std::min(remain, BLOCK_SIZE);
|
||||
@@ -31,40 +34,55 @@ CVec wavLoad(const char *pName)
|
||||
WavDeIlvdFloat(&wav, pWavInterleaved, pWav, numRead);
|
||||
for (int j=0; j < numRead; j++)
|
||||
{
|
||||
res[j] = ComplexScalar(pWav[0][j], pWav[1][j]);
|
||||
res[k++] = ComplexScalar(pWav[0][j], pWav[1][j]);
|
||||
}
|
||||
remain -= numRead;
|
||||
}
|
||||
return res;
|
||||
|
||||
}
|
||||
|
||||
const radio_float_t STR_GAIN_LEAD_AQU = (radio_float_t)4.00E-4; // 2E-3
|
||||
const radio_float_t STR_GAIN_LAG_AQU = (radio_float_t)0.50E-6; // 5E-7
|
||||
const radio_float_t STR_GAIN_LEAD_TRK = (radio_float_t)4.00E-6; // 8E-4
|
||||
const radio_float_t STR_GAIN_LAG_TRK = (radio_float_t)1.00E-9; // 1E-6
|
||||
|
||||
void test()
|
||||
{
|
||||
|
||||
Interpolation::Farrow m_farrow;
|
||||
m_farrow.load("/home/jens/farrow_coeff.dat");
|
||||
|
||||
// Setup Farrow
|
||||
Interpolation::Farrow farrow;
|
||||
farrow.load("/home/jens/farrow_coeff.dat");
|
||||
|
||||
// Setup IQ data
|
||||
CVec iq = wavLoad("m2_12k_12k_i_q.wav");
|
||||
|
||||
// Loop-Filter
|
||||
lead_lag_filter_t m_loop_filter_str;
|
||||
lead_lag_filter_t loop_filter_str;
|
||||
lead_lag_coeff_t str_loopfilter_coeff;
|
||||
|
||||
// Gardner Symbol Timing Recovery
|
||||
str_t m_SymbolTimingRevovery;
|
||||
timing_corrector_t m_timing_corrector;
|
||||
|
||||
radio_float_t m_Vc;
|
||||
LeadLagInit(&loop_filter_str, 1.0);
|
||||
LeadLagSetCoeff(&str_loopfilter_coeff, STR_GAIN_LEAD_AQU, STR_GAIN_LAG_AQU);
|
||||
|
||||
CVec iq = wavLoad("m2_12k_12k_i_q.wav");
|
||||
size_t len = iq.size();
|
||||
for (size_t n = 0; n < len; n++)
|
||||
radio_float_t vc=0;
|
||||
radio_float_t vd=0;
|
||||
for (size_t n = 0; n < iq.size(); n++)
|
||||
{
|
||||
// @2 x symbolrate
|
||||
|
||||
vc = LeadLagProcess(&loop_filter_str, &str_loopfilter_coeff, vd);
|
||||
|
||||
// Matched filtering and interpolation
|
||||
ComplexScalar iq_ip = m_farrow.process_new(iq[n], m_Vc);
|
||||
ComplexScalar iq_ip = farrow.process_new(iq[n], vc);
|
||||
|
||||
// Symbol timing recovery
|
||||
radio_float_t Vd = STRGardnerProcess(&m_SymbolTimingRevovery, toCpx(iq_ip));
|
||||
m_Vc = LeadLagProcess(&m_loop_filter_str, &str_loopfilter_coeff, Vd);
|
||||
vd = STRGardnerProcess(&m_SymbolTimingRevovery, toCpx(iq_ip));
|
||||
cout << "Vd = " << vd << ", Vc = " << vc << endl;
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user