vo_gpu_next: add source-dynamic mode to colorspace hint

This commit is contained in:
Kacper Michajłow committed 2025-07-11 21:53:58 +02:00
1 parent 72fe8fe3ea
commit 0b6feb993b
2 files changed
+18 -2

No files matched your search

+8 -1
View File
@@ -7032,7 +7032,7 @@ them.
best choice. It depends on your compositor, driver, and display
capabilities. However in most cases ``auto`` mode should work fine.
``--target-colorspace-hint-mode=<target|source>``
``--target-colorspace-hint-mode=<target|source|source-dynamic>``
Select which metadata to use for the ``--target-colorspace-hint``.
(Only for ``--vo=gpu-next``)
@@ -7048,6 +7048,13 @@ them.
and display will handle the colorspace directly and perform any necessary
mappings.
source-dynamic
The same as ``source``, but uses dynamic per-scene metadata instead of
static HDR10. This is experimental and depends on the display's ability
to react to metadata changes. Note that this does not send full HDR10+
or Dolby Vision metadata, but uses that information to produce HDR10
with per-scene luminance values.
Default is ``target``. If target display parameters are not available, this
will fall back to ``source``. Note that this is done on individual properties
basis, i.e. it will merge source params into target for unknown properties,
+10 -1
View File
@@ -206,7 +206,7 @@ const struct m_sub_options gl_next_conf = {
{"image-lut-type", OPT_CHOICE_C(image_lut.type, lut_types)},
{"target-lut", OPT_STRING(target_lut.opt), .flags = M_OPT_FILE},
{"target-colorspace-hint", OPT_CHOICE(target_hint, {"auto", -1}, {"no", 0}, {"yes", 1})},
{"target-colorspace-hint-mode", OPT_CHOICE(target_hint_mode, {"target", 0}, {"source", 1})},
{"target-colorspace-hint-mode", OPT_CHOICE(target_hint_mode, {"target", 0}, {"source", 1}, {"source-dynamic", 2})},
// No `target-lut-type` because we don't support non-RGB targets
{"libplacebo-opts", OPT_KEYVALUELIST(raw_opts)},
{0},
@@ -1068,6 +1068,15 @@ static bool draw_frame(struct vo *vo, struct vo_frame *frame)
hint = *(p->next_opts->target_hint_mode == 0 ? target : source);
if (pl_color_transfer_is_hdr(hint.transfer) && !pl_primaries_valid(&hint.hdr.prim))
pl_color_space_merge(&hint, source);
if (p->next_opts->target_hint_mode == 2) { // source-dynamic
pl_color_space_nominal_luma_ex(pl_nominal_luma_params(
.color = &hint,
.metadata = PL_HDR_METADATA_ANY,
.scaling = PL_HDR_NITS,
.out_min = &hint.hdr.min_luma,
.out_max = &hint.hdr.max_luma,
));
}
// Infer missing bits now. This is important so that we don't lose
// information after user option overrides. For example, if the user
// sets target_trc to PQ, but the hint(source) is SDR, we want to fill