vo_gpu_next: allow to use ICC profile luminance value

Also while at it respect target-peak option when ICC profile is used.

Fixes #11449
This commit is contained in:
Kacper Michajłow 2023-04-23 22:49:33 +02:00 committed by Niklas Haas
parent 8343b3bded
commit 9e716d6303
5 changed files with 23 additions and 4 deletions

View File

@ -27,6 +27,10 @@ Interface changes
::
--- mpv 0.36.0 ---
- Target luminance value is now also applied when ICC profile is used.
`--icc-use-luma` has been added to use ICC profile luminance value.
If target luminance and ICC luminance is not used, old behavior apply,
defaulting to 203 nits. (Only applies for `--vo=gpu-next`)
- `playlist/N/title` gets set upon opening the file if it wasn't already set
and a title is available.
- add the `--vo=kitty` video output driver, as well as the options

View File

@ -6674,6 +6674,9 @@ them.
value ``inf`` causes the BT.1886 curve to be treated as a pure power gamma
2.4 function.
``--icc-use-luma``
Use ICC profile luminance value. (Only for ``--vo=gpu-next``)
``--lut=<file>``
Specifies a custom LUT (in Adobe .cube format) to apply to the colors
as part of color conversion. The exact interpretation depends on the value

View File

@ -506,6 +506,7 @@ const struct m_sub_options mp_icc_conf = {
{"icc-force-contrast", OPT_CHOICE(contrast, {"no", 0}, {"inf", -1}),
M_RANGE(0, 1000000)},
{"icc-3dlut-size", OPT_STRING_VALIDATE(size_str, validate_3dlut_size_opt)},
{"icc-use-luma", OPT_BOOL(icc_use_luma)},
{"3dlut-size", OPT_REPLACED("icc-3dlut-size")},
{"icc-contrast", OPT_REMOVED("see icc-force-contrast")},
{0}

View File

@ -18,6 +18,7 @@ struct mp_icc_opts {
char *size_str;
int intent;
int contrast;
bool icc_use_luma;
};
struct lut3d {

View File

@ -798,10 +798,6 @@ static void apply_target_options(struct priv *p, struct pl_frame *target)
target->lut = p->target_lut.lut;
target->lut_type = p->target_lut.type;
#ifdef PL_HAVE_LCMS
target->profile = p->icc_profile;
#endif
// Colorspace overrides
const struct gl_video_opts *opts = p->opts_cache->opts;
if (p->output_levels)
@ -818,6 +814,20 @@ static void apply_target_options(struct priv *p, struct pl_frame *target)
tbits->color_depth += opts->dither_depth - tbits->sample_depth;
tbits->sample_depth = opts->dither_depth;
}
#ifdef PL_HAVE_LCMS
target->profile = p->icc_profile;
if (opts->icc_opts->icc_use_luma) {
// Use detected luminance
p->icc.max_luma = 0;
} else {
// Use HDR levels if available, fall back to default luminance
p->icc.max_luma = target->color.hdr.max_luma;
if (!p->icc.max_luma)
p->icc.max_luma = pl_icc_default_params.max_luma;
}
#endif
}
static void apply_crop(struct pl_frame *frame, struct mp_rect crop,