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

Floodfill GetSize function is useless?

Chaofeng_W_
Beginner
516 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
516 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

0 Kudos
4 Replies
Igor_A_Intel
Employee
517 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

0 Kudos
Chaofeng_W_
Beginner
516 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.

0 Kudos
Chaofeng_W_
Beginner
516 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.

0 Kudos
Sergey_K_Intel
Employee
516 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.

0 Kudos
Reply