From: Jorge Estrada <jestrada.list@gmail.com> To: ffmpeg-devel@ffmpeg.org Cc: Jorge Estrada <jestrada.list@gmail.com> Subject: [FFmpeg-devel] use av_buffer_replace Date: Thu, 7 Aug 2025 16:14:17 -0700 Message-ID: <20250807231416.34930-1-jestrada.list@gmail.com> (raw) In-Reply-To: <20250807195800.77462-1-jestrada.list@gmail.com> 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); + } + + 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 -- 2.34.1 _______________________________________________ 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".
prev parent reply other threads:[~2025-08-07 23:17 UTC|newest] Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top 2025-08-07 19:58 [FFmpeg-devel] [PATCH] avfilter/vf_alphamerge: use refcounting for planar formats Jorge Estrada 2025-08-07 20:12 ` James Almer 2025-08-07 23:21 ` Jorge Estrada 2025-08-07 23:14 ` Jorge Estrada [this message]
Reply instructions: You may reply publicly to this message via plain-text email using any one of the following methods: * Save the following mbox file, import it into your mail client, and reply-to-all from there: mbox Avoid top-posting and favor interleaved quoting: https://en.wikipedia.org/wiki/Posting_style#Interleaved_style * Reply using the --to, --cc, and --in-reply-to switches of git-send-email(1): git send-email \ --in-reply-to=20250807231416.34930-1-jestrada.list@gmail.com \ --to=jestrada.list@gmail.com \ --cc=ffmpeg-devel@ffmpeg.org \ /path/to/YOUR_REPLY https://kernel.org/pub/software/scm/git/docs/git-send-email.html * If your mail client supports setting the In-Reply-To header via mailto: links, try the mailto: link
Git Inbox Mirror of the ffmpeg-devel mailing list - see https://ffmpeg.org/mailman/listinfo/ffmpeg-devel This inbox may be cloned and mirrored by anyone: git clone --mirror https://master.gitmailbox.com/ffmpegdev/0 ffmpegdev/git/0.git # If you have public-inbox 1.1+ installed, you may # initialize and index your mirror using the following commands: public-inbox-init -V2 ffmpegdev ffmpegdev/ https://master.gitmailbox.com/ffmpegdev \ ffmpegdev@gitmailbox.com public-inbox-index ffmpegdev Example config snippet for mirrors. AGPL code for this site: git clone https://public-inbox.org/public-inbox.git