Wrong colors when rendering paletted PNG
mpv renders paletted PNG wrongly when the option vo=opengl:srgb is used.
Sample PNG:

mpv output:

Tested on lachs0r's 2015-01-27 Windows build (git-f6e05b1)
This is triggered by https://github.com/mpv-player/mpv/blob/master/video/out/gl_video.c#L1720
For some reason GL_SRGB does not play well with paletted PNG files, it seems. No idea what the root cause is. We can safely delete that entire if block if you want, at the expensive of a slight(?) performance loss. I'm not sure if anybody would care. Our scaler already takes care of sRGB companding just fine even without GL_SRGB.
Would also allow us to remove is_linear_rgb completely, which makes the code a bit simpler.
Would anyone even notice the difference performance? Not that anyone opens PNGs in mpv in the first place.
It makes a (meaningful?) difference for RGB video as well. I haven't tested the performance.
@haasn: but why is it failing? This makes no sense to me. Unless the is_linear_rgb code path was broken in the meantime.
One thing is clear: it's a regression and works with 0.7.2.
I'm not opposed to removing the extra codepath, once we know we know why it fails.
OK, it's simple: srgb textures don't touch the alpha channel. But we have the red color component in the alpha channel, which we later move to the red channel. So the red component is broken. (This is done because PNG uses a component order order than RGBA - we fix this in the shader.)
So I guess I'll just remove this code.
Actually, it's the blue channel, not red.
Done.
Would also allow us to remove is_linear_rgb completely, which makes the code a bit simpler.
It looked like it still has to be there, but maybe I didn't look closely enough when simplifying the code.