From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from ffbox0-bg.mplayerhq.hu (ffbox0-bg.ffmpeg.org [79.124.17.100]) by master.gitmailbox.com (Postfix) with ESMTPS id 9E4C04D32D for ; Wed, 19 Feb 2025 20:47:30 +0000 (UTC) Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id DB30E68C462; Wed, 19 Feb 2025 22:46:10 +0200 (EET) Received: from haasn.dev (haasn.dev [78.46.187.166]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id 31D6B68C3C0 for ; Wed, 19 Feb 2025 22:45:59 +0200 (EET) Received: from haasn.dev (unknown [10.30.1.1]) by haasn.dev (Postfix) with ESMTP id 21631432E4; Wed, 19 Feb 2025 21:45:55 +0100 (CET) From: Niklas Haas To: ffmpeg-devel@ffmpeg.org Date: Wed, 19 Feb 2025 21:45:44 +0100 Message-ID: <20250219204550.2826561-8-ffmpeg@haasn.xyz> X-Mailer: git-send-email 2.47.0 In-Reply-To: <20250219204550.2826561-1-ffmpeg@haasn.xyz> References: <20250219204550.2826561-1-ffmpeg@haasn.xyz> MIME-Version: 1.0 Subject: [FFmpeg-devel] [PATCH 08/12] avfilter/vf_premultiply: tag correct alpha mode on result X-BeenThere: ffmpeg-devel@ffmpeg.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: FFmpeg development discussions and patches List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Reply-To: FFmpeg development discussions and patches Cc: Niklas Haas Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Errors-To: ffmpeg-devel-bounces@ffmpeg.org Sender: "ffmpeg-devel" Archived-At: List-Archive: List-Post: From: Niklas Haas --- libavfilter/vf_premultiply.c | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/libavfilter/vf_premultiply.c b/libavfilter/vf_premultiply.c index 322fc39094..1c08cf524a 100644 --- a/libavfilter/vf_premultiply.c +++ b/libavfilter/vf_premultiply.c @@ -512,6 +512,7 @@ static int filter_frame(AVFilterContext *ctx, { PreMultiplyContext *s = ctx->priv; AVFilterLink *outlink = ctx->outputs[0]; + const AVPixFmtDescriptor *desc = av_pix_fmt_desc_get(outlink->format); if (ctx->is_disabled) { *out = av_frame_clone(base); @@ -529,6 +530,13 @@ static int filter_frame(AVFilterContext *ctx, full = base->color_range == AVCOL_RANGE_JPEG; limited = base->color_range == AVCOL_RANGE_MPEG; + if (desc->flags & AV_PIX_FMT_FLAG_ALPHA) { + (*out)->alpha_mode = s->inverse ? AVALPHA_MODE_STRAIGHT + : AVALPHA_MODE_PREMULTIPLIED; + } else { + (*out)->alpha_mode = AVALPHA_MODE_UNSPECIFIED; + } + if (s->inverse) { switch (outlink->format) { case AV_PIX_FMT_YUV444P: -- 2.47.0 _______________________________________________ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-devel To unsubscribe, visit link above, or email ffmpeg-devel-request@ffmpeg.org with subject "unsubscribe".