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.
Macros | Functions
misc.h File Reference
#include <math.h>
+ Include dependency graph for misc.h:
+ This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Macros

#define M_PI   3.14159265358979323846
 

Functions

float sinc (float x)
 
float cosc (float x)
 
float clamp (float x, float min, float max)
 
float decayavg (float average, float input, int weight)
 This is always called with an int weight. More...
 
float blackman (float x)
 
float hamming (float x)
 
float hanning (float x)
 
float rcos (float t, float T, float alpha=1.0)
 

Macro Definition Documentation

◆ M_PI

#define M_PI   3.14159265358979323846

Definition at line 30 of file misc.h.

Referenced by blackman(), cosc(), hamming(), hanning(), rcos(), and sinc().

Function Documentation

◆ blackman()

float blackman ( float  x)
inline

Definition at line 55 of file misc.h.

References cos(), and M_PI.

56 {
57  return (0.42 - 0.50 * cos(2 * M_PI * x) + 0.08 * cos(4 * M_PI * x));
58 }
Fixed< IntType, IntBits > cos(Fixed< IntType, IntBits > const &x)
Definition: fixed.h:2271
#define M_PI
Definition: misc.h:30
+ Here is the call graph for this function:

◆ clamp()

float clamp ( float  x,
float  min,
float  max 
)
inline

Definition at line 42 of file misc.h.

References leansdr::max(), and leansdr::min().

43 {
44  return (x < min) ? min : ((x > max) ? max : x);
45 }
T max(const T &x, const T &y)
Definition: framework.h:446
T min(const T &x, const T &y)
Definition: framework.h:440
+ Here is the call graph for this function:

◆ cosc()

float cosc ( float  x)
inline

Definition at line 37 of file misc.h.

References cos(), and M_PI.

38 {
39  return (fabs(x) < 1e-10) ? 0.0 : ((1.0 - cos(M_PI * x)) / (M_PI * x));
40 }
Fixed< IntType, IntBits > cos(Fixed< IntType, IntBits > const &x)
Definition: fixed.h:2271
#define M_PI
Definition: misc.h:30
+ Here is the call graph for this function:

◆ decayavg()

float decayavg ( float  average,
float  input,
int  weight 
)
inline

This is always called with an int weight.

Definition at line 48 of file misc.h.

49 {
50  if (weight <= 1) return input;
51  return ( ( input - average ) / (float)weight ) + average ;
52 }

◆ hamming()

float hamming ( float  x)
inline

Definition at line 60 of file misc.h.

References cos(), and M_PI.

61 {
62  return 0.54 - 0.46 * cos(2 * M_PI * x);
63 }
Fixed< IntType, IntBits > cos(Fixed< IntType, IntBits > const &x)
Definition: fixed.h:2271
#define M_PI
Definition: misc.h:30
+ Here is the call graph for this function:

◆ hanning()

float hanning ( float  x)
inline

Definition at line 65 of file misc.h.

References cos(), and M_PI.

66 {
67  return 0.5 - 0.5 * cos(2 * M_PI * x);
68 }
Fixed< IntType, IntBits > cos(Fixed< IntType, IntBits > const &x)
Definition: fixed.h:2271
#define M_PI
Definition: misc.h:30
+ Here is the call graph for this function:

◆ rcos()

float rcos ( float  t,
float  T,
float  alpha = 1.0 
)
inline

Definition at line 70 of file misc.h.

References cos(), M_PI, and sin().

71 {
72  if( t == 0 ) return 1.0;
73  float taT = T / (2.0 * alpha);
74  if( fabs(t) == taT ) return ((alpha/2.0) * sin(M_PI/(2.0*alpha)));
75  return (sin(M_PI*t/T)/(M_PI*t/T))*cos(alpha*M_PI*t/T)/(1.0-(t/taT)*(t/taT));
76 }
Fixed< IntType, IntBits > cos(Fixed< IntType, IntBits > const &x)
Definition: fixed.h:2271
Fixed< IntType, IntBits > sin(Fixed< IntType, IntBits > const &x)
Definition: fixed.h:2265
#define M_PI
Definition: misc.h:30
+ Here is the call graph for this function:

◆ sinc()

float sinc ( float  x)
inline

Definition at line 32 of file misc.h.

References M_PI, and sin().

Referenced by leansdr::filtergen::lowpass().

33 {
34  return (fabs(x) < 1e-10) ? 1.0 : (sin(M_PI * x) / (M_PI * x));
35 }
Fixed< IntType, IntBits > sin(Fixed< IntType, IntBits > const &x)
Definition: fixed.h:2265
#define M_PI
Definition: misc.h:30
+ Here is the call graph for this function:
+ Here is the caller graph for this function: