diff mbox series

[FFmpeg-devel,v3,1/9] avutil/film_grain_params: add extra AFGS1 metadata

Message ID 20240315120442.73754-2-ffmpeg@haasn.xyz
State New
Headers show
Series AFGS1 film grain support | expand

Checks

Context Check Description
yinshiyou/make_loongarch64 success Make finished
yinshiyou/make_fate_loongarch64 success Make fate finished
andriy/make_x86 success Make finished
andriy/make_fate_x86 success Make fate finished

Commit Message

Niklas Haas March 15, 2024, 11:58 a.m. UTC
From: Niklas Haas <git@haasn.dev>

In hindsight, it may have been better for this to be part of the common
film grain struct, to avoid duplication of these fields between it and
H274 (and to allow initialization by av_film_grain_params_alloc), but
I can't add new fields before the union without breaking ABI, and having
the union not be the last parameter will make future extensibility
similarly difficult.
---
 doc/APIchanges                |  4 ++++
 libavutil/film_grain_params.h | 15 +++++++++++++++
 libavutil/version.h           |  2 +-
 3 files changed, 20 insertions(+), 1 deletion(-)

Comments

James Almer March 15, 2024, 12:18 p.m. UTC | #1
On 3/15/2024 8:58 AM, Niklas Haas wrote:
> From: Niklas Haas <git@haasn.dev>
> 
> In hindsight, it may have been better for this to be part of the common
> film grain struct, to avoid duplication of these fields between it and
> H274 (and to allow initialization by av_film_grain_params_alloc), but
> I can't add new fields before the union without breaking ABI, and having
> the union not be the last parameter will make future extensibility
> similarly difficult.

You could add them now at the end, and in the next major bump we simply 
reorder the fields so the union is last again.

> ---
>   doc/APIchanges                |  4 ++++
>   libavutil/film_grain_params.h | 15 +++++++++++++++
>   libavutil/version.h           |  2 +-
>   3 files changed, 20 insertions(+), 1 deletion(-)
> 
> diff --git a/doc/APIchanges b/doc/APIchanges
> index cf58c8c5f0a..5a192b600af 100644
> --- a/doc/APIchanges
> +++ b/doc/APIchanges
> @@ -2,6 +2,10 @@ The last version increases of all libraries were on 2024-03-07
>   
>   API changes, most recent first:
>   
> +2024-03-08 - xxxxxxxxxx - lavu 59.2.100 - film_grain_params.h
> +  Add AVFilmGrainAOMParams.color_range, color_primaries, color_trc,
> +  color_space, width, height, subx, suby and bit_depth.
> +
>   2024-03-08 - xxxxxxxxxx - lavc 61.1.100 - avcodec.h
>     Add AVCodecContext.[nb_]side_data_prefer_packet.
>   
> diff --git a/libavutil/film_grain_params.h b/libavutil/film_grain_params.h
> index f3bd0a4a6a3..17fefeb06c3 100644
> --- a/libavutil/film_grain_params.h
> +++ b/libavutil/film_grain_params.h
> @@ -120,6 +120,21 @@ typedef struct AVFilmGrainAOMParams {
>        * Signals to clip to limited color levels after film grain application.
>        */
>       int limit_output_range;
> +
> +    /**
> +     * Video characteristics metadata, only for AFGS1 streams.
> +     */
> +    enum AVColorRange                  color_range;
> +    enum AVColorPrimaries              color_primaries;
> +    enum AVColorTransferCharacteristic color_trc;
> +    enum AVColorSpace                  color_space;
> +
> +    /**
> +     * Intended display resolution and format, only for AFGS1 streams.
> +     */
> +    int width, height;
> +    int subx, suby;
> +    int bit_depth; /* or 0 if unknown */
>   } AVFilmGrainAOMParams;
>   
>   /**
> diff --git a/libavutil/version.h b/libavutil/version.h
> index 09f8cdc2926..57cad02ec0a 100644
> --- a/libavutil/version.h
> +++ b/libavutil/version.h
> @@ -79,7 +79,7 @@
>    */
>   
>   #define LIBAVUTIL_VERSION_MAJOR  59
> -#define LIBAVUTIL_VERSION_MINOR   1
> +#define LIBAVUTIL_VERSION_MINOR   2
>   #define LIBAVUTIL_VERSION_MICRO 100
>   
>   #define LIBAVUTIL_VERSION_INT   AV_VERSION_INT(LIBAVUTIL_VERSION_MAJOR, \
diff mbox series

Patch

diff --git a/doc/APIchanges b/doc/APIchanges
index cf58c8c5f0a..5a192b600af 100644
--- a/doc/APIchanges
+++ b/doc/APIchanges
@@ -2,6 +2,10 @@  The last version increases of all libraries were on 2024-03-07
 
 API changes, most recent first:
 
+2024-03-08 - xxxxxxxxxx - lavu 59.2.100 - film_grain_params.h
+  Add AVFilmGrainAOMParams.color_range, color_primaries, color_trc,
+  color_space, width, height, subx, suby and bit_depth.
+
 2024-03-08 - xxxxxxxxxx - lavc 61.1.100 - avcodec.h
   Add AVCodecContext.[nb_]side_data_prefer_packet.
 
diff --git a/libavutil/film_grain_params.h b/libavutil/film_grain_params.h
index f3bd0a4a6a3..17fefeb06c3 100644
--- a/libavutil/film_grain_params.h
+++ b/libavutil/film_grain_params.h
@@ -120,6 +120,21 @@  typedef struct AVFilmGrainAOMParams {
      * Signals to clip to limited color levels after film grain application.
      */
     int limit_output_range;
+
+    /**
+     * Video characteristics metadata, only for AFGS1 streams.
+     */
+    enum AVColorRange                  color_range;
+    enum AVColorPrimaries              color_primaries;
+    enum AVColorTransferCharacteristic color_trc;
+    enum AVColorSpace                  color_space;
+
+    /**
+     * Intended display resolution and format, only for AFGS1 streams.
+     */
+    int width, height;
+    int subx, suby;
+    int bit_depth; /* or 0 if unknown */
 } AVFilmGrainAOMParams;
 
 /**
diff --git a/libavutil/version.h b/libavutil/version.h
index 09f8cdc2926..57cad02ec0a 100644
--- a/libavutil/version.h
+++ b/libavutil/version.h
@@ -79,7 +79,7 @@ 
  */
 
 #define LIBAVUTIL_VERSION_MAJOR  59
-#define LIBAVUTIL_VERSION_MINOR   1
+#define LIBAVUTIL_VERSION_MINOR   2
 #define LIBAVUTIL_VERSION_MICRO 100
 
 #define LIBAVUTIL_VERSION_INT   AV_VERSION_INT(LIBAVUTIL_VERSION_MAJOR, \