Main Content

Read Binary File

Read video data from binary file

  • Read Binary File block

Libraries:
Computer Vision Toolbox / Sinks

Description

The Read Binary File block reads the video data from a binary file and imports it into a Simulink® model.

The user-specified block parameters describe the format of the video data. These parameters, along with the raw binary file, create the video data for the Simulink model.

Note

This block supports code generation for only those platforms that have file I/O. The block does not support code generation using Simulink Desktop Real-Time™ or Simulink Real-Time™.

Examples

Ports

Output

expand all

Luminance component of the video read from the binary file, specified as a 3-D array. The label of this port can be changed using the Component1 parameter when the Video format parameter is set to Custom.

Data Types: int8 | int16 | int32 | uint8 | uint16 | uint32

Blue difference component of the video read from the binary file, specified as a 3-D array. The label of this port can be changed using the Component2 parameter when the Video format parameter is set to Custom.

Data Types: int8 | int16 | int32 | uint8 | uint16 | uint32

Red difference component of the video read from the binary file, specified as a 3-D array. The label of this port can be changed using the Component3 parameter when the Video format parameter is set to Custom.

Data Types: int8 | int16 | int32 | uint8 | uint16 | uint32

Alpha component of the video read from the binary file, specified as a 3-D array. The label of this port can be changed using the Component4 parameter when the Video format parameter is set to Custom.

Dependencies

To enable this port, use one of these options.

  • Set the Video format parameter to Four character codes and set the Four character code parameter to AYUV or IF09.

  • Set the Video format parameter to Custom and the Number of output components parameter to 4.

Data Types: int8 | int16 | int32 | uint8 | uint16 | uint32

Transparency component of the video read from the binary file, specified as a 3-D array.

Dependencies

To enable this port, set the Video format parameter to Four character codes and set the Four character code parameter to Y41T or Y42T.

Data Types: int8 | int16 | int32 | uint8 | uint16 | uint32

The port outputs a 1 when the component ports output the last video frame. For every frame before that, it outputs a 0.

Dependencies

To enable this port, select the Output end-of-file indicator parameter.

Data Types: Boolean

Parameters

expand all

Specify the name of the binary source file to read video data from.

Specify the format of the video data as one of these options.

  • Four character codes (FOURCC) — For more information about these codes, see https://en.wikipedia.org/wiki/FourCC.

  • Custom — Read the video data from a binary file of a custom format.

Specify the four character code of the binary file codec. The value of this parameter also sets the number of output ports. For information on which four character codes enable which output ports, see the table below.

Output Ports for Four Character Codes

Four Character CodesOutput Ports
I420Y'|Cb|Cr
AYUVY'|Cb|Cr|A
CLJRY'|Cb|Cr
cyuvY'|Cb|Cr
GREYY'
IF09Y'|Cb|Cr|A
IMC1Y'|Cb|Cr
IMC2Y'|Cb|Cr
IMC3Y'|Cb|Cr
IMC4Y'|Cb|Cr
IUYVY'|Cb|Cr
IY41Y'|Cb|Cr
IYU1Y'|Cb|Cr
IYU2Y'|Cb|Cr
IYUVY'|Cb|Cr
NV12Y'|Cb|Cr
NV21Y'|Cb|Cr
UYNVY'|Cb|Cr
UYNYY'|Cb|Cr
V210Y'|Cb|Cr
Y411Y'|Cb|Cr
Y41PY'|Cb|Cr
Y41TY'|Cb|Cr|T
Y422Y'|Cb|Cr
Y42TY'|Cb|Cr|T
Y8Y'
Y800Y'
YUNVY'|Cb|Cr
YUY2Y'|Cb|Cr
YUYVY'|Cb|Cr
YV12Y'|Cb|Cr
YV16Y'|Cb|Cr
YVU9Y'|Cb|Cr
YVYUY'|Cb|Cr

Dependencies

To enable this parameter, set the Video format parameter to Four character codes.

Specify the number of rows in the output array as a positive integer. The value of this parameter must match the dimensions of the data inside the file.

Dependencies

To enable this parameter, set the Video format parameter to Four character codes.

Specify the number of columns in the output array as a positive integer. The value of this parameter must match the dimensions of the data inside the file.

Dependencies

To enable this parameter, set the Video format parameter to Four character codes.

If you select Top line first, the block first fills the first row of the output array with the corresponding contents of the binary file. It then fills the other rows in increasing order. When you select Bottom line first, the block first fills the last row of the output array with the corresponding contents of the binary file. It then fills the other rows in decreasing order.

Specify the number of times to repeat the binary file as a positive integer or inf. For any positive integer value n of this parameter, the block plays the binary file n times. For a value of inf, the block plays the file indefinitely until the end of simulation.

This parameter indicates when the block output reaches the last video frame in the binary file. Selecting this parameter enables the EOF port. The output from the EOF port is 1 when the block output reaches the last video frame. For all other frames, it is 0.

