On Wed, 19 Feb 2025 18:04:18 -0300 James Almer <jamr...@gmail.com> wrote:
> On 2/19/2025 5:45 PM, Niklas Haas wrote:
> > From: Niklas Haas <g...@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-requ...@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-requ...@ffmpeg.org with subject "unsubscribe".

Reply via email to