Intel® Integrated Performance Primitives
Deliberate problems developing high-performance vision, signal, security, and storage applications.

Resampling with FIRMR

fps
Beginner
282 Views
I'm attempting to resample blocks of data using FIRMR, but the block edges have glitches, where I suspect some state is being lost. Could someone please look at this and tell where I've gone wrong? Thanks.
Here's the code fragment (DECLARE_ALIGNED_VAR is a local macro to align buffers). Note using a step of 240 should generate exactly 160 samples, so the problem doesn't seem to be associated with fractional phase.

int step = 240;

DECLARE_ALIGNED_VAR(Ipp64f, WorkTaps, VSP_TC_SRC_FIR_LEN);
DECLARE_ALIGNED_VAR(float, SRC_FIR_Coeffs, VSP_TC_SRC_FIR_LEN);
DECLARE_ALIGNED_VAR(short, SRC_FIR_Delay, VSP_TC_SRC_FIR_LEN * 2);

IppsFIRState32f_16s * SRC_StatePtr;
ippsFIRGenLowpass_64f(0.333, WorkTaps, VSP_TC_SRC_FIR_LEN, ippWinHann, ippTrue);
for (int i = 0; i < VSP_TC_SRC_FIR_LEN; i++)
SRC_FIR_Coeffs = (float)WorkTaps;
ippsFIRMRInitAlloc32f_16s(&SRC_StatePtr, SRC_FIR_Coeffs, VSP_TC_SRC_FIR_LEN, 2, 0, 3, 0, NULL);

for (int i = 0; i < incount; i+=step)
{
NumSRCIters = step;
// ippsFIR32f_16s_Sfs(inbuffptr, outbuffptr, NumSRCIters, SRC_StatePtr, 0);
ippsFIRMR32f_Direct_16s_Sfs(inbuffptr, outbuffptr, NumSRCIters, SRC_FIR_Coeffs, 60, 2, 0, 3, 0, SRC_FIR_Delay, 0);
inbuffptr += step;
outbuffptr += (step * 2) / 3;
}

0 Kudos
1 Reply
Ying_H_Intel
Employee
282 Views
Hi

Could be the problem NumSRCIters?

It is ok as parameter of ippiFIR32f_16s_Sfs(). But for ippsFIRMR32f_Direct, it should be80.


See the manual of ippsMan.pdf=> FIRMR_Direct

numIters
Parameter associated with the number of samples to

be filtered by the function. The (numIters *

downFactor) elements of the source vector are filtered

and the resulting (numIters * upFactor) samples are

stored in the output array.

In addition, there are some sample code about almost all of FIR function usage in \ipp-samples\signal-processing\signal-processing-functions. IPP Downloads, Registration and Licensing.It isin MSVC 2005 project if windows. You may refer to them.

Best Regards,
Ying

0 Kudos
Reply