diff options
author | Niklas Haas <git@haasn.dev> | 2022-12-12 21:41:15 +0100 |
---|---|---|
committer | Niklas Haas <github-daiK1o@haasn.dev> | 2023-02-13 21:53:41 +0100 |
commit | 862be6c2376ad5abdaf705138e5f3ba8a3f4bd82 (patch) | |
tree | b47be52b5fee9ab026ee2a7617f91e42b00a70bc /video/out | |
parent | 5078132b2893e577a75aec8d8f69aa1deff18ad2 (diff) | |
download | mpv-862be6c2376ad5abdaf705138e5f3ba8a3f4bd82.tar.bz2 mpv-862be6c2376ad5abdaf705138e5f3ba8a3f4bd82.tar.xz |
vo_gpu_next: tag screenshots with correct colorspace
When taking window screenshots with a colorspace override, tag them
appropriately, based on the best-known colorspace info. Note that this
is imperfect, we should ideally also attach the output ICC profile if
one exists. But this is better than nothing.
Also force 1:1 PAR in this case. In all other cases, default to sRGB.
Diffstat (limited to 'video/out')
-rw-r--r-- | video/out/vo_gpu_next.c | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/video/out/vo_gpu_next.c b/video/out/vo_gpu_next.c index fae36164ec..e8b2636ebb 100644 --- a/video/out/vo_gpu_next.c +++ b/video/out/vo_gpu_next.c @@ -1229,6 +1229,8 @@ static void video_screenshot(struct vo *vo, struct voctrl_screenshot *args) if (args->scaled) { // Apply target LUT, ICC profile and CSP override only in window mode apply_target_options(p, &target); + } else { + target.color = pl_color_space_srgb; } apply_crop(&image, src, mpi->params.w, mpi->params.h); @@ -1252,6 +1254,19 @@ 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.p_w = args->res->params.p_h = 1; + } 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, .ptr = args->res->planes[0], |