Message Edited by vdudnik on 04-29-2005 08:25 AM
The function ippiMalloc is declared in the ippi.h file. This function allocates a memory block aligned to a 32-byte boundary for elements of different data types. Every line of the image is aligned by padding with zeros in accordance with the pStepBytes parameter, which is calculated by the ippiMalloc function and returned for further use.
I know that ippiMalloc does not initialize image pixels and I have used symbol 'x'in examples to refers to not initialized values.
That is true that memory is just a contiguous array of bytes. But how do you logically treat these bytes does matter.
The only valid casefor step which is equal to width * BytesPerPixel is whenimage memory allocated without padding at the end of image rows. It does not depend on whetherROI is usedor not! If examples from my previous post are not clear on that let me construct another example to address that particular case. Let's consider situation where memory allocated without padding for the same single channel, Ipp8u image with size 3x3:
Ipp8u* pSrc= (Ipp8u*)malloc(3*3);
Althoughreal memory block will look like just array of bytes x x x x x x x x x, logically it might be treated as 2D array
x x x
x x x
x x x
So,toget pointer tothesecond pixel in the second row (in assumtion that base address still the same 100) you will need do something like this Ipp8uroiPtr = 100 + 3 + 1. It is obvious that in case of padding this calculation will provide wrong result, isn't it?
Could you please refer to a certain example in IPP documentation which really says: "when a function does not operate on ROI, step must be equal to width * bytesperpixel"? I'm asking that because it is wrong in general case and so should be fixed in documenation.