diff mbox series

[FFmpeg-devel] avcodec/libvpxenc: add -min-gf-interval

Message ID 20220914002757.1570637-1-jzern@google.com
State New
Headers show
Series [FFmpeg-devel] avcodec/libvpxenc: add -min-gf-interval | expand

Checks

Context Check Description
yinshiyou/make_loongarch64 success Make finished
yinshiyou/make_fate_loongarch64 success Make fate finished
andriy/make_x86 success Make finished
andriy/make_fate_x86 success Make fate finished

Commit Message

James Zern Sept. 14, 2022, 12:27 a.m. UTC
this maps to the vpxenc argument with the same name and the
VP9E_SET_MIN_GF_INTERVAL codec control

Signed-off-by: James Zern <jzern@google.com>
---
 doc/encoders.texi      |  2 ++
 libavcodec/libvpxenc.c | 11 +++++++++++
 libavcodec/version.h   |  2 +-
 3 files changed, 14 insertions(+), 1 deletion(-)

Comments

Vignesh Venkat Sept. 19, 2022, 4:46 p.m. UTC | #1
On Tue, Sep 13, 2022 at 5:28 PM James Zern
<jzern-at-google.com@ffmpeg.org> wrote:
>
> this maps to the vpxenc argument with the same name and the
> VP9E_SET_MIN_GF_INTERVAL codec control
>
> Signed-off-by: James Zern <jzern@google.com>
> ---
>  doc/encoders.texi      |  2 ++
>  libavcodec/libvpxenc.c | 11 +++++++++++
>  libavcodec/version.h   |  2 +-
>  3 files changed, 14 insertions(+), 1 deletion(-)
>
> diff --git a/doc/encoders.texi b/doc/encoders.texi
> index ac71f50ad2..5a5579d5e5 100644
> --- a/doc/encoders.texi
> +++ b/doc/encoders.texi
> @@ -2176,6 +2176,8 @@ Set altref noise reduction filter type: backward, forward, centered.
>  Set altref noise reduction filter strength.
>  @item rc-lookahead, lag-in-frames (@emph{lag-in-frames})
>  Set number of frames to look ahead for frametype and ratecontrol.
> +@item min-gf-interval
> +Set minimum golden/alternate reference frame interval (VP9 only).
>  @end table
>
>  @item error-resilient
> diff --git a/libavcodec/libvpxenc.c b/libavcodec/libvpxenc.c
> index 09b56aae2a..667cffc200 100644
> --- a/libavcodec/libvpxenc.c
> +++ b/libavcodec/libvpxenc.c
> @@ -131,6 +131,7 @@ typedef struct VPxEncoderContext {
>      int tune_content;
>      int corpus_complexity;
>      int tpl_model;
> +    int min_gf_interval;
>      AVFifo *hdr10_plus_fifo;
>      /**
>       * If the driver does not support ROI then warn the first time we
> @@ -186,6 +187,9 @@ static const char *const ctlidstr[] = {
>  #ifdef VPX_CTRL_VP9E_SET_TPL
>      [VP9E_SET_TPL]                     = "VP9E_SET_TPL",
>  #endif
> +#ifdef VPX_CTRL_VP9E_SET_MIN_GF_INTERVAL
> +    [VP9E_SET_MIN_GF_INTERVAL]         = "VP9E_SET_MIN_GF_INTERVAL",
> +#endif
>  #endif
>  };
>
> @@ -1173,6 +1177,10 @@ static av_cold int vpx_init(AVCodecContext *avctx,
>  #ifdef VPX_CTRL_VP9E_SET_TPL
>          if (ctx->tpl_model >= 0)
>              codecctl_int(avctx, VP9E_SET_TPL, ctx->tpl_model);
> +#endif
> +#ifdef VPX_CTRL_VP9E_SET_MIN_GF_INTERVAL
> +        if (ctx->min_gf_interval >= 0)
> +            codecctl_int(avctx, VP9E_SET_MIN_GF_INTERVAL, ctx->min_gf_interval);
>  #endif
>      }
>  #endif
> @@ -1911,6 +1919,9 @@ static const AVOption vp9_options[] = {
>  #endif
>  #ifdef VPX_CTRL_VP9E_SET_TPL
>      { "enable-tpl",      "Enable temporal dependency model", OFFSET(tpl_model), AV_OPT_TYPE_BOOL, {.i64 = -1}, -1, 1, VE },
> +#endif
> +#ifdef VPX_CTRL_VP9E_SET_MIN_GF_INTERVAL
> +    { "min-gf-interval", "Minimum golden/alternate reference frame interval", OFFSET(min_gf_interval), AV_OPT_TYPE_INT, {.i64 = -1}, -1, INT_MAX, VE },
>  #endif
>      LEGACY_OPTIONS
>      { NULL }
> diff --git a/libavcodec/version.h b/libavcodec/version.h
> index 2328be4b26..7e89daf017 100644
> --- a/libavcodec/version.h
> +++ b/libavcodec/version.h
> @@ -30,7 +30,7 @@
>  #include "version_major.h"
>
>  #define LIBAVCODEC_VERSION_MINOR  43
> -#define LIBAVCODEC_VERSION_MICRO 100
> +#define LIBAVCODEC_VERSION_MICRO 101
>
>  #define LIBAVCODEC_VERSION_INT  AV_VERSION_INT(LIBAVCODEC_VERSION_MAJOR, \
>                                                 LIBAVCODEC_VERSION_MINOR, \
> --
> 2.37.2.789.g6183377224-goog
>
> _______________________________________________
> 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".

lgtm.
diff mbox series

Patch

diff --git a/doc/encoders.texi b/doc/encoders.texi
index ac71f50ad2..5a5579d5e5 100644
--- a/doc/encoders.texi
+++ b/doc/encoders.texi
@@ -2176,6 +2176,8 @@  Set altref noise reduction filter type: backward, forward, centered.
 Set altref noise reduction filter strength.
 @item rc-lookahead, lag-in-frames (@emph{lag-in-frames})
 Set number of frames to look ahead for frametype and ratecontrol.
+@item min-gf-interval
+Set minimum golden/alternate reference frame interval (VP9 only).
 @end table
 
 @item error-resilient
diff --git a/libavcodec/libvpxenc.c b/libavcodec/libvpxenc.c
index 09b56aae2a..667cffc200 100644
--- a/libavcodec/libvpxenc.c
+++ b/libavcodec/libvpxenc.c
@@ -131,6 +131,7 @@  typedef struct VPxEncoderContext {
     int tune_content;
     int corpus_complexity;
     int tpl_model;
+    int min_gf_interval;
     AVFifo *hdr10_plus_fifo;
     /**
      * If the driver does not support ROI then warn the first time we
@@ -186,6 +187,9 @@  static const char *const ctlidstr[] = {
 #ifdef VPX_CTRL_VP9E_SET_TPL
     [VP9E_SET_TPL]                     = "VP9E_SET_TPL",
 #endif
+#ifdef VPX_CTRL_VP9E_SET_MIN_GF_INTERVAL
+    [VP9E_SET_MIN_GF_INTERVAL]         = "VP9E_SET_MIN_GF_INTERVAL",
+#endif
 #endif
 };
 
@@ -1173,6 +1177,10 @@  static av_cold int vpx_init(AVCodecContext *avctx,
 #ifdef VPX_CTRL_VP9E_SET_TPL
         if (ctx->tpl_model >= 0)
             codecctl_int(avctx, VP9E_SET_TPL, ctx->tpl_model);
+#endif
+#ifdef VPX_CTRL_VP9E_SET_MIN_GF_INTERVAL
+        if (ctx->min_gf_interval >= 0)
+            codecctl_int(avctx, VP9E_SET_MIN_GF_INTERVAL, ctx->min_gf_interval);
 #endif
     }
 #endif
@@ -1911,6 +1919,9 @@  static const AVOption vp9_options[] = {
 #endif
 #ifdef VPX_CTRL_VP9E_SET_TPL
     { "enable-tpl",      "Enable temporal dependency model", OFFSET(tpl_model), AV_OPT_TYPE_BOOL, {.i64 = -1}, -1, 1, VE },
+#endif
+#ifdef VPX_CTRL_VP9E_SET_MIN_GF_INTERVAL
+    { "min-gf-interval", "Minimum golden/alternate reference frame interval", OFFSET(min_gf_interval), AV_OPT_TYPE_INT, {.i64 = -1}, -1, INT_MAX, VE },
 #endif
     LEGACY_OPTIONS
     { NULL }
diff --git a/libavcodec/version.h b/libavcodec/version.h
index 2328be4b26..7e89daf017 100644
--- a/libavcodec/version.h
+++ b/libavcodec/version.h
@@ -30,7 +30,7 @@ 
 #include "version_major.h"
 
 #define LIBAVCODEC_VERSION_MINOR  43
-#define LIBAVCODEC_VERSION_MICRO 100
+#define LIBAVCODEC_VERSION_MICRO 101
 
 #define LIBAVCODEC_VERSION_INT  AV_VERSION_INT(LIBAVCODEC_VERSION_MAJOR, \
                                                LIBAVCODEC_VERSION_MINOR, \