[FFmpeg-devel] [PATCH] libsvtav1: pass color description info

Christopher Degawa ccom at randomderp.com
Thu Jul 29 20:24:19 EEST 2021


On Thu, Jul 22, 2021 at 9:02 PM Christopher Degawa <ccom at randomderp.com>
wrote:

> these fields are only available past svt-av1 0.8.7
>
> Signed-off-by: Christopher Degawa <ccom at randomderp.com>
> ---
>  libavcodec/libsvtav1.c | 20 ++++++++++++++++++++
>  1 file changed, 20 insertions(+)
>
> diff --git a/libavcodec/libsvtav1.c b/libavcodec/libsvtav1.c
> index fabc4e6428..6c12777911 100644
> --- a/libavcodec/libsvtav1.c
> +++ b/libavcodec/libsvtav1.c
> @@ -37,6 +37,14 @@
>  #include "avcodec.h"
>  #include "profiles.h"
>
> +#ifndef SVTAV1_MAKE_VERSION
> +#define SVTAV1_MAKE_VERSION(x,y,z) ((x) << 16 | (y) << 8 | z)
> +#endif
> +
> +#ifndef SVTAV1_CURR_VERSION
> +#define SVTAV1_CURR_VERSION SVTAV1_MAKE_VERSION(SVT_VERSION_MAJOR,
> SVT_VERSION_MINOR, SVT_VERSION_PATCHLEVEL)
> +#endif
> +
>  typedef enum eos_status {
>      EOS_NOT_REACHED = 0,
>      EOS_SENT,
> @@ -218,6 +226,18 @@ static int config_enc_params(EbSvtAv1EncConfiguration
> *param,
>      param->tile_columns = svt_enc->tile_columns;
>      param->tile_rows    = svt_enc->tile_rows;
>
> +#if SVTAV1_CURR_VERSION >= SVTAV1_MAKE_VERSION(0, 8, 7)
> +    if (desc->flags & AV_PIX_FMT_FLAG_RGB) {
> +        param->color_primaries = AVCOL_PRI_BT709;
> +        param->matrix_coefficients = AVCOL_SPC_RGB;
> +        param->transfer_characteristics = AVCOL_TRC_IEC61966_2_1;
> +    } else {
> +        param->color_primaries = avctx->color_primaries;
> +        param->matrix_coefficients = avctx->colorspace;
> +        param->transfer_characteristics = avctx->color_trc;
> +    }
> +#endif
> +
>      return 0;
>  }
>
> --
> 2.32.0
>

ping


More information about the ffmpeg-devel mailing list