summaryrefslogtreecommitdiffstats
path: root/video/out/gl_video.c
diff options
context:
space:
mode:
authorwm4 <wm4@nowhere>2015-02-28 19:13:19 +0100
committerwm4 <wm4@nowhere>2015-02-28 19:29:03 +0100
commit8d24e9d9b8ad1b5d82139980eca148dc0f4a1eab (patch)
tree5bfe8e190da7e676f63586de5e604337abd05748 /video/out/gl_video.c
parent833ac3f264b74bc4d8e1dc6e6c836e364353558a (diff)
downloadmpv-8d24e9d9b8ad1b5d82139980eca148dc0f4a1eab.tar.bz2
mpv-8d24e9d9b8ad1b5d82139980eca148dc0f4a1eab.tar.xz
Revert recent vo_opengl related commits
Breaks vo_opengl by default. I'm hot able to fix this myself, because I have no clue about the overcomplicated color management logic. Also, whilethis is apparently caused by commit fbacd5, the following commits all depend on it, so revert them too. This reverts the following commits: e141caa97dade07f4d7e0d6c208bcd3493e712ed 653b0dd5295453d9661f673b4ebd02c5ceacf645 729c8b3f641e633474be612e66388c131a1b5c92 fbacd5de31de964f7cd562304ab1c9b4a0d76015 Fixes #1636.
Diffstat (limited to 'video/out/gl_video.c')
-rw-r--r--video/out/gl_video.c17
1 files changed, 16 insertions, 1 deletions
diff --git a/video/out/gl_video.c b/video/out/gl_video.c
index 9c8a64365d..23b19b3125 100644
--- a/video/out/gl_video.c
+++ b/video/out/gl_video.c
@@ -937,7 +937,8 @@ static void compile_shaders(struct gl_video *p)
bool use_input_gamma = p->input_gamma != 1.0;
bool use_conv_gamma = p->conv_gamma != 1.0;
bool use_const_luma = p->image_params.colorspace == MP_CSP_BT_2020_C;
- enum mp_csp_trc gamma_fun = p->image_params.gamma;
+
+ enum mp_csp_trc gamma_fun = MP_CSP_TRC_NONE;
// If either color correction option (3dlut or srgb) is enabled, or if
// sigmoidal upscaling is requested, or if the source is linear XYZ, we
@@ -945,6 +946,20 @@ static void compile_shaders(struct gl_video *p)
bool use_linear_light = p->opts.linear_scaling || p->opts.sigmoid_upscaling
|| use_cms || is_xyz;
+ if (use_linear_light) {
+ // We use the color level range to distinguish between PC
+ // content like images, which are most likely sRGB, and TV content
+ // like movies, which are most likely BT.1886. XYZ input is always
+ // treated as linear.
+ if (is_xyz) {
+ gamma_fun = MP_CSP_TRC_LINEAR;
+ } else if (p->image_params.colorlevels == MP_CSP_LEVELS_PC) {
+ gamma_fun = MP_CSP_TRC_SRGB;
+ } else {
+ gamma_fun = MP_CSP_TRC_BT_1886;
+ }
+ }
+
// The inverse of the above transformation is normally handled by
// the CMS cases, but if CMS is disabled we need to go back manually
bool use_inv_bt1886 = false;