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 E7BEE4D37A for ; Thu, 20 Feb 2025 13:42:03 +0000 (UTC) Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id 90B7468C399; Thu, 20 Feb 2025 15:41:58 +0200 (EET) Received: from haasn.dev (haasn.dev [78.46.187.166]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id 3CCC368C147 for ; Thu, 20 Feb 2025 15:41:52 +0200 (EET) Received: from haasn.dev (unknown [10.30.1.1]) by haasn.dev (Postfix) with ESMTP id 05A00419F6; Thu, 20 Feb 2025 14:41:51 +0100 (CET) From: Niklas Haas To: ffmpeg-devel@ffmpeg.org Date: Thu, 20 Feb 2025 14:41:50 +0100 Message-ID: <20250220134150.274215-1-ffmpeg@haasn.xyz> X-Mailer: git-send-email 2.47.0 MIME-Version: 1.0 Subject: [FFmpeg-devel] [PATCH] avfilter/vf_libplacebo: set correct alpha mode before blending 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 &pl_alpha_overlay expects straight alpha, but the alpha output may be premultiplied as a result of the target alpha mode (or in the absence of an alpha channel). Fix it by requesting independent alpha explicitly when blending. --- libavfilter/vf_libplacebo.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/libavfilter/vf_libplacebo.c b/libavfilter/vf_libplacebo.c index f6c29c2f2b..28a0bde135 100644 --- a/libavfilter/vf_libplacebo.c +++ b/libavfilter/vf_libplacebo.c @@ -909,6 +909,9 @@ static int output_frame(AVFilterContext *ctx, int64_t pts) opts->params.skip_caching_single_frame = high_fps; update_crops(ctx, in, &target, out->pts * av_q2d(outlink->time_base)); pl_render_image_mix(in->renderer, &in->mix, &target, &opts->params); + + /* Force straight output and set correct blend mode */ + target.repr.alpha = PL_ALPHA_INDEPENDENT; opts->params.blend_params = &pl_alpha_overlay; #if PL_API_VER >= 346 opts->params.background = opts->params.border = PL_CLEAR_SKIP; -- 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".