Hi,
We are developing a video player that renders to a GL_TEXTURE_EXTERNAL_OES texture. I seems that the colour of the video is slightly wrong on our Galaxy S8 test device. (in fact the colour of this video seems wrong in any built in or 3rd party video player apps on this device) On every other device in our possession the colour seems fine. My guess would be (after a LOT of fiddling with the colorspaces etc) that maybe the internal YUV -> RGB conversion could be guilty? If that's the case, could there be any workaround? (right now I'm trying to write our own conversion, but I'm afraid that wouldn't be ideal considering all the possible YUV output formats http://bigflake.com/mediacodec/ - see "Q5")
Here is the video:
Here is the first frame exported in photoshop:
And here is screenshot from the built in video player from the device:
If you look carefully, you can see, that colour of the grass is a little off.
Thanks,
Peter
Hi again,
It turns out that there are some other phones (namely Huawei M8 and P9 - that I know of) that have the same issue, but they don't have the GL_EXT_YUV_target extension. Do you have any idea maybe, how the manual conversion could be done in this case?
Yeah, I know this isn't exactly the right forum for these questions, but it seems you are far more experienced in this area then I am. Maybe you can save me some couple more days of research :)
If it doesn't have EXT_yuv_target, you'll probably have to construct a custom transform which inverts the RGB -> YUV transforms and transforms to YUV again with a different matrix.
If input is BT.604 and you need BT.709, I suppose you can build a matrix
m = bt709_transform * inverse(bt604_transform) on CPU,
and pass that down to the fragment shader as a uniform. That's the best option I can think of. Does the video have proper color space set in the H.264 (?) stream to begin with though?
It turns out that this kind ofcolor space information wasn't specified in the video (just said yuv420p), so I tried to convert it to BT.601* and BT.709 as well. Unfortunately both gave the same output as the original. (weird?)
About those conversions... Still not an expert over here :D After some googling I've found this: https://www.mathworks.com/matlabcentral/fileexchange/36417-yuv-files-reading-and-converting?focused=5229495&tab=function&requestedDomain=www.mathworks.com Are these the droirds.. ahem matrices I am looking for?
Ok so, I got the conversions working for both formats, now I just can't determine when to use which one. Is there any way to find out which conversion OpenGL is using internally with samplerExternalOES textures?