Audacity  2.2.2
Macros | Functions
Biquad.cpp File Reference
#include "Biquad.h"

Go to the source code of this file.

Macros

#define square(a)   ((a)*(a))
 

Functions

void Biquad_Process (BiquadStruct *pBQ, int iNumSamples)
 
void ComplexDiv (float fNumerR, float fNumerI, float fDenomR, float fDenomI, float *pfQuotientR, float *pfQuotientI)
 
bool BilinTransform (float fSX, float fSY, float *pfZX, float *pfZY)
 
float Calc2D_DistSqr (float fX1, float fY1, float fX2, float fY2)
 

Macro Definition Documentation

#define square (   a)    ((a)*(a))

Definition at line 3 of file Biquad.cpp.

Referenced by BilinTransform(), Calc2D_DistSqr(), and ComplexDiv().

Function Documentation

bool BilinTransform ( float  fSX,
float  fSY,
float *  pfZX,
float *  pfZY 
)

Definition at line 39 of file Biquad.cpp.

References square.

Referenced by EffectScienFilter::CalcFilter().

40 {
41  float fDenom = square (1 - fSX) + square (fSY);
42  *pfZX = (1 - square (fSX) - square (fSY)) / fDenom;
43  *pfZY = 2 * fSY / fDenom;
44  return true;
45 }
#define square(a)
Definition: Biquad.cpp:3
void Biquad_Process ( BiquadStruct pBQ,
int  iNumSamples 
)

Definition at line 5 of file Biquad.cpp.

References BiquadStruct::fDenomCoeffs, BiquadStruct::fNumerCoeffs, BiquadStruct::fPrevIn, BiquadStruct::fPrevOut, BiquadStruct::fPrevPrevIn, BiquadStruct::fPrevPrevOut, BiquadStruct::pfIn, and BiquadStruct::pfOut.

Referenced by EffectScienFilter::ProcessBlock().

6 {
7  float* pfIn = pBQ->pfIn;
8  float* pfOut = pBQ->pfOut;
9  float fPrevIn = pBQ->fPrevIn;
10  float fPrevPrevIn = pBQ->fPrevPrevIn;
11  float fPrevOut = pBQ->fPrevOut;
12  float fPrevPrevOut = pBQ->fPrevPrevOut;
13  for (int i = 0; i < iNumSamples; i++)
14  {
15  float fIn = *pfIn++;
16  *pfOut = fIn * pBQ->fNumerCoeffs [0] +
17  fPrevIn * pBQ->fNumerCoeffs [1] +
18  fPrevPrevIn * pBQ->fNumerCoeffs [2] -
19  fPrevOut * pBQ->fDenomCoeffs [0] -
20  fPrevPrevOut * pBQ->fDenomCoeffs [1];
21  fPrevPrevIn = fPrevIn;
22  fPrevIn = fIn;
23  fPrevPrevOut = fPrevOut;
24  fPrevOut = *pfOut++;
25  }
26  pBQ->fPrevIn = fPrevIn;
27  pBQ->fPrevPrevIn = fPrevPrevIn;
28  pBQ->fPrevOut = fPrevOut;
29  pBQ->fPrevPrevOut = fPrevPrevOut;
30 }
float fPrevPrevOut
Definition: Biquad.h:28
float fPrevOut
Definition: Biquad.h:27
float * pfOut
Definition: Biquad.h:22
float fPrevPrevIn
Definition: Biquad.h:26
float fDenomCoeffs[2]
Definition: Biquad.h:24
float fNumerCoeffs[3]
Definition: Biquad.h:23
float * pfIn
Definition: Biquad.h:21
float fPrevIn
Definition: Biquad.h:25
float Calc2D_DistSqr ( float  fX1,
float  fY1,
float  fX2,
float  fY2 
)

Definition at line 47 of file Biquad.cpp.

References square.

Referenced by EffectScienFilter::CalcFilter().

48 {
49  return square (fX1 - fX2) + square (fY1 - fY2);
50 }
#define square(a)
Definition: Biquad.cpp:3
void ComplexDiv ( float  fNumerR,
float  fNumerI,
float  fDenomR,
float  fDenomI,
float *  pfQuotientR,
float *  pfQuotientI 
)

Definition at line 32 of file Biquad.cpp.

References square.

Referenced by EffectScienFilter::CalcFilter().

33 {
34  float fDenom = square(fDenomR) + square(fDenomI);
35  *pfQuotientR = (fNumerR * fDenomR + fNumerI * fDenomI) / fDenom;
36  *pfQuotientI = (fNumerI * fDenomR - fNumerR * fDenomI) / fDenom;
37 }
#define square(a)
Definition: Biquad.cpp:3