summaryrefslogtreecommitdiffstats
path: root/video/out/vo_opengl.c
diff options
context:
space:
mode:
authorNiklas Haas <git@nand.wakku.to>2016-02-13 15:33:00 +0100
committerwm4 <wm4@nowhere>2016-04-01 10:27:27 +0200
commit2dcf18c0c01282f0f0e72423038a78c1fc938b02 (patch)
tree2ca8bae135f1c29f6847e68861f8bb3461e8c8c1 /video/out/vo_opengl.c
parent0d746522325923ff5926f3a3cd0024b679a8199f (diff)
downloadmpv-2dcf18c0c01282f0f0e72423038a78c1fc938b02.tar.bz2
mpv-2dcf18c0c01282f0f0e72423038a78c1fc938b02.tar.xz
vo_opengl: generate 3DLUT against source and use full BT.1886
This commit refactors the 3DLUT loading mechanism to build the 3DLUT against the original source characteristics of the file. This allows us, among other things, to use a real BT.1886 profile for the source. This also allows us to actually use perceptual mappings. Finally, this reduces errors on standard gamut displays (where the previous 3DLUT target of BT.2020 was unreasonably wide). This also improves the overall accuracy of the 3DLUT due to eliminating rounding errors where possible, and allows for more accurate use of LUT-based ICC profiles. The current code is somewhat more ugly than necessary, because the idea was to implement this commit in a working state first, and then maybe refactor the profile loading mechanism in a later commit. Fixes #2815.
Diffstat (limited to 'video/out/vo_opengl.c')
-rw-r--r--video/out/vo_opengl.c24
1 files changed, 9 insertions, 15 deletions
diff --git a/video/out/vo_opengl.c b/video/out/vo_opengl.c
index 7f4f13f882..dfef6ec500 100644
--- a/video/out/vo_opengl.c
+++ b/video/out/vo_opengl.c
@@ -217,7 +217,7 @@ static void call_request_hwdec_api(struct mp_hwdec_info *info,
vo_control(vo, VOCTRL_LOAD_HWDEC_API, (void *)api_name);
}
-static bool get_and_update_icc_profile(struct gl_priv *p, int *events)
+static void get_and_update_icc_profile(struct gl_priv *p, int *events)
{
bool has_profile = p->icc_opts->profile && p->icc_opts->profile[0];
if (p->icc_opts->profile_auto && !has_profile) {
@@ -233,17 +233,12 @@ static bool get_and_update_icc_profile(struct gl_priv *p, int *events)
}
gl_lcms_set_memory_profile(p->cms, &icc);
+ has_profile = true;
}
}
- struct lut3d *lut3d = NULL;
- if (!gl_lcms_has_changed(p->cms))
- return true;
- if (gl_lcms_get_lut3d(p->cms, &lut3d) && !lut3d)
- return false;
- gl_video_set_lut3d(p->renderer, lut3d);
- talloc_free(lut3d);
- return true;
+ if (has_profile)
+ gl_video_update_profile(p->renderer);
}
static void get_and_update_ambient_lighting(struct gl_priv *p, int *events)
@@ -416,19 +411,18 @@ static int preinit(struct vo *vo)
MP_VERBOSE(vo, "swap_control extension missing.\n");
}
- p->renderer = gl_video_init(p->gl, vo->log, vo->global);
+ p->cms = gl_lcms_init(p, vo->log, vo->global);
+ if (!p->cms)
+ goto err_out;
+ p->renderer = gl_video_init(p->gl, vo->log, vo->global, p->cms);
if (!p->renderer)
goto err_out;
gl_video_set_osd_source(p->renderer, vo->osd);
gl_video_set_options(p->renderer, p->renderer_opts);
gl_video_configure_queue(p->renderer, vo);
- p->cms = gl_lcms_init(p, vo->log, vo->global);
- if (!p->cms)
- goto err_out;
gl_lcms_set_options(p->cms, p->icc_opts);
- if (!get_and_update_icc_profile(p, &(int){0}))
- goto err_out;
+ get_and_update_icc_profile(p, &(int){0});
p->hwdec_info.load_api = call_request_hwdec_api;
p->hwdec_info.load_api_ctx = vo;