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 | CDSPRealFFTSetup |
| Real-valued FFT setup class. 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 | CRefKeeper |
| Reference "keeper" class with automatic unref() call. More... | |
| class | CSineGen |
| Sine signal generator class. More... | |
| class | CSinglyLinkedListItem |
| Class for items of a singly-linked list. 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... | |
Typedefs | |
| typedef double | realfft_t |
| Forward transform's native type. | |
Enumerations | |
| enum | EDSPFilterPhaseResponse { fprLinearPhase = 0 , fprMinPhase } |
| Enumeration of filter's phase responses. More... | |
Functions | |
| template<typename T> | |
| T * | align_ptr (T *const ptr, const uintptr_t align) |
Forces the provided ptr pointer to be aligned to align bytes. | |
| double | besselI0 (const double x) |
| 1st kind, 0th order modified Bessel function of a value. | |
| double | calcFIRFilterGroupDelay (const double *const flt, const int fltlen, const double th) |
| FIR filter's group delay calculation function. | |
| void | calcFIRFilterResponse (const double *flt, int fltlen, const double th, double &re0, double &im0, const int fltlat=0) |
| FIR filter's frequency response calculation. | |
| void | calcMinPhaseTransform (double *const Kernel, const int KernelLen, const int LenMult=2, const bool DoFinalMul=true, double *const DCGroupDelay=R8B_NULL) |
| Calculates the minimum-phase transform of the filter kernel, using a discrete Hilbert transform in cepstrum domain. | |
| void | calcSpline2p8Coeffs (double *const 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) |
| Calculates 2nd order spline coefficients, using 8 points. | |
| void | calcSpline3p4Coeffs (double *const c, const double *const y) |
| Calculates 3rd order spline coefficients, using 4 points. | |
| void | calcSpline3p6Coeffs (double *const c, const double *const y) |
| Calculates 3rd order spline coefficients, using 6 points. | |
| void | calcSpline3p8Coeffs (double *const 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) |
| Calculates 3rd order spline coefficients, using 8 points. | |
| double | clampr (const double Value, const double minv, const double maxv) |
| Clamps a value to be within the specified min-max range. | |
| template<typename T> | |
| T * | construct_ptr (void *const ptr, const size_t c) |
Performs placement new to turn a block of unoccupied memory into a "constructed" array of elements of type T. | |
| bool | findGCD (double l, double s, double &GCD) |
| Interatively searches for a greatest common denominator (GCD) of 2 numbers. | |
| int | getBitOccupancy (const int v) |
| Calculate the exact number of bits a value needs for representation. | |
| bool | getWholeStepping (const double SSampleRate, const double DSampleRate, int &ResInStep, int &ResOutStep) |
| Evaluates source and destination sample rate ratio and returns the required input and output stepping. | |
| template<typename T> | |
| T | max (const T &v1, const T &v2) |
| Returns maximum of two values. | |
| template<typename T> | |
| T | min (const T &v1, const T &v2) |
| Returns minimum of two values. | |
| void | normalizeFIRFilter (double *const p, const int l, const double DCGain, const int pstep=1) |
| FIR filter's gain normalization. | |
| double | pow_a (const double v, const double p) |
| Power of an absolute value. | |
| double | sqr (const double x) |
| Returns square ot a value. | |
Variables | |
| R8B_CONST double | R8B_2PI = 6.28318530717958648 |
Equals 2*pi. | |
| R8B_CONST double | R8B_3PI = 9.42477796076937972 |
Equals 3*pi. | |
| R8B_CONST double | R8B_PI = 3.14159265358979324 |
Equals pi. | |
| R8B_CONST double | R8B_PId2 = 1.57079632679489662 |
Equals 0.5*pi. | |
The "r8brain-free-src" library namespace.
The "r8brain-free-src" sample rate converter library namespace.
Enumeration of filter's phase responses.
| T * r8b::align_ptr | ( | T *const | ptr, |
| const uintptr_t | align ) |
Forces the provided ptr pointer to be aligned to align bytes.
Works with power-of-2 alignments only.
| ptr | Pointer to align. |
| align | Alignment, in bytes, power-of-2. |
| T | Pointer's element type. |
| double r8b::besselI0 | ( | const double | x | ) |
1st kind, 0th order modified Bessel function of a value.
| x | Input value. |
| double r8b::calcFIRFilterGroupDelay | ( | const double *const | flt, |
| const int | fltlen, | ||
| const double | th ) |
FIR filter's group delay calculation function.
Function calculates 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]. |
| void r8b::calcFIRFilterResponse | ( | const double * | flt, |
| int | fltlen, | ||
| const double | th, | ||
| double & | re0, | ||
| double & | im0, | ||
| const int | fltlat = 0 ) |
FIR filter's frequency response calculation.
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. |
| void r8b::calcMinPhaseTransform | ( | double *const | Kernel, |
| const int | KernelLen, | ||
| const int | LenMult = 2, | ||
| const bool | DoFinalMul = true, | ||
| double *const | DCGroupDelay = R8B_NULL ) |
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 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. 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 nullptr, this variable receives group delay at DC offset, in samples (can be a non-integer value). |
| void r8b::calcSpline2p8Coeffs | ( | double *const | 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 ) |
Calculates 2nd order spline coefficients, using 8 points.
Function calculates coefficients used to calculate 2nd order spline (polynomial) on the equidistant lattice, using 8 points. This function is based on the calcSpline3p8Coeffs() 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. |
| void r8b::calcSpline3p4Coeffs | ( | double *const | c, |
| const double *const | y ) |
Calculates 3rd order spline coefficients, using 4 points.
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. |
| void r8b::calcSpline3p6Coeffs | ( | double *const | c, |
| const double *const | y ) |
Calculates 3rd order spline coefficients, using 6 points.
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. |
| void r8b::calcSpline3p8Coeffs | ( | double *const | 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 ) |
Calculates 3rd order spline coefficients, using 8 points.
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. |
| double r8b::clampr | ( | const double | Value, |
| const double | minv, | ||
| const double | maxv ) |
Clamps a value to be within the specified min-max range.
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. |
| T * r8b::construct_ptr | ( | void *const | ptr, |
| const size_t | c ) |
Performs placement new to turn a block of unoccupied memory into a "constructed" array of elements of type T.
| ptr | Pointer for placement of elements. |
| c | The number of elements to "construct". |
| T | Required element type. |
| bool r8b::findGCD | ( | double | l, |
| double | s, | ||
| double & | GCD ) |
Interatively searches for a greatest common denominator (GCD) of 2 numbers.
| l | Number 1. | |
| s | Number 2. | |
| [out] | GCD | Resulting GCD. |
true if the greatest common denominator of 2 numbers was found. | int r8b::getBitOccupancy | ( | const int | v | ) |
Calculate the exact number of bits a value needs for representation.
| v | Input value. |
| bool r8b::getWholeStepping | ( | const double | SSampleRate, |
| const double | DSampleRate, | ||
| int & | ResInStep, | ||
| int & | ResOutStep ) |
Evaluates source and destination sample rate ratio and returns the required input and output stepping.
Function returns false if whole stepping 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. |
true if stepping was acquired. | T r8b::max | ( | const T & | v1, |
| const T & | v2 ) |
Returns maximum of two values.
| v1 | Value 1. |
| v2 | Value 2. |
| T | Values' type. |
| T r8b::min | ( | const T & | v1, |
| const T & | v2 ) |
Returns minimum of two values.
| v1 | Value 1. |
| v2 | Value 2. |
| T | Values' type. |
| void r8b::normalizeFIRFilter | ( | double *const | p, |
| const int | l, | ||
| const double | DCGain, | ||
| const int | pstep = 1 ) |
FIR filter's gain normalization.
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. |
| double r8b::pow_a | ( | const double | v, |
| const double | p ) |
Power of an absolute value.
| v | Input value. |
| p | Power factor. |
| double r8b::sqr | ( | const double | x | ) |
Returns square ot a value.
| x | Value to square. |