top of page

MicroZed Chronicles: Video Frame Read Buffer

Last week we examined the Video Frame Buffer Write (VFBW), which is capable of writing image frames to an external memory. This week, we are going to look at its counterpart the Video Frame Buffer Read (VFBR). This IP block enables us to read video frames from an external memory.


Of course, these blocks can be used together, for example, when the input video timing is different to the output video timing or when a processor performs some processing steps on the images stored within the DDR memory.


Just like with the Video Frame Buffer Write, we should be using the Video Frame Buffer Read for most image processing applications and especially if we are intending to work with Linux and frameworks such as the Video4Linux, GStreamer etc.


To implement the VFBR in a design, we can add it from the IP library and customize it to define the number of pixels per clock, the maximum resolutions, and the video formats which the block is required to support. In the example application, I am using the VFBR to read out an image running on the AC701 board. The design has a MIPI CSI-2 receiver, demosaic, VFBW and MIG along with a VFBR, VPSS and AXI Stream to video out operating under a timing controller.


This is all configured and controlled by a MicroBlaze which also sets up the MIPI camera and HDMI transmitter over I2C. The full description of the design can be found here on my Hackster page.


For this application, simple 8-bit RGB at one pixel per clock was sufficient.

As can be seen below, the VFBR was integrated in the design with an AXI-Lite interface for configuration along with an AXI4 interface which is connected via a Smart Connect to the MIG and the AXI Stream output. This goes through the standard image processing output path of color space conversion and AXI Stream to video out generation.

The VFBR is clocked at the image processing clock rate of 150 MHz.

To use the VFBR within the software world, we need to do the following:

  • Initialize the VFBR

  • Set the image width and height

  • Set the image stride (this is the image width multiplied by the bytes per pixel)

  • Set the video format

  • Set the frame buffer address

  • Start the VFBR

To enable these capabilities, AMD Xilinx provides a range of APIs within the header file

#include "xv_frmbufrd.h"

The initialization is achieved using the function call

XV_frmbufrd_Initialize(&frmbufrd, XPAR_V_FRMBUF_RD_0_DEVICE_ID);

The device ID is provided by the xparameters.h file and the frmbufrd variable is the instance of the frame buffer of type XV_frmbufrd defined in xv_frmbufrd.h


We are working with 1080p video for this application so we can use the API to set the height, width, stride, video format, and frame buffer location.

XV_frmbufrd_Set_HwReg_width(&frmbufrd, 1920);
XV_frmbufrd_Set_HwReg_height(&frmbufrd, 1080);
XV_frmbufrd_Set_HwReg_stride(&frmbufrd, 4*1920);
XV_frmbufrd_Set_HwReg_video_format(&frmbufrd, XVIDC_CSF_MEM_RGB8);
XV_frmbufrd_Set_HwReg_frm_buffer_V(&frmbufrd, XVFRMBUFWR_BUFFER_BASEADDR);

We can then start the Video Frame Buffer Read using the commands

	XV_frmbufrd_EnableAutoRestart(&frmbufrd);
	XV_frmbufrd_Start(&frmbufrd);

As can be seen below, the image was read out of memory from the DDR and displayed on the HDMI display when started along with the remainder of the image processing system in the design on the AC701 board.


In a future blog, we will look at how we can create an embedded Linux-based processing system on a SoC using these blocks.





0 comments

Comments


bottom of page