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 50DBB4BBB6 for ; Wed, 23 Jul 2025 13:59:29 +0000 (UTC) Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.ffmpeg.org (Postfix) with ESMTP id BCAED68D908; Wed, 23 Jul 2025 16:57:06 +0300 (EEST) Received: from haasn.dev (haasn.dev [78.46.187.166]) by ffbox0-bg.ffmpeg.org (Postfix) with ESMTP id 6505B68D7B4 for ; Wed, 23 Jul 2025 16:56:33 +0300 (EEST) Received: from haasn.dev (unknown [10.30.1.1]) by haasn.dev (Postfix) with UTF8SMTP id AE17E497F4; Wed, 23 Jul 2025 15:56:29 +0200 (CEST) From: Niklas Haas To: ffmpeg-devel@ffmpeg.org Date: Wed, 23 Jul 2025 15:47:20 +0200 Message-ID: <20250723135626.1390296-18-ffmpeg@haasn.xyz> X-Mailer: git-send-email 2.50.1 In-Reply-To: <20250723135626.1390296-1-ffmpeg@haasn.xyz> References: <20250723135626.1390296-1-ffmpeg@haasn.xyz> MIME-Version: 1.0 Subject: [FFmpeg-devel] [PATCH v2 17/18] avfilter/vf_setparams: add alpha_mode parameter 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 --- doc/filters.texi | 13 +++++++++++++ libavfilter/vf_setparams.c | 10 ++++++++++ 2 files changed, 23 insertions(+) diff --git a/doc/filters.texi b/doc/filters.texi index fbf8aff382..13ca065f85 100644 --- a/doc/filters.texi +++ b/doc/filters.texi @@ -21602,6 +21602,19 @@ Keep the same chroma location (default). @item bottomleft @item bottom @end table + +@item alpha_mode +Set the alpha moda. +Available values are: + +@table @samp +@item auto +Keep the same alpha mode (default). + +@item unspecified, unknown +@item premultiplied +@item straight +@end table @end table @section shear diff --git a/libavfilter/vf_setparams.c b/libavfilter/vf_setparams.c index 1e37876e42..5043ae6e65 100644 --- a/libavfilter/vf_setparams.c +++ b/libavfilter/vf_setparams.c @@ -42,6 +42,7 @@ typedef struct SetParamsContext { int color_trc; int colorspace; int chroma_location; + int alpha_mode; } SetParamsContext; #define OFFSET(x) offsetof(SetParamsContext, x) @@ -131,6 +132,13 @@ static const AVOption setparams_options[] = { {"top", NULL, 0, AV_OPT_TYPE_CONST, {.i64=AVCHROMA_LOC_TOP}, 0, 0, FLAGS, .unit = "chroma_location"}, {"bottomleft", NULL, 0, AV_OPT_TYPE_CONST, {.i64=AVCHROMA_LOC_BOTTOMLEFT}, 0, 0, FLAGS, .unit = "chroma_location"}, {"bottom", NULL, 0, AV_OPT_TYPE_CONST, {.i64=AVCHROMA_LOC_BOTTOM}, 0, 0, FLAGS, .unit = "chroma_location"}, + + {"alpha_mode", "select alpha moda", OFFSET(alpha_mode), AV_OPT_TYPE_INT, {.i64=-1}, -1, AVALPHA_MODE_NB-1, FLAGS, .unit = "alpha_mode"}, + {"auto", "keep the same alpha mode", 0, AV_OPT_TYPE_CONST, {.i64=-1}, 0, 0, FLAGS, .unit = "alpha_mode"}, + {"unspecified", NULL, 0, AV_OPT_TYPE_CONST, {.i64=AVALPHA_MODE_UNSPECIFIED}, 0, 0, FLAGS, .unit = "alpha_mode"}, + {"unknown", NULL, 0, AV_OPT_TYPE_CONST, {.i64=AVALPHA_MODE_UNSPECIFIED}, 0, 0, FLAGS, .unit = "alpha_mode"}, + {"premultiplied", NULL, 0, AV_OPT_TYPE_CONST, {.i64=AVALPHA_MODE_PREMULTIPLIED}, 0, 0, FLAGS, .unit = "alpha_mode"}, + {"straight", NULL, 0, AV_OPT_TYPE_CONST, {.i64=AVALPHA_MODE_STRAIGHT}, 0, 0, FLAGS, .unit = "alpha_mode"}, {NULL} }; @@ -187,6 +195,8 @@ static int filter_frame(AVFilterLink *inlink, AVFrame *frame) frame->colorspace = s->colorspace; if (s->chroma_location >= 0) frame->chroma_location = s->chroma_location; + if (s->alpha_mode >= 0) + frame->alpha_mode = s->alpha_mode; return ff_filter_frame(ctx->outputs[0], frame); } -- 2.50.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".