[FFmpeg-devel] [PATCH 2/2] qsvdec_av1: add an option to disable film grain
Xiang, Haihao
haihao.xiang at intel.com
Fri Nov 27 02:47:02 EET 2020
On Thu, 2020-11-26 at 10:17 -0300, James Almer wrote:
> On 11/26/2020 2:30 AM, Haihao Xiang wrote:
> > User may use '-disable_film_grain 1' to disable film grain.
>
> A side data type was recently pushed that lets the user choose to export
> film grain parameters as frame side data instead of having the decoder
> apply them. Can you implement it here? Does QSV give you such values in
> order to export them?
Thanks for the comment, I will check QSV to make sure whether we can get such
values from QSV.
Regards
Haihao
>
> > ---
> > 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,
> > };
> >
> >
>
> _______________________________________________
> 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