From 0225453fb13862a7688a4a670fe7e7d3be731b12 Mon Sep 17 00:00:00 2001 From: Pekka Paalanen Date: Fri, 20 May 2022 15:09:30 +0300 Subject: [PATCH] tests/color_util: add transfer_fn_name() This helps reporting test results, then you can print the fn by name. Signed-off-by: Pekka Paalanen --- tests/color_util.c | 23 +++++++++++++++++++++++ tests/color_util.h | 3 +++ 2 files changed, 26 insertions(+) diff --git a/tests/color_util.c b/tests/color_util.c index f51666dd..0e0c738a 100644 --- a/tests/color_util.c +++ b/tests/color_util.c @@ -121,6 +121,29 @@ transfer_fn_invert(enum transfer_fn fn) return 0; } +const char * +transfer_fn_name(enum transfer_fn fn) +{ + switch (fn) { + case TRANSFER_FN_ADOBE_RGB_EOTF: + return "AdobeRGB EOTF"; + case TRANSFER_FN_ADOBE_RGB_EOTF_INVERSE: + return "inverse AdobeRGB EOTF"; + case TRANSFER_FN_IDENTITY: + return "identity"; + case TRANSFER_FN_POWER2_4_EOTF: + return "power 2.4"; + case TRANSFER_FN_POWER2_4_EOTF_INVERSE: + return "inverse power 2.4"; + case TRANSFER_FN_SRGB_EOTF: + return "sRGB EOTF"; + case TRANSFER_FN_SRGB_EOTF_INVERSE: + return "inverse sRGB EOTF"; + } + assert(0 && "bad transfer_fn"); + return 0; +} + /** * NaN comes out as is *This function is not intended for hiding NaN. diff --git a/tests/color_util.h b/tests/color_util.h index 6b6f96d7..27d7d3c8 100644 --- a/tests/color_util.h +++ b/tests/color_util.h @@ -110,6 +110,9 @@ color_float_apply_matrix(const struct lcmsMAT3 *mat, struct color_float c); enum transfer_fn transfer_fn_invert(enum transfer_fn fn); +const char * +transfer_fn_name(enum transfer_fn fn); + void lcmsMAT3_invert(struct lcmsMAT3 *result, const struct lcmsMAT3 *mat);