- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
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
Link Copied
5 Replies
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
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;
}
#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
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
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
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
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.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
It might be such a code.
pTmp = (Ipp16s *)(
(char *)pImg + x * sizeof(Ipp16s) + y * stepBytes
);
printf("pixel[5][6] = %d ", *pTmp);
pTmp = (Ipp16s *)(
(char *)pImg + x * sizeof(Ipp16s) + y * stepBytes
);
printf("pixel[5][6] = %d ", *pTmp);
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
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 ?

Reply
Topic Options
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page