Floodfill GetSize function is useless?

Floodfill GetSize function is useless?

I found in the example of Floodfill_Grad page: http://software.intel.com/sites/products/documentation/hpc/ipp/ippi/ippi_ch14/functn_FloodFill_Grad.html

ippiFloodFillGetSize_Grad ( roiSize, &pBufSize );
Ipp8u* pBuffer = ippiMalloc_8u_C1 ( 8, 8, &pBufSize );
ippiFloodFill_Grad4Con_8u_C1IR ( pImage, 8, roiSize, seed, newVal, minDelta, maxDelta, &pRegion, pBuffer );

The pBufSize is calculated by GetSize() function, however it is updated in ippiMalloc function without any use.

From the manual description, the temporary buffer size should be calculated by GetSize and we only need to create a char buff with that size and pass the buff to flood fill function. However, as the example shows, the size returned by GetSize is not used at all. Or I guess the pBufSize is both \param[in, out] for ippiMalloc?

I have tried both ways: 1. the same way as the example shows. 2. I get size with GetSize() and new a char array with this size, and use this char array in Floodfill. It turns out that the 2nd way is about 3 times slower than the 1st way.

Is there any explanation? Or should the manual be updated to reflect about this difference?

Thanks!

5 posts / 0 new
Last post
For more complete information about compiler optimizations, see our Optimization Notice.
Best Reply

Hi,

of course it's a bug in the manual.

the correct code should look the next way:

ippiFloodFillGetSize_Grad ( roiSize, &pBufferSize );

Ipp8u* pBuffer = ippMalloc_8u (pBufferSize );

ippiFloodFill_Grad4Con_8u_C1IR ( pImage, 8, roiSize, seed, newVal, minDelta, maxDelta, &pRegion, pBuffer );

Regarding your question on performance - does function work correctly in both cases and return OK status?

regards, Igor

Dear Igor,

Thanks for the info. I found that I used std::vector to hold the buffer and the initialization leads to extra time costs. I changed to use ippsMalloc and the time cost is reduced to the same as using ippiMalloc.

BTW, I can't find ippMalloc and ippFree in my IPPv7.0. I am using Windows 7 sp1.

OK, I just found that it's in ipp.h which I never included before. I thought it ought to be automatically included by including ippi.h.

Quote:

Chaofeng W. wrote:

OK, I just found that it's in ipp.h which I never included before. I thought it ought to be automatically included by including ippi.h.

Hi,

ippMalloc/ippFree come from ippcore library. It's a different functional domain. These functions are described in signal-processing manual (Support Functions) and require "ippcore.h" to be included.

Leave a Comment

Please sign in to add a comment. Not a member? Join today