I am grabbing video from a web cam using Microsoft Media Foundation. The image data is in YUY2 format. The pixels are packed in a 4:2:2 ratio. The color format is YCbCr. The color data gets repeated 2x. Ex the packed pixel data is:
y0 u y1 v
Gets unpacked to 2 pixels:
y0 u v and y1 u v
I want to use this data as an OpenGL texture. The question is: is there a way to pass this type of texture to glTexImage2D
as-is? Or do I need to unpack it first? I would like you keep the YCbCr color and convert to RGBA in a shader.
(I know I can use OpenCV to get video - I've already done that. I am trying a more low level solution mostly as a learning experience).
texture(tex, vec2(Texcoord.x + 1, Texcoord.y));
I'm guessing this is due to scaling. $\endgroup$