From 674cc1d3a93d2bfb8e1964d26f4e073af74f0c24 Mon Sep 17 00:00:00 2001 From: nand Date: Sun, 9 Feb 2014 14:26:27 +0100 Subject: vo_opengl: use exactly the values defined by BT.709 for CMS I could not see any difference whatsoever, but for usage with a 3DLUT there's zero performance difference so we might as well follow the spec to the letter. --- video/out/gl_lcms.c | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/video/out/gl_lcms.c b/video/out/gl_lcms.c index 01e40f9e92..c1d79b5989 100644 --- a/video/out/gl_lcms.c +++ b/video/out/gl_lcms.c @@ -157,14 +157,20 @@ struct lut3d *mp_load_icc(struct mp_icc_opts *opts, struct mp_log *log, if (!profile) goto error_exit; - cmsCIExyY d65; - cmsWhitePointFromTemp(&d65, 6504); + cmsCIExyY d65 = {0.3127, 0.3290, 1.0}; static const cmsCIExyYTRIPLE bt709prim = { .Red = {0.64, 0.33, 1.0}, .Green = {0.30, 0.60, 1.0}, .Blue = {0.15, 0.06, 1.0}, }; - cmsToneCurve *tonecurve = cmsBuildGamma(NULL, 1.0/0.45); + + /* Rec BT.709 defines the tone curve as: + V = 1.099 * L^0.45 - 0.099 for L >= 0.018 + V = 4.500 * L for L < 0.018 + + The 0.18 parameter comes from inserting 0.018 into the function */ + cmsToneCurve *tonecurve = cmsBuildParametricToneCurve(NULL, 4, + (cmsFloat64Number[5]){1/0.45, 1/1.099, 0.099, 1/4.5, 0.18}); cmsHPROFILE vid_profile = cmsCreateRGBProfile(&d65, &bt709prim, (cmsToneCurve*[3]){tonecurve, tonecurve, tonecurve}); cmsFreeToneCurve(tonecurve); -- cgit v1.2.3