From 9ae0a7ec059b89a58cb5c6c3a016bc410594ea16 Mon Sep 17 00:00:00 2001 From: Leandro Ribeiro Date: Fri, 13 Dec 2024 19:17:44 -0300 Subject: [PATCH] color: accept max_fall and max_cll even for tf different from PQ The CM&HDR protocol extension spec relaxed the requirements for the max_fall and max_cll setters. Now we accept such values even when the transfer function is not PQ. This also fixes an issue in which we'd not accept target_luminance for transfer function different from PQ, which was not on the spec. INCONSISTENT_SET is not being used in any other errors, so remove that from enum weston_color_profile_param_builder_error. Signed-off-by: Leandro Ribeiro --- include/libweston/libweston.h | 1 - libweston/color-profile-param-builder.c | 9 --------- libweston/color.h | 2 +- 3 files changed, 1 insertion(+), 11 deletions(-) diff --git a/include/libweston/libweston.h b/include/libweston/libweston.h index 71a45c2c8..dc4fd231c 100644 --- a/include/libweston/libweston.h +++ b/include/libweston/libweston.h @@ -361,7 +361,6 @@ enum weston_color_profile_param_builder_error { WESTON_COLOR_PROFILE_PARAM_BUILDER_ERROR_CIE_XY_OUT_OF_RANGE, WESTON_COLOR_PROFILE_PARAM_BUILDER_ERROR_INVALID_LUMINANCE, WESTON_COLOR_PROFILE_PARAM_BUILDER_ERROR_INCONSISTENT_LUMINANCES, - WESTON_COLOR_PROFILE_PARAM_BUILDER_ERROR_INCONSISTENT_SET, WESTON_COLOR_PROFILE_PARAM_BUILDER_ERROR_INCOMPLETE_SET, WESTON_COLOR_PROFILE_PARAM_BUILDER_ERROR_ALREADY_SET, WESTON_COLOR_PROFILE_PARAM_BUILDER_ERROR_UNSUPPORTED, diff --git a/libweston/color-profile-param-builder.c b/libweston/color-profile-param-builder.c index 90baadc2f..49e7c9377 100644 --- a/libweston/color-profile-param-builder.c +++ b/libweston/color-profile-param-builder.c @@ -535,15 +535,6 @@ builder_validate_params_set(struct weston_color_profile_param_builder *builder) if (!(builder->group_mask & WESTON_COLOR_PROFILE_PARAMS_TF)) store_error(builder, WESTON_COLOR_PROFILE_PARAM_BUILDER_ERROR_INCOMPLETE_SET, "transfer function not set"); - - /* If target luminance values were given, tf must be PQ. */ - if (builder->params.tf_info->tf != WESTON_TF_ST2084_PQ && - (builder->group_mask & WESTON_COLOR_PROFILE_PARAMS_TARGET_LUMINANCE || - builder->group_mask & WESTON_COLOR_PROFILE_PARAMS_MAXCLL || - builder->group_mask & WESTON_COLOR_PROFILE_PARAMS_MAXFALL)) - store_error(builder, WESTON_COLOR_PROFILE_PARAM_BUILDER_ERROR_INCONSISTENT_SET, - "luminance values were given but transfer function " \ - "is not Rec. ITU-R BT.2100-2 (PQ)"); } static float diff --git a/libweston/color.h b/libweston/color.h index 26531f105..965c60707 100644 --- a/libweston/color.h +++ b/libweston/color.h @@ -146,7 +146,7 @@ struct weston_color_profile_params { /* Target luminance parameters cd/m²; negative when not set */ float target_min_luminance, target_max_luminance; - float maxCLL, maxFALL; /* only for PQ transfer function */ + float maxCLL, maxFALL; }; /** Type or formula for a curve */