Video and Image Processing Suite User Guide

ID 683416
Date 4/04/2022
Public
Document Table of Contents

A.1. Avalon-ST Video Class Library

The class library is a unified modeling language (UML)-styled class structure broken down into individual files and packages.
Figure 84. UML-Style Class DiagramThe figure shows a unified modeling language (UML)-styled diagram of the class structure of the library and how these break down into individual files and packages.
Table 88.  Class DescriptionThe table describes each of the classes in the av_st_video_classes package.
Note: The classes listed do not contain information about the physical transport mechanism and the Avalon-ST Video protocol.
Class Description
class c_av_st_video_item The most fundamental of all the classes.

Represents any item that is sent over the Avalon-ST bus and contains a packet_type field.

You can set the field to video_packet, control_packet, or user_packet types. These three packet types are represented by classes which extend this base class.

Structuring the classes in this way allows you to define the mailboxes and queues of c_av_st_video_item. Then, you can send any type of packet in the order that they appear on the bus.

class c_pixel

Fundamental and parameterized class.

Comprised of an array of channels that contains pixel data. For example, a pixel from an RGB24 video system comprises an array of three channels (8 bits per channel).

A pixel for a YcbCr system comprises two channels. An individual channel either represents a luminance or chroma-type component of video data, one RGB component, or one alpha component. The class provides “getters”, “setters”, and “copy” methods.

The parameters for this class are BITS_PER_CHANNEL and CHANNELS_PER_PIXEL.

class c_av_st_video_data Parameterized class.

Contains a queue of pixel elements. This class library is used by other classes to represent fields of video and line (or smaller) units of video. It extends c_av_video_item. The class provides methods to push and pop pixels on and off the queue.

The parameters for this class are BITS_PER_CHANNEL and CHANNELS_PER_PIXEL.

class c_av_st_video_control

Parameterized class.

Extends c_av_video_item. Comprises of width, height, and interlaced bits (the fields found in an Avalon-ST video control packet). It also contains data types and methods that control the addition of garbage beats that are used by other classes. The class provides methods to get and set the individual fields.

The parameters for this class are BITS_PER_CHANNEL and CHANNELS_PER_PIXEL.

class c_av_st_user_packet Parameterized class.

Contains a queue of data and is used by the other classes to represent packets of user data. It extends c_av_video_item. The class provides methods to push and pop data on and off the queue.

The parameters for this class are BITS_PER_CHANNEL and CHANNELS_PER_PIXEL.

Table 89.  Additional Class DescriptionThe table describes the classes included in the av_st_video_file_io_class package, and the source and sink class packages.
Class Description
class c_av_st_video_source_sink_base Designed to be extended by source and sink BFM classes.

Contains a mailbox of c_av_st_video_item, together with various fields that define the transport mechanism (serial or parallel), record the numbers of packets sent, and define the service quality (readiness) of the source or sink.

class c_av_st_video_source_bfm_’SOURCE

Extends c_av_st_video_source_sink_base.

Named according to the instance names of the Avalon-ST source and sink BFMs in the SystemVerilog netlist. This is because you must access the API functions in the Avalon-ST BFMs by directly calling them through the design hierarchy. Therefore, this hierarchy information is required in the Avalon-ST video source and sink classes. This means that a unique class with the correct design hierarchy information for target source or sink is required for every object created of that class type.

To overcome this limitation, create the source and sink class files (av_st_video_bfm_class.sv and av_st_video_sink_bfm_class.sv) which are designed to be ‘included into the test environment with ‘defines set to point to the correct hierarchy.

The source class comprises of a simple start() task and a send_video task (called by the start task). The send_video task continually polls its mailbox. When a video_item arrives, the video_item is assembled into a set of transactions according to its type and the transport mechanism specified. Then, the video_item is sent to the Avalon-ST BFM.

One Avalon-ST BFM transaction is considered as one beat on the Avalon-ST bus, comprised of the logic levels on the SOP, EOP, READY, VALID, and EMPTY signals, as well as the data on the bus in a given clock cycle. For example, a video packet is sent to the BFM preceded by a 0x0 on the LSB of the first transaction, as per the Avalon-ST video protocol. A control packet is preceded by a 0xf on the LSB. Then, the height, width and interlacing fields are sent in subsequent transaction in accordance to the Avalon-ST Video protocol.

The class c_av_st_video_source_bfm_`SOURCE requires you to create an object from it and to call the start() task as it automatically handles any video_item sent to its mailbox. No other interaction is required.

class c_av_st_video_sink_bfm_’SINK Operates in the same way as the source class, except it contains a receive_video() task and performs the opposite function to the source.

This class receives incoming transactions from the Avalon-ST sink BFM, decoding their type, assembling them into the relevant objects (control, video, or user packets), and pushing them out of its mailbox. No further interaction is required from the user.

class c_av_st_video_file_io

Parameterized class.

Extends c_av_video_item. Comprised of width, height, and interlaced bits (the fields found in an Avalon-ST video control packet). It also contains data types and methods that control the addition of garbage beats that are used by other classes. The class provides methods to get and set the individual fields.

class c_av_st_user_packet This parameterized class is defined in a separate file (av_st_video_file_io_class.sv) because some test environments do not use video data from a file, using constrained random data generated by the other classes instead.
This class provides the following methods:
  • to read and write video files (in .raw format)
  • to send or receive videos and control packet objects to or from the mailbox.

Variables that govern the file I/O details include the ability to artificially lengthen and shorten video packets and to introduce garbage beats into control packets by various get and set method calls.

Typical usage of the file I/O class is to construct two objects—a reader and a writer, call the open file methods for both, call the read_file method for the reader, and repeatedly call the wait_for_and_write_video_packet_to_file method in the writer.

The parameters for this class are BITS_PER_CHANNEL and CHANNELS_PER_PIXEL.