Developer Reference for Intel® Integrated Performance Primitives
Gets polyphase resampling filter coefficients.
IppStatus ippsResamplePolyphaseGetFixedFilter_16s(Ipp16s* pDst, int step, int height, const IppsResamplingPolyphaseFixed_16s* pSpec);
IppStatus ippsResamplePolyphaseGetFixedFilter_32f(Ipp32f* pDst, int step, int height, const IppsResamplingPolyphaseFixed_32f* pSpec);
ipps.h
Headers: ippcore.h, ippvm.h
Libraries: ippcore.lib, ippvm.lib
pDst |
The pointer to the output vector of filter coefficients. |
step |
The row step in pDst vector. |
height |
The number of filters (the number of rows in pDst vector). |
pSpec |
The pointer to the resampling state structure. |
This function exports filter coefficients from the polyphase resampling structure. If the step value is less than the filter length, only first step coefficients are exported.
ippStsNoErr |
Indicates no error. |
ippStsNullPtrErr |
Indicates an error when one of the specified pointers is NULL. |
ippStsSizeErr |
Indicates an error when step or height is less than or equal to 0. |
ippStsBadArgErr |
Indicates an error when height is greater than the number of filters in pSpec structure. |
The code example below demonstrates export and import of the Polyphase Resampling Filter Bank.
int inRate=16000; // input frequency
int outRate=8000; // output frequency
int history; // half of filter length
char fname[]="filter.flt\0";
// coefficient file name
{
int size,len,height;
FILE *file; short *pFilter;
IppsresamplingPolyphaseFixed_16s *state;
history=(int)(64.0f*0.5*IPP_MAX(1.0,1.0/(double)outRate/(double)inRate))+1;
ippsResamplePolyphaseFixedGetSize_16s(inRate, outRate, 2*(history-1), &size, &len, &height, ippAlgHintFast);
state = (IppsResamlingPolyphaseFixed_16s*)ippsMalloc_8u(size);
ippsResamplePolyphaseFixedInit_16s(inRate,outRate,2*(history-1), 0.95f, 9.0f, state, ippAlgHintFast);
pFilter=ippsMalloc_16s(len*height); ippsResamplePolyphaseGetFixedFilter_16s(pFilter,len,height,state);
file=fopen(fname,"wb"); fwrite(&size,sizeof(int),1,file);
fwrite(&len,sizeof(int),1,file);
fwrite(&height,sizeof(int),1,file);
fwrite(pFilter,sizeof(short),len*height,file);
fclose(file); ippsFree(pFilter);
ippsFree (state);
}
{
int size,len,height; FILE *file;
short *pFilter;
IppsresamplingPolyphaseFixed_16s *state;
history=(int)(64.0f*0.5*IPP_MAX(1.0,1.0/(double)outRate/(double)inRate))+1;
file=fopen(fname,"rb");
fread(&size,sizeof(int),1,file);
fread(&len,sizeof(int),1,file);
fread(&height,sizeof(int),1,file);
pFilter=ippsMalloc_16s(len*height);
fread(pFilter,sizeof(short),len*height,file);
fclose(file);
state=(IppsresamplingPolyphaseFixed_16s*)ippsMalloc_8u(size);
ippsResamplePolyphaseFixedInit_16s(inRate,outRate,2*(history-1), 0.95f, 9.0f, state, ippAlgHintFast);
ippsResamplePolyphaseSetFixedFilter_16s((const Ipp16s*)pFilter,len,height, (IppsresamplingPolyphaseFixed_16s*)state);
ippsFree(pFilter);
// use of polyphase filter
…
ippsFree(state);
}