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

Index error of pDlySrc in FIRMR

Aleksey_Y_
Beginner
442 Views

Hi.

It seems like indexing of the array pDlySrc begins with 1, not with 0.

Check the code below. It preforms FIRMR. Then changing pDlySrc[0] to 0 and performs FIRMR again. The results are equal.

IPP version: 2017.2.187 (20017 Update 2)
OS: Windows 8.1 Pro
Visual Studio 2013

CODE:

#include "stdafx.h"
#include <ipps.h>
#include <ipp.h>


int _tmain(int argc, _TCHAR* argv[])
{
	ippInit();

	Ipp32f pTaps[10] = { 0.1, 0.1, 0.1, 0.1, 0.1, 0.1, 0.1, 0.1, 0.1, 0.1};
	const int numIters = 6;
	const int tapsLen = 10;
	const int downFactor = 5;
	const int srcSize = downFactor*(numIters - 1) + 1;
	const int dstSize = numIters;
	const int dlySize = tapsLen - 1;

	int specSize, bufSize, i;

	Ipp32f* pSrc = ippsMalloc_32f(srcSize);
	Ipp32f* pDst = ippsMalloc_32f(dstSize);
	Ipp32f* pDlySrc = ippsMalloc_32f(dlySize +1); 

	Ipp8u* pBuf;
	IppsFIRSpec_32f *pSpec;

	IppStatus status;

	status = ippsFIRMRGetSize(tapsLen, 1, downFactor, ipp32f, &specSize, &bufSize);
	if (ippStsNoErr != status) return -1;

	pSpec = (IppsFIRSpec_32f*)ippsMalloc_8u(specSize);
	pBuf = ippsMalloc_8u(bufSize);
	status = ippsFIRMRInit_32f(pTaps, tapsLen, 1, 0, downFactor, 0, pSpec);
	if (ippStsNoErr != status) return -1;
	

	for (i = 0; i < dlySize+1; i++) pDlySrc = 10;
	for (i = 0; i<srcSize; i++)	pSrc = 1;
	pSrc[srcSize - 1] = 100;

	status = ippsFIRMR_32f(pSrc, pDst, numIters, pSpec, pDlySrc, NULL, pBuf);
	if (ippStsNoErr != status) return -1;

	printf("dlySrc[%d]\n", dlySize);
	for (i = 0; i<dlySize; i++)	printf("%6.2f ", pDlySrc);
	printf("{%6.2f}", pDlySrc[dlySize]);
	printf("\nsrc[%d]\n", srcSize);
	for (i = 0; i<srcSize; i++)	printf("%2.0f ", pSrc);
	printf("\ntaps[%d]\n", tapsLen);
	for (i = 0; i<tapsLen; i++)	printf("%1.3f ", pTaps);
	printf("\n\n\ndst[%d]\n", dstSize);
	for (i = 0; i<dstSize; i++)	printf("%2.2f ", pDst);


	pDlySrc[0] = 0;
	status = ippsFIRMR_32f(pSrc, pDst, numIters, pSpec, pDlySrc, NULL, pBuf);
	if (ippStsNoErr != status) return -1;

	printf("\n\n\n\ndlySrc[%d]\n", dlySize);
	for (i = 0; i<dlySize; i++)	printf("%6.2f ", pDlySrc);
	printf("{%6.2f}", pDlySrc[dlySize]);
	printf("\nsrc[%d]\n", srcSize);
	for (i = 0; i<srcSize; i++)	printf("%2.0f ", pSrc);
	printf("\ntaps[%d]\n", tapsLen);
	for (i = 0; i<tapsLen; i++)	printf("%1.3f ", pTaps);
	printf("\n\n\ndst[%d]\n", dstSize);
	for (i = 0; i<dstSize; i++)	printf("%2.2f ", pDst);

	printf("\n\nIPP_VERSION: ");
	printf(IPP_VERSION_STR);
	printf("\n");

	return 0;
}

 

0 Kudos
5 Replies
Aleksey_Y_
Beginner
443 Views

Dear developers.
There is still no feedback on this issue. Tell me maybe I should post this information somewhere else?

0 Kudos
Andrey_B_Intel
Employee
443 Views

Hi Aleksey.

Thanks for using IPP library.

FIRMR has very complex API. Actually to get correct result the +-1 element from delay line is used. It depends from combination up/down factors and phases. Therefore ippsFIRMR function always requests  enough number (tapsLen + upFactor - 1) / upFactor elements in delay line. See IPP manual "If the delay line array pDlyLine is not NULL, its length is defined as (tapsLen + upFactor - 1) /
upFactor." In your case you provide (10+1-1/1)=10 elements and 0th is not used. So zeroing of 0th has no effect in your case.

 

0 Kudos
Aleksey_Y_
Beginner
443 Views

Hi Andrey. Thank you for your reply.

According to this documentation: "The length of the pDlySrc array is tapsLen-1 elements."

There is the same statement in this manual. What "IPP manual" are you talking about?

 

0 Kudos
Andrey_B_Intel
Employee
443 Views

 

Hmm. Looks like that last documentation of ippsFIRMR is not correct enough. But the code example  uses correct sizes of pDlySrc and pDlyDst

There is a lot of information how ippsFIRMR works in legacy pdf manual of IPP 7.1

https://software.intel.com/sites/default/files/m/d/4/1/d/8/ipps.pdf

I hope it will clarify API and behavior of ippsFIRMR.

We'll fix documentation in next IPP release.

0 Kudos
Aleksey_Y_
Beginner
443 Views

Got it. Thank you, Andrey.

0 Kudos
Reply