mirror of
https://github.com/SatDump/SatDump
synced 2026-08-13 17:47:30 -04:00
freq_shift back to simple
and now working without perf. issues
This commit is contained in:
parent
cb75472072
commit
4dc43e9997
2 changed files with 8 additions and 26 deletions
|
|
@ -4,22 +4,12 @@ namespace satdump
|
|||
{
|
||||
namespace ndsp
|
||||
{
|
||||
FreqShiftBlock::FreqShiftBlock() : Block("freq_shift_cc", {{"in", DSP_SAMPLE_TYPE_CF32}}, {{"out", DSP_SAMPLE_TYPE_CF32}}) {}
|
||||
FreqShiftBlock::FreqShiftBlock() : BlockSimple<complex_t, complex_t>("freq_shift_cc", {{"in", DSP_SAMPLE_TYPE_CF32}}, {{"out", DSP_SAMPLE_TYPE_CF32}}) {}
|
||||
|
||||
FreqShiftBlock::~FreqShiftBlock() {}
|
||||
|
||||
bool FreqShiftBlock::work()
|
||||
uint32_t FreqShiftBlock::process(complex_t *input, uint32_t nsamples, complex_t *output)
|
||||
{
|
||||
DSPBuffer iblk;
|
||||
inputs[0].fifo->wait_dequeue(iblk);
|
||||
|
||||
if (iblk.isTerminator())
|
||||
{
|
||||
if (iblk.terminatorShouldPropagate())
|
||||
outputs[0].fifo->wait_enqueue(DSPBuffer::newBufferTerminator());
|
||||
iblk.free();
|
||||
return true;
|
||||
}
|
||||
|
||||
if (needs_reinit)
|
||||
{
|
||||
|
|
@ -27,17 +17,9 @@ namespace satdump
|
|||
init();
|
||||
}
|
||||
|
||||
auto oblk = DSPBuffer::newBufferSamples<complex_t>(iblk.max_size);
|
||||
complex_t *ibuf = iblk.getSamples<complex_t>();
|
||||
complex_t *obuf = oblk.getSamples<complex_t>();
|
||||
volk_32fc_s32fc_x2_rotator2_32fc((lv_32fc_t *)output, (const lv_32fc_t *)input, (lv_32fc_t *)&phase_delta, (lv_32fc_t *)&phase, nsamples);
|
||||
|
||||
volk_32fc_s32fc_x2_rotator2_32fc((lv_32fc_t *)obuf, (const lv_32fc_t *)ibuf, (lv_32fc_t *)&phase_delta, (lv_32fc_t *)&phase, iblk.size);
|
||||
|
||||
oblk.size = iblk.size;
|
||||
outputs[0].fifo->wait_enqueue(oblk);
|
||||
iblk.free();
|
||||
|
||||
return false;
|
||||
return nsamples;
|
||||
}
|
||||
|
||||
} // namespace ndsp
|
||||
|
|
|
|||
|
|
@ -5,7 +5,7 @@
|
|||
*/
|
||||
|
||||
#include "common/dsp/complex.h"
|
||||
#include "dsp/block.h"
|
||||
#include "dsp/block_simple.h"
|
||||
|
||||
namespace satdump
|
||||
{
|
||||
|
|
@ -22,7 +22,7 @@ namespace satdump
|
|||
* @param freq_shift frequency shift value
|
||||
* @param samplerate stream sample rate
|
||||
*/
|
||||
class FreqShiftBlock : public Block
|
||||
class FreqShiftBlock : public BlockSimple<complex_t, complex_t>
|
||||
{
|
||||
private:
|
||||
bool needs_reinit = false;
|
||||
|
|
@ -34,12 +34,12 @@ namespace satdump
|
|||
complex_t phase_delta;
|
||||
complex_t phase;
|
||||
|
||||
bool work();
|
||||
|
||||
public:
|
||||
FreqShiftBlock();
|
||||
~FreqShiftBlock();
|
||||
|
||||
uint32_t process(complex_t *input, uint32_t nsamples, complex_t *output);
|
||||
|
||||
void init()
|
||||
{
|
||||
if (raw_shift == false)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue