From 94bc7315bdcc5226f4704012fdcf0acd84bf3516 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Kacper=20Michaj=C5=82ow?= Date: Thu, 17 Apr 2025 21:30:36 +0200 Subject: [PATCH] video/zimg: set alpha to ZIMG_ALPHA_STRAIGHT in all cases except premul Fixes: 6a96b15cf48e75a1f2b17dccddf7ada95f3e0fcf ("video/csputils: add missing alpha choice") Fixes: #16255 --- video/zimg.c | 15 ++------------- 1 file changed, 2 insertions(+), 13 deletions(-) diff --git a/video/zimg.c b/video/zimg.c index bfe0fce4a6..2e176e5061 100644 --- a/video/zimg.c +++ b/video/zimg.c @@ -198,18 +198,6 @@ static zimg_color_primaries_e mp_to_z_prim(enum pl_color_primaries prim) } } -#if HAVE_ZIMG_ALPHA -static zimg_alpha_type_e pl_to_z_alpha(enum pl_alpha_mode alpha) -{ - switch (alpha) { - case PL_ALPHA_UNKNOWN: return ZIMG_ALPHA_STRAIGHT; - case PL_ALPHA_INDEPENDENT: return ZIMG_ALPHA_STRAIGHT; - case PL_ALPHA_PREMULTIPLIED: return ZIMG_ALPHA_PREMULTIPLIED; - default: return ZIMG_ALPHA_NONE; - } -} -#endif - static void destroy_zimg(struct mp_zimg_context *ctx) { for (int n = 0; n < ctx->num_states; n++) { @@ -390,7 +378,8 @@ static bool setup_format(zimg_image_format *zfmt, struct mp_zimg_repack *r, r->z_planes[3] = n; // alpha, always plane 4 in zimg #if HAVE_ZIMG_ALPHA - zfmt->alpha = pl_to_z_alpha(fmt.repr.alpha); + zfmt->alpha = fmt.repr.alpha == PL_ALPHA_PREMULTIPLIED + ? ZIMG_ALPHA_PREMULTIPLIED : ZIMG_ALPHA_STRAIGHT; #else return false; #endif