| Products & Services | Solutions | Academia | Support | User Community | Company |
| Download Product Updates | | | Get Pricing | | | Trial Software |
| Documentation → Target Support Package |
| Contents | Index |
| Learn more about Target Support Package |
Adding this block to a model enables code generated from your model to perform the following tasks:
Capture analog video data from the video input ports on the DM642 EVM.
Convert the input to a format and mode you define in the block.
Output the converted digital video for further downstream processing.
Adding two of these blocks to a model lets you capture two separate video data streams and prepare them for display simultaneously, such as in picture-in-picture mode.
The block captures and buffers one frame (two fields for NTSC standard) of analog input video from the input ports, converts the buffered video to the specified format, and then outputs the converted video frame as 8-bit unsigned integer data for further processing.
Input to the DM642 EVM must be analog National Television Standards Committee (NTSC) or Phase Alternating Line (PAL) video format. The block captures and processes data in frames, not fields.
To configure the format for the output video, the block offers output format options that control how the block handles color data. The block also offers a sample time option to let you set the frame rate for video output from the block.
Note This block does not provide output video for display. Use the DM642 EVM Video DAC to generate video data to output to the board video output connectors. The DM642EVM board provides both composite and S-video connectors for output. However, these are driven simultaneously, so you do not need to specify which one is to be used. |
When you add this block to a Simulink model, it has no affect in your simulation — it outputs a string of zeros. Generating code from a model that includes this block produces the code needed for capturing data on your evaluation module by adding
Video device configuration code for the chosen mode
Code used to copy the run time buffer
To use video in a Simulink model, use one of the available video source blocks to introduce video data to your model.
Options for the block let you configure the digital video format and video mode for the data output by the block.
NTSC TV systems use interlaced scanning to create TV frames from fields. The even and odd TV lines are separated into even and odd fields that combine to make a complete TV frame image. For output, the block always provides complete frames, consisting of two fields, which are available at any instant. When the sample time you specify for the block is different from the NTSC frame rate of 30Hz, you may encounter visible anomalies in the video stream from the block.
This block allocates video capture buffers on the system heap, using a TI driver that allocates three frame buffers on the heap for continuous video capture. To use the block you must create a heap in external memory on the target with the label EXTERNALHEAP. If you do not create the heap, either using the default values in the DM642 Target Preferences block or setting your own values. Target Support Package software returns an error.
Use Create heap and Heap size and set the heap size in the DM642EVM Target Preferences block to configure the heap. Select Define label and name the heap EXTERNALHEAP in Heap label.
The default settings for the target preferences create a heap with sufficient memory to handle the worst case memory allocation needs automatically. If you configure the heap without sufficient memory, you get a run-time error because the system cannot initialize the video driver.
When you choose to convert your NTSC YCbCr-defined video input to RGB24 (8:8:8 RGB) for output from the block, the block performs an intermediate conversion step that follows a standard process for conversion (as described by Graphical Device Interface (GDI) color space conversions documentation from the International Color Consortium (ICC)).
First, the block converts the luma component (Y'), blue-difference chroma component (Cb), and red-difference chroma component (Cr) of the input signal to 5:6:5 RGB format where the red and blue channels of the source use a 5-bit representation and the green channel uses 6 bits.
Now the block converts your 5:6:5 RGB to 8:8:8 RGB using the following conventions:
For the red and blue 5-bit channels, it copies the three most significant bits (MSB) from the 5-bit source word and append them to the lower order end of the target word.
For the green 6-bit channel, it copies the two MSBs from the green source word and append them to the lower order end of the target green word.
The results is to output three RGB channels — red, green, and blue — each with 8-bit words.
For example, to convert hexadecimal values by this algorithm, 5:5:5 RGB data of (0x19, 0x33, 0x1A) becomes (0xCE, 0xCF, 0xD6) of 8:8:8 RGB output.
To do the conversion in the binary case for 5:5:5 RGB data:
for the green channel, conversion takes 11 0011 to 1100 1111
red data 1 0101 becomes 1010 1101 (same algorithm as blue data)
To maximize the speed of the RGB conversion, the Video ADC block provides color space conversion using a routine written in assembly language and optimized for the DM64x processor core. Using the optimized color space conversion code replaces the Color Space Conversion block available from the Video and Image Processing Blockset™ (VIP blockset). While you can use any compatible VIP blockset block with the DM642, this particular color space conversion operation is handled better by the conversion code included in the ADC block.

Configures the block options to support either the TVP5146 Decoder on the DM642 EVM or the SAA7115 Decoder, depending on the model of your board. Choose one option from the list — TVP5146 or SAA7115. When you select SAA7115 for the type of decoder, the dialog box adds a new option — Output Mode. Generally, older DM642 EVM boards use the SAA7115 decoder. Newer boards use the default setting TVP5146 decoder. Refer to Identifying Your DM642 EVM Board Version for information about identifying the revision of your DM642 EVM.
Directs the block to capture video from either the 0 or 1 video input port on the DM642 EVM. The block does not support port 2 for video input. Input port 0 provides both composite video (via connector J15) and S-video (connector J16) inputs.
Select the video format to capture from the list. The block supports NTSC and PAL video formats.
Select composite video or S-video. The video decoder connected to port 0 has both composite and S-video inputs. These are available via connector J15 and J16, respectively. Port 1 has two composite video connectors and no S-video availability.
Reports the size of the video images to output. Output size is a read-only parameter set to 720 x 576 resolution elements when you select PAL mode and the TVP5146 decoder in Decoder type. When you select NTSC mode with the TVP5146 decoder, Output size reports the read-only value 720 x 480.
If you select the SAA7115 decoder, Output size lists the available video sizes to output for further processing, depending on the Mode setting. The following tables show the sizes to pick from depending on whether you pick NTSC or PAL for Mode The block scales the input video to the selected size for output.
| Video Output Size Options For NTSC Mode | Description |
|---|---|
| 128 x 96 | Output NTSC video with dimensions 128 pixels by 96 pixels. Scales the output to 1/4 the resolution of QCIF video. |
| 176 x 144 | Output NTSC video with dimensions 176 pixels by 144 pixels. Scales the output to 1/4 the resolution of CIF video. |
| 320 x 240 | Output NTSC video with dimensions 320 pixels by 240 pixels. Scales the output to standard interchange format NTSC. Derived from CCIR 601 video (most often). |
| 720 x 480 | Output NTSC video with dimensions 720 pixels by 480 pixels. Scales the output to higher definition TV mode. |
| Video Output Size Options For PAL Mode | Description |
|---|---|
| 128 x 96 | Output video with dimensions 128 pixels by 96 pixels |
| 176 x 144 | Output video with dimensions 176 pixels by 144 pixels. |
| 320 x 240 | Output video with dimensions 320 pixels by 240 pixels |
| 720 x 576 | Output video with dimensions 720 pixels by 576 pixels |
Determines how the block represents color data in the output. Choose one of the following color representations according to what your model and algorithm require.
Digital Output Format | Description |
|---|---|
RGB24 | Output uses 8 bits each of red, green, and blue colors to represent the color of each pixel in the image. RGB color space is device-dependent. |
YCbCr | Output from the block includes three channels to represent the color image data per pixel:
This is the digital standard color space DVDs use. |
Y | Black/White video. No color/chromaticity values. |
With data order, you control the way the video decoder stores and outputs video data fields and frames of images. Choose one of these options from the list.
Row major — store video data in row major order. This is the default setting and matches most video data.
Column major — store video data in column major order. The Simulink and MATLAB software use this format to store images and matrices.
DM642 EVM Video ADC blocks store the image data in row major format because most video capture devices use a scanning order of left-to-right and top-to-bottom, favoring the rows.
MATLAB and Simulink software use column major ordering to store image and matrix data. Therefore, some of the Simulink blocks may not work correctly or as expected with the DM642 EVM Video ADC blocks.
To address this problem, the Video ADC blocks include an option Data order to let you select either row major or the column major storage formats. By default, this block uses row major data format.
When you select Column major, the block performs an explicit transposition on the image data to map the data format from row major to column major order. To minimize the processor time spent on the transposition, the block uses optimized assembly routines to transpose the image data.
Selecting Inherit sample time sets the sample time to –1. To use this block in a function call subsystem, you must select this option. Inherit sample time is cleared by default and the block uses the model sample time.
Specifying sample-time inheritance for a this block, a source block, can cause Simulink software to assign an inappropriate sample time to the block. You should avoid selecting Inherit sample time unless you are required to do so because you placed the block in a function call subsystem. When you select Inherit sample time, Simulink software displays a warning message when you update or simulate the model.
![]() | DM642 EVM FPGA GPIO Write | DM642 EVM Video DAC | ![]() |

Includes the most popular MATLAB recorded presentations with Q&A sessions led by MATLAB experts.
| © 1984-2009- The MathWorks, Inc. - Site Help - Patents - Trademarks - Privacy Policy - Preventing Piracy - RSS |