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

Help with ippiMalloc function

bhatt1
Beginner
424 Views

Hi,

I am new to the IPP programming. I am trying to replace some old image processing code using the IPP image processing library. I was testing the performance (speed increase) using the ippi functions as compared to my older functions. I started withusing asimple malloc followed bythe ippi copy function and then I replaced the malloc function with ippimalloc. I expected to see a speed increase or at least no difference in speed. But I am seeing a speed decrease by using ippimalloc in place of malloc.

If anyone can help me findmy mistakethat'd be a great help. Here is the piece of code that explains what I tried:

IppStatus ippResult;
IppiSize ippROISize = {m_nImgWidth, m_nImgHeight}; //width and height of image
int nSrcStep = m_nImgWidth * 2; (as my input is a one channel 16-bit image)
int nDestStep = m_nImgWidth * 2;

short* pDestBuffer;
pDestBuffer = (short*)malloc(m_nImgWidth*m_nImgHeight*sizeof(short));
TimerStart();
ippResult = ippiCopy_16s_C1R(pSrcBuffer, nSrcStep,pDestBuffer, nDestStep, ippROISize);
TimerEnd();

AND

nDestStep = 0;
Ipp16s* pDestBuffer;
pDestBuffer = ippiMalloc_16s_C1(m_nImgWidth, m_nImgHeight, &nDestStep);
TimerStart();
ippResult = ippiCopy_16s_C1R(pSrcBuffer, nSrcStep,pDestBuffer, nDestStep, ippROISize);
TimerEnd();

The timing that I getfrom the second piece of code is actually a little higher than that from the first piece of code; which is what I dont understand. I expected ippiMalloc to make the copy operation faster.

Any help or suggestion is greatly appreciated. Thanks in advance.

-Mittal

0 Kudos
3 Replies
Vladimir_Dudnik
Employee
424 Views

Hi Mittal,

you are right, expected result that using ippiMalloc (whos only the difference from standard malloc is that it alignes memory to 32 byte boundary) should improve performance in comparison with standard CRT malloc. What sizes of images do you use? What version of IPP and on what kind of system you run your test?

Regards,
Vladimir

0 Kudos
bhatt1
Beginner
424 Views

Hi Vladimir,

Thanks for replying. The images that I tested with had sizes ranging from 1Kx1K to 3Kx3K (not necessarily square). I tested different dimensions in this range, most of which were odd numbers or not multiples of 32.

I am running IPP v5.1 on a Windows 2000, P4-2.8G computer with IA-32 Intel Architechture and am using the appropriate IPP libraries.I am using Visual Studio 6.0 to write my code in.

Isthere anything I am missing or using incorrectly? Let me know if you need more information.

Thanks,

Mittal

0 Kudos
Vladimir_Dudnik
Employee
424 Views

Hi Mittal, seems you did all right. Did you use IPP in DLL or in static libraries?

Vladimir

0 Kudos
Reply