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

iterating ippiMalloc

adig
Beginner
999 Views
hi all
the ippimalloc is not exactly clear to me.
let us say for example i have an allocated memory block A.
how do i go to cell [5][6] ?
someone needs to calculate the correct location, is it me ?
if it is me - what is the StepBytes parameter , how do i use it ?
adi
0 Kudos
5 Replies
seiji-torigoe
Beginner
999 Views
I calculate it myself.

#include "ipp.h"
int main(int argc, char* argv[])
{
Ipp16s * pImg; Ipp16s * pTmp;
int widthPixels, heightPixels, stepBytes;
int y, x; Ipp16s value;

widthPixels = 10; heightPixels = 10;
pImg = ippiMalloc_16s_C1(widthPixels, heightPixels, &stepBytes);

// set pixel
value = 1;
for ( y = 0; y < heightPixels; y++ )
{
pTmp = pImg + y * stepBytes / sizeof(Ipp16s);
for ( x = 0; x < widthPixels; x++ )
{
*pTmp = value; printf("%d, ", *pTmp); pTmp++; value++;
} printf(" ");
} printf(" ");

// get pixel
x = 5; y = 6;
pTmp = pImg + x + y * stepBytes / sizeof(Ipp16s);
printf("pixel[5][6] = %d ", *pTmp);

ippiFree(pImg);

return 0;
}

Message Edited by Seiji-Torigoe on 01-06-2005 01:44 AM

0 Kudos
Vladimir_Dudnik
Employee
999 Views
Hi,
first of all, please consult with IPPI User's Manual, Chapter 2 - Intel Integrated Performance Primitives Concepts, Article - Image Data Types and Ranges. We tried to answer the most of question which usually people have when they are looking on the libraries at the first time.
Regards,
Vladimir
0 Kudos
borix
Beginner
999 Views
Adi, stepBytes moves you to the next row/line of the image. if you are in the beginning then to the beginning, if you are in the end then to the end. so, for the current position p you jump to the point below by (char*)p+stepBytes.
0 Kudos
seiji-torigoe
Beginner
999 Views
It might be such a code.

pTmp = (Ipp16s *)(
(char *)pImg + x * sizeof(Ipp16s) + y * stepBytes
);
printf("pixel[5][6] = %d ", *pTmp);
0 Kudos
mh_de_ruiter
Beginner
999 Views
does ippimalloc allocates basicly muuuuch more memory as 'normal' createcompatibelbitmap etc. ?
i mean.. is every color of each pixels stored like in ONE whole 32 bit block ?
when the normal bitmaps use 'only' 8 bits per color..
does ippimalloc uses (allocates) anyway 32 bits per color of each pixel ?
0 Kudos
Reply