diff options
author | wm4 <wm4@nowhere> | 2015-12-12 14:47:30 +0100 |
---|---|---|
committer | wm4 <wm4@nowhere> | 2015-12-12 14:47:30 +0100 |
commit | f24ba544cd03261f25dab8ab564d832c28233079 (patch) | |
tree | c200b7b66e8d44328ebcb326950abef1fd83efa5 /video/csputils.c | |
parent | 000285ee8e077f5b0cd391ffc30cc71e5a3c728d (diff) | |
download | mpv-f24ba544cd03261f25dab8ab564d832c28233079.tar.bz2 mpv-f24ba544cd03261f25dab8ab564d832c28233079.tar.xz |
vo_opengl: enable brightness/contrast controls for RGB
Why not.
Also, instead of disabling hue/saturation for RGB, just don't apply
them. (They don't make sense for conversion matrixes other than YUV, but
I can't be bothered to keep the fine-grained disabling of UI controls
either.)
Diffstat (limited to 'video/csputils.c')
-rw-r--r-- | video/csputils.c | 21 |
1 files changed, 13 insertions, 8 deletions
diff --git a/video/csputils.c b/video/csputils.c index fb9d971517..d6e80e0c16 100644 --- a/video/csputils.c +++ b/video/csputils.c @@ -652,14 +652,19 @@ void mp_get_csp_matrix(struct mp_csp_params *params, struct mp_cmat *m) abort(); }; - // Hue is equivalent to rotating input [U, V] subvector around the origin. - // Saturation scales [U, V]. - float huecos = params->gray ? 0 : params->saturation * cos(params->hue); - float huesin = params->gray ? 0 : params->saturation * sin(params->hue); - for (int i = 0; i < 3; i++) { - float u = m->m[i][1], v = m->m[i][2]; - m->m[i][1] = huecos * u - huesin * v; - m->m[i][2] = huesin * u + huecos * v; + if ((colorspace == MP_CSP_BT_601 || colorspace == MP_CSP_BT_709 || + colorspace == MP_CSP_SMPTE_240M || colorspace == MP_CSP_BT_2020_NC) + && !params->gray) + { + // Hue is equivalent to rotating input [U, V] subvector around the origin. + // Saturation scales [U, V]. + float huecos = params->saturation * cos(params->hue); + float huesin = params->saturation * sin(params->hue); + for (int i = 0; i < 3; i++) { + float u = m->m[i][1], v = m->m[i][2]; + m->m[i][1] = huecos * u - huesin * v; + m->m[i][2] = huesin * u + huecos * v; + } } // The values below are written in 0-255 scale - thus bring s into range. |