Specify the sample period of the output. Sample time indicates when, during simulation the block produces output. The value of this parameter must be a positive scalar less than the simulation time or -1. It cannot be 0. When set to -1, the block inherits the sample time from the simulink model.

Specify the data format of the binary file as planar or packed. If the data is packed, use the FrameSize Rows and FrameSize Cols parameters to define the size of the output array.

Dependencies

To enable this parameter, set the Video format parameter to Custom.

Specify the number of output components from the binary file. This parameter sets the number of output ports.

Dependencies

To enable this parameter, set the Video format parameter to Custom.

Specify the name for the luminance component of the output array. The luminance component is the first component from the input binary file.

Dependencies

To enable this parameter, set the Video format parameter to Custom, set the Number of output components parameter to 1 or greater.

Specify the name for the blue difference component of the output array. The blue difference component is the second component from the input binary file.

Dependencies

To enable this parameter, set the Video format parameter to Custom, set the Number of output components parameter to 2 or greater.

Specify the name for the red difference component of the output array using this parameter. The red difference component is the third component from the input binary file.

Dependencies

To enable this parameter, set the Video format parameter to Custom, set the Number of output components parameter to 3 or greater.

Specify the name for the alpha component of the output array. The alpha component is the fourth component from the input binary file.

Dependencies

To enable this parameter, set the Video format parameter to Custom, set the Number of output components parameter to 4.

Specify the size of the luminance component in the output array. The value of this parameter determines the interpretation of the video stream data as 8-bit, 16-bit, 24-bit, or 32-bit.

Dependencies

To enable this parameter, set the Video format parameter to Custom, and set the Number of output components parameter to 1 or greater.

Specify the size of the blue difference component in the output array. The value of this parameter determines the interpretation of the video stream data as 8-bit, 16-bit, 24-bit, or 32-bit.

Dependencies

To enable this parameter, set the Video format parameter to Custom, and set the Number of output components parameter to 2 or greater.

Specify the size of the red difference component in the output array. The value of this parameter determines the interpretation of the video stream data as 8-bit, 16-bit, 24-bit, or 32-bit.

Dependencies

To enable this parameter, set the Video format parameter to Custom, and set the Number of output components parameter to 3 or greater.

Specify the size of the alpha component in the output array. The value of this parameter determines the interpretation of the video stream data as 8-bit, 16-bit, 24-bit, or 32-bit.

Dependencies

To enable this parameter, set the Video format parameter to Custom, and set the Number of output components parameter to 4.

Specify the number of rows for the luminance component in the output array. The value of this parameter must be a positive integer.

Dependencies

To enable this parameter, set the Video format parameter to Custom, and set the Number of output components parameter to 1 or greater.

Specify the number of rows for the blue difference component in the output array. The value of this parameter must be a positive integer.

Dependencies

To enable this parameter, set the Video format parameter to Custom, and set the Number of output components parameter to 2 or greater.

Specify the number of rows for the red difference component in the output array. The value of this parameter must be a positive integer.

Dependencies

To enable this parameter, set the Video format parameter to Custom, and set the Number of output components parameter to 3 or greater.

Specify the number of rows for the alpha component in the output array. The value of this parameter must be a positive integer.

Dependencies

To enable this parameter, set the Video format parameter to Custom, and set the Number of output ports parameter to 4.

Specify the number of columns for the luminance component in the output array. The value of this parameter must be a positive integer.

Dependencies

To enable this parameter, set the Video format parameter to Custom, and set the Number of output components parameter to 1 or greater.

Specify the number of columns for the blue difference component in the output array. The value of this parameter must be a positive integer.

Dependencies

To enable this parameter, set the Video format parameter to Custom, and set the Number of output components parameter to 2 or greater.

Specify the number of columns for the luminance component in the output array. The value of this parameter must be a positive integer.

Dependencies

To enable this parameter, set the Video format parameter to Custom, and set the Number of output components parameter to 3 or greater.

Specify the number of columns for the alpha component in the output array. The value of this parameter must be a positive integer.

Dependencies

To enable this parameter, set the Video format parameter to Custom, and set the Number of output components parameter to 4.

Specify the arrangement of components in the binary file. Identify the components by the assigned numerals, from 1 to 4, in desired order. You must include all the enabled components when setting this parameter.

Dependencies

To enable this parameter, set the Video format parameter to Custom.

Select this parameter when the binary file contains interlaced video data.

Dependencies

To enable this parameter, set the Video format parameter to Custom.

Select this parameter when the binary file contains signed integers.

Dependencies

To enable this parameter, set the Video format parameter to Custom.

Specify the byte order of the binary file as either little endian or big endian.

Dependencies

To enable this parameter, set the Video format parameter to Custom.

Block Characteristics

Data Types

integer

Multidimensional Signals

no

Variable-Size Signals

no

Extended Capabilities

C/C++ Code Generation
Generate C and C++ code using Simulink® Coder™.

Version History

Introduced before R2006a