cancel
Showing results for 
Search instead for 
Did you mean: 
Highlighted
Adventurer
Adventurer
124 Views
Registered: ‎03-31-2020

AXI video stream with dynamic rows

Hello,

I am creating a passthrough HLS IP. In the below code, if the number of columns changes (by modifying the x_max and x_min), it works. However, if I change the row value, the IP hangs. So, for this IP, I have to make the output stream has the same rows as the input. I guess the problem is at the Start of Frame signal but could not understand why. Could you please help me on this?

void ip_accel_app(hls::stream< ap_axiu<48,1,1,1> >& _src,hls::stream< ap_axiu<48,1,1,1> >& _dst)
{
#pragma HLS INTERFACE axis register both  port=_src
#pragma HLS INTERFACE axis register both  port=_dst
#pragma HLS INTERFACE ap_ctrl_none port=return
	ap_axiu<48, 1, 1, 1> _tempStream;

	int indexSrcMat = 0;
	int res = 0, depth;	
	xf::Mat<TYPE, HEIGHT, WIDTH, NPC1> imgInput1(HEIGHT, WIDTH);
	xf::Scalar<XF_CHANNELS(TYPE, NPC1), XF_TNAME(TYPE,NPC1)> temppixel;
	int nSrc_rows = HEIGHT;
	int nSrc_cols = WIDTH/NPC1;
	int i, j;
	int nDst_rows =0;
	int nDst_cols =0;
	bool sof = 1;
	indexSrcMat = 0;	
#pragma HLS stream variable=imgInput1.data dim=1 depth=1
#pragma HLS dataflow
	xf::AXIvideo2xfMat(_src, imgInput1);
	loop_height: for (i = 0; i < HEIGHT; i++)
		loop_width: for (j = 0; j < WIDTH / NPC1; j++) {
		#pragma HLS loop_flatten off
		#pragma HLS pipeline II=1

			//read pixel
			fillingdata(imgInput1, temppixel,indexSrcMat);
			indexSrcMat++;

			if((i>=roi_y_min)&&(i<roi_y_max)&&(j>=roi_x_min)&&(j<roi_x_max))//is in ROI?
			{
				if(sof)//start of frame
				{
					_tempStream.user = 1;
					sof = 0;
				}
				else
				{
					_tempStream.user = 0;
				}

				if(j==roi_x_max-1)//is end of line
				{
					_tempStream.last =1;
				}
				else
				{
					_tempStream.last =0;
				}
				_tempStream.data = -1;

				xf::AXISetBitFields(_tempStream, 0, 48, temppixel.val[0]);
				_tempStream.keep = -1;
				_dst << _tempStream;

			}

		}

}

 

0 Kudos
0 Replies