From: Niklas Haas <ffmpeg@haasn.xyz>
To: ffmpeg-devel@ffmpeg.org
Cc: Niklas Haas <git@haasn.dev>
Subject: [FFmpeg-devel] [PATCH 11/12] avfilter/vf_setparams: add alpha_mode parameter
Date: Wed, 19 Feb 2025 21:45:47 +0100
Message-ID: <20250219204550.2826561-11-ffmpeg@haasn.xyz> (raw)
In-Reply-To: <20250219204550.2826561-1-ffmpeg@haasn.xyz>
From: Niklas Haas <git@haasn.dev>
---
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 fa23c10b2d..6e8272fd81 100644
--- a/doc/filters.texi
+++ b/doc/filters.texi
@@ -22231,6 +22231,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 sharpen_npp
diff --git a/libavfilter/vf_setparams.c b/libavfilter/vf_setparams.c
index 34583b1d10..01902da763 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}
};
@@ -198,6 +206,8 @@ FF_ENABLE_DEPRECATION_WARNINGS
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.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".
next prev parent reply other threads:[~2025-02-19 20:48 UTC|newest]
Thread overview: 21+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-02-19 20:45 [FFmpeg-devel] [PATCH 01/12] avutil/frame: add AVFrame.alpha_mode Niklas Haas
2025-02-19 20:45 ` [FFmpeg-devel] [PATCH 02/12] fftools/ffprobe: add support for AVFrame.alpha_mode Niklas Haas
2025-02-19 20:45 ` [FFmpeg-devel] [PATCH 03/12] avfilter/vf_showinfo: print alpha mode when relevant Niklas Haas
2025-02-19 20:45 ` [FFmpeg-devel] [PATCH 04/12] avcodec/avcodec: add AVCodecContext.alpha_mode Niklas Haas
2025-02-19 21:04 ` James Almer
2025-02-19 21:18 ` Niklas Haas
2025-02-19 20:45 ` [FFmpeg-devel] [PATCH 05/12] avcodec/encode: enforce alpha mode compatibility at encode time Niklas Haas
2025-02-19 20:45 ` [FFmpeg-devel] [PATCH 06/12] avcodec/png: set correct alpha mode Niklas Haas
2025-02-19 20:45 ` [FFmpeg-devel] [PATCH 07/12] fftools/ffmpeg_enc: forward frame alpha mode to encoder Niklas Haas
2025-02-22 2:44 ` mypopy
2025-02-19 20:45 ` [FFmpeg-devel] [PATCH 08/12] avfilter/vf_premultiply: tag correct alpha mode on result Niklas Haas
2025-02-19 20:45 ` [FFmpeg-devel] [PATCH 09/12] avfilter/vf_alphamerge: tag correct alpha mode Niklas Haas
2025-02-19 20:45 ` [FFmpeg-devel] [PATCH 10/12] avfilter/vf_overlay: respect alpha mode tagging by default Niklas Haas
2025-02-19 20:45 ` Niklas Haas [this message]
2025-02-19 20:45 ` [FFmpeg-devel] [PATCH 12/12] avfilter/vf_libplacebo: add an alpha_mode setting Niklas Haas
2025-02-20 8:53 ` [FFmpeg-devel] [PATCH 01/12] avutil/frame: add AVFrame.alpha_mode Zhao Zhili
2025-02-20 9:39 ` Nicolas George
2025-02-20 11:25 ` Niklas Haas
2025-02-28 8:51 ` Nicolas George
2025-02-27 17:52 ` Niklas Haas
2025-02-28 8:53 ` Nicolas George
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=20250219204550.2826561-11-ffmpeg@haasn.xyz \
--to=ffmpeg@haasn.xyz \
--cc=ffmpeg-devel@ffmpeg.org \
--cc=git@haasn.dev \
/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