1
mirror of https://github.com/mpv-player/mpv synced 2024-11-18 21:16:10 +01:00

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.
This commit is contained in:
nand 2014-02-09 14:26:27 +01:00 committed by wm4
parent 7f744c9a16
commit 257d9f1610

View File

@ -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);