How to convert the UYVY and YUV2 to RGB with OpenGL ES ( i.mx6q/linux platform ) ?

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

How to convert the UYVY and YUV2 to RGB with OpenGL ES ( i.mx6q/linux platform ) ?

3,820 Views
louiswu
Contributor I
How to convert the UYVY and YUV2 to RGB with OpenGL ES ( i.mx6q/linux platform ) ? 
 
(1)  I know how to convert the YUV SemiPlanar( Y placed in a buffer and UV in another buffer ) to RGB with GLSL shader, and had done it sucessful; 
(2)  But I don't know how to convert the packed UYVY 4:2:2 and YUV2 4:2:2 to RGB, which the UYVY is organized as U Y V Y U Y V Y...... (packed format), and placed in one buffer. in detail, the question is:
     (a): Which internalformat ang format shoud I assign in glTexImage2D()  or  in glTexDirectVIVMap()? 
     (b): When use rgba = texture2D()  in fragment shader, How rgba corresponding to yuv ?  If the yuv were got correctly , i can convert them to RGB properly.
 
Thanks!
Labels (3)
Tags (3)
0 Kudos
3 Replies

2,197 Views
louiswu
Contributor I

If has sample code, that would be great~

0 Kudos

2,197 Views
Bio_TICFSL
NXP TechSupport
NXP TechSupport

Hi Louis,

Our Suggestion is doing the YUV to RGB using the IPU CSC if you have a single layer overlay since it's done on the fly. however Please check sect.2.4.1 Color space conversion from YUV to RGB in your i.MX_6_Graphics_User's_Guide.pdf and sect.7.3.15 Video conversion Linux Guide of the Linux user bsp guide:

 

https://community.nxp.com/servlet/JiveServlet/download/833793-1-393243/i.MX_6_Graphics_User's_Guide.... 

https://community.nxp.com/servlet/JiveServlet/download/833793-1-393244/i.MX_Linux_User's_Guide.pdf 

For samples You can download  gpu_sdk from nxp website:

https://www.nxp.com/webapp/Download?colCode=IMX6_GPU_SDK&Parent_nodeId=1337637154535695831062&Parent...

https://www.nxp.com/webapp/Download?colCode=IMX6_GPU_SDK&Parent_nodeId=1337637154535695831062&Parent... 

Regards

0 Kudos

2,197 Views
louiswu
Contributor I
Thank you for your answer. 
I'm sorry my previous question is simplified, cause you misunderstand my needs. My exactly operating flow is:
(1) Firstly, get the camera video data from the IPU, the data format is packed U Y V Y U Y V Y......;
(2) Secondly,  I need deal with the data, use some specific algorithm, such as yuv' = fun(yuv), to produce new yuv data, then convert the new yuv to rgb to display.
 
For this application, because the IPU cann't do the yuv' = fun(yuv) , I should put the packed UYVY data to GPU, with glTexDirectVIVMap()function ( or have other better method? please point out, thanks ), then sample the yuv data in fragment shader. I know i can use  GL_VIV_UYVY format with glTexDirectVIVMap()function, but when use rgba = texture2D()  in fragment shader, How rgba corresponding to yuv ? and because of the data is packed UYVY, is the MSAA can work correctly? We need anti-aliasing image.
0 Kudos