- •Contents
- •1. Video and Image Processing Suite Overview
- •Release Information
- •Device Family Support
- •Latency
- •In-System Performance and Resource Guidance
- •Stall Behavior and Error Recovery
- •2. Interfaces
- •Video Formats
- •Avalon-ST Video Protocol
- •Video Data Packets
- •Static Parameters of Video Data Packets
- •Control Data Packets
- •Ancillary Data Packets
- •User-Defined and Altera-Reserved Packets
- •Packet Propagation
- •Transmission of Avalon-ST Video Over Avalon-ST Interfaces
- •Packet Transfer Examples
- •Avalon-MM Slave Interfaces
- •Specification of the Type of Avalon-MM Slave Interfaces
- •Avalon-MM Master Interfaces
- •Specification of the Type of Avalon-MM Master Interfaces
- •Buffering of Non-Image Data Packets in Memory
- •3. Getting Started
- •IP Catalog and Parameter Editor
- •Specifying IP Core Parameters and Options
- •Installing and Licensing IP Cores
- •OpenCore Plus IP Evaluation
- •4. Clocked Video Interface IP Cores
- •Control Port
- •Clocked Video Input Format Detection
- •Interrupts
- •Clocked Video Output Video Modes
- •Interrupts
- •Generator Lock
- •Underflow and Overflow
- •Timing Constraints
- •Handling Ancillary Packets
- •Modules for Clocked Video Input II IP Core
- •Clocked Video Interface Parameter Settings
- •Clocked Video Interface Signals
- •Clocked Video Interface Control Registers
- •5. 2D FIR Filter IP Core
- •Calculation Precision
- •Coefficient Precision
- •Result to Output Data Type Conversion
- •2D FIR IP Core Parameter Settings
- •2D FIR Filter Signals
- •2D FIR Filter Control Registers
- •6. Video Mixing IP Cores
- •Alpha Blending
- •Video Mixing Parameter Settings
- •Video Mixing Signals
- •Video Mixing Control Registers
- •7. Chroma Resampler IP Core
- •Horizontal Resampling (4:2:2)
- •Vertical Resampling (4:2:0)
- •Chroma Resampler Parameter Settings
- •Chroma Resampler Signals
- •8. Video Clipping IP Cores
- •Video Clipping Parameter Settings
- •Video Clipping Signals
- •Video Clipping Control Registers
- •9. Color Plane Sequencer IP Core
- •Combining Color Patterns
- •Rearranging Color Patterns
- •Splitting and Duplicating
- •Subsampled Data
- •Color Plane Sequencer Parameter Settings
- •Color Plane Sequencer Signals
- •10. Color Space Conversion IP Cores
- •Input and Output Data Types
- •Color Space Conversion
- •Result of Output Data Type Conversion
- •Color Space Conversion Parameter Settings
- •Color Space Conversion Signals
- •Color Space Conversion Control Registers
- •11. Control Synchronizer IP Core
- •Using the Control Synchronizer IP Core
- •Control Synchronizer Parameter Settings
- •Control Synchronizer Signals
- •Control Synchronizer Control Registers
- •12. Deinterlacing IP Cores
- •Deinterlacing Methods
- •Bob with Scanline Duplication
- •Bob with Scanline Interpolation
- •Weave
- •Motion-Adaptive
- •Sobel-Based HQ Mode
- •Pass-Through Mode for Progressive Frames
- •Frame Buffering
- •Frame Rate Conversion
- •Bandwidth Requirement Calculations for 10-bit YCbCr Video
- •Behavior When Unexpected Fields are Received
- •Handling of Avalon-ST Video Control Packets
- •Deinterlacing Parameter Settings
- •Deinterlacing Signals
- •Deinterlacing Control Registers
- •Design Guidelines for Broadcast Deinterlacer IP Core
- •13. Frame Reader IP Core
- •Single-Cycle Color Patterns
- •Frame Reader Output Pattern and Memory Organization
- •Frame Reader Parameter Settings
- •Frame Reader Signals
- •Frame Reader Control Registers
- •14. Frame Buffer IP Cores
- •Double Buffering
- •Triple Buffering
- •Locked Frame Rate Conversion
- •Handling of Avalon-ST Video Control Packets
- •Color Format
- •Frame Buffer Parameter Settings
- •Frame Buffer Signals
- •Frame Buffer Control Registers
- •15. Gamma Corrector IP Core
- •Gamma Corrector Parameter Settings
- •Gamma Corrector Signals
- •Gamma Corrector Control Registers
- •16. Interlacer IP Core
- •Interlacer Parameter Settings
- •Interlacer Signals
- •Interlacer Control Registers
- •17. Scaler II IP Core
- •Nearest Neighbor Algorithm
- •Bilinear Algorithm
- •Bilinear Algorithmic Description
- •Polyphase and Bicubic Algorithm
- •Double-Buffering
- •Polyphase Algorithmic Description
- •Choosing and Loading Coefficients
- •Edge-Adaptive Scaling Algorithm
- •Scaler II Parameter Settings
- •Scaler II Signals
- •Scaler II Control Registers
- •18. Video Switching IP Cores
- •Mixer Layer Switching
- •Video Switching Parameter Settings
- •Video Switching Signals
- •Video Switching Control Registers
- •19. Test Pattern Generator IP Cores
- •Test Pattern
- •Generation of Avalon-ST Video Control Packets and Run-Time Control
- •Test Pattern Generator Parameter Settings
- •Test Pattern Generator Signals
- •Test Pattern Generator Control Registers
- •20. Trace System IP Core
- •Trace System Parameter Settings
- •Trace System Signals
- •Operating the Trace System from System Console
- •Loading the Project and Connecting to the Hardware
- •Trace Within System Console
- •TCL Shell Commands
- •21. Avalon-ST Video Monitor IP Core
- •Packet Visualization
- •Monitor Settings
- •Avalon-ST Video Monitor Parameter Settings
- •Avalon-ST Video Monitor Signals
- •Avalon-ST Video Monitor Control Registers
- •Avalon-ST Video Class Library
- •Running the Tests
- •Video File Reader Test
- •Example Test Environment
- •Video Field Life Cycle
- •Constrained Random Test
- •Complete Class Reference
- •c_av_st_video_control
- •c_av_st_video_data
- •c_av_st_video_file_io
- •c_av_st_video_item
- •c_av_st_video_source_sink_base
- •c_av_st_video_sink_bfm_’SINK
- •c_av_st_video_source_bfm_’SOURCE
- •c_av_st_video_user_packet
- •c_pixel
- •Raw Video Data Format
- •Cadence Detection and Reverse Pulldown in the Deinterlacer II IP Core
- •Document Revision History
- •How to Contact Altera
A-10 |
Video File Reader Test |
UG-VIPSUITE |
|
2015.01.23 |
|||
|
|
To generate the .avi file, open a DOS command prompt from a Windows machine and run the following convertor utility:
C:>raw2avi.exe vip_car_out.raw video.avi
You can view the video.avi file with a media player. The media player shows a grayscale version of the source video file (vip_car_0.avi) that you can also play to see the full color video. You can view the full sequence from which the clip is taken in the vip_car.avi file.
Video File Reader Test
The video file reader test is the simplest way of using the class library.
The video file reader test reads and translates the video file into video_item objects, streams to the DUT using the BFM, and then retranslates video file back to video, and writes to the file again.
The test environment itself is set up through the tb_test.v file (found in the example_video_files directory), which instantiates the Qsys generated netlist, creates the necessary classes, and sets the test running.
The test has four main features of code.
Altera Corporation |
Avalon-ST Video Verification IP Suite |
|
|
Send Feedback
UG-VIPSUITE 2015.01.23
Video File Reader Test |
A-11 |
•tb_test.sv—first section of the code.
`timescale 1ns / 1ns
module tb_test;
`define |
CHANNELS_PER_PIXEL |
3 |
`define |
BITS_PER_CHANNEL |
8 |
import av_st_video_classes::*; import av_st_video_file_io_class::*;
// Create clock and reset: logic clk, reset;
initial
clk <= 1'b0;
always
#2.5 clk <= ~clk; //200 MHz
initial begin
reset <= 1'b1;
#10 @(posedge clk) reset <= 1'b0;
end
//Instantiate "netlist" : `define NETLIST netlist
tb `NETLIST (.reset(reset),.clk(clk));
//Create some useful objects from our defined classes :
c_av_st_video_data |
#(`BITS_PER_CHANNEL, |
`CHANNELS_PER_PIXEL) |
video_data_pkt1; |
|
|
c_av_st_video_control |
#(`BITS_PER_CHANNEL, |
`CHANNELS_PER_PIXEL) |
video_control_pkt1; |
|
|
c_av_st_video_user_packet #(`BITS_PER_CHANNEL, `CHANNELS_PER_PIXEL) user_pkt1;
First, the test must define the numbers of bits per channel and channels per pixel, because most of the classes require this information. Next, the class packages are imported, the clock and reset defined, and the netlist itself instantiated with connections for clock and reset in place.
Note: The BFM resets are all active high. If an active low reset is required, it may be necessary to invert the reset at the DUT input.
The final part of the this section of the code creates some objects from the class library which are used later in the code. The parameterization is standard across all object instances of the classes as the bits per channel and channels per pixel is constant in any given system.
•tb_test.sv—second section of the code.
//This creates a class with a names specific to `SOURCE0, which is needed
//because the class calls functions for that specific `SOURCE0. A class
//is used so that individual mailboxes can be easily associated with
//individual sources/sinks :
//This names MUST match the instance name of the source in tb.v :
`define SOURCE st_source_bfm_0 `define SOURCE_STR "st_source_bfm_0"
`define SOURCE_HIERARCHY_NAME `NETLIST.`SOURCE `include "av_st_video_source_bfm_class.sv"
// Create an object of name `SOURCE of class av_st_video_source_bfm_`SOURCE : `define CLASSNAME c_av_st_video_source_bfm_`SOURCE
`CLASSNAME `SOURCE;
Avalon-ST Video Verification`undef IPCLASSNAMESuite
// This names MUST match the instance name of the sink in tb.v : Send Feedback`define SINK st_sink_bfm_0
`define SINK_STR "st_sink_bfm_0"
`define SINK_HIERARCHY_NAME `NETLIST.`SINK `include "av_st_video_sink_bfm_class.sv"
// Create an object of name `SINK of class av_st_video_sink_bfm_`SINK :
A-12 |
Example Test Environment |
UG-VIPSUITE |
|
2015.01.23 |
|||
|
|
Example Test Environment
The Avalon-ST Video Verification IP Suite offers two types of example test environment: video file reader test and constrained random test.
The video file reader test is useful for checking the video functionality of the DUT for any video types. However, this test is not suitable to test the DUT with a variety of differently-sized and formatted video fields. Altera recommends a constrained random approach that is easily accomplished using the class library.
Video Field Life Cycle
Figure A-5: Video Field Life Cycle
The figure below shows the life cycle of the video field.
|
Stage 4: |
|
|
Stage 5: |
|
|
|
Field stored as |
|
|
Field stored as |
|
|
|
Height x width +1 |
|
|
Height x width +1 |
|
|
|
beats on the |
|
transactions from the sink BFM |
|
||
|
Avalon-ST bus |
|
|
|
|
|
|
Field |
|
|
Field |
|
|
|
Avalon |
DUT |
|
Avalon |
|
|
Stage 1: |
Source BFM |
|
|
Sink BFM |
|
Stage 8: |
Field stored as |
|
|
|
|
|
Field stored as |
c_av_st_video_data |
|
|
|
|
|
binary data |
Field |
|
|
|
|
|
Field |
Input |
|
Stage 6: |
|
|
|
|
|
Field stored as |
|
|
Stage 7: |
Output |
|
File |
|
|
Field |
|||
|
c_av_st_video_data |
Field stored as |
||||
|
Video |
|
File |
|||
|
Source BFM |
|
|
|
c_av_st_video_item |
|
|
|
|
|
|
|
|
|
Field |
|
|
|
|
|
|
|
|
|
|
Field |
|
|
|
|
|
|
||
|
|
|
|
File |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
||||||
|
|
|
|
|
|
Field |
|
|
Video |
|
|
|
|
|
|
|
|||||||||||
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
||||
|
|
|
|
reader |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|||
|
|
|
|
|
mailbox |
|
|
|
|
|
|
|
|
|
mailbox |
|
|
|
File |
|
|
||||||
|
|
|
|
BFM |
|
|
Stage 2: |
|
|
|
|
Sink BFM |
|
|
|
|
|
|
writer |
|
|
||||||
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
||||||
|
|
|
|
|
|
|
|
Field stored as |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|||
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|||||
|
|
|
|
|
|
|
Stage 3: |
|
|
|
|
|
|
|
|
|
|
|
|
|
|||||||
|
|
|
|
|
|
|
c_av_st_video_item |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
||||||
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|||||||||
|
|
|
|
|
|
|
|
|
|
|
|
Field stored as |
|
|
|
|
|
|
|
|
|
|
|
|
|
||
|
|
|
|
|
|
|
|
|
|
|
|
Height x width +1 |
|
|
|
|
|
|
|
|
|
|
|
|
|
||
|
|
|
|
|
|
|
|
|
|
|
|
transactions to the |
|
|
|
|
|
|
|
|
|
|
|
|
|
||
|
|
|
|
|
|
|
|
|
|
|
|
source BFM |
|
|
|
|
|
|
|
|
|
|
|
|
|
||
Before stage 1: |
Field |
|
|
Method calls |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Method calls |
|
|||
Field stored as |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
||||||
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
||
binary file data |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Table A-3: Stages of the Video Field Life Cycle
Stage |
|
Description |
|
|
|
Stage 1 |
|
• A method call to the reader initiates the field to be read by the file reader |
|
|
BFM. |
•The reader streams binary pixel data from the file, packs each pixel into an object of type c_pixel, and pushes the pixels into a c_av_st_video_data video object.
Altera Corporation |
Avalon-ST Video Verification IP Suite |
|
|
Send Feedback