color: add WESTON_TF_POWER

Up to now we had support only for transfer functions with pre-defined
parameters in struct weston_color_tf_info. Add support for the first
parameterized transfer function (a function whose params are not
pre-defined).

Signed-off-by: Leandro Ribeiro <leandro.ribeiro@collabora.com>
This commit is contained in:
Leandro Ribeiro 2024-06-17 11:49:07 -03:00
parent 1c54ad7fd6
commit 9707a3320d
3 changed files with 30 additions and 0 deletions

View File

@ -347,6 +347,7 @@ enum weston_transfer_function {
WESTON_TF_LOG_316,
WESTON_TF_XVYCC,
WESTON_TF_HLG,
WESTON_TF_POWER,
};
enum weston_color_characteristics_groups {

View File

@ -40,6 +40,11 @@
#include "color-management-v1-server-protocol.h"
enum tf_has_parameters {
YES_PARAMETERS = true,
NO_PARAMETERS = false,
};
static const struct weston_color_feature_info color_feature_info_table[] = {
{
.feature = WESTON_COLOR_FEATURE_ICC,
@ -254,72 +259,91 @@ static const struct weston_color_tf_info color_tf_info_table[] = {
.tf = WESTON_TF_LINEAR,
.desc = "Linear transfer function",
.protocol_tf = XX_COLOR_MANAGER_V2_TRANSFER_FUNCTION_LINEAR,
.has_parameters = NO_PARAMETERS,
},
{
.tf = WESTON_TF_GAMMA22,
.desc = "Assumed display gamma 2.2 transfer function",
.protocol_tf = XX_COLOR_MANAGER_V2_TRANSFER_FUNCTION_GAMMA22,
.has_parameters = NO_PARAMETERS,
},
{
.tf = WESTON_TF_GAMMA28,
.desc = "Assumed display gamma 2.8 transfer function",
.protocol_tf = XX_COLOR_MANAGER_V2_TRANSFER_FUNCTION_GAMMA28,
.has_parameters = NO_PARAMETERS,
},
{
.tf = WESTON_TF_SRGB,
.desc = "sRGB piece-wise transfer function",
.protocol_tf = XX_COLOR_MANAGER_V2_TRANSFER_FUNCTION_SRGB,
.has_parameters = NO_PARAMETERS,
},
{
.tf = WESTON_TF_EXT_SRGB,
.desc = "Extended sRGB piece-wise transfer function",
.protocol_tf = XX_COLOR_MANAGER_V2_TRANSFER_FUNCTION_EXT_SRGB,
.has_parameters = NO_PARAMETERS,
},
{
.tf = WESTON_TF_BT709,
.desc = "BT.709 transfer function",
.protocol_tf = XX_COLOR_MANAGER_V2_TRANSFER_FUNCTION_BT709,
.has_parameters = NO_PARAMETERS,
},
{
.tf = WESTON_TF_BT1361,
.desc = "BT.1361 extended transfer function",
.protocol_tf = XX_COLOR_MANAGER_V2_TRANSFER_FUNCTION_BT1361,
.has_parameters = NO_PARAMETERS,
},
{
.tf = WESTON_TF_ST240,
.desc = "SMPTE ST 240 transfer function",
.protocol_tf = XX_COLOR_MANAGER_V2_TRANSFER_FUNCTION_ST240,
.has_parameters = NO_PARAMETERS,
},
{
.tf = WESTON_TF_ST428,
.desc = "SMPTE ST 428 transfer function",
.protocol_tf = XX_COLOR_MANAGER_V2_TRANSFER_FUNCTION_ST428,
.has_parameters = NO_PARAMETERS,
},
{
.tf = WESTON_TF_ST2084_PQ,
.desc = "Perceptual quantizer transfer function",
.protocol_tf = XX_COLOR_MANAGER_V2_TRANSFER_FUNCTION_ST2084_PQ,
.has_parameters = NO_PARAMETERS,
},
{
.tf = WESTON_TF_LOG_100,
.desc = "Logarithmic 100:1 transfer function",
.protocol_tf = XX_COLOR_MANAGER_V2_TRANSFER_FUNCTION_LOG_100,
.has_parameters = NO_PARAMETERS,
},
{
.tf = WESTON_TF_LOG_316,
.desc = "Logarithmic (100*Sqrt(10) : 1) transfer function",
.protocol_tf = XX_COLOR_MANAGER_V2_TRANSFER_FUNCTION_LOG_316,
.has_parameters = NO_PARAMETERS,
},
{
.tf = WESTON_TF_XVYCC,
.desc = "IEC 61966-2-4 transfer function",
.protocol_tf = XX_COLOR_MANAGER_V2_TRANSFER_FUNCTION_XVYCC,
.has_parameters = NO_PARAMETERS,
},
{
.tf = WESTON_TF_HLG,
.desc = "Hybrid log-gamma transfer function",
.protocol_tf = XX_COLOR_MANAGER_V2_TRANSFER_FUNCTION_HLG,
.has_parameters = NO_PARAMETERS,
},
{
.tf = WESTON_TF_POWER,
.desc = "Parameterized power-law transfer function",
.has_parameters = YES_PARAMETERS,
},
};
WL_EXPORT const struct weston_color_feature_info *

View File

@ -107,6 +107,11 @@ struct weston_color_tf_info {
/** CM&HDR protocol extension value representing the tf. */
uint32_t protocol_tf;
/* The protocol also has support for parameterized functions, i.e.
* certain known functions that clients can define passing arbitrary
* parameters. */
bool has_parameters;
};
const struct weston_color_feature_info *