How to get the YUV 420 data from the picture_t

This forum is about all development around libVLC.
nataraajc
Blank Cone
Blank Cone
Posts: 22
Joined: 16 Aug 2010 09:03

How to get the YUV 420 data from the picture_t

Postby nataraajc » 07 Sep 2010 17:54

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

Sébastien Escudier
Big Cone-huna
Big Cone-huna
Posts: 853
Joined: 06 Nov 2008 08:38
Operating System: linux

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

Postby Sébastien Escudier » 07 Sep 2010 18:02

I think you can use smem for this

nataraajc
Blank Cone
Blank Cone
Posts: 22
Joined: 16 Aug 2010 09:03

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

Postby nataraajc » 07 Sep 2010 18:21

any other ways pls?

Rémi Denis-Courmont
Developer
Developer
Posts: 15263
Joined: 07 Jun 2004 16:01
VLC version: master
Operating System: Linux
Contact:

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

Postby Rémi Denis-Courmont » 08 Sep 2010 02:14

Did you even peek at other filters or outputs?
I guess you are looking for picture_t.plane[{Y,U,V}_PLANE].p_pixels
Rémi Denis-Courmont
https://www.remlab.net/
Private messages soliciting support will be systematically discarded

nataraajc
Blank Cone
Blank Cone
Posts: 22
Joined: 16 Aug 2010 09:03

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

Postby nataraajc » 08 Sep 2010 04:58

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.

Rémi Denis-Courmont
Developer
Developer
Posts: 15263
Joined: 07 Jun 2004 16:01
VLC version: master
Operating System: Linux
Contact:

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

Postby Rémi Denis-Courmont » 09 Sep 2010 04:10

Either your code is wrong, or the chroma is not I420, or you are not using the correct pixel line pitch.
Rémi Denis-Courmont
https://www.remlab.net/
Private messages soliciting support will be systematically discarded

nataraajc
Blank Cone
Blank Cone
Posts: 22
Joined: 16 Aug 2010 09:03

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

Postby nataraajc » 09 Sep 2010 15:09

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

nataraajc
Blank Cone
Blank Cone
Posts: 22
Joined: 16 Aug 2010 09:03

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

Postby nataraajc » 20 Sep 2010 07:57

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; }


Return to “Development around libVLC”

Who is online

Users browsing this forum: No registered users and 5 guests