iterating ippiMalloc

iterating ippiMalloc

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 ?

6 posts / 0 new
Last post
For more complete information about compiler optimizations, see our Optimization Notice.

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);


return 0;

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


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.


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.

It might be such a code.

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

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 ?

Leave a Comment

Please sign in to add a comment. Not a member? Join today