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::naive_lowpass< T > Struct Template Reference

#include <dsp.h>

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

Public Member Functions

 naive_lowpass (scheduler *sch, pipebuf< T > &_in, pipebuf< T > &_out, int _w)
 
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< T > in
 
pipewriter< T > out
 
int w
 

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::naive_lowpass< T >

Definition at line 235 of file dsp.h.

Constructor & Destructor Documentation

◆ naive_lowpass()

template<typename T >
leansdr::naive_lowpass< T >::naive_lowpass ( scheduler sch,
pipebuf< T > &  _in,
pipebuf< T > &  _out,
int  _w 
)
inline

Definition at line 237 of file dsp.h.

238  : runnable(sch, "lowpass"), in(_in), out(_out), w(_w)
239  {
240  }
pipereader< T > in
Definition: dsp.h:262
runnable(scheduler *_sch, const char *name)
Definition: framework.h:193
scheduler * sch
Definition: framework.h:199
pipewriter< T > out
Definition: dsp.h:263

Member Function Documentation

◆ run()

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

Reimplemented from leansdr::runnable_common.

Definition at line 242 of file dsp.h.

References i, leansdr::cconverter< Tin, Zin, Tout, Zout, Gn, Gd >::in, leansdr::min(), and leansdr::cconverter< Tin, Zin, Tout, Zout, Gn, Gd >::out.

243  {
244  if (in.readable() < w)
245  return;
246  unsigned long count = min(in.readable() - w, out.writable());
247  T *pin = in.rd(), *pend = pin + count;
248  T *pout = out.wr();
249  float k = 1.0 / w;
250  for (; pin < pend; ++pin, ++pout)
251  {
252  T x = 0.0;
253  for (int i = 0; i < w; ++i)
254  x = x + pin[i];
255  *pout = x * k;
256  }
257  in.read(count);
258  out.written(count);
259  }
pipereader< T > in
Definition: dsp.h:262
int32_t i
Definition: decimators.h:244
pipewriter< T > out
Definition: dsp.h:263
T min(const T &x, const T &y)
Definition: framework.h:440
+ Here is the call graph for this function:

Member Data Documentation

◆ in

template<typename T >
pipereader<T> leansdr::naive_lowpass< T >::in
private

Definition at line 262 of file dsp.h.

◆ out

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

Definition at line 263 of file dsp.h.

◆ w

template<typename T >
int leansdr::naive_lowpass< T >::w
private

Definition at line 264 of file dsp.h.


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