From: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
To: ffmpeg-devel@ffmpeg.org
Subject: Re: [FFmpeg-devel] [PATCH v2 02/13] avcodec: add extended AVCodec color metadata
Date: Fri, 13 Oct 2023 19:10:33 +0200
Message-ID: <AS8P250MB074469156B0B9002222575A18FD2A@AS8P250MB0744.EURP250.PROD.OUTLOOK.COM> (raw)
In-Reply-To: <20231013142706.23971-3-ffmpeg@haasn.xyz>
Niklas Haas:
> From: Niklas Haas <git@haasn.dev>
>
> This is motivated primarily by a desire for YUVJ removal, which will
> require signalling the supported color ranges as part of the codec
> capabilities. But since we're here anyway, we might as well add all of
> the metadata, which I foresee seeing more use in the future (e.g.
> automatic conversion from HDR to SDR when encoding to formats that don't
> support AVCOL_TRC_SMPTE2084, ...)
> ---
> doc/APIchanges | 4 ++++
> libavcodec/codec.h | 7 +++++++
> libavcodec/version.h | 4 ++--
> 3 files changed, 13 insertions(+), 2 deletions(-)
>
> diff --git a/doc/APIchanges b/doc/APIchanges
> index 9b109e6fa7..f91e855e70 100644
> --- a/doc/APIchanges
> +++ b/doc/APIchanges
> @@ -2,6 +2,10 @@ The last version increases of all libraries were on 2023-02-09
>
> API changes, most recent first:
>
> +2023-10-xx - xxxxxxxxxx - lavc 60.23.100 - avcodec.h
> + Add AVCodec.csps, AVCodec.color_ranges, AVCodec.chroma_locs, AVCodec.primaries,
> + AVCodec.trcs.
> +
> 2023-10-06 - xxxxxxxxxx - lavc 60.30.101 - avcodec.h
> AVCodecContext.coded_side_data may now be used during decoding, to be set
> by user before calling avcodec_open2() for initialization.
> diff --git a/libavcodec/codec.h b/libavcodec/codec.h
> index 8034f1a53c..5bc8f21868 100644
> --- a/libavcodec/codec.h
> +++ b/libavcodec/codec.h
> @@ -235,6 +235,13 @@ typedef struct AVCodec {
> * Array of supported channel layouts, terminated with a zeroed layout.
> */
> const AVChannelLayout *ch_layouts;
> +
> + /* Extended colorspace support metadata */
> + const enum AVColorSpace *csps; ///< array of supported color spaces, or NULL if unknown, array is terminated by AVCOL_SPC_UNSPECIFIED
> + const enum AVColorRange *color_ranges; ///< array of supported color ranges, or NULL if unknown, array is terminated by 0
> + const enum AVChromaLocation *chroma_locs; ///< array of supported chroma locations, or NULL if unknown, array is terminated by 0
> + const enum AVColorPrimaries *primaries; ///< array of supported color primaries, or NULL if unknown, array is terminated by 0
> + const enum AVColorTransferCharacteristic *trcs; ///< array of supported transfer characteristics, or NULL if known, array is terminated by 0
> } AVCodec;
>
This design has several drawbacks:
1. It adds stuff that will only be set by a tiny minority of AVCodec's
to all of them.
2. It is based around the underlying assumption that the set of
permissible states (tupels) is a cartesian product of a set of color
spaces, a set of color ranges etc. This is wrong: E.g. VP9 disallows
limited-range RGB (it is syntactically impossible to set the color range
when using RGB color space).
3. I don't see how the MJPEG encoder behaviour where the valid formats
de facto depend upon strictness can be encoded in this way; isn't the
aim to get rid of the necessity of the workaround in ffmpeg cli?
1. and 2. suggests using some form of function that returns a list of
supported tupels; if said function uses an AVCodecContext* parameter,
said list can depend upon the state of the AVCodecContext given to it,
thereby solving 3. to the extent that one can get the supported
combinations given AVCodecContext options (but I do not see a good way
to signal which options modify the supported combinations).
- Andreas
_______________________________________________
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:[~2023-10-13 17:09 UTC|newest]
Thread overview: 37+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-10-13 14:24 [FFmpeg-devel] [PATCH v2 00/13] YUVJ removal Niklas Haas
2023-10-13 14:24 ` [FFmpeg-devel] [PATCH v2 01/13] avfilter/vf_scale: don't change range by default Niklas Haas
2023-10-13 14:24 ` [FFmpeg-devel] [PATCH v2 02/13] avcodec: add extended AVCodec color metadata Niklas Haas
2023-10-13 17:10 ` Andreas Rheinhardt [this message]
2023-10-13 18:52 ` Vittorio Giovara
2023-10-14 10:29 ` Niklas Haas
2023-10-14 11:46 ` Niklas Haas
2023-10-20 13:54 ` Anton Khirnov
2023-10-20 14:11 ` Michael Niedermayer
2023-10-20 14:01 ` Anton Khirnov
2023-10-14 13:31 ` Leo Izen
2023-10-14 13:40 ` Niklas Haas
2023-10-13 14:24 ` [FFmpeg-devel] [PATCH v2 03/13] fftools/ffmpeg_filter: auto-convert range if needed Niklas Haas
2023-10-13 14:24 ` [FFmpeg-devel] [PATCH v2 04/13] lavfi/vf_colorspace: support prim/trc/csp passthrough Niklas Haas
2023-10-13 14:24 ` [FFmpeg-devel] [PATCH v2 05/13] fftools/ffmpeg_filter: auto-insert colorspace filter Niklas Haas
2023-10-13 14:24 ` [FFmpeg-devel] [PATCH v2 06/13] avcodec/encode: enforce AVCodec capabilities at encode time Niklas Haas
2023-10-13 14:24 ` [FFmpeg-devel] [PATCH v2 07/13] tests/fate: force MPEG range for rawvideo tests Niklas Haas
2023-10-13 14:24 ` [FFmpeg-devel] [PATCH v2 08/13] tests/fate: allow conversion filters in jpg-icc test Niklas Haas
2023-10-13 14:24 ` [FFmpeg-devel] [PATCH v2 09/13] lavc: set color_ranges for YUVJ-only codecs Niklas Haas
2023-10-13 14:24 ` [FFmpeg-devel] [PATCH v2 10/13] lavfi/lavu/lavc: remove YUVJ pixel formats Niklas Haas
2023-10-13 14:24 ` [FFmpeg-devel] [PATCH v2 11/13] swscale/utils: simplify JPEG handling function Niklas Haas
2023-10-13 14:24 ` [FFmpeg-devel] [PATCH v2 12/13] tests/fate: remove unused YUVJ ref files Niklas Haas
2023-10-13 14:24 ` [FFmpeg-devel] [PATCH v2 13/13] avutil/pixdesc: remove old yuvj pixel format check Niklas Haas
2023-10-13 18:33 ` [FFmpeg-devel] [PATCH v2 00/13] YUVJ removal Vittorio Giovara
2023-10-13 21:14 ` Lynne
2023-10-13 22:21 ` Vittorio Giovara
2023-10-14 13:11 ` Lynne
2023-10-14 15:15 ` Vittorio Giovara
2023-10-14 15:18 ` Lynne
2023-10-20 12:14 ` Ronald S. Bultje
2023-10-20 16:14 ` Vittorio Giovara
2023-10-20 23:13 ` Ronald S. Bultje
2023-10-21 23:20 ` Michael Niedermayer
2023-10-24 0:56 ` Vittorio Giovara
2023-10-25 22:15 ` Michael Niedermayer
2023-10-20 11:30 ` Niklas Haas
2023-10-20 16:17 ` Vittorio Giovara
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=AS8P250MB074469156B0B9002222575A18FD2A@AS8P250MB0744.EURP250.PROD.OUTLOOK.COM \
--to=andreas.rheinhardt@outlook.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