Frame To Pixels

Convert frame-based video to pixel stream

  • Library:
  • Vision HDL Toolbox / I/O Interfaces

Description

The Frame To Pixels block converts color or grayscale video frames to a pixel stream and control signals. The control signals indicate the validity of each pixel and its location in 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 stream can support scalar streaming or multipixel streaming. Multipixel streaming provides 4 or 8 pixels per clock cycle to support high-rate or high-resolution formats. For details of the pixel stream format, see Streaming Pixel Interface.

This block does not support HDL code generation. However, you can use this block to generate input for a separate subsystem targeted for HDL code generation.

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.

Ports

Input

expand all

Full image frame, specified 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.

When you use a multipixel stream (Number of pixels > 1), you must represent each pixel with a single value (N = 1).

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

Output

expand all

For scalar pixel streams, pixel is a single image pixel returned as a scalar or a vector of 1-by-Number of components values. For multipixel streams, pixel is a vector of Number of pixels-by-1 pixel intensity values. When Number of pixels is greater than 1, the Number of components must be 1.

The output data type is the same as the data type of the frame port.

Control signals associated with the pixel stream, specified as a pixelcontrol bus that 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 are 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

Parameters

expand all

Number of values used to represent each pixel. Each pixel can have 1, 3, or 4 components. Set this parameter to 1 for grayscale video. Set this parameter to 3 for color video, for example, {R,G,B} or {Y,Cb,Cr}. Set this parameter to 4 to use color with an alpha channel for transparency.

Dependencies

When Number of pixels is greater than 1, you must set Number of components to 1.

Number of pixels transferred on the streaming interface for each time step, specified as 1, 4, or 8. To enable multipixel streaming and increase throughput for high-resolution or high-frame-rate video, set this parameter to 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

Dependencies

When Number of pixels is greater than 1, you must set Number of components to 1.

Dimensions of active and inactive regions in a video frame. To select a predefined format, select from the Video format list. The actual frame dimensions are displayed in the Video Format Parameters section. For a custom format, select Custom, and then specify the dimensions as integers.

The dimensions are defined in the diagram.

Note

The sample time of your video source must match the total number of pixels in the frame of your Frame To Pixels block. The total number of pixels is Total pixels per line × Total video lines, so set the sample time to this value.

Video FormatActive Pixels Per LineActive Video LinesTotal Pixels Per LineTotal Video LinesStarting Active LineEnding Active LineFront PorchBack Porch
240p320240 40232412404438
480p6404808005253651516 144
480pH7204808585253351216122
576p7205768646254762212132
720p1280720165075025744110260
768p102476813448061077724296
1024p128010241688106642106548360
1080p (default)192010802200112542112188192
1200p160012002160125050124964496
2KCinema204810802750112542112163963
4KUHDTV384021604400225042220188472
8KUHDTV7680432088004500424361881032
CustomUser-
defined
User-
defined
User-
defined
User-
defined
User-
defined
User-
defined
User-
defined
User-
defined

When using a custom format, the values you enter for the active and inactive dimensions of the image must add up to the total frame dimensions. If you specify a format that does not conform to these rules, the block reports an error.

  • For the horizontal direction, Total pixels per line must be greater than or equal to Front porch + Active pixels per line. The block calculates Back porch = Total pixels per lineFront porchActive pixels per line.

  • For the vertical direction, Total video lines must be greater than or equal to Starting active line + Active video lines − 1. The block calculates Ending active line = Starting active line + Active video lines − 1.

When using the Line Memory block, or blocks that use an internal line memory, with a custom video format, further requirements apply:

  • Active pixels per line must be greater than 1.

  • The horizontal blanking interval, or Back porch + Front porch, must meet these guidelines:

    • The total of Back porch + Front porch must be at least 2 times the largest kernel size of the algorithm in the blocks following the Frame To Pixel block. If the kernel size is less than 4, the total porch must be at least 8 pixels.

    • The Back porch must be at least 6 pixels. This parameter is the number of inactive pixels before the first valid pixel in a frame.

When using multipixel streaming (Number of pixels > 1) these requirements apply.

  • The video format must have horizontal dimensions divisible by the Number of pixels parameter value. The horizontal dimensions are set by these parameters: Active pixels per line, Total pixels per line, Front porch, and Back porch. Standard video protocols 480p, 720p, 1080p, and 4k UHD support Number of pixels equal to 4 or 8.

  • The minimum input frame size for multipixel streaming (either 4 or 8 pixels) is 18 rows-by-32 columns.

  • Choose your kernel size and Active pixels per line such that (Active pixels per line)/(Number of pixels) is at least the kernel width.

Extended Capabilities

Introduced in R2015a