mirror of
https://github.com/SatDump/SatDump
synced 2026-08-13 17:47:30 -04:00
32 lines
No EOL
1.1 KiB
C++
32 lines
No EOL
1.1 KiB
C++
#include "moving_average.h"
|
|
|
|
namespace dsp
|
|
{
|
|
CCMovingAverageBlock::CCMovingAverageBlock(std::shared_ptr<dsp::stream<std::complex<float>>> input, int length, std::complex<float> scale, int max_iter, unsigned int vlen) : Block(input), d_mov(length, scale, max_iter, vlen)
|
|
{
|
|
}
|
|
|
|
void CCMovingAverageBlock::work()
|
|
{
|
|
int nsamples = input_stream->read();
|
|
if (nsamples <= 0)
|
|
return;
|
|
int d_out = d_mov.work(input_stream->readBuf, nsamples, output_stream->writeBuf);
|
|
input_stream->flush();
|
|
output_stream->swap(d_out);
|
|
}
|
|
|
|
FFMovingAverageBlock::FFMovingAverageBlock(std::shared_ptr<dsp::stream<float>> input, int length, float scale, int max_iter, unsigned int vlen) : Block(input), d_mov(length, scale, max_iter, vlen)
|
|
{
|
|
}
|
|
|
|
void FFMovingAverageBlock::work()
|
|
{
|
|
int nsamples = input_stream->read();
|
|
if (nsamples <= 0)
|
|
return;
|
|
int d_out = d_mov.work(input_stream->readBuf, nsamples, output_stream->writeBuf);
|
|
input_stream->flush();
|
|
output_stream->swap(d_out);
|
|
}
|
|
} |