diff mbox series

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

Message ID 20201026212123.4035511-1-bohanli@google.com
State Superseded
Headers show
Series [FFmpeg-devel] Add enable_keyframe_filtering option for libaom-av1 encoder. | expand

Checks

Context Check Description
andriy/x86_make success Make finished
andriy/x86_make_fate success Make fate finished
andriy/PPC64_make success Make finished
andriy/PPC64_make_fate success Make fate finished

Commit Message

Bohan Li Oct. 26, 2020, 9:21 p.m. UTC
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@google.com>
---
 libavcodec/libaomenc.c | 5 +++++
 1 file changed, 5 insertions(+)

Comments

James Almer Oct. 26, 2020, 9:46 p.m. UTC | #1
On 10/26/2020 6:21 PM, Bohan Li wrote:

> Regarding the last comment, the enable-keyframe-filtering parameter was a
> boolean, but recently there is one more option added to libaom
> (--enable-keyframe-filtering=2), so I thought it would be better to use
>  AV_OPT_TYPE_INT here so people who build libaom from source could use that
> option.
> 
> Please let me know if there are any concerns with it.

No, if it was extended then it's correct as INT.

> Add the option to use -enable-keyframe-filtering with libaom-av1
> codec.  The option controls the encoder behavior on performing
> temporal filtering on keyframes.

By missing documentation i meant an entry in doc/encoder.texi
Look for the libaom-av1 section and add the new option at the end.

This blurb in the commit message is ok and can stay, too.

> 
> Signed-off-by: Bohan Li <bohanli@google.com>
> ---
>  libavcodec/libaomenc.c | 5 +++++
>  1 file changed, 5 insertions(+)
> 
> 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 },
>  };
>  
>
Bohan Li Oct. 26, 2020, 9:48 p.m. UTC | #2
Thanks a lot for the explanation! I'll add the documentation accordingly.

Best,
Bohan

On Mon, Oct 26, 2020 at 2:46 PM James Almer <jamrial@gmail.com> wrote:

> On 10/26/2020 6:21 PM, Bohan Li wrote:
>
> > Regarding the last comment, the enable-keyframe-filtering parameter was a
> > boolean, but recently there is one more option added to libaom
> > (--enable-keyframe-filtering=2), so I thought it would be better to use
> >  AV_OPT_TYPE_INT here so people who build libaom from source could use
> that
> > option.
> >
> > Please let me know if there are any concerns with it.
>
> No, if it was extended then it's correct as INT.
>
> > Add the option to use -enable-keyframe-filtering with libaom-av1
> > codec.  The option controls the encoder behavior on performing
> > temporal filtering on keyframes.
>
> By missing documentation i meant an entry in doc/encoder.texi
> Look for the libaom-av1 section and add the new option at the end.
>
> This blurb in the commit message is ok and can stay, too.
>
> >
> > Signed-off-by: Bohan Li <bohanli@google.com>
> > ---
> >  libavcodec/libaomenc.c | 5 +++++
> >  1 file changed, 5 insertions(+)
> >
> > 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 },
> >  };
> >
> >
>
> _______________________________________________
> ffmpeg-devel mailing list
> ffmpeg-devel@ffmpeg.org
> https://ffmpeg.org/mailman/listinfo/ffmpeg-devel
>
> To unsubscribe, visit link above, or email
> ffmpeg-devel-request@ffmpeg.org with subject "unsubscribe".
diff mbox series

Patch

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 },
 };