Main Content

Pixels To Frame

Convert pixel stream to frame-based video

  • Pixels To Frame block

Libraries:
Vision HDL Toolbox / I/O Interfaces

Description

The Pixels To Frame block converts a color or grayscale pixel stream and control signals to frame-based video. The control signal bus indicates the validity of each pixel and its location within the frame. The pixel stream format can include padding pixels around the active frame. You can configure the frame and padding dimensions by selecting a common video format or by specifying custom dimensions. The pixel input can support single pixel streaming, or multipixel streaming. Multipixel streaming accepts 2, 4, or 8 pixels each clock cycle to support high-rate or high-resolution formats. For details of the pixel stream format, see Streaming Pixel Interface.

This block itself does not support HDL code generation. However, you can use this block to convert the output of a separate subsystem, targeted for HDL code generation, back to frames.

If your model converts frames to a pixel stream and later converts the stream back to frames, specify the same video format for the Frame To Pixels block and the Pixels To Frame block.

Examples

Ports

Input

expand all

For single pixel streams, specify pixel as a scalar or a vector of 1-by-Number of components values that represent a single pixel. For multipixel streams, specify pixel as a matrix of Number of pixels-by-Number of components pixel intensity values. Number of pixels can be two, four, or eight.Number of components can be from one to four.

Data Types: uint | int | fixed point | Boolean | single | double

The pixelcontrol bus contains five signals. The signals describe the validity of the pixel and its location in the frame. For more information, see Pixel Control Bus.

For multipixel streaming, each vector of pixel values has one set of control signals. Because the vector has only one valid signal, the pixels in the vector must be either all valid or all invalid. The hStart and vStart signals apply to the pixel with the lowest index in the vector. The hEnd and vEnd signals apply to the pixel with the highest index in the vector.

Data Types: bus

Output

expand all

Full image frame, returned as an Active pixels per line-by-Active video lines-by-N array. The first two array dimensions are the height and width of the active image specified by the Video format parameter. N is the Number of components used to express a single pixel. The output data type is the same as the data type of the pixel port.

Data Types: uint | int | fixed point | Boolean | single | double

This signal is 1 (true) when the block has successfully recompiled an output frame from the input stream.

Data Types: Boolean

Parameters

expand all

Number of values used to represent each pixel. Each pixel can have from 1 to 4 components.

  • For grayscale video, set this parameter to 1.

  • For color video, for example, {R,G,B} or {Y,Cb,Cr}, set this parameter to 3.

  • For color video with an alpha channel for transparency, set this parameter to 4.

To process multicomponent streams for blocks that do not support multicomponent input, replicate the block for each component. The pixelcontrol bus for all components is identical, so you can connect the ctrl output of the Frame To Pixels block to each replicated block.

Number of pixels transferred on the streaming interface for each time step, specified as 1, 2, 4, or 8. To enable multipixel streaming and increase throughput for high-resolution or high-frame-rate video, set this parameter to 2, 4 or 8. Multipixel streaming processes more pixels with the same clock frequency as a single-pixel streaming interface.

Video ResolutionClock Frequency Required for Single-Pixel Streaming at 60 fpsClock Frequency Required for Multipixel Streaming at 60 fps (4 pixels)
1080p150 MHz37.5 MHz
4k UHD600 MHz150 MHz
8k UHD1200 MHz300 MHz

Dimensions of active regions in a video frame. To select a predefined format, use the Video format pull-down menu. The active frame dimensions are set as shown in the table. For a custom format, select Custom, then specify the active frame dimensions as integers.

Video FormatActive Pixels Per LineActive Video Lines
240p320240
480p640480
480pH720480
576p720576
720p1280720
768p1024768
1024p12801024
1080p (default)19201080
1200p16001200
2KCinema20481080
4KUHDTV38402160
8KUHDTV76804320
CustomUser-
defined
User-
defined

Extended Capabilities

Version History

Introduced in R2015a

expand all