Git Inbox Mirror of the ffmpeg-devel mailing list - see https://ffmpeg.org/mailman/listinfo/ffmpeg-devel
 help / color / mirror / Atom feed
From: James Almer <jamrial@gmail.com>
To: ffmpeg-devel@ffmpeg.org
Subject: Re: [FFmpeg-devel] [PATCH 01/10] avcodec: add dolbyvision option
Date: Wed, 3 Apr 2024 15:32:56 -0300
Message-ID: <105e11c1-ae4b-48f6-8f4d-d1d7fd169828@gmail.com> (raw)
In-Reply-To: <20240403154330.71585-1-ffmpeg@haasn.xyz>

On 4/3/2024 12:43 PM, Niklas Haas wrote:
> From: Niklas Haas <git@haasn.dev>
> 
> Tri-state yes/no/auto option. Allows users to set `dolbyvision` to `no`
> to suppress coding dolby vision even when supported by the target codec.
> ---
>   doc/APIchanges             |  3 +++
>   doc/codecs.texi            | 12 ++++++++++++
>   libavcodec/avcodec.h       | 11 +++++++++++
>   libavcodec/options_table.h |  2 ++
>   libavcodec/version.h       |  2 +-
>   5 files changed, 29 insertions(+), 1 deletion(-)
> 
> diff --git a/doc/APIchanges b/doc/APIchanges
> index 7eda1321cb0..a4484ceb670 100644
> --- a/doc/APIchanges
> +++ b/doc/APIchanges
> @@ -2,6 +2,9 @@ The last version increases of all libraries were on 2024-03-07
>   
>   API changes, most recent first:
>   
> +2024-03-23 - f17e18d2922 - lavc 61.6.100 - avcodec.h
> +  Add AVCodecContext.dolbyvision option.
> +
>   2024-04-xx - xxxxxxxxxx - lavu 59.12.100 - dovi_meta.h
>     Add AVDOVIMetadata.ext_block_{offset,size}, AVDOVIMetadata.num_ext_blocks,
>     AVDOVIDmData and AVDOVIDmLevel{1..6,8..11,254..255}, av_dovi_get_ext()
> diff --git a/doc/codecs.texi b/doc/codecs.texi
> index 6bdeb664e72..7203adc0489 100644
> --- a/doc/codecs.texi
> +++ b/doc/codecs.texi
> @@ -1018,6 +1018,18 @@ Note: The required alignment depends on if @code{AV_CODEC_FLAG_UNALIGNED} is set
>   CPU. @code{AV_CODEC_FLAG_UNALIGNED} cannot be changed from the command line. Also hardware
>   decoders will not apply left/top Cropping.
>   
> +@item dolbyvision @var{integer} (@emph{encoding,video})
> +Whether to encode Dolby Vision metadata when transcoding.
> +Possible values:
> +@table @samp
> +@item auto
> +Enable when coded frames contain Dolby Vision side data (default)
> +@item yes/on
> +Enable always, error out when frames do not contain metadata
> +@item no/off
> +Disable always, strip any tagged metadata
> +@end table
> +
>   
>   @end table
>   
> diff --git a/libavcodec/avcodec.h b/libavcodec/avcodec.h
> index 83dc487251c..f54f758608d 100644
> --- a/libavcodec/avcodec.h
> +++ b/libavcodec/avcodec.h
> @@ -2075,6 +2075,17 @@ typedef struct AVCodecContext {
>        */
>       AVFrameSideData  **decoded_side_data;
>       int             nb_decoded_side_data;
> +
> +    /**
> +     * Video encoding only. Whether to mark the coded stream as Dolby Vision.
> +     * If set to FF_DOLBYVISION_AUTO, this will be enabled only if
> +     * decoded_side_data contains a valid RPU.
> +     *
> +     * If enabled, sending frames without AV_FRAME_DATA_DOVI_METADATA is
> +     * considered an error.
> +     */
> +    int dolbyvision;

This should be encoder specific options, not a global one. Only three 
encoders care about it at the end of this set.

> +#define FF_DOLBYVISION_AUTO -1
>   } AVCodecContext;
>   
>   /**
> diff --git a/libavcodec/options_table.h b/libavcodec/options_table.h
> index 7a2ef3474e7..d92269d2ff7 100644
> --- a/libavcodec/options_table.h
> +++ b/libavcodec/options_table.h
> @@ -407,6 +407,8 @@ static const AVOption avcodec_options[] = {
>       {"mastering_display_metadata",  .default_val.i64 = AV_PKT_DATA_MASTERING_DISPLAY_METADATA,  .type = AV_OPT_TYPE_CONST, .flags = A|D, .unit = "side_data_pkt" },
>       {"content_light_level",         .default_val.i64 = AV_PKT_DATA_CONTENT_LIGHT_LEVEL,         .type = AV_OPT_TYPE_CONST, .flags = A|D, .unit = "side_data_pkt" },
>       {"icc_profile",                 .default_val.i64 = AV_PKT_DATA_ICC_PROFILE,                 .type = AV_OPT_TYPE_CONST, .flags = A|D, .unit = "side_data_pkt" },
> +{"dolbyvision", "flag stream as Dolby Vision", OFFSET(dolbyvision), AV_OPT_TYPE_INT, {.i64 = FF_DOLBYVISION_AUTO }, -1, 1, V|E, .unit = "dolbyvision" },

You can make it AV_OPT_TYPE_BOOL and still support -1 for auto. It's 
done in many places.

> +{"auto", NULL, 0, AV_OPT_TYPE_CONST, {.i64 = FF_DOLBYVISION_AUTO }, .flags = V|E, .unit = "dolbyvision" },
>   {NULL},
>   };
>   
> diff --git a/libavcodec/version.h b/libavcodec/version.h
> index 7aa95fc3f1c..da54f878874 100644
> --- a/libavcodec/version.h
> +++ b/libavcodec/version.h
> @@ -29,7 +29,7 @@
>   
>   #include "version_major.h"
>   
> -#define LIBAVCODEC_VERSION_MINOR   5
> +#define LIBAVCODEC_VERSION_MINOR   6
>   #define LIBAVCODEC_VERSION_MICRO 100
>   
>   #define LIBAVCODEC_VERSION_INT  AV_VERSION_INT(LIBAVCODEC_VERSION_MAJOR, \
_______________________________________________
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".

      parent reply	other threads:[~2024-04-03 18:32 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-04-03 15:43 Niklas Haas
2024-04-03 15:43 ` [FFmpeg-devel] [PATCH 02/10] avcodec/dovi_rpu: store entire config record Niklas Haas
2024-04-03 15:43 ` [FFmpeg-devel] [PATCH 03/10] avcodec/dovi_rpu: properly replace context header Niklas Haas
2024-04-03 15:43 ` [FFmpeg-devel] [PATCH 04/10] avcodec/dovi_rpu: clarify error on missing RPU VDR Niklas Haas
2024-04-03 15:43 ` [FFmpeg-devel] [PATCH 05/10] avcodec/dovi_rpu: clarify semantics of guess_profile() Niklas Haas
2024-04-03 15:43 ` [FFmpeg-devel] [PATCH 06/10] avcodec/dovi_rpu: add ff_dovi_configure() Niklas Haas
2024-04-03 15:43 ` [FFmpeg-devel] [PATCH 07/10] avcodec/dovi_rpu: add ff_dovi_rpu_generate() Niklas Haas
2024-04-03 15:43 ` [FFmpeg-devel] [PATCH 08/10] avcodec/libaomenc: implement dolby vision coding Niklas Haas
2024-04-03 15:43 ` [FFmpeg-devel] [PATCH 09/10] avcodec/libx265: " Niklas Haas
2024-04-03 15:43 ` [FFmpeg-devel] [PATCH 10/10] avformat/movenc: warn if dovi cfg ignored Niklas Haas
2024-04-03 16:29 ` [FFmpeg-devel] [PATCH 01/10] avcodec: add dolbyvision option Andreas Rheinhardt
2024-04-03 18:32 ` James Almer [this message]

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=105e11c1-ae4b-48f6-8f4d-d1d7fd169828@gmail.com \
    --to=jamrial@gmail.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