- use Farrow as Processor::Block
git-svn-id: http://moon:8086/svn/software/trunk/libsrc/cpp@1013 b431acfa-c32f-4a4a-93f1-934dc6c82436
This commit is contained in:
@@ -8,9 +8,11 @@
|
||||
|
||||
#include <string.h>
|
||||
#include <iostream>
|
||||
#include <type_traits>
|
||||
|
||||
using namespace std;
|
||||
using namespace Radio;
|
||||
using namespace Processor;
|
||||
|
||||
CVec wavLoad(const char *pName, WAVEHEADER &format)
|
||||
{
|
||||
@@ -126,14 +128,14 @@ class TimingGeneratorGardner : public Interpolation::TimingGenerator
|
||||
void test()
|
||||
{
|
||||
|
||||
// Setup Farrow
|
||||
Interpolation::Farrow farrow;
|
||||
farrow.load("/home/jens/farrow_coeff.dat");
|
||||
|
||||
// Setup timing generator
|
||||
TimingGeneratorGardner timingGenerator;
|
||||
timingGenerator.setOmega(1.0);
|
||||
|
||||
// Setup Farrow
|
||||
Interpolation::Farrow farrow(timingGenerator);
|
||||
farrow.load("/home/jens/farrow_coeff.dat");
|
||||
|
||||
// Setup IQ data
|
||||
WAVEHEADER header;
|
||||
CVec iq_in = wavLoad("m2_12k_12k_i_q_short_2sps.wav", header);
|
||||
@@ -146,25 +148,31 @@ void test()
|
||||
size_t n=0;
|
||||
size_t remain = iq_in.size();
|
||||
const size_t BLOCKSIZE=1024;
|
||||
|
||||
IBuffer *buf_in = farrow.buffer_in();
|
||||
auto farrow_buf_in = dynamic_cast<Buffer<ComplexScalar>*>(buf_in);
|
||||
auto farrow_buf_out = new Buffer<ComplexScalar>(BLOCKSIZE);
|
||||
|
||||
farrow.buffer_out_add(farrow_buf_out);
|
||||
|
||||
while(remain)
|
||||
{
|
||||
size_t size = std::min(BLOCKSIZE, remain);
|
||||
// @2 x symbolrate
|
||||
|
||||
// Matched filtering and interpolation
|
||||
size_t numFed = farrow.feed(&iq_in.data()[n], size);
|
||||
size_t size = std::min(BLOCKSIZE, remain);
|
||||
size_t numFed = farrow_buf_in->write(&iq_in.data()[n], size);
|
||||
n += numFed;
|
||||
remain -= numFed;
|
||||
|
||||
farrow.process(timingGenerator);
|
||||
Processor::Buffer<ComplexScalar>& buf_farrow = farrow.getOutputBuffer();
|
||||
while(buf_farrow.len())
|
||||
farrow.process();
|
||||
while(farrow_buf_out->len())
|
||||
{
|
||||
size_t size = std::min(BLOCKSIZE, buf_farrow.len());
|
||||
size_t size = std::min(BLOCKSIZE, farrow_buf_out->len());
|
||||
iq_out.resize(k+size);
|
||||
for (size_t i=0; i < size; i++)
|
||||
{
|
||||
iq_out[k++] = buf_farrow.readAt(0);
|
||||
iq_out[k++] = farrow_buf_out->readAt(0);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user