From e85ec39e4f1fa470a52f29c32c3ebffcef2521b5 Mon Sep 17 00:00:00 2001 From: Pekka Paalanen Date: Tue, 2 Jun 2026 14:05:41 +0300 Subject: [PATCH] tests: color parameters to color_util.h These will be needed in more than one test program, probably three. Signed-off-by: Pekka Paalanen --- tests/color-output-parsing-test.c | 36 +------------------------------ tests/harness/color_util.h | 36 +++++++++++++++++++++++++++++++ 2 files changed, 37 insertions(+), 35 deletions(-) diff --git a/tests/color-output-parsing-test.c b/tests/color-output-parsing-test.c index 11cccc237..ca770c484 100644 --- a/tests/color-output-parsing-test.c +++ b/tests/color-output-parsing-test.c @@ -27,6 +27,7 @@ #include +#include "color_util.h" #include "weston-test-client-helper.h" #include "weston-test-assert.h" @@ -56,41 +57,6 @@ struct config_testcase { const struct expected_params expected; }; -#define NO_VALUE -1.f -#define D65 { 0.3127f, 0.3290f } -#define prim_bt709 ((struct weston_color_gamut){ \ - .primary = { \ - { 0.640f, 0.330f }, \ - { 0.300f, 0.600f }, \ - { 0.150f, 0.060f }, \ - }, \ - .white_point = D65, \ -}) -#define prim_bt2020 ((struct weston_color_gamut){ \ - .primary = { \ - { 0.708f, 0.292f }, \ - { 0.170f, 0.797f }, \ - { 0.131f, 0.046f }, \ - }, \ - .white_point = D65, \ -}) -#define prim_display_p3 ((struct weston_color_gamut){ \ - .primary = { \ - { 0.680f, 0.320f }, \ - { 0.265f, 0.690f }, \ - { 0.150f, 0.060f }, \ - }, \ - .white_point = D65, \ -}) -#define prim_hp_5dq99aa ((struct weston_color_gamut){ \ - .primary = { \ - { 0.6650f, 0.3261f }, \ - { 0.2890f, 0.6435f }, \ - { 0.1494f, 0.0507f }, \ - }, \ - .white_point = { 0.3134f, 0.3291f }, \ -}) - static const struct config_testcase config_cases[] = { { WESTON_EOTF_MODE_SDR, WESTON_COLORIMETRY_MODE_DEFAULT, diff --git a/tests/harness/color_util.h b/tests/harness/color_util.h index 1abb890d7..1ed2225e8 100644 --- a/tests/harness/color_util.h +++ b/tests/harness/color_util.h @@ -170,3 +170,39 @@ rgb_diff_stat_update(struct rgb_diff_stat *stat, void rgb_diff_stat_print(const struct rgb_diff_stat *stat, const char *title, unsigned scaling_bits); + +#define NO_VALUE -1.f + +#define D65 { 0.3127f, 0.3290f } +#define prim_bt709 ((struct weston_color_gamut){ \ + .primary = { \ + { 0.640f, 0.330f }, \ + { 0.300f, 0.600f }, \ + { 0.150f, 0.060f }, \ + }, \ + .white_point = D65, \ +}) +#define prim_bt2020 ((struct weston_color_gamut){ \ + .primary = { \ + { 0.708f, 0.292f }, \ + { 0.170f, 0.797f }, \ + { 0.131f, 0.046f }, \ + }, \ + .white_point = D65, \ +}) +#define prim_display_p3 ((struct weston_color_gamut){ \ + .primary = { \ + { 0.680f, 0.320f }, \ + { 0.265f, 0.690f }, \ + { 0.150f, 0.060f }, \ + }, \ + .white_point = D65, \ +}) +#define prim_hp_5dq99aa ((struct weston_color_gamut){ \ + .primary = { \ + { 0.6650f, 0.3261f }, \ + { 0.2890f, 0.6435f }, \ + { 0.1494f, 0.0507f }, \ + }, \ + .white_point = { 0.3134f, 0.3291f }, \ +})