Intel® Integrated Performance Primitives
Community support and discussions relating to developing high-performance vision, signal, security, and storage applications.
Announcements
This community is designed for sharing of public information. Please do not share Intel or third-party confidential information here.

Floodfill GetSize function is useless?

Chaofeng_W_
Beginner
168 Views

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!

0 Kudos
1 Solution
Igor_A_Intel
Employee
168 Views

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

View solution in original post

4 Replies
Igor_A_Intel
Employee
169 Views

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

Chaofeng_W_
Beginner
168 Views

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.

Chaofeng_W_
Beginner
168 Views

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.

Sergey_K_Intel
Employee
168 Views

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.

Reply