Community
cancel
Showing results for 
Search instead for 
Did you mean: 
ngurom
Beginner
107 Views

Help: How to use the Polyphase analysis Filterbank function of the ipp

Hello Im R.Nguete,

I want to split an input signal into 32 Suband. to achieve it, im using the polyphase Analysis Filterbank functions from the ipps library.
I write this small code but it not work corretly because after calling the main function (ippsAnalysisFilter_SBR_RToC_32f32fc_D2L) i receive "ippStsContextMatchErr" error. Please can somebody help me to know what it wrong in my source?

IppStatus ippRes;
Ipp32s pSizeSpec, pSizeInitBuf, pSizeWorkBuf;
Ipp32fc* pDst[32];

int iChannel = 32;

IppsFilterSpec_SBR_C_32fc** ppFilterSpec;
Ipp8u* pMemSpec;
Ipp8u* pInitBuf;
Ipp8u* pWorkBuf;

int NumLoop= NUM_TIME_SLOTS * RATE;// = 16*2 = 32
int offset = SBR_TIME_HFGEN ; // 8 siehe (sbr_dec_settings.h)
int kx = 0; //first Subband 0<=kx<=32


// get size need for the analysisfilter
ippRes = ippsAnalysisFilterGetSize_SBR_RToC_32f32fc(&pSizeSpec,&pSizeInitBuf,&pSizeWorkBuf);
if (ippRes != ippStsOk)
{
printf("error during getsize for the Analysis Filter");
return 1;
}

// Memory allocation

pInitBuf = (Ipp8u*)calloc(1,pSizeInitBuf);
pWorkBuf = (Ipp8u*)calloc(1,pSizeWorkBuf);


// Ipp8u* pAnalysisFilterSpec[2];

pMemSpec = (Ipp8u*)calloc(1,pSizeSpec);
ppFilterSpec = (IppsFilterSpec_SBR_C_32fc**)calloc(iChannel,sizeof(IppsFilterSpec_SBR_C_32fc*));

