Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

how to display data of yuv format without converting rgb in OpenGL ES?

Tags:

rgb

opengl-es

yuv

I have being study about OpenGL ES for iOS. I wonder that data of YUV format is can display without converting RGB. In most, the yuv data have to convert RGB for display. But, converting process is very slow, Then, that is not display smoothly. So, I would like to try to dispaly YUV data without convert to RGB. Is it possible? If possible, what can I do? Please, let me give a advice.

like image 216
ddylee Avatar asked Oct 15 '25 00:10

ddylee


2 Answers

I think it is not possible in OpenGL ES to display YUV data without convert to RGB data.

like image 172
Saiful Avatar answered Oct 18 '25 15:10

Saiful


You can do this very easily using OpenGL ES 2.0 shaders. I use this technique for my super-fast iOS camera app SnappyCam. The fragment shader would perform the matrix multiplication to take you from YCbCr ("YUV") to RGB. You can have each {Y, Cb, Cr} channel in a separate GL_LUMINANCE texture, or combine the {Cb, Cr} textures together using a GL_LUMINANCE_ALPHA texture if your chrominance data is already interleaved (Apple call this a bi-planar format).

See my related answer to the question YUV to RGBA on Apple A4, should I use shaders or NEON? here on StackOverflow.

You may also do this using the fixed rendering pipeline of ES 1.1, but I haven't tried it. I would look toward the the texture blending functions, e.g. given in this OpenGL Texture Combiners Wiki Page.

like image 34
jpap Avatar answered Oct 18 '25 13:10

jpap



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!