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

Sample code doesn't compile

mmroden
Beginner
459 Views
Hi All,

I'm trying to get the gaussian/laplacian code to work, and the provided code in the documentation is very broken. I don't know how to fix it (I've been using the IPP for two days now), and any obvious help to fix the documentation would be helpful.

In my application, we take an image down from roughly 4000x4000 to 1x1 and build it back up again, using 12 decomposition levels. I wanted to use the provided gaussian functions, but they break at about the fourth level down, simply because they hit into an odd/even bug (ie, the subsampled image has an even index, the upsampled image needs an odd index, and the default code (_Gauss5x5) won't allow for that). So, I started to use the more generic pyramid coding.

Turns out, the sample code for that is just broken as is, and won't compile.

Here's the sample code from the documentation, p14-69 of ippiman.pdf. I've added the srcRoi IppiSize structure, because I figure that part's right, as well as the 'rate' parameter. I haven't set the Kernel yet; I wanted to get the error count to something manageable before I implement the kernel. I was going to use a float array for pSrc, but I think I really need it to be of type Ipp32f* instead; that's something with which I can experiment.


IppiPyramid *gPyr; // pointer to Gaussian pyramid structure
IppiPyramid *lPyr; // pointer to Laplacian pyramid structure
// allocate pyramid structures
IppiSize srcRoi = {theColumns, theRows};
float rate = 2.0f; //decrease by 2 each time
ippiPyramidInitAlloc (&gPyr, 1000, srcRoi, rate);
ippiPyramidInitAlloc (&lPyr, 1000, srcRoi, rate);
{
IppiPyramidDownState_32f_C1R **gState =
(IppiPyramidDownState_32f_C1R*)&(gPyr->pState);
IppiPyramidUpState_32f_C1R **lState =
(IppiPyramidUpState_32f_C1R*) &(lPyr->pState);
Ipp32f **gImage = (Ipp32f**)(gPyr->pImage);
Ipp32f **lImage = (Ipp32f**)(lPyr->pImage);
IppiSize *pRoi = dPyr->pRoi;
int *gStep = gPyr->pStep;
int *lStep = lPyr->pStep;
int level = gPyr->level;
Ipp32f *ptr;
int step;
// allocate structures to calculate pyramid layers
ippiPyramidLayerDownInitAlloc_32f_C1R(gState, srcRoi, rate, pKernel,
&n bsp; kerSize, IPPI_INTER_LINEAR);
ippiPyramidLayerUpInitAlloc_32f_C1R (lState, srcRoi, rate, pKernel,
kerSize, IPPI_INTER_LINEAR);
// build Gaussian pyramid with level+1 layers
gImage[0] = pSrc;
gStep[0] = srcStep;
for (i=1; i<=level; i++) {
gImage = ippiMalloc_32f_C1(pRoi.width,pRoi.height,gStep+i);
ippiPyramidLayerDown_32f_C1R(gImage[i-1], gStep[i-1], pRoi[i-1],
gImage, gStep, pRoi, *gState);
}
// build Laplacian pyramid with level layers
ptr = ippiMalloc_32f_C1(srcRoi.width,srcRoi.height,&step);
for (i=level-1; i>=0; i--) {
lImage = ippiMalloc_32f_C1(pRoi.width,pRoi.height,gStep+i);
ippiPyramidLayerUp_32f_C1R(gImage[i+1], gStep[i+1], pRoi[i+1],
ptr, step, pRoi, *lState);
ippiSub_32f_C1R(ptr, step, gImage, gStep,
lImage, lStep, pRoi);
}
ippiFree(ptr);
ippiPyramidLayerDownFree_32f_C1R(*gStep);
ippiPyramidLayerUpFree_32f_C1R (*lStep);
// use Gaussian and Laplacian pyramids
// free allocated images
for (i=1; i<=level; i++) {
ippiFree(gImage);
ippiFree(lImage[i-1]);
}
}
// free pyramid structures
ippiPyramidFree (gPyr);
ippiPyramidFree (lPyr);


Here are the error codes, using the Intel compiler version as of yesterday (10.3.somethingorother) and the IPP from the same day. MKL is also included, but I don't see how that could interfere. There are just some obvious bugs here (dPyr?); I'm not familiar enough with these libraries yet to make the necessary fixes, and any help would be appreciated. Thanks!


icl: warning #10210: problem with Microsoft compilation of 'C:source\_dllImageOperationsCGaussianPyramids.cpp'
C:source\_dllImageOperationsCGaussianPyramids.cpp(257): error: a value of type "IppiPyramidDownState_32f_C1R *" cannot be used to initialize an entity of type "IppiPyramidDownState_32f_C1R **"
(IppiPyramidDownState_32f_C1R*)&(gPyr->pState);
^
C:source\_dllImageOperationsCGaussianPyramids.cpp(259): error: a value of type "IppiPyramidUpState_32f_C1R *" cannot be used to initialize an entity of type "IppiPyramidUpState_32f_C1R **"
(IppiPyramidUpState_32f_C1R*) &(lPyr->pState);
^
C:source\_dllImageOperationsCGaussianPyramids.cpp(262): error: identifier "dPyr" is undefined
IppiSize *pRoi = dPyr->pRoi;
^
C:source\_dllImageOperationsCGaussianPyramids.cpp(269): error: identifier "pKernel" is undefined
ippiPyramidLayerDownInitAlloc_32f_C1R(gState, srcRoi, rate, pKernel,
^
C:source\_dllImageOperationsCGaussianPyramids.cpp(270): error: identifier "kerSize" is undefined
kerSize, IPPI_INTER_LINEAR);
^
C:source\_dllImageOperationsCGaussianPyramids.cpp(274): error: identifier "pSrc" is undefined
gImage[0] = pSrc;
^
C:source\_dllImageOperationsCGaussianPyramids.cpp(275): error: identifier "srcStep" is undefined
&n bsp; gStep[0] = srcStep;
^
C:source\_dllImageOperationsCGaussianPyramids.cpp(291): error: argument of type "int" is incompatible with parameter of type "IppiPyramidDownState_32f_C1R *"
ippiPyramidLayerDownFree_32f_C1R(*gStep);
^
C:source\_dllImageOperationsCGaussianPyramids.cpp(292): error: argument of type "int" is incompatible with parameter of type "IppiPyramidUpState_32f_C1R *"
ippiPyramidLayerUpFree_32f_C1R (*lStep);
^
compilation aborted for C:source\_dllImageOperationsCGaussianPyramids.cpp (code 2)
Error executing xicl6.exe.

ImageOperations.dll - 9 error(s), 1 warning(s)

0 Kudos
2 Replies
Vladimir_Dudnik
Employee
459 Views

Please submit your issue report to Intel Premier Support

Vladimir

0 Kudos
mmroden
Beginner
459 Views
I'm trying, but I keep getting redirected to this error page:

https://welcome.intel.com/scripts-util/500.asp?aspxerrorpath=/Login.aspx
0 Kudos
Reply