From 565cff5cb98d26426735a993c37a40b82d3b5ef6 Mon Sep 17 00:00:00 2001 From: Joan Torres Date: Wed, 26 Feb 2025 17:52:38 +0100 Subject: [PATCH] clutter/color-state-params: Ignore explicit max_lum on EOTF_PQ MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This is a requirement from the wayland color management: "With transfer_function.st2084_pq the given 'max_lum' value is ignored, and 'max_lum' is taken as 'min_lum' + 10000 cd/m²." Part-of: --- clutter/clutter/clutter-color-state-params.c | 5 ++++- src/tests/wayland-color-management-test.c | 2 +- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/clutter/clutter/clutter-color-state-params.c b/clutter/clutter/clutter-color-state-params.c index bbaa4b04b..45ab257d1 100644 --- a/clutter/clutter/clutter-color-state-params.c +++ b/clutter/clutter/clutter-color-state-params.c @@ -1621,7 +1621,10 @@ clutter_color_state_params_new_full (ClutterContext *context, { color_state_params->luminance.type = CLUTTER_LUMINANCE_TYPE_EXPLICIT; color_state_params->luminance.min = min_lum; - color_state_params->luminance.max = max_lum; + if (transfer_function == CLUTTER_TRANSFER_FUNCTION_PQ) + color_state_params->luminance.max = min_lum + 10000.0f; + else + color_state_params->luminance.max = max_lum; color_state_params->luminance.ref = ref_lum; } else diff --git a/src/tests/wayland-color-management-test.c b/src/tests/wayland-color-management-test.c index 3ae575213..65e3921fe 100644 --- a/src/tests/wayland-color-management-test.c +++ b/src/tests/wayland-color-management-test.c @@ -105,7 +105,7 @@ color_management (void) lum = clutter_color_state_params_get_luminance (color_state_params); g_assert_cmpuint (lum->type, ==, CLUTTER_LUMINANCE_TYPE_EXPLICIT); g_assert_cmpfloat_with_epsilon (lum->min, 0.005f, TEST_COLOR_EPSILON); - g_assert_cmpfloat_with_epsilon (lum->max, 10000.0f, TEST_COLOR_EPSILON); + g_assert_cmpfloat_with_epsilon (lum->max, lum->min + 10000.0f, TEST_COLOR_EPSILON); g_assert_cmpfloat_with_epsilon (lum->ref, 303.0f, TEST_COLOR_EPSILON); emit_sync_event (1);