Skip to content

Commit

Permalink
csputils: add missing PL_COLOR_SYSTEM names
Browse files Browse the repository at this point in the history
  • Loading branch information
kasper93 authored and Dudemanguy committed Mar 9, 2024
1 parent 391261f commit 05c8d5a
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 4 deletions.
11 changes: 7 additions & 4 deletions DOCS/man/vf.rst
Original file line number Diff line number Diff line change
Expand Up @@ -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

``<colorlevels>``
Expand Down
9 changes: 9 additions & 0 deletions video/csputils.c
Original file line number Diff line number Diff line change
Expand Up @@ -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},
Expand Down Expand Up @@ -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;
Expand Down
3 changes: 3 additions & 0 deletions video/mp_image.c
Original file line number Diff line number Diff line change
Expand Up @@ -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)
{
Expand Down

0 comments on commit 05c8d5a

Please sign in to comment.