Intel® Integrated Performance Primitives (Intel® IPP) Developer Guide and Reference

ID 790148
Date 6/24/2024
Public

A newer version of this document is available. Customers should click here to go to the newest version.

Document Table of Contents

ResamplePolyphaseInit, ResamplePolyphaseFixedInit

Initialize the structure for polyphase resampling with calculating the filter coefficients.

Syntax

IppStatus ippsResamplePolyphaseInit_16s( Ipp32f window, int nStep, Ipp32f rollf, Ipp32f alpha, IppsResamplingPolyphase_16s* pSpec, IppHintAlgorithm hint);

IppStatus ippsResamplePolyphaseInit_32f( Ipp32f window, int nStep, Ipp32f rollf, Ipp32f alpha, IppsResamplingPolyphase_32f* pSpec, IppHintAlgorithm hint);

IppStatus ippsResamplePolyphaseFixedInit_16s( int inRate, int outRate, int len, Ipp32f rollf, Ipp32f alpha, IppsResamplingPolyphaseFixed_16s* pSpec, IppHintAlgorithm hint);

IppStatus ippsResamplePolyphaseFixedInit_32f( int inRate, int outRate, int len, Ipp32f rollf, Ipp32f alpha, IppsResamplingPolyphaseFixed_32f* pSpec, IppHintAlgorithm hint);

Include Files

ipps.h

Domain Dependencies

Headers: ippcore.h, ippvm.h

Libraries: ippcore.lib, ippvm.lib

Parameters

window

The size of the ideal lowpass filter window.

nStep

The discretization step for filter coefficients.

rollf

The roll-off frequency of the filter.

alpha

The parameter of the Kaiser window.

inRate

The input rate for fixed factor resampling.

outRate

The output rate for fixed factor resampling.

len

The filter length for fixed factor resampling.

pSpec

The pointer to the resampling state structure.

hint

Suggests using specific code (must be equal to ippAlgHintFast). The possible values for the parameter hint are listed in Hint Arguments.

Description

The function ippsResamplePolyphaseInit initializes structures for data resampling using the ideal lowpass filter. The function ippsResamplePolyphaseInit applies the Kaiser window with alpha parameter and window width to the lowpass filter. This means that the values of the ideal lowpass filtering function are calculated for all i values such that |i/nStep|≤window.

Use the pSpec structure to resample input samples with the ippsResample function with arbitrary resampling factor. In this case, filter coefficients for each output sample are calculated using linear interpolation between two nearest values. The size of the filter depends on the resampling factor.

The function ippsResamplePolyphaseFixedInit initializes structures for data resampling with the factor equal to inRate/outRate. If you denote the number of filters created in the IppsResamplingPolyphaseStructure structure for input and output frequencies by fnum, then

fnum = outRate/GCD (inRate, outRate)

where

GCD (a, b) is the greatest common divisor of a and b. For example, if inRate = 8000 and outRate = 11025, then the number of filters will be fnum = 11025/GCD (8000, 11025) = 441.

Functions with the Fixed suffix pre-calculate filter coefficients for each phase and store them in the data structure for better performance. Use these functions when the ratio inRate/outRate is rational only. These functions can be considerably faster but may require large data structures for some input and output rates.

Before calling these functions, you need to allocate memory for the resampling state structure. To calculate the memory size, filter length, and the number of filters, use the ippsResamplePolyphaseGetSize or ippsResamplePolyphaseFixedGetSize functions.

Return Values

ippStsNoErr

Indicates no error.

ippStsNullPtrErr

Indicates an error when one of the specified pointers is NULL.

ippStsSizeErr

For ippsResamplePolyphaseInit function, indicates an error when inRate, outRate , nStep or len is less than or equal to 0. For ippsResamplePolyphaseFixedInit function, indicates an error when inRate, outRate, nStep or len is less than or equal to 0.

ippStsBadArgErr

Indicates an error when rollf is less than or equal to 0 or is greater than 1, or if alpha is less than 1, or if window is less than 2/nStep.