Git Inbox Mirror of the ffmpeg-devel mailing list - see https://ffmpeg.org/mailman/listinfo/ffmpeg-devel
 help / color / mirror / Atom feed
From: Niklas Haas <ffmpeg@haasn.xyz>
To: ffmpeg-devel@ffmpeg.org
Subject: Re: [FFmpeg-devel] [PATCH 04/12] avcodec/avcodec: add AVCodecContext.alpha_mode
Date: Wed, 19 Feb 2025 22:18:27 +0100
Message-ID: <20250219221827.GC2840440@haasn.xyz> (raw)
In-Reply-To: <85d10abe-5990-4dd8-8f10-a5a4b06a24e0@gmail.com>

On Wed, 19 Feb 2025 18:04:18 -0300 James Almer <jamrial@gmail.com> wrote:
> On 2/19/2025 5:45 PM, Niklas Haas wrote:
> > From: Niklas Haas <git@haasn.dev>
> >
> > Following in the footsteps of the previous commit, this commit adds the
> > new fields to AVCodecContext so we can start properly setting it on codecs,
> > as well as limiting the list of supported options to detect a format mismatch
> > during encode.
> >
> > This commit also sets up the necessary infrastructure to start using the
> > newly added field in all codecs.
> > ---
> >   doc/APIchanges              | 4 ++++
> >   doc/codecs.texi             | 8 ++++++++
> >   libavcodec/avcodec.c        | 6 ++++++
> >   libavcodec/avcodec.h        | 8 ++++++++
> >   libavcodec/codec_internal.h | 5 +++++
> >   libavcodec/codec_par.c      | 3 +++
> >   libavcodec/codec_par.h      | 5 +++++
> >   libavcodec/decode.c         | 2 ++
> >   libavcodec/options_table.h  | 5 +++++
> >   libavcodec/version.h        | 4 ++--
> >   10 files changed, 48 insertions(+), 2 deletions(-)
> >
>
> [...]
>
> > diff --git a/libavcodec/options_table.h b/libavcodec/options_table.h
> > index 47da41b0ad..32f853bc54 100644
> > --- a/libavcodec/options_table.h
> > +++ b/libavcodec/options_table.h
> > @@ -358,6 +358,11 @@ static const AVOption avcodec_options[] = {
> >   {"bottomleft",  "Bottom-left", 0, AV_OPT_TYPE_CONST, {.i64 = AVCHROMA_LOC_BOTTOMLEFT },  INT_MIN, INT_MAX, V|E|D, .unit = "chroma_sample_location_type"},
> >   {"bottom",      "Bottom",      0, AV_OPT_TYPE_CONST, {.i64 = AVCHROMA_LOC_BOTTOM },      INT_MIN, INT_MAX, V|E|D, .unit = "chroma_sample_location_type"},
> >   {"unspecified", "Unspecified", 0, AV_OPT_TYPE_CONST, {.i64 = AVCHROMA_LOC_UNSPECIFIED }, INT_MIN, INT_MAX, V|E|D, .unit = "chroma_sample_location_type"},
> > +{"alpha_mode", "alpha mode", OFFSET(alpha_mode), AV_OPT_TYPE_INT, {.i64 = AVALPHA_MODE_UNSPECIFIED }, 0, INT_MAX, V|E|D, .unit = "alpha_mode_type"},
>
> Should it have the D flag if it's only settable by the user in encoding
> scenarios?

I'm not sure. I was using the same flags as colorspace, color_trc, chroma_loc,
etc. They all seem similar in principle.

I suppose that, for codecs which have ambiguous / absent tagging, it makes
sense for the user to set this field?

As a side note, I'm still unsure which codecs support what alpha modes. From
what I understand, PNG is always straight, TIFF and JPEG-XL supports both (with
tagging?), but I'm not sure about any of the H.26x codecs, OpenEXR, WebM etc.

>
> > +{"unknown",       "Unspecified",   0, AV_OPT_TYPE_CONST, {.i64 = AVALPHA_MODE_UNSPECIFIED   }, 0, 0, V|E|D, .unit = "alpha_mode_type"},
> > +{"unspecified",   "Unspecified",   0, AV_OPT_TYPE_CONST, {.i64 = AVALPHA_MODE_UNSPECIFIED   }, 0, 0, V|E|D, .unit = "alpha_mode_type"},
> > +{"premultiplied", "Premultiplied", 0, AV_OPT_TYPE_CONST, {.i64 = AVALPHA_MODE_PREMULTIPLIED }, 0, 0, V|E|D, .unit = "alpha_mode_type"},
> > +{"straight",      "Straight",      0, AV_OPT_TYPE_CONST, {.i64 = AVALPHA_MODE_STRAIGHT      }, 0, 0, V|E|D, .unit = "alpha_mode_type"},
> >   {"log_level_offset", "set the log level offset", OFFSET(log_level_offset), AV_OPT_TYPE_INT, {.i64 = 0 }, INT_MIN, INT_MAX },
> >   {"slices", "set the number of slices, used in parallelized encoding", OFFSET(slices), AV_OPT_TYPE_INT, {.i64 = 0 }, 0, INT_MAX, V|E},
> >   {"thread_type", "select multithreading type", OFFSET(thread_type), AV_OPT_TYPE_FLAGS, {.i64 = FF_THREAD_SLICE|FF_THREAD_FRAME }, 0, INT_MAX, V|A|E|D, .unit = "thread_type"},
> > diff --git a/libavcodec/version.h b/libavcodec/version.h
> > index 62e7eba3db..0ef6c991f3 100644
> > --- a/libavcodec/version.h
> > +++ b/libavcodec/version.h
> > @@ -29,8 +29,8 @@
> >
> >   #include "version_major.h"
> >
> > -#define LIBAVCODEC_VERSION_MINOR  33
> > -#define LIBAVCODEC_VERSION_MICRO 102
> > +#define LIBAVCODEC_VERSION_MINOR  34
> > +#define LIBAVCODEC_VERSION_MICRO 100
> >
> >   #define LIBAVCODEC_VERSION_INT  AV_VERSION_INT(LIBAVCODEC_VERSION_MAJOR, \
> >                                                  LIBAVCODEC_VERSION_MINOR, \
>
> _______________________________________________
> 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".
_______________________________________________
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".

  reply	other threads:[~2025-02-19 21:18 UTC|newest]

Thread overview: 18+ 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 [this message]
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 ` [FFmpeg-devel] [PATCH 11/12] avfilter/vf_setparams: add alpha_mode parameter Niklas Haas
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

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=20250219221827.GC2840440@haasn.xyz \
    --to=ffmpeg@haasn.xyz \
    --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