- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi,
I am a new user of IPP 5.1.Can anyone let me know how ippiMalloc_8u_C3 actually works....
Problem that I am facing is : When I use memcpy functionto store image data fromthe buffer that I have created using normal malloc(unsigned char buffer of image size*3 for a 24 bit Image) tobuffer created using ippiMalloc_8u_C3, thebuffer created usingippiMalloc contains only 1/3rd of the image....
Also,I have foundthat for 24 bit Images padding provided internally to make the image width a multiple of 32 is:
(Image Width * 3 ) + (32 - (Image Width MOD 32))
Can anyone Plz. explain why is it necessary to multiply the image width by 3, for a 3 Channel Image.
Thanking You .
Kind Regards,
Pooja
Link Copied
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hello,
You are right, IPP memory allocation functions provide you aligned memory for performance reasons. That is expected and documented behaviour, no need in investigations there, just take a look on IPP manual.
you do not need to multiply image width by 3 when you use ippiMalloc_8u_C3 function. Can you share piece of code to demonstrate how you use IPP function?
Regards,
Vladimir
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hello Vladimir,
I have provided a small portion of my code related to IPP function usage where step is calculated as:
step = (32 - Mod(image_width,32));
Here in this code if I use the actual width of the image, the image contains dashed black lines at regular intervals.I think that is the padding provided internally by IPP cause the image data gets pushed further everytime a dashed line is introduced in the output image.So in order to get rid of the padding while displaying the image, I have used image_width + step(where step is the number of pixels added to each row for 32 bit allignment)
Here buffin and buffout are buffers that I have createdusing malloc of size (height * width1* 4) and they contain the image data + the essential padding required accordng to image width.
width = image_width;
height = image_height;
width1 = image_width + step;
int imageStep = 0;
Ipp8u *image = ippiMalloc_8u_C3(width1,height,&imageStep);
memcpy(image,buffin,width1*height);
memcpy(buffout,image,width1*height);
My question is: With the above procedure I get correct results for an 8 bit Image and using ippiMalloc_8u_C1 function.
But when I try to use the same procedure with few changes for a 24 bit image and using ippiMalloc_8u_C3 function....
Only 1/3rd of the image gets stored in the IPP buffer.
Does ippiMalloc_8u_C3 internally store image data of one channel and then store padding required for that channel, and then store image data for next channel and so on..... How does the IPP Buffer pointer actually scan a 24 bit image along with the padding required.
Thanking You for your response.
Regards,
Pooja
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Pooja,
iamgeStep is output parameter for ippiMalloc function. The ippiMalloc allocates aligned memory based on width and height parameters you provide and return to you imageStep to allow you access image lines.
Please see IPP manual for more details
Regards,
Vladimir

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