Page 1 of 1

How to get the YUV 420 data from the picture_t

Posted: 07 Sep 2010 17:54
by nataraajc
Hi All,

I am in a way to write one Video Filter, where I need to get a Y, U & V data into separate memory pointers. How can I get the Lum, Cb & Cr from the picture_t structure? I tried many ways couldn’t find one, pls help.

Thx
Natz

Re: How to get the YUV 420 data from the picture_t

Posted: 07 Sep 2010 18:02
by Sébastien Escudier
I think you can use smem for this

Re: How to get the YUV 420 data from the picture_t

Posted: 07 Sep 2010 18:21
by nataraajc
any other ways pls?

Re: How to get the YUV 420 data from the picture_t

Posted: 08 Sep 2010 02:14
by Rémi Denis-Courmont
Did you even peek at other filters or outputs?
I guess you are looking for picture_t.plane[{Y,U,V}_PLANE].p_pixels

Re: How to get the YUV 420 data from the picture_t

Posted: 08 Sep 2010 04:58
by nataraajc
Did you even peek at other filters or outputs?
I guess you are looking for picture_t.plane[{Y,U,V}_PLANE].p_pixels
Yea, I looking for this alone. But I have some questions on this.

Normally Lum will be of height * width size
Cb & Cr each will be of ((height * width)/4)

So I write "picture_t.plane[Y_PLANE].p_pixels" - height * width
then "picture_t.plane[U_PLANE].p_pixels" - ((height * width)/4)
then "picture_t.plane[V_PLANE].p_pixels" - ((height * width)/4)

The output is not the real video, some green patches are there. So something goes wrong in this. Pls advice.

Re: How to get the YUV 420 data from the picture_t

Posted: 09 Sep 2010 04:10
by Rémi Denis-Courmont
Either your code is wrong, or the chroma is not I420, or you are not using the correct pixel line pitch.

Re: How to get the YUV 420 data from the picture_t

Posted: 09 Sep 2010 15:09
by nataraajc
Either your code is wrong, or the chroma is not I420, or you are not using the correct pixel line pitch.
If possible, provide some sample code

Re: How to get the YUV 420 data from the picture_t

Posted: 20 Sep 2010 07:57
by nataraajc

Code: Select all

// Copy Input Video into YUV buffer for( i_line = p_pic->p[Y_PLANE].i_visible_lines; i_line--; ) { memcpy(((*p_buf_Img->imgY_orig)+i_sOff), (p_pic->p[Y_PLANE].p_pixels + i_offset), p_pic->p[Y_PLANE].i_visible_pitch); i_offset += p_pic->p[Y_PLANE].i_pitch; i_sOff += p_pic->p[Y_PLANE].i_visible_pitch; } i_offset = 0; i_sOff = 0; for( i_line = p_pic->p[U_PLANE].i_visible_lines; i_line--; ) { memcpy(((**p_buf_Img->imgUV_orig)+i_sOff), (p_pic->p[U_PLANE].p_pixels + i_offset), p_pic->p[U_PLANE].i_visible_pitch); i_offset += p_pic->p[U_PLANE].i_pitch; i_sOff += p_pic->p[U_PLANE].i_visible_pitch; } i_offset = 0; for( i_line = p_pic->p[V_PLANE].i_visible_lines; i_line--; ) { memcpy(((**p_buf_Img->imgUV_orig)+i_sOff), (p_pic->p[V_PLANE].p_pixels + i_offset), p_pic->p[V_PLANE].i_visible_pitch); i_offset += p_pic->p[V_PLANE].i_pitch; i_sOff += p_pic->p[V_PLANE].i_visible_pitch; }