Attribute
The data buffer attribute indicates the buffer type and its intended usage. Aurora Imaging Library uses this information to determine the most appropriate location in physical memory in which to allocate the buffer, and how to handle the buffer. A data buffer can be one of the following types:
M_IMAGE. Image buffers are used to store grabbed images.M_LUT. Lookup table buffers are used to store lookup table data.M_KERNEL. Kernel buffers define the filters used by convolution functions.M_STRUCT_ELEMENT. Structuring element buffers are used to store the structuring element data for morphology functions.M_ARRAY. Array buffers store array type data.
When allocating an image buffer (M_IMAGE), you must give more information about its intended usage. An image buffer can be any combination of the following:
- A buffer that can be displayed (
M_DISP). - A buffer that can be processed (
M_PROC). - A buffer in which data can be grabbed (
M_GRAB). - A buffer in which data is stored in a compressed format (
M_COMPRESS).
For example, to allocate an image buffer that can be displayed and used for processing, its attribute should be given as:
Image buffers without an M_DISP, M_PROC, M_GRAB, or M_COMPRESS attribute can still be used with the Buffer and Graphics modules.
Note: The
M_KERNELandM_STRUCT_ELEMENTattributes are not required to work under Aurora Imaging Library Lite.
When a displayable image buffer is allocated and selected for display (MbufAlloc... with M_DISP, and then MdispSelect), multiple buffers are maintained: one in Host memory for processing purposes, and other internal buffers in display or non-paged memory (maintained directly or using the normal Windows mechanisms) for display purposes (not necessarily the same size). When the Host buffer is modified, its associated internal buffers in display/non-paged memory are automatically updated. When displaying an image buffer, both the buffer and the display should be allocated on the same system.
When grabbing a single frame into a displayable image buffer, Aurora Imaging Library grabs into the Host memory version of the buffer and then updates the display of the buffer. When grabbing continuously, the grab will typically bypass the specified buffer, and grab into an intermediate temporary display buffer (in display or Host non-paged memory) to minimize CPU usage and improve performance. Only the last frame grabbed is written into the selected buffer.
It is possible to force the internal representation of a data buffer using internal storage format specifiers, such as M_PACKED or M_PLANAR, which force the data buffer to be in a packed or planar format, respectively. Refer to MbufAllocColor for a complete list of internal format specifiers.
If you try to use a data buffer in a situation that is not appropriate for its allocated attributes, an error message is generated and the operation is not performed. For example, if you try to display an image buffer without an M_DISP attribute with MdispSelect, an error message will be generated.
Memory locations
By default, all Zebra Imaging boards allocate buffers in shared Host memory instead of on-board memory. On these boards, on-board memory is typically limited in size and Host memory can be accessed much faster than on-board memory. Changing the default location for your buffer's allocation is typically done only when dealing with large buffers or limited amounts of memory. In most cases using the default memory storage locations will produce the best results. The following memory storage locations are available:
M_HOST_MEMORY. Stores the buffer in Host memory. Note that in all cases,M_HOST_MEMORYis the same asM_OFF_BOARD.M_ON_BOARD. Stores the buffer in memory located on your Zebra Imaging board.M_OFF_BOARD. Stores the buffer in memory located off your Zebra Imaging board.
Using on-board memory
Using on-board memory can improve performance when all buffers are allocated and processed on-board. This is beneficial when using boards with fast-processing memory.
There are three types of on-board memory available for some Zebra Imaging boards:
M_SHARED. Available in all boards with an FPGA, this forces the buffer in memory that is mapped on the PCI bus. Note that shared memory is only available on-board.- Unshared memory. This is the default memory location for all boards with a FPGA. The buffer is stored in unmapped memory.
Using paged or non-paged memory
There are two types of memory locations available to all Zebra Imaging boards:
M_PAGED. Forces the buffer into paged memory.M_NON_PAGED. Forces the buffer into non-paged memory.
Paging memory at allocation divides the available computer memory into small portions where the page is the smallest building block. Paging memory helps reduce the amount of external fragmentation and thus little memory is wasted. Use the Aurora Imaging Configurator utility to set the amount of non-paged memory available to your system. The rest of the memory is available for paging memory. Whenever possible, use the default settings for paged and non-paged memory.
If there is insufficient memory of the appropriate type to allocate a buffer with the specified attributes, the function generates an error and does not allocate the buffer.