diff mbox series

[FFmpeg-devel,2/5] avcodec/libsvtav1: make intra_refresh_type configurable

Message ID 1631789657-16936-2-git-send-email-lance.lmwang@gmail.com
State New
Headers show
Series [FFmpeg-devel,1/5] avcodec/libsvtav1: Fix redundant setting of caps_internal
Related show

Checks

Context Check Description
andriy/make_x86 success Make finished
andriy/make_fate_x86 success Make fate finished
andriy/make_ppc success Make finished
andriy/make_fate_ppc success Make fate finished

Commit Message

Limin Wang Sept. 16, 2021, 10:54 a.m. UTC
From: Limin Wang <lance.lmwang@gmail.com>

Signed-off-by: Limin Wang <lance.lmwang@gmail.com>
---
 libavcodec/libsvtav1.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

Comments

Jan Ekström Sept. 16, 2021, 10:38 p.m. UTC | #1
Hi

On Thu, Sep 16, 2021 at 1:54 PM <lance.lmwang@gmail.com> wrote:
>
> From: Limin Wang <lance.lmwang@gmail.com>
>
> Signed-off-by: Limin Wang <lance.lmwang@gmail.com>
> ---

I think something like:

avcodec/libsvtav1: make coded GOP type configurable

Might be a bit better as a commit message?
>  libavcodec/libsvtav1.c | 4 +++-
>  1 file changed, 3 insertions(+), 1 deletion(-)
>
> diff --git a/libavcodec/libsvtav1.c b/libavcodec/libsvtav1.c
> index 82ae2b9..8c2c970 100644
> --- a/libavcodec/libsvtav1.c
> +++ b/libavcodec/libsvtav1.c
> @@ -210,7 +210,8 @@ static int config_enc_params(EbSvtAv1EncConfiguration *param,
>          param->min_qp_allowed       = avctx->qmin;
>      }
>
> -    param->intra_refresh_type       = 2; /* Real keyframes only */
> +    /* 2 = IDR, closed GOP, 1 = CRA, open GOP */
> +    param->intra_refresh_type = avctx->flags & AV_CODEC_FLAG_CLOSED_GOP ? 2 : 1;
>

Ugh... I see they have EbIntraRefreshType for an enum (NO_REFRESH |
CRA_REFRESH | IDR_REFRESH), but I guess those are not available
through the public API?

>      if (svt_enc->la_depth >= 0)
>          param->look_ahead_distance  = svt_enc->la_depth;
> @@ -548,6 +549,7 @@ static const AVCodecDefault eb_enc_defaults[] = {
>      { "g",         "-1"    },
>      { "qmin",      "0"     },
>      { "qmax",      "63"    },
> +    { "flags",     "+cgop" },

Let's keep the alphabetic ordering since this module is not yet a mess
in that sense :) Thus this would go after "b" .

Otherwise LGTM.

Jan
Limin Wang Sept. 17, 2021, 1:14 a.m. UTC | #2
On Fri, Sep 17, 2021 at 01:38:46AM +0300, Jan Ekström wrote:
> Hi
> 
> On Thu, Sep 16, 2021 at 1:54 PM <lance.lmwang@gmail.com> wrote:
> >
> > From: Limin Wang <lance.lmwang@gmail.com>
> >
> > Signed-off-by: Limin Wang <lance.lmwang@gmail.com>
> > ---
> 
> I think something like:
> 
> avcodec/libsvtav1: make coded GOP type configurable
> 
> Might be a bit better as a commit message?

Yes, it's more better, I'll update it.


> >  libavcodec/libsvtav1.c | 4 +++-
> >  1 file changed, 3 insertions(+), 1 deletion(-)
> >
> > diff --git a/libavcodec/libsvtav1.c b/libavcodec/libsvtav1.c
> > index 82ae2b9..8c2c970 100644
> > --- a/libavcodec/libsvtav1.c
> > +++ b/libavcodec/libsvtav1.c
> > @@ -210,7 +210,8 @@ static int config_enc_params(EbSvtAv1EncConfiguration *param,
> >          param->min_qp_allowed       = avctx->qmin;
> >      }
> >
> > -    param->intra_refresh_type       = 2; /* Real keyframes only */
> > +    /* 2 = IDR, closed GOP, 1 = CRA, open GOP */
> > +    param->intra_refresh_type = avctx->flags & AV_CODEC_FLAG_CLOSED_GOP ? 2 : 1;
> >
> 
> Ugh... I see they have EbIntraRefreshType for an enum (NO_REFRESH |
> CRA_REFRESH | IDR_REFRESH), but I guess those are not available
> through the public API?

Yes, it's not public API.

> 
> >      if (svt_enc->la_depth >= 0)
> >          param->look_ahead_distance  = svt_enc->la_depth;
> > @@ -548,6 +549,7 @@ static const AVCodecDefault eb_enc_defaults[] = {
> >      { "g",         "-1"    },
> >      { "qmin",      "0"     },
> >      { "qmax",      "63"    },
> > +    { "flags",     "+cgop" },
> 
> Let's keep the alphabetic ordering since this module is not yet a mess
> in that sense :) Thus this would go after "b" .

OK, I'll change the order.

> 
> Otherwise LGTM.
> 
> Jan
> _______________________________________________
> 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/libsvtav1.c b/libavcodec/libsvtav1.c
index 82ae2b9..8c2c970 100644
--- a/libavcodec/libsvtav1.c
+++ b/libavcodec/libsvtav1.c
@@ -210,7 +210,8 @@  static int config_enc_params(EbSvtAv1EncConfiguration *param,
         param->min_qp_allowed       = avctx->qmin;
     }
 
-    param->intra_refresh_type       = 2; /* Real keyframes only */
+    /* 2 = IDR, closed GOP, 1 = CRA, open GOP */
+    param->intra_refresh_type = avctx->flags & AV_CODEC_FLAG_CLOSED_GOP ? 2 : 1;
 
     if (svt_enc->la_depth >= 0)
         param->look_ahead_distance  = svt_enc->la_depth;
@@ -548,6 +549,7 @@  static const AVCodecDefault eb_enc_defaults[] = {
     { "g",         "-1"    },
     { "qmin",      "0"     },
     { "qmax",      "63"    },
+    { "flags",     "+cgop" },
     { NULL },
 };