From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from ffbox0-bg.ffmpeg.org (ffbox0-bg.ffmpeg.org [79.124.17.100]) by master.gitmailbox.com (Postfix) with ESMTPS id 2616A4CD7C for ; Sat, 9 Aug 2025 17:47:09 +0000 (UTC) Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.ffmpeg.org (Postfix) with ESMTP id 1C14068CF2E; Sat, 9 Aug 2025 20:47:06 +0300 (EEST) Received: from nef.ens.fr (nef2.ens.fr [129.199.96.40]) by ffbox0-bg.ffmpeg.org (Postfix) with ESMTPS id B12A1687DB2 for ; Sat, 9 Aug 2025 20:46:59 +0300 (EEST) X-ENS-nef-client: 129.199.129.80 ( name = phare.normalesup.org ) Received: from phare.normalesup.org (phare.normalesup.org [129.199.129.80]) by nef.ens.fr (8.14.4/1.01.28121999) with ESMTP id 579HkxSM027339 for ; Sat, 9 Aug 2025 19:46:59 +0200 Received: by phare.normalesup.org (Postfix, from userid 1001) id 0CE8E2EFE3; Sat, 9 Aug 2025 19:46:59 +0200 (CEST) Date: Sat, 9 Aug 2025 19:46:58 +0200 From: Nicolas George To: FFmpeg development discussions and patches Message-ID: References: <20250807195800.77462-1-jestrada.list@gmail.com> <3dfd6642-9f52-4808-a25c-60807ddb18ef@gmail.com> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.4.3 (nef.ens.fr [129.199.96.32]); Sat, 09 Aug 2025 19:46:59 +0200 (CEST) Subject: Re: [FFmpeg-devel] [PATCH] avfilter/vf_alphamerge: use refcounting for planar formats 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 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: Jorge Estrada (HE12025-08-07): > From b413b7f8a966c2cf77c8703b5f68e8ea492d930a Mon Sep 17 00:00:00 2001 > From: Jorge Estrada > Date: Thu, 7 Aug 2025 12:55:19 -0700 > Subject: use av_buffer_replace > > Addressed. Uses av_buffer_replace now > > --- > libavfilter/vf_alphamerge.c | 24 +++++++++++++++++------- > 1 file changed, 17 insertions(+), 7 deletions(-) > > diff --git a/libavfilter/vf_alphamerge.c b/libavfilter/vf_alphamerge.c > index f5779484a9..69c0dd04ea 100644 > --- a/libavfilter/vf_alphamerge.c > +++ b/libavfilter/vf_alphamerge.c > @@ -28,12 +28,12 @@ > #include "libavutil/imgutils.h" > #include "libavutil/opt.h" > #include "libavutil/pixfmt.h" > +#include "libavutil/frame.h" > #include "avfilter.h" > #include "drawutils.h" > #include "formats.h" > #include "filters.h" > #include "framesync.h" > -#include "video.h" > > enum { Y, U, V, A }; > > @@ -78,11 +78,21 @@ static int do_alphamerge(FFFrameSync *fs) > } > } > } else { > - const int main_linesize = main_buf->linesize[A]; > - const int alpha_linesize = alpha_buf->linesize[Y]; > - av_image_copy_plane(main_buf->data[A], main_linesize, > - alpha_buf->data[Y], alpha_linesize, > - FFMIN(main_linesize, alpha_linesize), alpha_buf->height); > + AVBufferRef *alpha_plane_buf = av_frame_get_plane_buffer(alpha_buf, Y); > + > + if (!alpha_plane_buf) { > + av_log(ctx, AV_LOG_ERROR, "Could not get buffer for alpha plane.\n"); > + return AVERROR(EINVAL); That should probably be AVERROR_BUG. > + } > + > + ret = av_buffer_replace(&main_buf->buf[A], alpha_plane_buf); > + if (ret < 0) { > + av_log(ctx, AV_LOG_ERROR, "Failed to replace alpha plane buffer.\n"); > + return ret; > + } > + > + main_buf->data[A] = alpha_buf->data[Y]; > + main_buf->linesize[A] = alpha_buf->linesize[Y]; > } > > return ff_filter_frame(ctx->outputs[0], main_buf); > @@ -212,4 +222,4 @@ const FFFilter ff_vf_alphamerge = { > FILTER_QUERY_FUNC2(query_formats), > .uninit = uninit, > .activate = activate, > -}; > +}; > \ No newline at end of file You really need to fix you editor to not have it remove the final newline. I am assuming that you of course tested it on a few cases and ran FATE. If so, apart from the details above, LGTM. Thanks for your efforts. Regards, -- Nicolas George _______________________________________________ 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".