I know how to code a shader that converts planar data (YUV420 image) to packed one (RGB image) using fragment shader, yet how do I code the RGB to YUV420.
I do not need the YUV420 image for rendering but to pass it to the h264 compression code.
I know how to code a shader that converts planar data (YUV420 image) to
Share
From http://www.fourcc.org/fccyvrgb.php:
In a OpenGL shader those constant offsets at the end need to be multiplied by 1/256. Also if you look closely this is a vector-matrix multiplication. You can express this by
Some other formulas are given at http://en.wikipedia.org/wiki/YUV