summaryrefslogtreecommitdiffstats
path: root/video
diff options
context:
space:
mode:
authorKacper Michajłow <kasper93@gmail.com>2023-01-24 08:31:43 +0100
committerLeo Izen <leo.izen@gmail.com>2023-03-02 09:37:06 -0500
commit2101e77d1e7743dd16f3c37bd8cd4a00c0a0cf4c (patch)
tree0ff089c5c7e4efa77de1367a6a5d0c3ba16569ac /video
parentf2fab0d8e1eea51b4b51f67871e0c3e093c92f53 (diff)
downloadmpv-2101e77d1e7743dd16f3c37bd8cd4a00c0a0cf4c.tar.bz2
mpv-2101e77d1e7743dd16f3c37bd8cd4a00c0a0cf4c.tar.xz
sws_utils: hardcode output gamma and primaries for XYZ
Diffstat (limited to 'video')
-rw-r--r--video/sws_utils.c10
1 files changed, 10 insertions, 0 deletions
diff --git a/video/sws_utils.c b/video/sws_utils.c
index ad4c7025e9..0f1708af3f 100644
--- a/video/sws_utils.c
+++ b/video/sws_utils.c
@@ -404,6 +404,16 @@ int mp_sws_scale(struct mp_sws_context *ctx, struct mp_image *dst,
return mp_zimg_convert(ctx->zimg, dst, src) ? 0 : -1;
#endif
+ if (src->params.color.space == MP_CSP_XYZ && dst->params.color.space != MP_CSP_XYZ) {
+ // swsscale has hardcoded gamma 2.2 internally and 2.6 for XYZ
+ dst->params.color.gamma = MP_CSP_TRC_GAMMA22;
+ // and sRGB primaries...
+ dst->params.color.primaries = MP_CSP_PRIM_BT_709;
+ // it doesn't adjust white point though, but it is not worth to support
+ // this case. It would require custom prim with equal energy white point
+ // and sRGB primaries.
+ }
+
struct mp_image *a_src = check_alignment(ctx->log, &ctx->aligned_src, src);
struct mp_image *a_dst = check_alignment(ctx->log, &ctx->aligned_dst, dst);
if (!a_src || !a_dst) {