Half-band downsampler class. More...
#include <CDSPHBDownsampler.h>
Public Member Functions | |
| CDSPHBDownsampler (const double ReqAtten, const int SteepIndex, const bool IsThird, const double PrevLatency) | |
| Initalizes the half-band downsampler. | |
| virtual void | clear () |
| Clears (resets) the state of this object and returns it to the state after construction. | |
| virtual int | getInLenBeforeOutPos (const int ReqOutPos) const |
| Returns the number of input samples required to advance to the specified output sample position (so that the next process() call passes this output position). | |
| virtual int | getLatency () const |
| Return the latency, in samples, which is present in the output signal. | |
| virtual double | getLatencyFrac () const |
| Returns fractional latency, in samples, which is present in the output signal. | |
| virtual int | getMaxOutLen (const int MaxInLen) const |
Returns the maximal length of the output buffer required when processing the MaxInLen number of input samples. | |
| virtual int | process (double *ip, int l, double *&op0) |
| Performs DSP processing. | |
Half-band downsampler class.
Class implements brute-force half-band 2X downsampling that uses small sparse symmetric FIR filters. The output has 2.0 gain.
| r8b::CDSPHBDownsampler::CDSPHBDownsampler | ( | const double | ReqAtten, |
| const int | SteepIndex, | ||
| const bool | IsThird, | ||
| const double | PrevLatency ) |
Initalizes the half-band downsampler.
| ReqAtten | Required half-band filter attentuation. |
| SteepIndex | Steepness index - 0=steepest. Corresponds to general downsampling ratio, e.g., at 4x downsampling 0 is used, at 8x downsampling 1 is used, etc. |
| IsThird | true if 1/3 resampling is performed. |
| PrevLatency | Latency, in samples (any non-negative value), which was left in the output signal by a previous process. Whole-number latency will be consumed by this object while remaining fractional latency can be obtained via the getLatencyFrac() function. |
|
virtual |
Clears (resets) the state of this object and returns it to the state after construction.
All input data accumulated in the internal buffer so far will be discarded.
Implements r8b::CDSPProcessor.
|
virtual |
Returns the number of input samples required to advance to the specified output sample position (so that the next process() call passes this output position).
Assumes starting at the cleared or after-construction state of this object.
Note that the implementation of this function assumes the caller only needs to estimate an initial buffering requirement; passing a full sample length value (e.g., greater than 100000) may overflow the calculation or cause rounding errors.
| ReqOutPos | The required output position. Set to 0 to obtain "input length before output start" latency. Must be a non-negative value. |
Implements r8b::CDSPProcessor.
|
virtual |
Return the latency, in samples, which is present in the output signal.
This value is usually zero if the DSP processor "consumes" the latency automatically.
Implements r8b::CDSPProcessor.
|
virtual |
Returns fractional latency, in samples, which is present in the output signal.
This value is usually zero if a linear-phase filtering is used. With minimum-phase filters in use, this value can be non-zero even if the getLatency() function returns zero.
Implements r8b::CDSPProcessor.
|
virtual |
Returns the maximal length of the output buffer required when processing the MaxInLen number of input samples.
| MaxInLen | The number of samples planned to process at once, at most. |
Implements r8b::CDSPProcessor.
|
virtual |
Performs DSP processing.
| ip | Input data pointer. | |
| l0 | How many samples to process. | |
| [out] | op0 | Output data pointer. The capacity of this buffer should be equal to the value returned by the getMaxOutLen() function for the given l0. This buffer can be equal to ip only if the getMaxOutLen( l0 ) call returned a value lesser than l0. This pointer can be incremented on function's return if latency compensation was performed by the processor. Note that on function's return, this pointer may point to some internal buffers, including the ip buffer, ignoring the originally passed value. |
op0 buffer and available after processing. This value can be smaller or larger in comparison to the original l0 value due to processing and filter's latency compensation that took place, and due to resampling if it was performed. Implements r8b::CDSPProcessor.