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 ?
adi

6 帖子 / 0 全新
最新文章
如需更全面地了解编译器优化,请参阅优化注意事项

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

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

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 ?

发表评论

登录添加评论。还不是成员?立即加入