Definition of plane and step

Definition of plane and step

Hi guys,

I'm new to IPP and learning to use the image processing package. There are certain terms I'm not familiar in the memory allocation function ippiMalloc_<mod>(int widthPixels, int heightPixels, int* pStepBytes).

1. The third parameter is a pointer to the step in bytes through the image. What does "step" mean?
2. For mod, possible values include *_P3, which is "Data is made up of n discrete planar (non-interleaved) channels, with a separate pointer to each plane." What is a plane?


3 帖子 / 0 全新


You can see, step is distance in bytes between adjacent lines. (This is from ippi.h file)

/* /////////////////////////////////////////////////////////////////////////////
// Name: ippiMalloc
// Purpose: allocates memory with 32-byte aligned pointer for ippIP images,
// every line of the image is aligned due to the padding characterized
// by pStepBytes
// Parameter:
// widthPixels width of image in pixels
// heightPixels height of image in pixels
// pStepBytes the pointer to the image step, it is an out parameter calculated
// by the function
// Returns: pointer to allocated memory or 0 if out of memory or wrong parameters
// Notes: free the allocated memory by the function ippiFree only

There are generally two ways of storing image data: interleaved and planar. With interleaved data, all the values for a given pixel are stored adjacently in memory, and with planar data all the pixels for a given color are stored together.

So, lets say you have CMYK data with a pixel height and width of 2. For interleaved data, the data would be stored as:


where each character represents the color value for one colorant of one pixel. For example, the first "C" represents the cyan value for the first pixel.

With planar data, the data would be stored as:


where all the data for a single colorant is stored adjacently.

So,a "plane" is all the image data associated with one color. In the example above, the "CCCC" represents the cyan plane, the "MMMM" represents the magenta plane, and so on.

As for the "step", this is used to align data on an efficient boundary. Let's say you had a 3x2 pixel image (3 horizontal and 2 vertical), but the computer accesses data more efficiently on 4 byte boundaries. Now the planar data would look like this:


where each "x" is a filler byte used to adjust each line so the data for the next line is aligned to a 4-byte boundary.

(All the above assumes that there is one byte of data for each colorant for each pixel. There are other possibilities, but 8-bit color data is the most common.)