[FFmpeg-devel] [PATCH] Add enable_keyframe_filtering option for libaom-av1 encoder.

Bohan Li bohanli at google.com
Tue Oct 27 22:35:36 EET 2020


Thanks for the comment, Mark. Indeed this may not be helpful for people who
did not know the background of such parameters. I added more details to it
so people could understand the trade-off behind it better. Will re-submit
the patch soon.

Best,
Bohan

On Tue, Oct 27, 2020 at 1:26 PM Mark Thompson <sw at jkqxz.net> wrote:

> On 26/10/2020 22:04, Bohan Li wrote:
> > Add the option to use -enable-keyframe-filtering with libaom-av1
> > codec.  The option controls the encoder behavior on performing
> > temporal filtering on keyframes.
> >
> > Signed-off-by: Bohan Li <bohanli at google.com>
> > ---
> >   doc/encoders.texi      | 13 +++++++++++++
> >   libavcodec/libaomenc.c |  5 +++++
> >   2 files changed, 18 insertions(+)
> >
> > diff --git a/doc/encoders.texi b/doc/encoders.texi
> > index 0b1c69e982..8914546694 100644
> > --- a/doc/encoders.texi
> > +++ b/doc/encoders.texi
> > @@ -1685,6 +1685,19 @@ Enable interintra compound. Default is true.
> >   @item enable-smooth-interintra (@emph{boolean}) (Requires libaom >=
> v2.0.0)
> >   Enable smooth interintra mode. Default is true.
> >
> > + at item enable-keyframe-filtering (Requires libaom >= v2.0.0)
> > +Filtering type for key frames. Possible values:
> > + at table @samp
> > + at item @emph{-1}
> > +Use the default in libaom (default).
> > + at item @emph{0}
> > +Do not filter key frames.
> > + at item @emph{1}
> > +Filter key frames but do not apply overlays.
> > + at item @emph{2}
> > +Filter key frames and apply overlays to them (experimental).
> > + at end table
>
> This documentation does not seem helpful.  Suppose I am a normal end-user;
> what effect does this option have on the output and under what
> circumstances would I set it?  If never, why is the option in the user
> manual?
>
> (I would like to ask the same question of some of the options above this
> one as well.)
>
> > +
> >   @end table
> >
> >   @section libsvtav1
> > diff --git a/libavcodec/libaomenc.c b/libavcodec/libaomenc.c
> > index 2b0581b15a..77c25770a4 100644
> > --- a/libavcodec/libaomenc.c
> > +++ b/libavcodec/libaomenc.c
> > @@ -124,6 +124,7 @@ typedef struct AOMEncoderContext {
> >       int enable_diff_wtd_comp;
> >       int enable_dist_wtd_comp;
> >       int enable_dual_filter;
> > +    int enable_keyframe_filtering;
> >   } AOMContext;
> >
> >   static const char *const ctlidstr[] = {
> > @@ -192,6 +193,7 @@ static const char *const ctlidstr[] = {
> >       [AV1E_SET_REDUCED_REFERENCE_SET]    =
> "AV1E_SET_REDUCED_REFERENCE_SET",
> >       [AV1E_SET_ENABLE_SMOOTH_INTERINTRA] =
> "AV1E_SET_ENABLE_SMOOTH_INTERINTRA",
> >       [AV1E_SET_ENABLE_REF_FRAME_MVS]     =
> "AV1E_SET_ENABLE_REF_FRAME_MVS",
> > +    [AV1E_SET_ENABLE_KEYFRAME_FILTERING] =
> "AV1E_SET_ENABLE_KEYFRAME_FILTERING"
> >   #endif
> >   };
> >
> > @@ -812,6 +814,8 @@ static av_cold int aom_init(AVCodecContext *avctx,
> >           codecctl_int(avctx, AV1E_SET_ENABLE_ONESIDED_COMP,
> ctx->enable_onesided_comp);
> >       if (ctx->enable_smooth_interintra >= 0)
> >           codecctl_int(avctx, AV1E_SET_ENABLE_SMOOTH_INTERINTRA,
> ctx->enable_smooth_interintra);
> > +    if (ctx->enable_keyframe_filtering >= 0)
> > +        codecctl_int(avctx, AV1E_SET_ENABLE_KEYFRAME_FILTERING,
> ctx->enable_keyframe_filtering);
> >   #endif
> >
> >       codecctl_int(avctx, AOME_SET_STATIC_THRESHOLD, ctx->static_thresh);
> > @@ -1261,6 +1265,7 @@ static const AVOption options[] = {
> >       { "enable-masked-comp",           "Enable masked compound",
>                     OFFSET(enable_masked_comp),           AV_OPT_TYPE_BOOL,
> {.i64 = -1}, -1, 1, VE},
> >       { "enable-interintra-comp",       "Enable interintra compound",
>                     OFFSET(enable_interintra_comp),       AV_OPT_TYPE_BOOL,
> {.i64 = -1}, -1, 1, VE},
> >       { "enable-smooth-interintra",     "Enable smooth interintra
> mode",                     OFFSET(enable_smooth_interintra),
>  AV_OPT_TYPE_BOOL, {.i64 = -1}, -1, 1, VE},
> > +    { "enable-keyframe-filtering",    "Keyframe filtering type",
>                    OFFSET(enable_keyframe_filtering),    AV_OPT_TYPE_INT,
> {.i64 = -1}, -1, 3, VE},
> >       { NULL },
> >   };
> >
> >
>
> - Mark
> _______________________________________________
> 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