[FFmpeg-devel] [PATCH 2/2] qsvdec_av1: add an option to disable film grain

Guangxin Xu oddstone at gmail.com
Thu Nov 26 12:19:14 EET 2020


Hi Haihao,
Hold on a moment, Let me send another related refact patch set. :)

On Thu, Nov 26, 2020 at 1:30 PM Haihao Xiang <haihao.xiang at intel.com> wrote:

> User may use '-disable_film_grain 1' to disable film grain.
> ---
>  libavcodec/qsvdec.c       |  5 +++++
>  libavcodec/qsvdec.h       |  2 ++
>  libavcodec/qsvdec_other.c | 13 ++++++++++++-
>  3 files changed, 19 insertions(+), 1 deletion(-)
>
> diff --git a/libavcodec/qsvdec.c b/libavcodec/qsvdec.c
> index c666aaeb52..f34487bdbb 100644
> --- a/libavcodec/qsvdec.c
> +++ b/libavcodec/qsvdec.c
> @@ -290,6 +290,11 @@ static int qsv_decode_header(AVCodecContext *avctx,
> QSVContext *q, AVPacket *avp
>          return ff_qsv_print_error(avctx, ret,
>                  "Error decoding stream header");
>
> +#if CONFIG_AV1_QSV_DECODER
> +    if (avctx->codec_id == AV_CODEC_ID_AV1)
> +        param->mfx.FilmGrain = q->disable_film_grain ? 0 :
> param->mfx.FilmGrain;
> +#endif
> +
>      return 0;
>  }
>
> diff --git a/libavcodec/qsvdec.h b/libavcodec/qsvdec.h
> index 10e8cf7f91..b5914834d9 100644
> --- a/libavcodec/qsvdec.h
> +++ b/libavcodec/qsvdec.h
> @@ -85,6 +85,8 @@ typedef struct QSVContext {
>
>      mfxExtBuffer **ext_buffers;
>      int         nb_ext_buffers;
> +
> +    int disable_film_grain;
>  } QSVContext;
>
>  extern const AVCodecHWConfigInternal *const ff_qsv_hw_configs[];
> diff --git a/libavcodec/qsvdec_other.c b/libavcodec/qsvdec_other.c
> index 65cefff2ab..ac1e2ea84a 100644
> --- a/libavcodec/qsvdec_other.c
> +++ b/libavcodec/qsvdec_other.c
> @@ -325,10 +325,21 @@ AVCodec ff_vp9_qsv_decoder = {
>  #endif
>
>  #if CONFIG_AV1_QSV_DECODER
> +static const AVOption av1_options[] = {
> +    QSVDEC_COMMON_OPTIONS,
> +
> +    { "disable_film_grain",
> +      "Disable the film grain synthesis",
> +      OFFSET(qsv.disable_film_grain), AV_OPT_TYPE_BOOL,
> +      { .i64 = 0}, 0, 1, VD},
> +
> +    { NULL },
> +};
> +
>  static const AVClass av1_qsv_class = {
>      .class_name = "av1_qsv",
>      .item_name  = av_default_item_name,
> -    .option     = options,
> +    .option     = av1_options,
>      .version    = LIBAVUTIL_VERSION_INT,
>  };
>
> --
> 2.25.1
>
> _______________________________________________
> ffmpeg-devel mailing list
> ffmpeg-devel at ffmpeg.org
> https://ffmpeg.org/mailman/listinfo/ffmpeg-devel
>
> To unsubscribe, visit link above, or email
> ffmpeg-devel-request at ffmpeg.org with subject "unsubscribe".


More information about the ffmpeg-devel mailing list