From f9a27c5b6f615be4f3e73e403cc7ca7e768df478 Mon Sep 17 00:00:00 2001 From: Simon Ser Date: Sat, 21 Jun 2025 12:50:46 +0200 Subject: [PATCH] render/color: move inverse EOTF eval helper to private header This will be used by the DRM backend in the next commit. --- include/render/color.h | 5 +++++ render/color.c | 4 ++-- 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/include/render/color.h b/include/render/color.h index 128b345e1..7f133f5bd 100644 --- a/include/render/color.h +++ b/include/render/color.h @@ -97,4 +97,9 @@ void wlr_color_primaries_to_xyz(const struct wlr_color_primaries *primaries, flo void wlr_color_transfer_function_get_default_luminance(enum wlr_color_transfer_function tf, struct wlr_color_luminances *lum); +/** + * Apply a color transfer function's EOTF⁻¹ operation. + */ +float wlr_color_transfer_function_eval_inverse_eotf(enum wlr_color_transfer_function tf, float x); + #endif diff --git a/render/color.c b/render/color.c index 0a1a67be3..198e1c26d 100644 --- a/render/color.c +++ b/render/color.c @@ -177,7 +177,7 @@ static float bt1886_eval_inverse_eotf(float x) { return powf(x / a, 1.0 / 2.4) - b; } -static float transfer_function_eval_inverse_eotf( +float wlr_color_transfer_function_eval_inverse_eotf( enum wlr_color_transfer_function tf, float x) { switch (tf) { case WLR_COLOR_TRANSFER_FUNCTION_SRGB: @@ -198,7 +198,7 @@ static void color_transform_inverse_eotf_eval( struct wlr_color_transform_inverse_eotf *tr, float out[static 3], const float in[static 3]) { for (size_t i = 0; i < 3; i++) { - out[i] = transfer_function_eval_inverse_eotf(tr->tf, in[i]); + out[i] = wlr_color_transfer_function_eval_inverse_eotf(tr->tf, in[i]); } }