cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
aamir_sheikh
Contributor
Contributor
341 Views
Registered: ‎11-02-2020

axi stream video in hls

does anyone have an example of reading an axi video stream in hls? i am using the following code, but i am getting problems.

 

#define HDMI_INPUT_WIDTH 800
#define HDMI_INPUT_HEIGHT 600
#define PIXEL_BYTE 4
#define FB_SIZE HDMI_INPUT_WIDTH*HDMI_INPUT_HEIGHT*PIXEL_BYTE

bool posedge2pulse(bool signal){
#pragma HLS INTERFACE ap_ctrl_none port=return
	static ap_int<3> reg=0;
	reg= reg << 1;
	reg.bit(0)=signal;
	if(!reg.bit(2) & reg.bit(1)) return true;
	else return false;
}

THREAD_ENTRY()
{
	#pragma HLS INTERFACE axis port=Cam1
	
	THREAD_INIT();
	uint32 cnt = 0;
	uint32 output_buffer_addr = GET_INIT_DATA();
	uint32 addr_cnt = output_buffer_addr;
	static int loop_count = 0;

	while (1)
	{
		int i = 0;
		t_stream datain;
		uint32 ram[128];

		for(i = 0; i < 128; i++)
		{
			datain = Cam1.read();
			cnt++;
			ram[i] = datain.data;
			loop_count = i;
			if(posedge2pulse(datain.last))
			{
				line_cnt++;
				break;
			}
		}
		
		if((addr_cnt + ((loop_count+1) * 4)) < (output_buffer_addr + FB_SIZE)) 
			MEM_WRITE( ram, addr_cnt, (loop_count+1)*4);

		if (datain.user){
			addr_cnt = output_buffer_addr ;
			line_cnt = 0;
		}			
		else
		{
			addr_cnt += (loop_count+1) * 4;
		}
	}	
}

 

 
if i view the raw rgba data, this is what i get. The colours are not an issue; I am converting rgb to rgba by using a (alpha) of FF, rather the problem is the noise. and then repeatation of line data.

aamir_sheikh_0-1623266475812.png

 

what might be going wrong here?

0 Kudos
2 Replies
watari
Professor
Professor
316 Views
Registered: ‎06-16-2013

Hi @aamir_sheikh 

 

What is your source device's color format ?

Also, what is your target color format ?

 

I couldn't understand your query...

 

Best regards,

0 Kudos
aamir_sheikh
Contributor
Contributor
208 Views
Registered: ‎11-02-2020

the source generates rgb data, which is 24 bit. i converted it to  rgba8 i.e. 32 bit. The colours are not an issue, rather the end of line detection...

0 Kudos