-------------------------------------------------------------------------------- Matrox Imaging Library (8.0) Update 10 MilMorphisQxT.txt April 17, 2007 Copyright© 2007 by Matrox Electronic Systems Ltd. All rights reserved. -------------------------------------------------------------------------------- This document outlines what is new with MIL for Matrox Morphis QxT and explains the current limitations and particularities when using MIL with Matrox Morphis QxT. It also presents last minute information that did not make it into the manual or on-line help. Note that this text file serves to complement your manual. The information found in this file overrides your formally documented material. Contents 1. Matrox Morphis QxT with MIL 1.1 What's new 2. Matrox Morphis QxT MPEG-4 features and controls 2.1 Typical usage 2.2 MsysControl() 2.3 MsysInquire() 2.4 MbufControl() 2.5 MbufInquire() 2.6 MPEG-4 encoding engine resource limitation 3. New functionality with Morphis QxT (with or without MPEG-4 encoding) 3.1 Support for hardware image blending 3.2 User-defined signals for Matrox Morphis QxT 3.3 Matrox Morphis QxT Watchdog functionality 3.4 Video output usage 3.5 M_BGRX_ALPHA_VALUE with MbufControl 3.6 M_BGRX_ALPHA_VALUE with MbufInquire 4. Matrox Intellicam issue 1. Matrox Morphis QxT with MIL 1.1 What's new - Support for Matrox Morphis QxT MPEG-4 encoding. - Support for video test signals output. - Support for 32 TTL auxiliary I/Os. - Support watchdog timer to monitor overall system integrity. 2. Matrox Morphis QxT MPEG-4 features and controls 2.1 Typical usage - The following is a basic overview of how to use the MIL stream mechanism. For more information, refer to the example code in: \Matrox Imaging\Mil\Examples\Board-Specific\MorphisQxT\. // Stream initialization. MsysControl(MilSystem, M_STREAM_CONTROL + M_MPEG_STREAM(0), M_OPEN + M_MPEG4); MbufAllocColor(MilSystem, 3, 720, 480, 8 + M_UNSIGNED, M_IMAGE + M_COMPRESS + M_MPEG4 + M_NON_PAGED, &MilMpegBuffer); MbufControl(MilMpegBuffer, M_ASSOCIATED_STREAM, 0); // MPEG-4 compression. MbufCopy(MilGrabBuffer, MilMpegBuffer); // Stream closing. MsysControl(MilSystem, M_STREAM_CONFIG + M_MPEG_STREAM(0), M_CLOSE); 2.2 MsysControl() -------------------------------------------------------------------------------------- Control Type Type Description Control Value Value Description NOTE: For M_STREAM(x) values listed below, x can range from 0 to 15, inclusive. -------------------------------------------------------------------------------------- M_STREAM_CONTROL + M_STREAM(x) Sets the state of the specified stream (x). M_OPEN + M_MPEG4 Opens an MPEG compression stream on that specific system. M_CLOSE Closes a stream and frees the associated resources. Closing a stream will reset all compression parameters. M_STREAM_BIT_RATE_MODE + M_STREAM(x) Sets the bit rate mode of the specified stream (x). M_CONSTANT Constant bit rate mode, set using M_STREAM_BIT_RATE. M_VARIABLE Variable bit rate mode, set using M_STREAM_Q_FACTOR as a fixed quantization factor. M_VARIABLE_MAX Variable bit rate mode with maximum, set using M_STREAM_BIT_RATE as a maximum value. M_STREAM_BIT_RATE + M_STREAM(x) Sets the encoding bit rate of the specified stream (x), in kbps. Used for M_CONSTANT and M_VARIABLE_MAX bit rate modes. 196 to 4000 Range of acceptable bit rate values. M_STREAM_Q_FACTOR + M_STREAM(x) Sets the quantization parameter of the specified stream (x). Used for M_VARIABLE bit rate mode. 1 to 99 Range of acceptable quantization parameter values. M_STREAM_SIZE_X + M_STREAM(x) Sets the size-X of the specified output MPEG stream (x). *See note below (specific X/Y control not implemented). Value > 0 Range of acceptable size-X values. M_STREAM_SIZE_Y + M_STREAM(x) Sets the size-Y of the specified output MPEG stream (x). *See note below (specific X/Y control not implemented). Value > 0 Range of acceptable size-Y values. M_STREAM_GROUP_OF_PICTURE_SIZE + M_STREAM(x) Sets the "group of picture" size (interval between I frames) of the specified stream (x). "I" refers to intra-coded. 1 to 99 Range of acceptable size values. M_STREAM_NUMBER_OF_SLICES + M_STREAM(x) Sets the number of slices, per frame, of the specified stream (x). 1 to 4 Range of acceptable slice values. * NOTE: Supported resolutions are: 720x480, 720x576, 352x240 and 352x288. Specific size-X or size-Y control is not available at this time; the first compression done on a specific stream will set both X- and Y-values. 2.3 MsysInquire() -------------------------------------------------------------------------------------- Inquire Type Type Description Return Values NOTE: For M_STREAM(x) values listed below, x can range from 0 to 15, inclusive. -------------------------------------------------------------------------------------- M_STREAM_CONTROL + M_STREAM(x) Returns the state of the specified stream (x). M_OPEN + M_MPEG4 M_CLOSE M_STREAM_BIT_RATE_MODE + M_STREAM(x) Returns the bit rate mode of the specified stream (x). M_CONSTANT M_VARIABLE M_VARIABLE_MAX M_STREAM_BIT_RATE + M_STREAM(x) Returns the encoding bit rate of the specified stream (x), in kbps. Used for M_CONSTANT and M_VARIABLE_MAX bit rate modes. 196 to 4000 M_STREAM_Q_FACTOR + M_STREAM(x) Returns the Quantization parameter the specified stream (x). Used for M_VARIABLE bit rate mode. 1 to 99 M_STREAM_SIZE_X + M_STREAM(x) Returns the size-X of the specified output MPEG stream (x). Value > 0 M_STREAM_SIZE_Y + M_STREAM(x) Returns the size-Y of the specified output MPEG stream (x). Value > 0 M_STREAM_GROUP_OF_PICTURE_SIZE + M_STREAM(x) Returns the "group of picture" size (interval between I frames) of the specified output MPEG stream (x). "I" refers to intra-coded. 1 to 99 M_STREAM_NUMBER_OF_SLICES + M_STREAM(x) Returns the number of slices, per frame, of the specified output MPEG stream (x). 1 to 4 2.4 MbufControl() -------------------------------------------------------------------------------------- Control Type Type Description Control Value Value Description -------------------------------------------------------------------------------------- M_ASSOCIATED_STREAM Sets the stream number associated with the MPEG-4 buffer. The stream number will also set the hardware path used. 0 to 15 Range of acceptable stream numbers. 2.5 MbufInquire() -------------------------------------------------------------------------------------- Inquire Type Type Description Return Values Value Description -------------------------------------------------------------------------------------- M_ASSOCIATED_STREAM Returns the stream number associated with the frame, if it is attached to an MPEG stream. 0 to 15 Range of possible stream numbers. M_INVALID Invalid stream. M_FRAME_TYPE Returns the MPEG frame type. M_MPEG_P_FRAME Inter-coded frame (with prediction from a previously encoded I or P frame). M_MPEG_I_FRAME Intra-coded frame (without prediction from any other frame). 2.6 MPEG-4 encoding engine resource limitation - To respect the hardware MPEG-4 encoding engine resource limitation, you must be cautious about how many streams you allocate, and their respective resolution. Note that only four resolutions are supported: 720x480, 720x576, 352x240 and 352x288. The first two are known as "Full frame" and the last two are known as "Quarter frame". - Also note that, at anytime, you must avoid opening more than: - 16 x Quarter frame. - 1 x Full frame and 12 x Quarter frame. - 2 x Full frame and 8 x Quarter frame. - 3 x Full frame and 4 x Quarter frame. - 4 x Full frame. 3. New functionality with Morphis QxT (with or without MPEG-4 encoding) 3.1 Support for hardware image blending The Matrox MorphisQxT (MORQ/16VD and MORQ/16VD/M4) supports image composition on on-board buffers. This is supported by the Mil MbufTransfer() function. ee the MIL online help for more details. void MbufTransfer( MIL_ID SrcBufId, MIL_ID DestBufId, long SrcOffX, long SrcOffY, long SrcSizeX, long SrcSizeY, long SrcBand, long DestOffX, long DestOffY, long DestSizeX, long DestSizeY, long DestBand, long TransferFunction, long TransferType, long OperationFlag, void *ExtraParameter); New TransferFunction parameter values when the TransferType parameter is set to M_DRIVER_METHOD: - M_COMPOSITION Specifies a transfer function that copies all pixels, except for pixels in the source region that are equal to the keying color specified by the OperationFlag parameter. The source and destination buffers must be allocated with the M_ON_BOARD attribute. The supported source buffer and destination buffer format is M_YUV16 + M_PACKED. - M_ALPHA_BLENDING Specifies a transfer function that combines an image with an overlay to create the appearance of partial transparency. All buffers must be allocated with the M_ON_BOARD attribute. The supported source buffer and destination buffer format is M_YUV16 + M_PACKED. The supported overlay buffer format is M_YUV16 + M_PACKED and M_RGB16 + M_PACKED. The ExtraParameter parameter specifies a pointer to the identifier (MIL_ID) of the overlay buffer. The OperationFlag parameter specifies the overlay transparency value. Supported values are from 0 to 255. A value of 0 represents 100% of the source buffer and 0% of the overlay buffer. A value of 255 represents 0% of the source buffer and 100% of the overlay buffer. A value of 128 represents 50% of the source buffer and 50% of the overlay buffer. Here is an example of how to use this function to blend a source buffer with an overlay buffer at 50%. AlphaBlendingValue = 128; MbufTransfer(MilSrcBufferYUV16OnBoard, MilDstBufferYUV16OnBoard, 0, 0, SizeX, SizeY, M_DEFAULT, 0, 0, SizeX, SizeY, M_DEFAULT, M_ALPHA_BLENDING, M_DRIVER_METHOD, AlphaBlendingValue, &MilOverlayBuferRGB16OnBoard); 3.2 User-defined signals for Matrox Morphis QxT The following text describes the differences between the Matrox Morphis family and the QxT. For information about Matrox Morphis User-defined signals, refer to the Board-specific notes in the MIL online help. When using the Matrox Morphis In and Out module, the Matrox Morphis QxT supports user- defined signals for synchronizing with other devices or controlling other devices (such as a strobe light). The relationship between the MIL user-defined signal numbers and the actual user-defined signals on In and Out connector 0 for Matrox Morphis QxT are as follows: MIL user-defined signal # In/Out HD-44 on MORQ-I/O add-on module 0 In TTL user input 31 1 In TTL user input 1 2 In TTL user input 32 3 In TTL user input 2 4 In TTL user input 33 5 In TTL user input 3 6 In TTL user input 34 7 In TTL user input 4 8 In TTL user input 35 9 In TTL user input 5 10 In TTL user input 36 11 In TTL user input 6 12 In TTL user input 37 13 In TTL user input 7 14 In TTL user input 38 15 In TTL user input 8 MIL user-defined signal # In/Out HD-44 on MORQ-I/O add-on module 0 Out TTL user output 24 1 Out TTL user output 9 2 Out TTL user output 39 3 Out TTL user output 10 4 Out TTL user output 40 5 Out TTL user output 26 6 Out TTL user output 41 7 Out TTL user output 11 8 Out TTL user output 42 9 Out TTL user output 12 10 Out TTL user output 28 11 Out TTL user output 13 12 Out TTL user output 43 13 Out TTL user output 14 14 Out TTL user output 44 15 Out TTL user output 15 To use the user-bits on the Morphis QxT, refer to the Matrox Morphis board-specific notes in the MIL online help. Note that with Matrox Morphis QxT you do not need to set the user bit mode before configuring your user-defined signals. 3.3 Matrox Morphis QxT Watchdog functionality Matrox Morphis QxT supports Watchdog functionality. For more information, refer to the Matrox Morphis board-specific notes in the MIL online help. 3.4 Video output usage The Matrox MorphisQxT features four video outputs that may be used as video pass-through. For each output, you may select any of the sixteen input signals as the source. Matrox MorphisQxT's video outputs are controlled with MdigControl. ----------------------------------------------------------------------------------- Control Type Type Description Control Value Value Description ----------------------------------------------------------------------------------- M_VIDEO_OUTPUT Set the video output state. M_NULL Disable all video output that has been configured with the current digitizer as the source. M_CH0 Forward the current digitizer's signal to video output 0. M_CH1 Forward the current digitizer's signal to video output 1. M_CH2 Forward the current digitizer's signal to video output 2. M_CH3 Forward the current digitizer's signal to video output 3. ----------------------------------------------------------------------------------- Standard VGA (D-sub 15) to BNC cable may be used to connect to the video output signals. Here is the pin/signal correspondence: RED -> Video out 0 GREEN -> Video out 1 BLUE -> Video out 2 HSYNC -> Video out 3 VSYNC -> N/C 3.5 M_BGRX_ALPHA_VALUE with MbufControl - M_BGRX_ALPHA_VALUE is a ControlType parameter setting that specifies the value that a MorphisQXT will write as the 4th byte when performing a transfer from an on-board YUV16 buffer to a host BGR32 buffer. For MIL functions, this byte is a “don’t care” byte (i.e. BGRX). - M_BGRX_ALPHA_VALUE will be used when the functions MbufCopy(), MdigGrab(), and MdigProcess() are used. For copies, the source buffer must be allocated in the MorphisQXT’s on-board memory with the attributes M_PACKED+M_YUV16_YUYV. The host buffer must be allocated in non-paged memory with the attributes M_PACKED+M_BGR32. - M_BGRX_ALPHA_VALUE can be set to the following: M_DEFAULT, or a long value ranging from 0 to 255. The default value is 0. 3.6 M_BGRX_ALPHA_VALUE with MbufInquire - M_BGRX_ALPHA_VALUE is an InquireType parameter setting that returns the value that a MorphisQXT will write as the 4th byte when performing a transfer from an on-board YUV16 buffer to a host BGR32 buffer. - M_BGRX_ALPHA_VALUE will return a long value ranging from 0 to 255. 4. Matrox Intellicam issue - Selecting digitizer number 4 or above after a grab has begun will result in an error message. When you close the error message and click on grab, the grab will continue.