Intel® Integrated Performance Primitives
Deliberate problems developing high-performance vision, signal, security, and storage applications.
Announcements
FPGA community forums and blogs on community.intel.com are migrating to the new Altera Community and are read-only. For urgent support needs during this transition, please visit the FPGA Design Resources page or contact an Altera Authorized Distributor.

access pixel data allocated by IppiMalloc?

ctozlm
Beginner
650 Views
Is there anyone can tell me that how can I access the pixel data allocated by IppiMalloc.
I just wondering how to use the pStepBytes variable returned by IppiMalloc. If I just want to access a pixel, can I use pStepBytes as the width of the 2d array.
actually, I need to get the max value from a matrix. how should I do that? I attach some codes to illustrate my doubt.

int nImageSqureStep;
float* pImageSquare = ippiMalloc_32f_C1(szImage.width,szImage.height,&nImageSqureStep);
ippiSqr_32f_C1R(src,szImage.width*4,pImageSquare,nImageSqureStep,szImage);


How should I get access the pixel of pImageSqaure , for example
for (int row=0;row {
for (int col=0;col {
if (pImageSquare[row*nImageSqureStep+col]<)
}
}


it tell me wrong when it was executed and I gurantee that other part code is correct. So I think the problem is how to acess the pixel. and how to use the width is a problem.

Is there any other good way to get max value from the pImageSquare Array?

Thanks.
0 Kudos
3 Replies
ctozlm
Beginner
650 Views
I just fix that with
pImageSquare[row*nImageSqureStep/4+col]



But I am still wondering about the correctness of the above access.
will it bring correct result? nImageSquareStep is larger than the true width of the pImageSquare image?
0 Kudos
ctozlm
Beginner
650 Views
Is there anyone who can help me with that problem?Thanks.



How to access the pixel in IPP
0 Kudos
Ivan_Z_Intel
Employee
650 Views

float max = *pImageSquare;

float *pTmp;

for ( int row = 0; row < szImage.height; row++ ) {

pTmp = (float *)( (char *)pImageSquare + nImageSquareStep * row );

for ( int col = 0; col < szImage.width; col++ ) {

if ( pTmp[col] > max ) max = pTmp[col];

}

}

but better

float max;

ippiMax_32f_C1R( [ImageSquare, nImageSquareStep, szImage, &max );

0 Kudos
Reply