From 643417dd175ebe3a1b90213f97acddaea7eaea80 Mon Sep 17 00:00:00 2001 From: Wessel Dankers Date: Wed, 22 Aug 2018 14:39:40 +0200 Subject: video: add pure gamma TRC curves for 2.0, 2.4 and 2.6. --- video/csputils.c | 3 +++ video/csputils.h | 3 +++ video/out/gpu/lcms.c | 3 +++ video/out/gpu/video_shaders.c | 18 ++++++++++++++++++ 4 files changed, 27 insertions(+) (limited to 'video') diff --git a/video/csputils.c b/video/csputils.c index f02a4ca4b8..6f88fe30b2 100644 --- a/video/csputils.c +++ b/video/csputils.c @@ -78,7 +78,10 @@ const struct m_opt_choice_alternatives mp_csp_trc_names[] = { {"srgb", MP_CSP_TRC_SRGB}, {"linear", MP_CSP_TRC_LINEAR}, {"gamma1.8", MP_CSP_TRC_GAMMA18}, + {"gamma2.0", MP_CSP_TRC_GAMMA20}, {"gamma2.2", MP_CSP_TRC_GAMMA22}, + {"gamma2.4", MP_CSP_TRC_GAMMA24}, + {"gamma2.6", MP_CSP_TRC_GAMMA26}, {"gamma2.8", MP_CSP_TRC_GAMMA28}, {"prophoto", MP_CSP_TRC_PRO_PHOTO}, {"pq", MP_CSP_TRC_PQ}, diff --git a/video/csputils.h b/video/csputils.h index 441f2b024b..f817779584 100644 --- a/video/csputils.h +++ b/video/csputils.h @@ -78,7 +78,10 @@ enum mp_csp_trc { MP_CSP_TRC_SRGB, MP_CSP_TRC_LINEAR, MP_CSP_TRC_GAMMA18, + MP_CSP_TRC_GAMMA20, MP_CSP_TRC_GAMMA22, + MP_CSP_TRC_GAMMA24, + MP_CSP_TRC_GAMMA26, MP_CSP_TRC_GAMMA28, MP_CSP_TRC_PRO_PHOTO, MP_CSP_TRC_PQ, diff --git a/video/out/gpu/lcms.c b/video/out/gpu/lcms.c index a8f277d3f0..1d4e90d7af 100644 --- a/video/out/gpu/lcms.c +++ b/video/out/gpu/lcms.c @@ -253,7 +253,10 @@ static cmsHPROFILE get_vid_profile(struct gl_lcms *p, cmsContext cms, switch (trc) { case MP_CSP_TRC_LINEAR: tonecurve[0] = cmsBuildGamma(cms, 1.0); break; case MP_CSP_TRC_GAMMA18: tonecurve[0] = cmsBuildGamma(cms, 1.8); break; + case MP_CSP_TRC_GAMMA20: tonecurve[0] = cmsBuildGamma(cms, 2.0); break; case MP_CSP_TRC_GAMMA22: tonecurve[0] = cmsBuildGamma(cms, 2.2); break; + case MP_CSP_TRC_GAMMA24: tonecurve[0] = cmsBuildGamma(cms, 2.4); break; + case MP_CSP_TRC_GAMMA26: tonecurve[0] = cmsBuildGamma(cms, 2.6); break; case MP_CSP_TRC_GAMMA28: tonecurve[0] = cmsBuildGamma(cms, 2.8); break; case MP_CSP_TRC_SRGB: diff --git a/video/out/gpu/video_shaders.c b/video/out/gpu/video_shaders.c index e3021fdb9c..51b62ad7db 100644 --- a/video/out/gpu/video_shaders.c +++ b/video/out/gpu/video_shaders.c @@ -364,9 +364,18 @@ void pass_linearize(struct gl_shader_cache *sc, enum mp_csp_trc trc) case MP_CSP_TRC_GAMMA18: GLSL(color.rgb = pow(color.rgb, vec3(1.8));) break; + case MP_CSP_TRC_GAMMA20: + GLSL(color.rgb = pow(color.rgb, vec3(2.0));) + break; case MP_CSP_TRC_GAMMA22: GLSL(color.rgb = pow(color.rgb, vec3(2.2));) break; + case MP_CSP_TRC_GAMMA24: + GLSL(color.rgb = pow(color.rgb, vec3(2.4));) + break; + case MP_CSP_TRC_GAMMA26: + GLSL(color.rgb = pow(color.rgb, vec3(2.6));) + break; case MP_CSP_TRC_GAMMA28: GLSL(color.rgb = pow(color.rgb, vec3(2.8));) break; @@ -445,9 +454,18 @@ void pass_delinearize(struct gl_shader_cache *sc, enum mp_csp_trc trc) case MP_CSP_TRC_GAMMA18: GLSL(color.rgb = pow(color.rgb, vec3(1.0/1.8));) break; + case MP_CSP_TRC_GAMMA20: + GLSL(color.rgb = pow(color.rgb, vec3(1.0/2.0));) + break; case MP_CSP_TRC_GAMMA22: GLSL(color.rgb = pow(color.rgb, vec3(1.0/2.2));) break; + case MP_CSP_TRC_GAMMA24: + GLSL(color.rgb = pow(color.rgb, vec3(1.0/2.4));) + break; + case MP_CSP_TRC_GAMMA26: + GLSL(color.rgb = pow(color.rgb, vec3(1.0/2.6));) + break; case MP_CSP_TRC_GAMMA28: GLSL(color.rgb = pow(color.rgb, vec3(1.0/2.8));) break; -- cgit v1.2.3