Flan
|
The "r8brain-free-src" library namespace. More...
Classes | |
class | CDSPBlockConvolver |
Single-block overlap-save convolution processing class. More... | |
class | CDSPFIRFilter |
Calculation and storage class for FIR filters. More... | |
class | CDSPFIRFilterCache |
FIR filter cache class. More... | |
class | CDSPFracDelayFilterBank |
Sinc function-based fractional delay filter bank class. More... | |
class | CDSPFracDelayFilterBankCache |
Fractional delay filter cache class. More... | |
class | CDSPFracInterpolator |
Fractional delay filter bank-based interpolator class. More... | |
class | CDSPHBDownsampler |
Half-band downsampler class. More... | |
class | CDSPHBUpsampler |
Half-band upsampling class. More... | |
class | CDSPProcessor |
The base virtual class for DSP processing algorithms. More... | |
class | CDSPRealFFT |
Real-valued FFT transform class. More... | |
class | CDSPRealFFTKeeper |
A "keeper" class for real-valued FFT transform objects. More... | |
class | CDSPResampler |
The master sample rate converter (resampler) class. More... | |
class | CDSPResampler16 |
The resampler class for 16-bit resampling. More... | |
class | CDSPResampler16IR |
The resampler class for 16-bit impulse response resampling. More... | |
class | CDSPResampler24 |
The resampler class for 24-bit resampling. More... | |
class | CDSPSincFilterGen |
Sinc function-based FIR filter generator class. More... | |
class | CFixedBuffer |
Templated memory buffer class for element buffers of fixed capacity. More... | |
class | CPtrKeeper |
Pointer-to-object "keeper" class with automatic deletion. More... | |
class | CSineGen |
Sine signal generator class. More... | |
class | CStdClassAllocator |
The default base class for objects created on heap. More... | |
class | CStdMemAllocator |
The default base class for objects that allocate blocks of memory. More... | |
class | CSyncKeeper |
A "keeper" class for CSyncObject-based synchronization. More... | |
class | CSyncObject |
Multi-threaded synchronization object class. More... | |
class | ooura_fft |
A wrapper class around Takuya OOURA's FFT functions. More... | |
Enumerations | |
enum | EDSPFilterPhaseResponse { fprLinearPhase = 0, fprMinPhase } |
Enumeration of filter's phase responses. More... | |
Functions | |
bool | findGCD (double l, double s, double &GCD) |
bool | getWholeStepping (const double SSampleRate, const double DSampleRate, int &ResInStep, int &ResOutStep) |
Function evaluates source and destination sample rate ratio and returns the required input and output stepping. More... | |
void | calcMinPhaseTransform (double *const Kernel, const int KernelLen, const int LenMult=2, const bool DoFinalMul=true, double *const DCGroupDelay=NULL) |
Function calculates the minimum-phase transform of the filter kernel, using a discrete Hilbert transform in cepstrum domain. More... | |
int | getBitOccupancy (const int v) |
void | calcFIRFilterResponse (const double *flt, int fltlen, const double th, double &re0, double &im0, const int fltlat=0) |
Function calculates frequency response of the specified FIR filter at the specified circular frequency. More... | |
void | calcFIRFilterResponseAndGroupDelay (const double *const flt, const int fltlen, const double th, double &re, double &im, double &gd) |
Function calculates frequency response and group delay of the specified FIR filter at the specified circular frequency. More... | |
void | normalizeFIRFilter (double *const p, const int l, const double DCGain, const int pstep=1) |
Function normalizes FIR filter so that its frequency response at DC is equal to DCGain. More... | |
void | calcSpline3p8Coeffs (double *c, const double xm3, const double xm2, const double xm1, const double x0, const double x1, const double x2, const double x3, const double x4) |
Function calculates coefficients used to calculate 3rd order spline (polynomial) on the equidistant lattice, using 8 points. More... | |
void | calcSpline2p8Coeffs (double *c, const double xm3, const double xm2, const double xm1, const double x0, const double x1, const double x2, const double x3, const double x4) |
Function calculates coefficients used to calculate 2rd order spline (polynomial) on the equidistant lattice, using 8 points. More... | |
void | calcInterpCoeffs3p4 (double *const c, const double *const y) |
Function calculates coefficients used to calculate 3rd order segment interpolation polynomial on the equidistant lattice, using 4 points. More... | |
void | calcInterpCoeffs3p6 (double *const c, const double *const y) |
Function calculates coefficients used to calculate 3rd order segment interpolation polynomial on the equidistant lattice, using 6 points. More... | |
void | calcInterpCoeffs3p8 (double *const c, const double *const y) |
Function calculates coefficients used to calculate 3rd order segment interpolation polynomial on the equidistant lattice, using 8 points. More... | |
void | calcInterpCoeffs2p8 (double *const c, const double *const y) |
Function calculates coefficients used to calculate 3rd order segment interpolation polynomial on the equidistant lattice, using 8 points. More... | |
template<class T > | |
T | min (const T &v1, const T &v2) |
template<class T > | |
T | max (const T &v1, const T &v2) |
double | clampr (const double Value, const double minv, const double maxv) |
Function "clamps" (clips) the specified value so that it is not lesser than "minv", and not greater than "maxv". More... | |
double | sqr (const double x) |
double | pows (const double v, const double p) |
double | gauss (const double v) |
double | asinh (const double v) |
double | besselI0 (const double x) |
double | convertResponseToLog (const double re, const double im) |
void | updateScanStep (double &step, const double curg, double &prevg_log, const double prec, const double maxstep, const double minstep=1e-11) |
An utility function that performs frequency response scanning step update based on the current magnitude response's slope. More... | |
void | findFIRFilterResponseMinLtoR (const double *const flt, const int fltlen, double &ming, double &minth, const double thend) |
Function locates normalized frequency at which the minimum filter gain is reached. More... | |
void | findFIRFilterResponseMaxLtoR (const double *const flt, const int fltlen, double &maxg, double &maxth, const double thend) |
Function locates normalized frequency at which the maximal filter gain is reached. More... | |
void | findFIRFilterResponseLevelRtoL (const double *const flt, const int fltlen, const double maxg, double &th, const double thend) |
Function locates normalized frequency at which the specified maximum filter gain is reached. More... | |
The "r8brain-free-src" library namespace.
The "r8brain-free-src" sample rate converter library namespace.
Enumeration of filter's phase responses.
|
inline |
v | Input value. |
|
inline |
x | Input value. |
|
inline |
Function calculates frequency response of the specified FIR filter at the specified circular frequency.
Phase can be calculated as atan2( im, re ).
flt | FIR filter's coefficients. | |
fltlen | Number of coefficients (taps) in the filter. | |
th | Circular frequency [0; pi]. | |
[out] | re0 | Resulting real part of the complex frequency response. |
[out] | im0 | Resulting imaginary part of the complex frequency response. |
fltlat | Filter's latency in samples. |
|
inline |
Function calculates frequency response and group delay of the specified FIR filter at the specified circular frequency.
The group delay is calculated by evaluating the filter's response at close side-band frequencies of "th".
flt | FIR filter's coefficients. | |
fltlen | Number of coefficients (taps) in the filter. | |
th | Circular frequency [0; pi]. | |
[out] | re | Resulting real part of the complex frequency response. |
[out] | im | Resulting imaginary part of the complex frequency response. |
[out] | gd | Resulting group delay at the specified frequency, in samples. |
|
inline |
Function calculates coefficients used to calculate 3rd order segment interpolation polynomial on the equidistant lattice, using 8 points.
[out] | c | Output coefficients buffer, length = 3. |
[in] | y | Equidistant point values. Value at offset 3 corresponds to x=0 point. |
|
inline |
Function calculates coefficients used to calculate 3rd order segment interpolation polynomial on the equidistant lattice, using 4 points.
[out] | c | Output coefficients buffer, length = 4. |
[in] | y | Equidistant point values. Value at offset 1 corresponds to x=0 point. |
|
inline |
Function calculates coefficients used to calculate 3rd order segment interpolation polynomial on the equidistant lattice, using 6 points.
[out] | c | Output coefficients buffer, length = 4. |
[in] | y | Equidistant point values. Value at offset 2 corresponds to x=0 point. |
|
inline |
Function calculates coefficients used to calculate 3rd order segment interpolation polynomial on the equidistant lattice, using 8 points.
[out] | c | Output coefficients buffer, length = 4. |
[in] | y | Equidistant point values. Value at offset 3 corresponds to x=0 point. |
|
inline |
Function calculates the minimum-phase transform of the filter kernel, using a discrete Hilbert transform in cepstrum domain.
For more details, see part III.B of http://www.hpl.hp.com/personal/Niranjan_Damera-Venkata/files/ComplexMinPhase.pdf
[in,out] | Kernel | Filter kernel buffer. |
KernelLen | Filter kernel's length, in samples. | |
LenMult | Kernel length multiplier. Used as a coefficient of the "oversampling" in the frequency domain. Such oversampling is needed to improve the precision of the minimum-phase transform. If the filter's attenuation is high, this multiplier should be increased or otherwise the required attenuation will not be reached due to "smoothing" effect of this transform. | |
DoFinalMul | "True" if the final multiplication after transform should be performed or not. Such multiplication returns the gain of the signal to its original value. This parameter can be set to "false" if normalization of the resulting filter kernel is planned to be used. | |
[out] | DCGroupDelay | If not NULL, this variable receives group delay at DC offset, in samples (can be a non-integer value). |
|
inline |
Function calculates coefficients used to calculate 2rd order spline (polynomial) on the equidistant lattice, using 8 points.
This function is based on the calcSpline3Coeffs8() function, but without the 3rd order coefficient.
[out] | c | Output coefficients buffer, length = 3. |
xm3 | Point at x-3 position. | |
xm2 | Point at x-2 position. | |
xm1 | Point at x-1 position. | |
x0 | Point at x position. | |
x1 | Point at x+1 position. | |
x2 | Point at x+2 position. | |
x3 | Point at x+3 position. | |
x4 | Point at x+4 position. |
|
inline |
Function calculates coefficients used to calculate 3rd order spline (polynomial) on the equidistant lattice, using 8 points.
[out] | c | Output coefficients buffer, length = 4. |
xm3 | Point at x-3 position. | |
xm2 | Point at x-2 position. | |
xm1 | Point at x-1 position. | |
x0 | Point at x position. | |
x1 | Point at x+1 position. | |
x2 | Point at x+2 position. | |
x3 | Point at x+3 position. | |
x4 | Point at x+4 position. |
|
inline |
Function "clamps" (clips) the specified value so that it is not lesser than "minv", and not greater than "maxv".
Value | Value to clamp. |
minv | Minimal allowed value. |
maxv | Maximal allowed value. |
|
inline |
re | Real part of the frequency response. |
im | Imaginary part of the frequency response. |
|
inline |
Function locates normalized frequency at which the specified maximum filter gain is reached.
The scanning is performed from higher (right) to lower (left) frequencies, scanning stops when the required gain value was crossed. Function uses an extremely efficient binary search and thus expects that the magnitude response has the "main lobe" form produced by windowing, with a minimal pass-band ripple.
flt | Filter response. | |
fltlen | Filter response's length in samples (taps). | |
maxg | Maximal gain (squared). | |
[out] | th | The current normalized frequency. On function's return will point to the normalized frequency where "maxg" is reached. |
thend | The leftmost frequency to scan, inclusive. |
|
inline |
Function locates normalized frequency at which the maximal filter gain is reached.
The scanning is performed from lower (left) to higher (right) frequencies, the whole range is scanned.
Note: this function may "stall" in very rare cases if the magnitude response happens to be "saw-tooth" like, requiring a very small stepping to be used. If this happens, it may take dozens of seconds to complete.
flt | Filter response. | |
fltlen | Filter response's length in samples (taps). | |
[out] | maxg | The current maximal gain (squared). On function's return will contain the maximal gain value (squared). |
[out] | maxth | The normalized frequency where the maximal gain is currently at. On function's return will point to the normalized frequency where the maximum was reached. |
thend | The ending frequency, inclusive. |
|
inline |
Function locates normalized frequency at which the minimum filter gain is reached.
The scanning is performed from lower (left) to higher (right) frequencies, the whole range is scanned.
Function expects that the magnitude response is always reducing from lower to high frequencies, starting at "minth".
flt | Filter response. | |
fltlen | Filter response's length in samples (taps). | |
[out] | ming | The current minimal gain (squared). On function's return will contain the minimal gain value found (squared). |
[out] | minth | The normalized frequency where the minimal gain is currently at. On function's return will point to the normalized frequency where the new minimum was found. |
thend | The ending frequency, inclusive. |
|
inline |
l | Number 1. | |
s | Number 2. | |
[out] | GCD | Resulting GCD. |
|
inline |
v | Input value. |
|
inline |
v | Input value. |
|
inline |
Function evaluates source and destination sample rate ratio and returns the required input and output stepping.
Function returns "false" if *this class cannot be used to perform interpolation using these sample rates.
SSampleRate | Source sample rate. | |
DSampleRate | Destination sample rate. | |
[out] | ResInStep | Resulting input step. |
[out] | ResOutStep | Resulting output step. |
|
inline |
v1 | Value 1. |
v2 | Value 2. |
|
inline |
v1 | Value 1. |
v2 | Value 2. |
|
inline |
Function normalizes FIR filter so that its frequency response at DC is equal to DCGain.
[in,out] | p | Filter coefficients. |
l | Filter length. | |
DCGain | Filter's gain at DC (linear, non-decibel value). | |
pstep | "p" array step. |
|
inline |
v | Input value. |
p | Power factor. |
|
inline |
x | Value to square. |
|
inline |
An utility function that performs frequency response scanning step update based on the current magnitude response's slope.
[in,out] | step | The current scanning step. Will be updated on function's return. Must be a positive value. |
curg | Squared magnitude response at the current frequency point. | |
[in,out] | prevg_log | Previous magnitude response, log scale. Will be updated on function's return. |
prec | Precision multiplier, affects the size of the step. | |
maxstep | The maximal allowed step. | |
minstep | The minimal allowed step. |