LIBML
Version 3.2.4
LIBML DSP Software Library
|
Functions | |
void | tpt_fir_upsample_f32 (f32_t *aOutData, const tpt_fir_upsample_f32_t *aFilter, f32_t *aInData, uint32_t aCount) |
Function for the floating-point Upsampling FIR filter. More... | |
void | tpt_fir_upsample_q15 (q15_t *aOutData, const tpt_fir_upsample_q15_t *aFilter, q15_t *aInData, uint32_t aCount) |
Function for the q15 Upsampling FIR filter. More... | |
void | tpt_fir_upsample_q31 (q31_t *aOutData, const tpt_fir_upsample_q31_t *aFilter, q31_t *aInData, uint32_t aCount) |
Function for the q31 Upsampling FIR filter. More... | |
This functions implement the Upsampling Fir Filter by combine an FIR filter together with a upsampler. They are used in multirate systems for increasing the sample rate of a signal without introducing high frequency images.
When upsampling by a factor of L
, the signal should be filtered by a lowpass filter with a normalized cutoff frequency of 1/L
in order to prevent aliasing distortion. The upsampler inserts L-1
zeros between each sample.
The functions operate on blocks of input and output data. src
points to an array for the length aCount
values and the output dst
points to an array of the length aCount * L
values. The functions use a polyphase filter structure:
dst[n] = b[0] * src[n] + b[L] * src[n - 1] + ... + b[L * (plen - 1)] * src[n - plen + 1] dst[n + 1] = b[1] * src[n] + b[L + 1] * src[n - 1] + ... + b[L * (plen - 1) + 1] * src[n - plen + 1] ... dst[n + (L - 1)] = b[L - 1] * src[n] + b[2 * L - 1] * src[n - 1] + ... + b[L * (plen - 1) + (L - 1)] * src[n - plen + 1] wher b[n] is the filter coefficients.
The coefficients and state variables for a filter are stored together in an instance data structure which is defined as follow. The state variables are updated after each block of data is processed and the coefficients are untouched.
struct { uint32_t uL; uint32_t uLen; (type) *pCoeff; (type) *pState; } tpt_fir_upsample_(type)_t; where *pState points to the state variable array of aCountpLen + aCount - 1
. *pCoeff points to the coefficient array of aCountuL*uPlen
. uLen length of the polyphase filter. uL is the upsampling factor.
void tpt_fir_upsample_f32 | ( | f32_t * | aOutData, |
const tpt_fir_upsample_f32_t * | aFilter, | ||
f32_t * | aInData, | ||
uint32_t | aCount | ||
) |
Function for the floating-point Upsampling FIR filter.
[out] | aOutData | points to the output block data. |
[in] | aFilter | points to an instance of the Upsampling FIR structure. |
[in] | aInData | points to the input block data. |
[in] | aCount | number of the aCount. |
void tpt_fir_upsample_q15 | ( | q15_t * | aOutData, |
const tpt_fir_upsample_q15_t * | aFilter, | ||
q15_t * | aInData, | ||
uint32_t | aCount | ||
) |
Function for the q15 Upsampling FIR filter.
[out] | aOutData | points to the output block data. |
[in] | aFilter | points to an instance of the Upsampling FIR structure. |
[in] | aInData | points to the input block data. |
[in] | aCount | number of the aCount. |
void tpt_fir_upsample_q31 | ( | q31_t * | aOutData, |
const tpt_fir_upsample_q31_t * | aFilter, | ||
q31_t * | aInData, | ||
uint32_t | aCount | ||
) |
Function for the q31 Upsampling FIR filter.
[out] | aOutData | points to the output block data. |
[in] | aFilter | points to an instance of the Upsampling FIR structure. |
[in] | aInData | points to the input block data. |
[in] | aCount | number of the aCount. |