diff options
author | sfan5 <sfan5@live.de> | 2023-07-17 23:29:12 +0200 |
---|---|---|
committer | sfan5 <sfan5@live.de> | 2023-07-19 13:01:08 +0200 |
commit | a0d8962be8beea6393aa27a8526b3ff5447e0749 (patch) | |
tree | 61946d65380df07dfbf8013eb6496cacef2aab16 /video | |
parent | a960b756045f37eccec43bfb06e9e51c4f245f55 (diff) | |
download | mpv-a0d8962be8beea6393aa27a8526b3ff5447e0749.tar.bz2 mpv-a0d8962be8beea6393aa27a8526b3ff5447e0749.tar.xz |
zimg: fix broken sig_peak handling
In sum there were three issues:
1. nominal_peak_luminance is an output parameter, not input
2. mpv internally uses MP_REF_WHITE which we need to scale by
3. the value should be left at its default for SDR
Together with the last change this means mpv can sucessfully
take HDR screenshots with --screenshot-sw without resulting
in a brightly colored mess. Though note that zimg does not
perform proper tonemapping.
Diffstat (limited to 'video')
-rw-r--r-- | video/zimg.c | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/video/zimg.c b/video/zimg.c index f0a945f494..c3560a0ff7 100644 --- a/video/zimg.c +++ b/video/zimg.c @@ -540,8 +540,9 @@ static bool mp_zimg_state_init(struct mp_zimg_context *ctx, if (opts->fast) params.allow_approximate_gamma = 1; - if (ctx->src.color.sig_peak > 0) - params.nominal_peak_luminance = ctx->src.color.sig_peak; + // leave at default for SDR, which means 100 cd/m^2 for zimg + if (ctx->dst.color.sig_peak > 0 && mp_trc_is_hdr(ctx->dst.color.gamma)) + params.nominal_peak_luminance = ctx->dst.color.sig_peak * MP_REF_WHITE; st->graph = zimg_filter_graph_build(&src_fmt, &dst_fmt, ¶ms); if (!st->graph) { |