for (int i=0;i {

if(pSizeSpec !=0)
{
ppFilterSpec =(IppsFilterSpec_SBR_C_32fc*)calloc(1,pSizeSpec);

}
else
{
ppFilterSpec = NULL;

}

}


ippRes = ippsAnalysisFilterInit_SBR_RToC_32f32fc(ppFilterSpec,pMemSpec,pInitBuf);
// }
if (ippRes != ippStsOk)
{
printf("error during initilaisation for the Analysis Filter");
return 1;
}


//Filtering

ippRes = ippsAnalysisFilter_SBR_RToC_32f32fc_D2L((constIpp32f*)pSrc->DataPtr(),pDst,SBR_TABLE_QMF_WINDOW_320,
NumLoop,offset,kx,ppFilterSpec[5],pWorkBuf);

if (ippRes != ippStsOk)
{
printf("error during filtering for the Analysis Filter");
return 1;
}

Thanks you


R. Nguete



0 Kudos
3 Replies
Chao_Y_Intel
Employee
107 Views


Hi Nguete,

It looks that the initiation is not correct. It need to initiate each of the filter:


for (int i=0;iippRes = ippsAnalysisFilterInit_SBR_RToC_32f32fc( &(ppFilterSpec),...);

}

Thanks,
Chao
ngurom
Beginner
107 Views

Quoting - Chao Yu (Intel)

Hi Nguete,

It looks that the initiation is not correct. It need to initiate each of the filter:


for (int i=0;iippRes = ippsAnalysisFilterInit_SBR_RToC_32f32fc( &(ppFilterSpec),...);

}

Thanks,
Chao

Hi Chao,
Thanks for your Answer to my question. I initialize all subband filter as your write me on the last post. But now i meet that there are all point to the same reference and in in the filtering step (by calling:ippsAnalysisFilter_SBR_RToC_32f32fc_D2L() ) I receive an Access violation error . may be you can tell have another idea, or is it posible to send me a small example of the implementation of this polyphase analysis filterbank?
this is my new code:

IppStatus ippRes;
Ipp32s pSizeSpec, pSizeInitBuf, pSizeWorkBuf;
Ipp32fc* pDst[32];

int iChannel = 32;

IppsFilterSpec_SBR_C_32fc** ppFilterSpec;
Ipp8u* pMemSpec;
Ipp8u* pInitBuf;
Ipp8u* pWorkBuf;

int NumLoop= NUM_TIME_SLOTS * RATE;// = 16*2 = 32
int offset = SBR_TIME_HFGEN ; // 8 siehe (sbr_dec_settings.h)
int kx = 0; //first Subband 0<=kx<=32


// get size need for the analysisfilter
ippRes = ippsAnalysisFilterGetSize_SBR_RToC_32f32fc(&pSizeSpec,&pSizeInitBuf,&pSizeWorkBuf);
if (ippRes != ippStsOk)
{
printf("error during getsize for the Analysis Filter");
return 1;
}

// Memory allocation

pInitBuf = (Ipp8u*)calloc(1,pSizeInitBuf);
pWorkBuf = (Ipp8u*)calloc(1,pSizeWorkBuf);
pMemSpec = (Ipp8u*)calloc(1,pSizeSpec);
ppFilterSpec = (IppsFilterSpec_SBR_C_32fc**)calloc(iChannel,sizeof(IppsFilterSpec_SBR_C_32fc*));
int i =0;
for (i=0;i {

if(pSizeSpec !=0)
{
ppFilterSpec =(IppsFilterSpec_SBR_C_32fc*)calloc(1,pSizeSpec);

}
else
{
ppFilterSpec = NULL;

}

}

for (i=0;i {

ippRes = ippsAnalysisFilterInit_SBR_RToC_32f32fc( &(ppFilterSpec),pMemSpec,pInitBuf);
pDst = ( Ipp32fc*)calloc(pSrc->Length(),sizeof(Ipp32fc));

}


// ippRes = ippsAnalysisFilterInit_SBR_RToC_32f32fc(ppFilterSpec,pMemSpec,pInitBuf);
// }
if (ippRes != ippStsOk)
{
printf("error during initilaisation for the Analysis Filter");
return 1;
}


//Filtering

ippRes = ippsAnalysisFilter_SBR_RToC_32f32fc_D2L((const Ipp32f*)pSrc->DataPtr(),pDst,SBR_TABLE_QMF_WINDOW_320,
NumLoop,offset,kx,*ppFilterSpec,pWorkBuf);

if (ippRes != ippStsOk)
{
printf("error during filtering for the Analysis Filter");
return 1;
}



return 0;

}

Thanks you !

R.Nguete

Chao_Y_Intel
Employee
107 Views



Hi,

please checkthe notes from our AAC expert on the problem:

The following are the working code. For every call of ippsAnalysisFilter_SBR_RToC_32f32fc_D2L function, 1024 samples of Src data are processed. note that offset first pDst pointers will be skipped, so the first pointer to actual dst data is pDst[offset]. Also all subbands begins from kx are cleared.

for(i = offset, i < NUM_TIME_SLOTS * RATE + offset; i++)
{
for (j = kx; j < 32; j++)
{
pDst = 0;
}
}

{
IppStatus ippRes;
Ipp32s pSizeSpec, pSizeInitBuf, pSizeWorkBuf;
Ipp32fc* pDst[NUM_TIME_SLOTS * RATE + SBR_TIME_HFGEN];
Ipp32f src[1024];

IppsFilterSpec_SBR_C_32fc* pFilterSpec;
Ipp8u* pMemSpec;
Ipp8u* pInitBuf;
Ipp8u* pWorkBuf;

int NumLoop= NUM_TIME_SLOTS * RATE;// = 16*2 = 32
int offset = SBR_TIME_HFGEN ; // 8 siehe (sbr_dec_settings.h)
int kx = 31; //first SBR Subband 0<=kx<32
int i;

// get size need for the analysisfilter
ippRes = ippsAnalysisFilterGetSize_SBR_RToC_32f32fc(&pSizeSpec,
&pSizeInitBuf,
&pSizeWorkBuf);
if (ippRes != ippStsOk)
{
printf("error during getsize for the Analysis Filter");
return 1;
}

// Memory allocation

pInitBuf = (Ipp8u*)calloc(1,pSizeInitBuf);
pWorkBuf = (Ipp8u*)calloc(1,pSizeWorkBuf);
pMemSpec = (Ipp8u*)calloc(1,pSizeSpec);

for (i=0;i<(NumLoop + offset);i++)
{
pDst = (Ipp32fc*)calloc(32,sizeof(Ipp32fc));
}


ippRes = ippsAnalysisFilterInit_SBR_RToC_32f32fc(&pFilterSpec,pMemSpec,pInitBuf);

if (ippRes != ippStsOk)
{
printf("error during initilaisation for the Analysis Filter");
return 1;
}


//Filtering

ippRes = ippsAnalysisFilter_SBR_RToC_32f32fc_D2L((const Ipp32f*)pSrc->DataPtr(),
pDst,SBR_TABLE_QMF_WINDOW_320,
NumLoop,offset,kx,*ppFilterSpec,
pWorkBuf);
if (ippRes != ippStsOk)
{
printf("error during filtering for the Analysis Filter");
return 1;
}

return 0;
}

Reply