SDRAngel  4.11.5
Developer docs for <a href="https://github.com/f4exb/sdrangel">SDRangel<\a>, an Open Source Qt5 / OpenGL 3.0+ SDR and signal analyzer frontend to various hardware.
Public Member Functions | Private Attributes | List of all members
leansdr::rotator< T > Struct Template Reference

#include <sdr.h>

+ Inheritance diagram for leansdr::rotator< T >:
+ Collaboration diagram for leansdr::rotator< T >:

Public Member Functions

 rotator (scheduler *sch, pipebuf< complex< T >> &_in, pipebuf< complex< T >> &_out, float freq)
 
void run ()
 
- Public Member Functions inherited from leansdr::runnable
 runnable (scheduler *_sch, const char *name)
 
- Public Member Functions inherited from leansdr::runnable_common
 runnable_common (const char *_name)
 
virtual ~runnable_common ()
 
virtual void shutdown ()
 

Private Attributes

pipereader< complex< T > > in
 
pipewriter< complex< T > > out
 
float lut_cos [65536]
 
float lut_sin [65536]
 
unsigned short index
 

Additional Inherited Members

- Public Attributes inherited from leansdr::runnable_common
const char * name
 
- Protected Attributes inherited from leansdr::runnable
schedulersch
 

Detailed Description

template<typename T>
struct leansdr::rotator< T >

Definition at line 1650 of file sdr.h.

Constructor & Destructor Documentation

◆ rotator()

template<typename T>
leansdr::rotator< T >::rotator ( scheduler sch,
pipebuf< complex< T >> &  _in,
pipebuf< complex< T >> &  _out,
float  freq 
)
inline

Definition at line 1652 of file sdr.h.

1655  : runnable(sch, "rotator"),
1656  in(_in),
1657  out(_out),
1658  index(0)
1659  {
1660  int ifreq = freq * 65536;
1661  if (sch->debug)
1662  fprintf(stderr, "Rotate: req=%f real=%f\n", freq, ifreq / 65536.0);
1663 
1664  for (int i = 0; i < 65536; ++i)
1665  {
1666  lut_cos[i] = cosf(2 * M_PI * i * ifreq / 65536);
1667  lut_sin[i] = sinf(2 * M_PI * i * ifreq / 65536);
1668  }
1669  }
runnable(scheduler *_sch, const char *name)
Definition: framework.h:193
#define M_PI
Definition: rdsdemod.cpp:27
float lut_cos[65536]
Definition: sdr.h:1692
pipereader< complex< T > > in
Definition: sdr.h:1690
int32_t i
Definition: decimators.h:244
pipewriter< complex< T > > out
Definition: sdr.h:1691
unsigned short index
Definition: sdr.h:1694
scheduler * sch
Definition: framework.h:199
float lut_sin[65536]
Definition: sdr.h:1693

Member Function Documentation

◆ run()

template<typename T>
void leansdr::rotator< T >::run ( )
inlinevirtual

Reimplemented from leansdr::runnable_common.

Definition at line 1671 of file sdr.h.

1672  {
1673  unsigned long count = min(in.readable(), out.writable());
1674  complex<T> *pin = in.rd(), *pend = pin + count;
1675  complex<T> *pout = out.wr();
1676 
1677  for (; pin < pend; ++pin, ++pout, ++index)
1678  {
1679  float c = lut_cos[index];
1680  float s = lut_sin[index];
1681  pout->re = pin->re * c - pin->im * s;
1682  pout->im = pin->re * s + pin->im * c;
1683  }
1684 
1685  in.read(count);
1686  out.written(count);
1687  }
float lut_cos[65536]
Definition: sdr.h:1692
pipereader< complex< T > > in
Definition: sdr.h:1690
pipewriter< complex< T > > out
Definition: sdr.h:1691
unsigned short index
Definition: sdr.h:1694
float lut_sin[65536]
Definition: sdr.h:1693
T min(const T &x, const T &y)
Definition: framework.h:440

Member Data Documentation

◆ in

template<typename T>
pipereader<complex<T> > leansdr::rotator< T >::in
private

Definition at line 1690 of file sdr.h.

◆ index

template<typename T>
unsigned short leansdr::rotator< T >::index
private

Definition at line 1694 of file sdr.h.

◆ lut_cos

template<typename T>
float leansdr::rotator< T >::lut_cos[65536]
private

Definition at line 1692 of file sdr.h.

◆ lut_sin

template<typename T>
float leansdr::rotator< T >::lut_sin[65536]
private

Definition at line 1693 of file sdr.h.

◆ out

template<typename T>
pipewriter<complex<T> > leansdr::rotator< T >::out
private

Definition at line 1691 of file sdr.h.


The documentation for this struct was generated from the following file: