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

#include <htranslatebyfour.h>

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

Public Member Functions

 HTranslateByFour (HWriter< T > *writer, size_t blocksize, bool isQ=false, HProbe< T > *probe=NULL)
 
 HTranslateByFour (HWriterConsumer< T > *consumer, size_t blocksize, bool isQ=false, HProbe< T > *probe=NULL)
 
 HTranslateByFour (HReader< T > *reader, size_t blocksize, bool isQ=false, HProbe< T > *probe=NULL)
 
 ~HTranslateByFour ()
 
void Filter (T *src, T *dest, size_t blocksize)
 
void SetIsQ (bool isQ)
 
- Public Member Functions inherited from HFilter< T >
 ~HFilter ()
 
int Write (T *src, size_t blocksize)
 
int Read (T *dest, size_t blocksize)
 
bool Start ()
 
bool Stop ()
 
bool Command (HCommand *command)
 
void Enable ()
 
void Disable ()
 
bool GetEnabled ()
 
- 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 HReader< T >
virtual ~HReader ()=default
 
HReader< T > * Reader ()
 
- Public Member Functions inherited from HWriterConsumer< T >
HWriterConsumer< T > * Consumer ()
 

Static Public Member Functions

static void Translate (T *src, std::complex< T > *dest, size_t blocksize)
 
static void Translate (T *src, std::complex< double > *dest, size_t blocksize)
 
- Static Public Member Functions inherited from HFilter< T >
static std::vector< float > ReadCoeffsFromFile (std::string filename)
 
static std::vector< float > ReadCoeffsFromFile (char *filename)
 

Additional Inherited Members

- Protected Member Functions inherited from HFilter< T >
 HFilter (HWriter< T > *writer, size_t blocksize, HProbe< T > *probe=NULL)
 
 HFilter (HWriterConsumer< T > *consumer, size_t blocksize, HProbe< T > *probe=NULL)
 
 HFilter (HReader< T > *reader, size_t blocksize, HProbe< T > *probe=NULL)
 
void SetWriter (HWriter< T > *writer)
 
- Protected Attributes inherited from HFilter< T >
int _blocksize
 

Detailed Description

template<class T>
class HTranslateByFour< T >

Translating the input samples by four.

This implements the common frequency translation method of translating by four, either cos(PI*n) or sin(PI*n) at fs/4 by multiplying with [1, 0, -1, 0, 1, .... ] or [0, -1, 0, 1, 0, .... ]

The result is either the real or imaginary (I or Q) signal of a quadrature signal decimated by 4 and with the center frequency shifted to 0.

You can think if this as the output being either the I or Q branch of an combined IQ signal. If you look at the branches in a realvalued fft, you will find that

1) The input spectrum [0 - fs/4] will appear shifted up past fs/4 2) The input spectrum [0 - fs/4] will also appear as shifted towards 0 AND inverted.

Components above fs/4 will be shifted towards 0 not-inverted, but you will get an alias centered and to the left of fs/4.

The flag 'isQ' simply signifies if you wants to multiply with cos or sin (isQ)

Constructor & Destructor Documentation

◆ HTranslateByFour() [1/3]

template<class T >
HTranslateByFour< T >::HTranslateByFour ( HWriter< T > *  writer,
size_t  blocksize,
bool  isQ = false,
HProbe< T > *  probe = NULL 
)
inline

Construct a new HTranslateByFour object that writes to a writer

◆ HTranslateByFour() [2/3]

template<class T >
HTranslateByFour< T >::HTranslateByFour ( HWriterConsumer< T > *  consumer,
size_t  blocksize,
bool  isQ = false,
HProbe< T > *  probe = NULL 
)
inline

Construct a new HTranslateByFour object that registers with an upstream writer

◆ HTranslateByFour() [3/3]

template<class T >
HTranslateByFour< T >::HTranslateByFour ( HReader< T > *  reader,
size_t  blocksize,
bool  isQ = false,
HProbe< T > *  probe = NULL 
)
inline

Construct a new HTranslateByFour object that reads from a reader

◆ ~HTranslateByFour()

template<class T >
HTranslateByFour< T >::~HTranslateByFour ( )
inline

Default destructor

Member Function Documentation

◆ Filter()

template<class T >
void HTranslateByFour< T >::Filter ( T *  src,
T *  dest,
size_t  blocksize 
)
inlinevirtual

Run a block of samples through the translator

Implements HFilter< T >.

◆ SetIsQ()

template<class T >
void HTranslateByFour< T >::SetIsQ ( bool  isQ)
inline

Change direction of the shift

Parameters
isQshift direction, false=down, true=up

◆ Translate() [1/2]

template<class T >
static void HTranslateByFour< T >::Translate ( T *  src,
std::complex< double > *  dest,
size_t  blocksize 
)
inlinestatic

Convert the realvalued input signal 'src' to a complex IQ signal

◆ Translate() [2/2]

template<class T >
static void HTranslateByFour< T >::Translate ( T *  src,
std::complex< T > *  dest,
size_t  blocksize 
)
inlinestatic

Convert the realvalued input signal 'src' to a complex IQ signal


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