Hello,
I have a design in Vivado, in which data is read from an AXI-VDMA (AXI Direct Video Memory Access) trough AXI-Stream, which after some subset and colour space conversions gets sent onto the HDMI interface. The input for now is generated on SDK level (the standard colour test bars), and put into the VDMA.
By default, it works without any problem, but I'd like to insert an image processing block, which I designed in Vivado HLS. I have found a code, which takes the AXI stream input, converts it into a hls::Mat, on the Mat you can call image processing functions, then convert the transformed Mat into AXI stream, and send it out as output.
The code in question is the following (with header and source):
----------------
top.h
----------------
#include "hls_video.h"
// maximum image size
#define MAX_WIDTH 1920
#define MAX_HEIGHT 1080
// typedef video library core structures
typedef hls::stream<ap_axiu<32,1,1,1> > AXI_STREAM;
typedef hls::Scalar<3, unsigned char> RGB_PIXEL;
typedef hls::Mat<MAX_HEIGHT, MAX_WIDTH, HLS_8UC3> RGB_IMAGE;
// top level function for HW synthesis
void image_filter(AXI_STREAM& src_axi, AXI_STREAM& dst_axi, int rows, int cols);
---------------
top.cpp
----------------
void image_filter(AXI_STREAM& input, AXI_STREAM& output, int rows, int cols)
{
//Create AXI streaming interfaces for the core
#pragma HLS RESOURCE variable=input core=AXIS metadata="-bus_bundle INPUT_STREAM"
#pragma HLS RESOURCE variable=output core=AXIS metadata="-bus_bundle OUTPUT_STREAM"
#pragma HLS RESOURCE core=AXI_SLAVE variable=rows metadata="-bus_bundle CONTROL_BUS"
#pragma HLS RESOURCE core=AXI_SLAVE variable=cols metadata="-bus_bundle CONTROL_BUS"
#pragma HLS RESOURCE core=AXI_SLAVE variable=return metadata="-bus_bundle CONTROL_BUS"
#pragma HLS interface ap_stable port=rows
#pragma HLS interface ap_stable port=cols
hls::Mat<MAX_HEIGHT,MAX_WIDTH,HLS_8UC3> _src(rows,cols);
hls::Mat<MAX_HEIGHT,MAX_WIDTH,HLS_8UC3> _dst(rows,cols);
#pragma HLS dataflow
hls::AXIvideo2Mat(input, _src);
hls::Mat<MAX_HEIGHT,MAX_WIDTH,HLS_8UC3> src0(rows,cols);
hls::Mat<MAX_HEIGHT,MAX_WIDTH,HLS_8UC3> src1(rows,cols);
#pragma HLS stream depth=20000 variable=src1.data_stream
hls::Mat<MAX_HEIGHT,MAX_WIDTH,HLS_8UC1> mask(rows,cols);
hls::Mat<MAX_HEIGHT,MAX_WIDTH,HLS_8UC1> dmask(rows,cols);
hls::Scalar<3,unsigned char> color(255,0,0);
hls::Duplicate(_src,src0,src1);
hls::Mat<MAX_HEIGHT,MAX_WIDTH,HLS_8UC1> gray(rows,cols);
hls::CvtColor<HLS_BGR2GRAY>(src0,gray);
hls::FASTX(gray,mask,20,true);
hls::Dilate(mask,dmask);
hls::PaintMask(src1,dmask,_dst,color);
hls::Mat2AXIvideo(_dst, output);
}
----------------
When I synthesize and package this IP, it has no errors what so ever, but when I try to debug the whole design in SDK, I get no image. By that I do not mean a black screen, rather the connected screen detects no HDMI signal.
I tried to create a simple passtrough with this way, and the results were the same.
My guess would be it is either the AXI Stream is being read with no data on it, and it hangs the run, or the image processing IP does not forward the data, because it needs some signals to start.
Or maybe this is only used for image processing, and not for video.
If my explanation was unclear or you need some other detail about the problem, pleas tell me.
Thank you for reading.
Hopefully this is the adequate place for this question, sorry in advance if it is not.