summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--DOCS/interface-changes.rst1
-rw-r--r--DOCS/man/options.rst7
-rw-r--r--video/out/gpu/video.c1
-rw-r--r--video/out/gpu/video.h1
-rw-r--r--video/out/vo_gpu_next.c7
5 files changed, 17 insertions, 0 deletions
diff --git a/DOCS/interface-changes.rst b/DOCS/interface-changes.rst
index ebcdea4990..53ff736562 100644
--- a/DOCS/interface-changes.rst
+++ b/DOCS/interface-changes.rst
@@ -114,6 +114,7 @@ Interface changes
`--demuxer-readahead-secs` as well
- add hdr metadata to `video-params` property
- remove `hdr-metadata` property
+ - add `--target-gamut`
--- mpv 0.36.0 ---
- add `--target-contrast`
- Target luminance value is now also applied when ICC profile is used.
diff --git a/DOCS/man/options.rst b/DOCS/man/options.rst
index d8f55f4cd1..3eb548f557 100644
--- a/DOCS/man/options.rst
+++ b/DOCS/man/options.rst
@@ -6561,6 +6561,13 @@ them.
``inf`` contrast specifies display with perfect black level, in practice OLED.
(Only for ``--vo=gpu-next``)
+``--target-gamut=<value>``
+ Constrains the gamut of the display. You can use this option to output e.g.
+ DCIP3-in-BT.2020. Set ``--target-prim`` to the primaries of the containing
+ colorspace (into which values will be encoded), and ``--target-gamut`` to
+ the gamut you want to limit colors to. Takes the same values as
+ ``--target-prim``. (Only for ``--vo=gpu-next``)
+
``--target-lut=<file>``
Specifies a custom LUT file (in Adobe .cube format) to apply to the colors
before display on-screen. This LUT is fed values in normalized RGB, after
diff --git a/video/out/gpu/video.c b/video/out/gpu/video.c
index fcf11b2e31..0f48261389 100644
--- a/video/out/gpu/video.c
+++ b/video/out/gpu/video.c
@@ -374,6 +374,7 @@ const struct m_sub_options gl_video_conf = {
M_RANGE(10, 10000)},
{"target-contrast", OPT_CHOICE(target_contrast, {"auto", 0}, {"inf", -1}),
M_RANGE(10, 1000000)},
+ {"target-gamut", OPT_CHOICE_C(target_gamut, mp_csp_prim_names)},
{"tone-mapping", OPT_CHOICE(tone_map.curve,
{"auto", TONE_MAPPING_AUTO},
{"clip", TONE_MAPPING_CLIP},
diff --git a/video/out/gpu/video.h b/video/out/gpu/video.h
index c5e4463437..411d336a21 100644
--- a/video/out/gpu/video.h
+++ b/video/out/gpu/video.h
@@ -138,6 +138,7 @@ struct gl_video_opts {
int target_trc;
int target_peak;
int target_contrast;
+ int target_gamut;
struct gl_tone_map_opts tone_map;
bool correct_downscaling;
bool linear_downscaling;
diff --git a/video/out/vo_gpu_next.c b/video/out/vo_gpu_next.c
index 299d080c37..d0da4ebef6 100644
--- a/video/out/vo_gpu_next.c
+++ b/video/out/vo_gpu_next.c
@@ -791,6 +791,13 @@ static void apply_target_options(struct priv *p, struct pl_frame *target)
target->color.hdr.max_luma = opts->target_peak;
if (!target->color.hdr.min_luma)
apply_target_contrast(p, &target->color);
+ if (opts->target_gamut) {
+ // Ensure resulting gamut still fits inside container
+ const struct pl_raw_primaries *gamut, *container;
+ gamut = pl_raw_primaries_get(mp_prim_to_pl(opts->target_gamut));
+ container = pl_raw_primaries_get(target->color.primaries);
+ target->color.hdr.prim = pl_primaries_clip(gamut, container);
+ }
if (opts->dither_depth > 0) {
struct pl_bit_encoding *tbits = &target->repr.bits;
tbits->color_depth += opts->dither_depth - tbits->sample_depth;