From 4defd8bb271dcf73474cd15d78ec51fbf3b65ff1 Mon Sep 17 00:00:00 2001 From: Leo Izen Date: Mon, 27 Feb 2023 10:44:39 -0500 Subject: [PATCH] vo_gpu_next: use inverse mapping functions to tag screenshots Screenshots using the hardware renderer should now include color tags that map directly from the libplacebo tags, so the if/else logic only needs to be included once. --- video/out/vo_gpu_next.c | 19 +++++-------------- 1 file changed, 5 insertions(+), 14 deletions(-) diff --git a/video/out/vo_gpu_next.c b/video/out/vo_gpu_next.c index c09f9fafe9..94a171a7ab 100644 --- a/video/out/vo_gpu_next.c +++ b/video/out/vo_gpu_next.c @@ -1247,21 +1247,12 @@ static void video_screenshot(struct vo *vo, struct voctrl_screenshot *args) if (!args->res) goto done; - if (args->scaled) { - // Provide tagging for target CSP info (if known) - const struct gl_video_opts *opts = p->opts_cache->opts; - args->res->params.color.primaries = opts->target_prim; - args->res->params.color.gamma = opts->target_trc; - args->res->params.color.levels = p->output_levels; - args->res->params.color.sig_peak = opts->target_peak; + args->res->params.color.primaries = mp_prim_from_pl(target.color.primaries); + args->res->params.color.gamma = mp_trc_from_pl(target.color.transfer); + args->res->params.color.levels = mp_levels_from_pl(target.repr.levels); + args->res->params.color.sig_peak = target.color.hdr.max_luma / MP_REF_WHITE; + if (args->scaled) args->res->params.p_w = args->res->params.p_h = 1; - } else if (args->native_csp) { - args->res->params.color = mpi->params.color; - args->res->params.color.space = MP_CSP_RGB; - } else { - args->res->params.color.primaries = MP_CSP_PRIM_BT_709; - args->res->params.color.gamma = MP_CSP_TRC_SRGB; - } bool ok = pl_tex_download(gpu, pl_tex_transfer_params( .tex = fbo,