FIRUp

Directly filters a source vector through a FIR filter with upsampling and interpolation.

Syntax

Intel IPP style:

IppStatus ippsqFIRUpDirect_32f (const Ipp32f *pSrc, Ipp32f *pDst, Ipp32u srcLen, const Ipp32f* pTaps, Ipp32u tapsLen, Ipp32u upFactor, Ipp32f* pDlyLine);

IppStatus ippsqFIRUpDirectQ15_16s_Rms (const Ipp16s *pSrc, Ipp16s *pDst, Ipp32u srcLen, const Ipp16s* pTaps, Ipp32u tapsLen, Ipp32u upFactor, Ipp16s* pDlyLine);

IppStatus ippsqFIRUpDirectQ31_32s_Rms (const Ipp32s *pSrc, Ipp32s *pDst, Ipp32u srcLen, const Ipp32s* pTaps, Ipp32u tapsLen, Ipp32u upFactor, Ipp32s* pDlyLine);

DSP style:

typedef struct {
    Ipp8u   L;
    Ipp16u  phaseLength;
    Ipp32f *pCoeffs;
    Ipp32f *pState;
} ippsq_fir_interpolate_instance_f32;

ippsq_status ippsq_fir_interpolate_init_f32 (ippsq_fir_interpolate_instance_f32 *S, uint8_t L, uint16_t numTaps, float32_t *pCoeffs, float32_t *pState, uint32_t blockSize);

void ippsq_fir_interpolate_f32 (const ippsq_fir_interpolate_instance_f32 *S, float32_t *pSrc, float32_t *pDst, uint32_t blockSize);

typedef struct {
    Ipp8u   L;
    Ipp16u  phaseLength;
    Ipp16s *pCoeffs;
    Ipp16s *pState;
} ippsq_fir_interpolate_instance_q15;

ippsq_status ippsq_fir_interpolate_init_q15 (ippsq_fir_interpolate_instance_q15 *S, uint8_t L, uint16_t numTaps, q15_t *pCoeffs, q15_t *pState, uint32_t blockSize);

void ippsq_fir_interpolate_q15 (const ippsq_fir_interpolate_instance_q15 *S, q15_t *pSrc, q15_t *pDst, uint32_t blockSize);

typedef struct {
    Ipp8u   L;
    Ipp16u  phaseLength;
    Ipp32s *pCoeffs;
    Ipp32s *pState;
} ippsq_fir_interpolate_instance_q31;

ippsq_status ippsq_fir_interpolate_init_q31 (ippsq_fir_interpolate_instance_q31 *S, uint8_t L, uint16_t numTaps, q31_t *pCoeffs, q31_t *pState, uint32_t blockSize);

void ippsq_fir_interpolate_q31 (const ippsq_fir_interpolate_instance_q31 *S, q31_t *pSrc, q31_t *pDst, uint32_t blockSize);

Include Files

ippsq.h

dsp.h

Parameters

pSrc

Pointer to the source vector.

pDst

Pointer to the destination vector. The number of elements of pDst must be at least srcLen * upFactor.

srcLen, blockSize

Number of elements in the source vector; can be zero.

pTaps, pCoeffs

Pointer to the array containing the tap values. The number of elements in the array is tapsLen.

tapsLen, numTaps

Number of elements in the array containing the tap values. The value must be a multiple of the interpolation factor upFactor.

upFactor, L

Signal upsampling factor.

phaseLength

Signal upsampling phase; the value of phaseLength is equal to numTaps/L.

pDlyLine, pState

Pointer to the array containing the delay line values.

Description

This function passes a source vector pSrc through an upsampling filter, and stores the resulting samples in pDst. The values of filter coefficients (taps) are specified in the tapsLen-length array pTaps. The array pDlyLine specifies the delay line values. The input array pSrc contains srcLen samples, and the output array pDst stores the resulting (srcLen * upFactor) samples.

The algorithm is implemented as a single operation that includes two steps: filtering with a single-rate FIR filter and upsampling.

The upFactor parameter denotes the factor by which the filtered signal is internally upsampled or interpolated.

The length of the delay line array pDlyLine is defined as (srcLen + tapsLen / upFactor - 1).

Note

Parameters in the above description have Intel IPP-style names. For the corresponding DSP-style parameter names, refer to the Parameters section.

Intel IPP style:

When using Intel IPP-style APIs, you do not need to call any initialization functions. Intel IPP-style functions directly get all necessary parameters as arguments.

Function flavors with the _Rms suffix round down the resulting value and perform saturation if the resulting value exceeds the data range.

DSP style: Each function type (f32, q15, and q31) has its own state structure, which must be initialized with the corresponding initialization function. The initialization function copies arguments into the state structure and sets the pState array to zero. The number of elements in the pState array should be at least blockSize + phaseLength - 1. The numTaps value must be a multiple of the interpolation factor L.

Scaling, Truncation, Saturation

Intel IPP style:

Function Description
ippsqFIRUpDirectQ15_16s_Rms

The pSrc, pDst, pTaps, and pDlyLine values are represented in Q15 format. The function uses a 64-bit internal accumulator in Q34.30 format, so it preserves full precision of intermediate calculations and avoids internal overflow. In the end, the function shifts the accumulator right by 15 bits and saturates it in the [IPP_MIN_16S, IPP_MAX_16S] range.

ippsqFIRUpDirectQ31_32s_Rm

The pSrc, pDst, pTaps, and pDlyLine values are represented in Q31 format. The function uses a 64-bit internal accumulator in Q2.62 format and provides only one guard bit. The function is not protected from internal overflow. In the end, the function shifts the accumulator right by 31 bits and does not perform saturation.

DSP style:

Function Description
ippsq_fir_interpolate_q15

The pSrc, pDst, pCoeffs, and pState values are represented in Q15 format. The function uses a 64-bit internal accumulator in Q34.30 format, so it preserves full precision of intermediate calculations and avoids internal overflow. In the end, the function shifts the accumulator right by 15 bits and saturates it in the [IPP_MIN_16S, IPP_MAX_16S] range.

ippsq_fir_interpolate_q31

The pSrc, pDst, pCoeffs, and pState values are represented in Q31 format. The function uses a 64-bit internal accumulator in Q2.62 format and provides only one guard bit. The function is not protected from internal overflow. In the end, the function shifts the accumulator right by 31 bits and does not perform saturation.

Return Values

ippStsNoErr

Indicates no error.

ippStsSizeErr

Indicates an error when tapsLen is less than upFactor.

ippStsNullPtrErr

Indicates an error when any of the specified pointers is NULL.
For more complete information about compiler optimizations, see our Optimization Notice.