From bfb779ac2f44b5341e35cd3d0e6386ee4ce6498f Mon Sep 17 00:00:00 2001 From: Matthias Clasen Date: Mon, 29 Jul 2024 09:36:24 -0400 Subject: [PATCH] gsk: Add missing cicp transfer functions This was overlooked in 50ea9450eabe7e4. --- gsk/gpu/shaders/gskgpuconvertcicp.glsl | 44 ++++++++++++++++++++++++++ 1 file changed, 44 insertions(+) diff --git a/gsk/gpu/shaders/gskgpuconvertcicp.glsl b/gsk/gpu/shaders/gskgpuconvertcicp.glsl index 193deccc5c..c2329c48ba 100644 --- a/gsk/gpu/shaders/gskgpuconvertcicp.glsl +++ b/gsk/gpu/shaders/gskgpuconvertcicp.glsl @@ -176,6 +176,30 @@ bt709_oetf (float v) return 1.099 * pow (v, 0.45) - 0.099; } +float +gamma22_oetf (float v) +{ + return pow (v, 1.0 / 2.2); +} + +float +gamma22_eotf (float v) +{ + return pow (v, 2.2); +} + +float +gamma28_oetf (float v) +{ + return pow (v, 1.0 / 2.8); +} + +float +gamma28_eotf (float v) +{ + return pow (v, 2.8); +} + float hlg_eotf (float v) { @@ -216,6 +240,16 @@ apply_cicp_eotf (vec3 color, bt709_eotf (color.g), bt709_eotf (color.b)); + case 4u: + return vec3 (gamma22_eotf (color.r), + gamma22_eotf (color.g), + gamma22_eotf (color.b)); + + case 5u: + return vec3 (gamma28_eotf (color.r), + gamma28_eotf (color.g), + gamma28_eotf (color.b)); + case 8u: return color; @@ -253,6 +287,16 @@ apply_cicp_oetf (vec3 color, bt709_oetf (color.g), bt709_oetf (color.b)); + case 4u: + return vec3 (gamma22_oetf (color.r), + gamma22_oetf (color.g), + gamma22_oetf (color.b)); + + case 5u: + return vec3 (gamma28_oetf (color.r), + gamma28_oetf (color.g), + gamma28_oetf (color.b)); + case 8u: return color;