HARDT - The Ham Radio DSP Toolkit
Public Member Functions | List of all members
HDecimator< T > Class Template Reference

#include <hdecimator.h>

Inheritance diagram for HDecimator< T >:
Inheritance graph
[legend]
Collaboration diagram for HDecimator< T >:
Collaboration graph
[legend]

Public Member Functions

 HDecimator (HWriter< T > *writer, int factor, size_t blocksize, bool collect=true, int start=0, HProbe< T > *probe=nullptr)
 
 HDecimator (HWriterConsumer< T > *consumer, int factor, size_t blocksize, bool collect=true, int start=0, HProbe< T > *probe=nullptr)
 
 HDecimator (HReader< T > *reader, int factor, size_t blocksize, bool collect=true, int start=0, HProbe< T > *probe=nullptr)
 
void SetWriter (HWriter< T > *writer)
 
 ~HDecimator ()
 
int Write (T *src, size_t blocksize)
 
int Read (T *dest, size_t blocksize)
 
bool Start ()
 
bool Stop ()
 
bool Command (HCommand *command)
 
void SetFactor (int factor)
 
- Public Member Functions inherited from HReader< T >
virtual ~HReader ()=default
 
HReader< T > * Reader ()
 
- Public Member Functions inherited from HObject
 HObject ()
 
- Public Member Functions inherited from HWriter< T >
virtual ~HWriter ()=default
 
HWriter< T > * Writer ()
 
- Public Member Functions inherited from HWriterConsumer< T >
HWriterConsumer< T > * Consumer ()
 

Detailed Description

template<class T>
class HDecimator< T >

Implements a decimator that can reduce the incomming samplerate by a given factor

Constructor & Destructor Documentation

◆ HDecimator() [1/3]

template<class T >
HDecimator< T >::HDecimator ( HWriter< T > *  writer,
int  factor,
size_t  blocksize,
bool  collect = true,
int  start = 0,
HProbe< T > *  probe = nullptr 
)

Construct a new HDecimator that handle writers.

Parameters
writerThe downstream writer
factorDecimation factor, 1 or larger
blocksizeThe expected input and output blocksize
collectNormally you want to use the same blocksize for alle writers in a chain, but if you are going to use a decimator in a parallel demultiplexed chain (processing IQ data), it is very important to write chunks from both branches alternating. In that case, set 'collect=false'. A write of 1024 samples will then immediately result in a write of 1024/factor samples to the next writer.
startBegin decimating from this position in the buffer
probeProbe

◆ HDecimator() [2/3]

template<class T >
HDecimator< T >::HDecimator ( HWriterConsumer< T > *  consumer,
int  factor,
size_t  blocksize,
bool  collect = true,
int  start = 0,
HProbe< T > *  probe = nullptr 
)

Construct a new HDecimator that handle writer consumers.

Parameters
consumerThe upstream consumer to receive this as a writer
factorDecimation factor, 1 or larger
blocksizeThe expected input and output blocksize
collectNormally you want to use the same blocksize for alle writers in a chain, but if you are going to use a decimator in a parallel demultiplexed chain (processing IQ data), it is very important to write chunks from both branches alternating. In that case, set 'collect=false'. A write of 1024 samples will then immediately result in a write of 1024/factor samples to the next writer.
startBegin decimating from this position in the buffer
probeProbe

◆ HDecimator() [3/3]

template<class T >
HDecimator< T >::HDecimator ( HReader< T > *  reader,
int  factor,
size_t  blocksize,
bool  collect = true,
int  start = 0,
HProbe< T > *  probe = nullptr 
)

Construct a new HDecimator that handle readers.

Parameters
readerThe upstream reader
factorDecimation factor, 1 or larger
blocksizeThe expected input and output blocksize
collectNormally you want to use the same blocksize for alle readers in a chain, but if you are going to use a decimator in a parallel demultiplexed chain (processing IQ data), it is very important to read chunks from both branches alternating. In that case, set 'collect=false'. Constructing with 'blocksize=1024' then a Read() with 'blocksize=256' will then be expected.
startBegin decimating from this position in the buffer
probeProbe

◆ ~HDecimator()

template<class T >
HDecimator< T >::~HDecimator

Default destructor

Member Function Documentation

◆ Command()

template<class T >
bool HDecimator< T >::Command ( HCommand command)
inlinevirtual

Execute or carry through a command

Implements HReader< T >.

◆ Read()

template<class T >
int HDecimator< T >::Read ( T *  dest,
size_t  blocksize 
)
virtual

Read a block of samples

Parameters
destDestination buffer
blocksizeNumber of samples to read

Implements HReader< T >.

◆ SetFactor()

template<class T >
void HDecimator< T >::SetFactor ( int  factor)
inline

Set the decimation factor. Warning: This will reset the buffer position and start collecting samples for a write from position 0 (zero)

Parameters
factorDecimation factor

◆ SetWriter()

template<class T >
void HDecimator< T >::SetWriter ( HWriter< T > *  writer)
inlinevirtual

Implements HWriterConsumer::SetWriter()

Parameters
writerDownstream writer

Implements HWriterConsumer< T >.

◆ Start()

template<class T >
bool HDecimator< T >::Start ( )
inlinevirtual
Returns
Call Start() on up- or downstream components

Reimplemented from HReader< T >.

◆ Stop()

template<class T >
bool HDecimator< T >::Stop ( )
inlinevirtual
Returns
Call Stop() on up- or downstream components

Reimplemented from HReader< T >.

◆ Write()

template<class T >
int HDecimator< T >::Write ( T *  src,
size_t  blocksize 
)
virtual

Write a block of samples

Parameters
srcSource buffer
blocksizeNumber of samples to write

Implements HWriter< T >.


The documentation for this class was generated from the following files: