Table: | For specifying the MIL system |
Table: | For specifying the buffer width |
Table: | For specifying the buffer height |
Table: | For specifying the data depth of the buffer |
+ combination: | For specifying the data type of the buffer |
Table: | For specifying the buffer usage |
+ combination: | For specifying the intended purpose of the image buffer |
+ combination: | For specifying the compression type |
+ combination: | For specifying location information |
Table: | For specifying the physical nature of the buffer |
+ combination: | For specifying how the pitch is measured |
MIL_ID SystemId, | //in |
MIL_INT SizeX, | //in |
MIL_INT SizeY, | //in |
MIL_INT Type, | //in |
MIL_INT64 Attribute, | //in |
MIL_INT64 ControlFlag, | //in |
MIL_INT Pitch, | //in |
const void *DataPtr, | //in |
MIL_ID *BufIdPtr | //out |
This function creates a two-dimensional data buffer using memory at a specified location, and associates it with a specific MIL system.
This function should be used with caution because, when using physical addresses, it provides direct access to any of your computer's memory mapped devices; when using logical addresses, memory protection errors could result.
It is generally better to leave buffer allocation, data loading, and memory control to MIL (MbufAlloc2d(), MbufGet2d(), MbufPut2d()), since MIL might require special memory attributes (such as non-paged memory) or alignment to associate the buffer with a particular target system.
You must allocate the appropriate memory before calling MbufCreate2d() and you must free the created buffer when no longer required, using MbufFree() before freeing the memory. Using MbufFree() on a buffer created with MbufCreate2d() will free the internal structure required for a mapped buffer, but it will not free the memory used. MbufInquire() can be used to get the pointer to the data of a MIL allocated buffer.
Note that to create a buffer mapped to on-board memory, it must be shared memory. See your MIL Hardware-specific Notes for more information regarding shared memory.
Specifies the MIL system on which to create the buffer.
This parameter should be set to one of the following values:
For specifying the MIL system
|
|||||||||||||||||||||||||||||||||||||||
Value | Description | ||||||||||||||||||||||||||||||||||||||
M_DEFAULT_HOST |
Specifies the default Host system of the current MIL application. |
||||||||||||||||||||||||||||||||||||||
MIL system identifier |
Specifies a valid system identifier, previously allocated using MsysAlloc(). |
Specifies the buffer width.
For specifying the buffer width
|
|||||||||||||||||||||||||||||||||||||||
Value | Description | ||||||||||||||||||||||||||||||||||||||
M_DEFAULT |
Specifies that the buffer width is identical to that of the source buffer when the ControlFlag parameter is set to M_MIL_ID. |
||||||||||||||||||||||||||||||||||||||
Value |
Specifies buffer width. The units are determined by the selected buffer attribute. For example, if the buffer has an image buffer attribute, width is specified in pixels. (summarize)Specifies buffer width. (more details...) |
Specifies the buffer height.
For specifying the buffer height
|
|||||||||||||||||||||||||||||||||||||||
Value | Description | ||||||||||||||||||||||||||||||||||||||
M_DEFAULT |
Specifies that the buffer height is identical to that of the source buffer when the ControlFlag parameter is set to M_MIL_ID. |
||||||||||||||||||||||||||||||||||||||
Value |
Specifies the buffer height. The units are determined by the selected buffer attribute. For example, if the buffer has an image buffer attribute, height is specified in pixels. (summarize)Specifies the buffer height. (more details...) |
Specifies a combination of two values: data type and data depth. Specify the depth of the buffer as one of the following:
For specifying the data depth of the
buffer
|
|||||||||||||||||||||||||||||||||||||||
Value | Description | ||||||||||||||||||||||||||||||||||||||
M_DEFAULT |
Specifies that the buffer data depth and type are identical to that of the source buffer when the ControlFlag parameter is set to M_MIL_ID. |
||||||||||||||||||||||||||||||||||||||
1 + |
Specifies a 1-bit (packed binary) buffer. Note that you cannot allocate a 1-bit LUT, kernel, or structuring element buffer. (summarize)Specifies a 1-bit (packed binary) buffer. (more details...) |
||||||||||||||||||||||||||||||||||||||
8 + |
Specifies an 8-bit buffer. |
||||||||||||||||||||||||||||||||||||||
16 + |
Specifies a 16-bit buffer. |
||||||||||||||||||||||||||||||||||||||
32 + |
Specifies a 32-bit buffer. |
You can add one of the following values to the above-mentioned values to set the data type.
Supported data types depend on the specified depth.
For specifying the data type of the
buffer
|
|||||||||||||||||||||||||||||||||||||||
|
Description | ||||||||||||||||||||||||||||||||||||||
M_FLOAT |
Specifies that the type of data is floating-point. The valid data depth is 32 bits. (summarize)Specifies that the type of data is floating-point. (more details...) |
||||||||||||||||||||||||||||||||||||||
M_SIGNED |
Specifies that the type of data is signed. The valid data depths are 8, 16 or 32 bits. (summarize)Specifies that the type of data is signed. (more details...) |
||||||||||||||||||||||||||||||||||||||
M_UNSIGNED |
Specifies that the type of data is unsigned. The valid data depths are 1, 8, 16 or 32 bits. This is the default value. (summarize)Specifies that the type of data is unsigned. (more details...) |
Specifies the buffer usage. This allows you to specify the type of buffer, intended purpose, compression type, storage format, data direction, location, internal storage format, memory type, and overscan region of the created buffer; all of which provides additional information for other MIL functions.
This function should be used with caution because, when using physical addresses, it provides direct access to any of your computer's memory mapped devices; when using logical addresses, memory protection errors could result.
Set this parameter to one of the following values:
For specifying the buffer usage
|
|||||||||||||||||||||||||||||||||||||||
Value | Description | ||||||||||||||||||||||||||||||||||||||
M_ARRAY + |
Specifies a buffer to store array type data. Note that some functions take an M_ARRAY buffer rather than a user-defined array. (summarize)Specifies a buffer to store array type data. (more details...) |
||||||||||||||||||||||||||||||||||||||
M_IMAGE + |
Specifies a buffer to store image data. You must specify a combination value from the following table: Specifies a buffer to store image data. (more details...) |
||||||||||||||||||||||||||||||||||||||
M_KERNEL + |
[For
essential MIL-Lite information, see remarks ]
Specifies a kernel buffer to store a custom filter for convolution functions. The depth must be 8, 16, or 32-bit integer or floating-point. (summarize)[For
essential MIL-Lite information, see remarks ]
Specifies a kernel buffer to store a custom filter for convolution functions. (more details...) |
||||||||||||||||||||||||||||||||||||||
M_LUT + |
Specifies a buffer to store lookup table data. The valid data depths are 8, 16, or 32-bit. (summarize)Specifies a buffer to store lookup table data. (more details...) |
||||||||||||||||||||||||||||||||||||||
M_STRUCT_ELEMENT + |
[For
essential MIL-Lite information, see remarks ]
Specifies a buffer to store structuring element data for morphology functions. The data depth must be 32-bit. If signed, the range is -32768 to +32767. If unsigned, the range is 0 to +32767. Note that the data can be set to M_DONT_CARE to ignore specific structuring elements. (summarize)[For
essential MIL-Lite information, see remarks ]
Specifies a buffer to store structuring element data for morphology functions. (more details...) |
You must add one or more of the following values to the above-mentioned value to set the intended purpose of this buffer.
Note that this value must not conflict with the attribute of the specified physical memory to which it is mapped. Such a conflict can result in errors that MIL cannot catch.
For specifying the intended purpose of the image
buffer
|
|||||||||||||||||||||||||||||||||||||||
|
Description |
MIL system-specific tooltip (‡) |
|||||||||||||||||||||||||||||||||||||
M_COMPRESS + |
[For
essential MIL-Lite information, see remarks ]
Specifies an image buffer that can hold compressed data. Note that a buffer with this attribute cannot have the M_SIGNED data type. If M_COMPRESS is specified, the underlying data must already be compressed with the specified compression type. The Type SizeX and SizeY parameters must also be set to the exact size of the compressed image stored in the underlying data. It is not possible to create a compressed buffer mapped on to only part of a compressed image. When mapping buffers for operations that require a source and destination buffer, and one of the buffers has an M_COMPRESS attribute, the data will be compressed or decompressed depending on the attributes of the destination buffer. If both the source and destination buffers have M_COMPRESS specifiers but different compression types, the data will be re-compressed according to the settings of the destination buffer. Note that buffers created from preallocated memory with the M_COMPRESS attribute should typically only be passed to MIL functions as a source. If you pass a compressed buffer created from preallocated memory as a destination for a MIL function, an error will be generated if the compressed size in memory of the function output is not the same as the size of the allocated memory. This is true even if the ControlFlag parameter is set to M_MIL_ID. (summarize)[For
essential MIL-Lite information, see remarks ]
Specifies an image buffer that can hold compressed data. (more details...) |
‡ | a | c M10 |
g | h | i | j | k M10 |
l | m | o | p | r U27 |
t U28 |
u U36 |
v | y U75 |
aa | ||||||||||||||||||||
M_DISP |
Specifies an image buffer that can be displayed. |
‡ | a | c M10 |
g | h | i | j | k M10 |
l | m | o | p | r U27 |
t U28 |
u U36 |
v | y U75 |
aa | ||||||||||||||||||||
M_GRAB |
Specifies an image buffer in which to grab data. This type of buffer is usually allocated in MIL-reserved, physically contiguous, non-paged memory. The physical nature of the buffers (using the ControlFlag) must be set to M_PHYSICAL_ADDRESS. (summarize)Specifies an image buffer in which to grab data. (more details...) |
‡ | a | c M10 |
g | h | i | j | k M10 |
l | m | o | p | r U27 |
t U28 |
u U36 |
v | y U75 |
aa | ||||||||||||||||||||
MIL system specific | |||||||||||||||||||||||||||||||||||||||
Single-band (monochrome) buffers must have a depth of 8 bits or 16 bits to have an M_GRAB attribute. |
‡ | c M10 |
j | k M10 |
l | m | o | p | r U27 |
v | y U75 |
aa | |||||||||||||||||||||||||||
Single-band (monochrome) buffers must have a depth of 8 bits to have an M_GRAB attribute. |
‡ | g | h | t U28 |
|||||||||||||||||||||||||||||||||||
M_PROC |
Specifies an image buffer that can be processed. |
‡ | a | c M10 |
g | h | i | j | k M10 |
l | m | o | p | r U27 |
t U28 |
u U36 |
v | y U75 |
aa |
You can add one of the following values to the above-mentioned value to set the compression type.
The image buffer's data depth dictates which compression type can be selected.
Note that this value must not conflict with the compression format of the underlying data.
For specifying the compression type
INQ
|
|||||||||||||||||||||||||||||||||||||||
|
Description | ||||||||||||||||||||||||||||||||||||||
M_JPEG2000_LOSSLESS |
[For
essential MIL-Lite information, see remarks ]
Specifies that the buffer will be used to hold JPEG2000 lossless data. The supported data formats are: 1-band, 8- or 16-bit data. (summarize)[For
essential MIL-Lite information, see remarks ]
Specifies that the buffer will be used to hold JPEG2000 lossless data. (more details...) |
||||||||||||||||||||||||||||||||||||||
M_JPEG2000_LOSSY |
[For
essential MIL-Lite information, see remarks ]
Specifies that the buffer will be used to hold JPEG2000 lossy data. The supported data formats are: 1-band, 8- or 16-bit data. (summarize)[For
essential MIL-Lite information, see remarks ]
Specifies that the buffer will be used to hold JPEG2000 lossy data. (more details...) |
||||||||||||||||||||||||||||||||||||||
M_JPEG_LOSSLESS |
[For
essential MIL-Lite information, see remarks ]
Specifies that the buffer will be used to hold JPEG lossless data. The supported data formats are: 1-band, 8- or 16-bit data. (summarize)[For
essential MIL-Lite information, see remarks ]
Specifies that the buffer will be used to hold JPEG lossless data. (more details...) |
||||||||||||||||||||||||||||||||||||||
M_JPEG_LOSSLESS_INTERLACED |
[For
essential MIL-Lite information, see remarks ]
Specifies that the buffer will be used to hold JPEG lossless data in separate fields. The supported data formats are: 1-band, 8- or 16-bit data. (summarize)[For
essential MIL-Lite information, see remarks ]
Specifies that the buffer will be used to hold JPEG lossless data in separate fields. (more details...) |
||||||||||||||||||||||||||||||||||||||
M_JPEG_LOSSY |
[For
essential MIL-Lite information, see remarks ]
Specifies that the buffer will be used to hold JPEG lossy data. The supported data format is 1-band, 8-bit data. This is the default value. (summarize)[For
essential MIL-Lite information, see remarks ]
Specifies that the buffer will be used to hold JPEG lossy data. (more details...) |
||||||||||||||||||||||||||||||||||||||
M_JPEG_LOSSY_INTERLACED |
[For
essential MIL-Lite information, see remarks ]
Specifies that the buffer will be used to hold JPEG lossy data in separate fields. The supported data format is 1-band, 8-bit data. (summarize)[For
essential MIL-Lite information, see remarks ]
Specifies that the buffer will be used to hold JPEG lossy data in separate fields. (more details...) |
You can add the following value to the above-mentioned values to set whether the buffer is mapped to Host memory by default.
This value is only available when ControlFlag is set to M_PHYSICAL_ADDRESS, or M_MIL_ID if DataPtr specifies a buffer with a physical address (that is, MbufInquire() with M_PHYSICAL_ADDRESS does not return M_NULL).
For specifying location information
|
|||||||||||||||||||||||||||||||||||||||
Combination value | Description | ||||||||||||||||||||||||||||||||||||||
M_MAPPABLE |
Specifies that the buffer is not mapped to Host memory when it is created (that is, by default the buffer will have a physical address, but not a Host address). Use MbufControl() with M_MAP to enable or disable mapping the buffer to Host memory. This setting is useful when dealing with many large buffers that cannot all be mapped in Host memory at the same time. By creating a M_MAPPABLE buffer, it can be mapped and unmapped as needed. (summarize)Specifies that the buffer is not mapped to Host memory when it is created (that is, by default the buffer will have a physical address, but not a Host address). (more details...) |
Specifies the physical nature of the buffer. This parameter can be set to one of the values below.
For specifying the physical nature of the
buffer
|
|||||||||||||||||||||||||||||||||||||||
Value | Description | ||||||||||||||||||||||||||||||||||||||
M_HOST_ADDRESS + |
Specifies that DataPtr is a logical address that points to the data. Note that when using logical addresses, memory protection errors could result. Note that you can use MbufInquire() with M_HOST_ADDRESS to get the logical address of a MIL allocated buffer. You must specify a combination value from the following table: Specifies that DataPtr is a logical address that points to the data. (more details...) |
||||||||||||||||||||||||||||||||||||||
M_MIL_ID + |
Specifies that the new buffer maps to an existing source buffer. DataPtr points to the MIL identifier of the source buffer. You must specify a combination value from the following table: Specifies that the new buffer maps to an existing source buffer. (more details...) |
||||||||||||||||||||||||||||||||||||||
M_PHYSICAL_ADDRESS + |
Specifies that DataPtr is a physical address that points to the data. Note that using physical addresses provides direct access to any of your computer's memory mapped devices. Note that you can use MbufInquire() with M_PHYSICAL_ADDRESS to get the physical address of a MIL allocated buffer. This setting must be used for all buffers with the M_GRAB attribute. You must specify a combination value from the following table: Specifies that DataPtr is a physical address that points to the data. (more details...) |
You must add one of the following values to the above-mentioned values to set how the pitch is measured.
For specifying how the pitch is
measured
|
|||||||||||||||||||||||||||||||||||||||
Combination value | Description | ||||||||||||||||||||||||||||||||||||||
M_PITCH |
Specifies that the pitch is in pixels. |
||||||||||||||||||||||||||||||||||||||
M_PITCH_BYTE |
Specifies that the pitch is in bytes. |
Specifies the size of the pitch. The pitch is the number of pixels or bytes (as specified by the ControlFlag parameter) between the start of any two adjacent rows of the buffer. The actual length of a row in the buffer, in physical memory, might be different from the value of the SizeX parameter (for example, due to use of buffer overscan).
Note that your code should not make assumptions about the actual pitch of the source memory. If the memory was allocated using an MbufAlloc...() function, use MbufInquire() with M_PITCH or M_PITCH_BYTE to establish the required pitch.
For specifying the size of the pitch
|
|||||||||||||||||||||||||||||||||||||||
Value | Description | ||||||||||||||||||||||||||||||||||||||
M_DEFAULT |
Specifies that when dealing with a 1-bit buffer, the pitch is a multiple of 4 bytes; otherwise the pitch equals the SizeX parameter. |
||||||||||||||||||||||||||||||||||||||
Value |
Specifies the pitch in pixels or bytes (as determined by the ControlFlag parameter). |
Specifies the MIL identifier of the buffer, or a pointer to the data array, on which to map the created MIL buffer.
When the ControlFlag parameter is set to M_MIL_ID, DataPtr specifies the MIL identifier of the source buffer.
When the ControlFlag parameter is set to M_HOST_ADDRESS, DataPtr specifies a logical address that points to the data.
When the ControlFlag parameter is set to M_PHYSICAL_ADDRESS, DataPtr specifies a physical address that points to the data.
Header | Include mil.h. |
Library | Use mil.lib. |
DLL | Requires mil.dll. |