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 | Public Attributes | Private Attributes | List of all members
leansdr::ss_estimator< T > Struct Template Reference

#include <sdr.h>

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

Public Member Functions

 ss_estimator (scheduler *sch, pipebuf< complex< T >> &_in, pipebuf< T > &_out)
 
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 ()
 

Public Attributes

unsigned long window_size
 
unsigned long decimation
 
- Public Attributes inherited from leansdr::runnable_common
const char * name
 

Private Attributes

pipereader< complex< T > > in
 
pipewriter< T > out
 
unsigned long phase
 

Additional Inherited Members

- Protected Attributes inherited from leansdr::runnable
schedulersch
 

Detailed Description

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

Definition at line 224 of file sdr.h.

Constructor & Destructor Documentation

◆ ss_estimator()

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

Definition at line 229 of file sdr.h.

229  : runnable(sch, "SS estimator"),
230  window_size(1024),
231  decimation(1024),
232  in(_in),
233  out(_out),
234  phase(0)
235  {
236  }
unsigned long window_size
Definition: sdr.h:226
runnable(scheduler *_sch, const char *name)
Definition: framework.h:193
unsigned long decimation
Definition: sdr.h:227
pipewriter< T > out
Definition: sdr.h:261
pipereader< complex< T > > in
Definition: sdr.h:260
unsigned long phase
Definition: sdr.h:262
scheduler * sch
Definition: framework.h:199

Member Function Documentation

◆ run()

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

Reimplemented from leansdr::runnable_common.

Definition at line 238 of file sdr.h.

References leansdr::auto_notch< T >::decimation, leansdr::complex< T >::im, leansdr::auto_notch< T >::in, leansdr::auto_notch< T >::out, leansdr::auto_notch< T >::phase, and leansdr::complex< T >::re.

239  {
240  while (in.readable() >= window_size && out.writable() >= 1)
241  {
242  phase += window_size;
243 
244  if (phase >= decimation)
245  {
246  phase -= decimation;
247  complex<T> *p = in.rd(), *pend = p + window_size;
248  float s = 0;
249 
250  for (; p < pend; ++p)
251  s += (float)p->re * p->re + (float)p->im * p->im;
252 
253  out.write(sqrtf(s / window_size));
254  }
255  in.read(window_size);
256  }
257  }
unsigned long window_size
Definition: sdr.h:226
unsigned long decimation
Definition: sdr.h:227
pipewriter< T > out
Definition: sdr.h:261
pipereader< complex< T > > in
Definition: sdr.h:260
unsigned long phase
Definition: sdr.h:262

Member Data Documentation

◆ decimation

template<typename T >
unsigned long leansdr::ss_estimator< T >::decimation

Definition at line 227 of file sdr.h.

◆ in

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

Definition at line 260 of file sdr.h.

◆ out

template<typename T >
pipewriter<T> leansdr::ss_estimator< T >::out
private

Definition at line 261 of file sdr.h.

◆ phase

template<typename T >
unsigned long leansdr::ss_estimator< T >::phase
private

Definition at line 262 of file sdr.h.

◆ window_size

template<typename T >
unsigned long leansdr::ss_estimator< T >::window_size

Definition at line 226 of file sdr.h.


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