From 05c8d5a93a743cb735ca751c2a6343dba4dcf511 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Kacper=20Michaj=C5=82ow?= Date: Sun, 11 Feb 2024 00:51:58 +0100 Subject: [PATCH] csputils: add missing PL_COLOR_SYSTEM names --- DOCS/man/vf.rst | 11 +++++++---- video/csputils.c | 9 +++++++++ video/mp_image.c | 3 +++ 3 files changed, 19 insertions(+), 4 deletions(-) diff --git a/DOCS/man/vf.rst b/DOCS/man/vf.rst index 1423e4c3923a9..1d067e31f4874 100644 --- a/DOCS/man/vf.rst +++ b/DOCS/man/vf.rst @@ -204,10 +204,13 @@ Available mpv-only filters are: Available color spaces are: :auto: automatic selection (default) - :bt.601: ITU-R BT.601 (SD) - :bt.709: ITU-R BT.709 (HD) - :bt.2020-ncl: ITU-R BT.2020 non-constant luminance system - :bt.2020-cl: ITU-R BT.2020 constant luminance system + :bt.601: ITU-R Rec. BT.601 (SD) + :bt.709: ITU-R Rec. BT.709 (HD) + :bt.2020-ncl: ITU-R Rec. BT.2020 (non-constant luminance) + :bt.2020-cl: ITU-R Rec. BT.2020 (constant luminance) + :bt.2100-pq: ITU-R Rec. BT.2100 ICtCp PQ variant + :bt.2100-hlg: ITU-R Rec. BT.2100 ICtCp HLG variant + :dolbyvision: Dolby Vision :smpte-240m: SMPTE-240M ```` diff --git a/video/csputils.c b/video/csputils.c index 0587c57f4ecbf..555f0c045e262 100644 --- a/video/csputils.c +++ b/video/csputils.c @@ -37,6 +37,9 @@ const struct m_opt_choice_alternatives pl_csp_names[] = { {"smpte-240m", PL_COLOR_SYSTEM_SMPTE_240M}, {"bt.2020-ncl", PL_COLOR_SYSTEM_BT_2020_NC}, {"bt.2020-cl", PL_COLOR_SYSTEM_BT_2020_C}, + {"bt.2100-pq", PL_COLOR_SYSTEM_BT_2100_PQ}, + {"bt.2100-hlg", PL_COLOR_SYSTEM_BT_2100_HLG}, + {"dolbyvision", PL_COLOR_SYSTEM_DOLBYVISION}, {"rgb", PL_COLOR_SYSTEM_RGB}, {"xyz", PL_COLOR_SYSTEM_XYZ}, {"ycgco", PL_COLOR_SYSTEM_YCGCO}, @@ -315,6 +318,12 @@ void mp_get_csp_matrix(struct mp_csp_params *params, struct pl_transform3x3 *m) enum pl_color_system colorspace = params->repr.sys; if (colorspace <= PL_COLOR_SYSTEM_UNKNOWN || colorspace >= PL_COLOR_SYSTEM_COUNT) colorspace = PL_COLOR_SYSTEM_BT_601; + // Not supported. TODO: replace with pl_color_repr_decode + if (colorspace == PL_COLOR_SYSTEM_BT_2100_PQ || + colorspace == PL_COLOR_SYSTEM_BT_2100_HLG || + colorspace == PL_COLOR_SYSTEM_DOLBYVISION) { + colorspace = PL_COLOR_SYSTEM_BT_2020_NC; + } enum pl_color_levels levels_in = params->repr.levels; if (levels_in <= PL_COLOR_LEVELS_UNKNOWN || levels_in >= PL_COLOR_LEVELS_COUNT) levels_in = PL_COLOR_LEVELS_LIMITED; diff --git a/video/mp_image.c b/video/mp_image.c index 33a784741f6e7..23b1ab8af0c5f 100644 --- a/video/mp_image.c +++ b/video/mp_image.c @@ -910,6 +910,9 @@ void mp_image_params_guess_csp(struct mp_image_params *params) params->repr.sys != PL_COLOR_SYSTEM_BT_709 && params->repr.sys != PL_COLOR_SYSTEM_BT_2020_NC && params->repr.sys != PL_COLOR_SYSTEM_BT_2020_C && + params->repr.sys != PL_COLOR_SYSTEM_BT_2100_PQ && + params->repr.sys != PL_COLOR_SYSTEM_BT_2100_HLG && + params->repr.sys != PL_COLOR_SYSTEM_DOLBYVISION && params->repr.sys != PL_COLOR_SYSTEM_SMPTE_240M && params->repr.sys != PL_COLOR_SYSTEM_YCGCO) {