| Customize Help

Controlling how color image buffers are stored



A color image buffer's internal representation can be either in a planar or packed format. When allocating the buffer, if you specify an M_PLANAR attribute, the pixels are stored in planes (for example, RRR GGG BBB); if you specifiy an M_PACKED attribute, each pixel is stored as one unit containing all its components (for example, RGB RGB RGB).

MIL automatically selects the most appropriate format, according to the specified intended purpose attribute. If an image buffer is allocated in one format, and a general processing function requiring another format is called, the function will automatically convert the data to the required format and re-convert it back to its original format upon completion. To change a buffer's default internal storage format, explicitly specify the required internal storage format when calling MbufAllocColor(). Note that it might be slower to process buffers with M_PACKED attributes.

In general, packed formats are mostly used for display purposes; when setting a buffer's attribute to M_DISP, the default internal representation is usually packed. This configuration allows for faster transfers to display sections.

Planar formats are generally preferred for processing. Processing is done on each of the component planes separately.

When allocating an image buffer with more than one attribute, for example, M_DISP and M_PROC, the buffer's internal storage requirements for the display will take precedence over other attributes.

See MbufAllocColor() in the MIL Reference to determine which formats are supported for your MIL system.