mirror of https://github.com/mpv-player/mpv
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.)
This commit is contained in:
parent
000285ee8e
commit
f24ba544cd
|
@ -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.
|
||||
|
|
|
@ -753,7 +753,7 @@ static void init_video(struct gl_video *p)
|
|||
mp_image_params_guess_csp(&p->image_params);
|
||||
|
||||
int eq_caps = MP_CSP_EQ_CAPS_GAMMA;
|
||||
if (p->is_yuv && p->image_params.colorspace != MP_CSP_BT_2020_C)
|
||||
if (p->image_params.colorspace != MP_CSP_BT_2020_C)
|
||||
eq_caps |= MP_CSP_EQ_CAPS_COLORMATRIX;
|
||||
if (p->image_desc.flags & MP_IMGFLAG_XYZ)
|
||||
eq_caps |= MP_CSP_EQ_CAPS_BRIGHTNESS;
|
||||
|
|
Loading…
Reference in New Issue