diff mbox series

[FFmpeg-devel] avcodec/libkvazaar: Set default ratecontrol algorithm for libkvazaar

Message ID db6c703e-c878-5d17-4841-e04337c26304@tuni.fi
State Accepted
Headers show
Series [FFmpeg-devel] avcodec/libkvazaar: Set default ratecontrol algorithm for libkvazaar | expand

Checks

Context Check Description
andriy/configure warning Failed to apply patch

Commit Message

Joose Sainio Dec. 10, 2020, 6:08 a.m. UTC
The standalone version of Kvazaar sets a default ratecontrol algorithm when
bitrate is set. Mirror this behaviour.

Signed-off-by: Joose Sainio <joose.sainio@tuni.fi>
---
  libavcodec/libkvazaar.c | 3 +++
  1 file changed, 3 insertions(+)

Comments

Linjie Fu Dec. 10, 2020, 7:28 a.m. UTC | #1
On Thu, Dec 10, 2020 at 2:09 PM Joose Sainio <joose.sainio@tuni.fi> wrote:
>
> The standalone version of Kvazaar sets a default ratecontrol algorithm when
> bitrate is set. Mirror this behaviour.
>
> Signed-off-by: Joose Sainio <joose.sainio@tuni.fi>
> ---
>   libavcodec/libkvazaar.c | 3 +++
>   1 file changed, 3 insertions(+)
>
> diff --git a/libavcodec/libkvazaar.c b/libavcodec/libkvazaar.c
> index 9032547678..68ce7ad58c 100644
> --- a/libavcodec/libkvazaar.c
> +++ b/libavcodec/libkvazaar.c
> @@ -95,6 +95,9 @@ static av_cold int libkvazaar_init(AVCodecContext *avctx)
>       cfg->target_bitrate = avctx->bit_rate;
>       cfg->vui.sar_width  = avctx->sample_aspect_ratio.num;
>       cfg->vui.sar_height = avctx->sample_aspect_ratio.den;
> +    if(avctx->bit_rate){
> +        cfg->rc_algorithm = KVZ_LAMBDA;
> +    }
>
>       if (ctx->kvz_params) {
>           AVDictionary *dict = NULL;
>
>
Looks reasonable,  fixed the encoding failure if explicitly setting
bitrate through "-b:v 3M".
And the result matches the behaviour of -kvazaar-params "bitrate=3000000".

- linjie
Linjie Fu Jan. 1, 2021, 1:55 p.m. UTC | #2
On Thu, Dec 10, 2020 at 3:28 PM Linjie Fu <linjie.justin.fu@gmail.com> wrote:
>
> On Thu, Dec 10, 2020 at 2:09 PM Joose Sainio <joose.sainio@tuni.fi> wrote:
> >
> > The standalone version of Kvazaar sets a default ratecontrol algorithm when
> > bitrate is set. Mirror this behaviour.
> >
> > Signed-off-by: Joose Sainio <joose.sainio@tuni.fi>
> > ---
> >   libavcodec/libkvazaar.c | 3 +++
> >   1 file changed, 3 insertions(+)
> >
> > diff --git a/libavcodec/libkvazaar.c b/libavcodec/libkvazaar.c
> > index 9032547678..68ce7ad58c 100644
> > --- a/libavcodec/libkvazaar.c
> > +++ b/libavcodec/libkvazaar.c
> > @@ -95,6 +95,9 @@ static av_cold int libkvazaar_init(AVCodecContext *avctx)
> >       cfg->target_bitrate = avctx->bit_rate;
> >       cfg->vui.sar_width  = avctx->sample_aspect_ratio.num;
> >       cfg->vui.sar_height = avctx->sample_aspect_ratio.den;
> > +    if(avctx->bit_rate){
> > +        cfg->rc_algorithm = KVZ_LAMBDA;
> > +    }
> >
> >       if (ctx->kvz_params) {
> >           AVDictionary *dict = NULL;
> >
> >
> Looks reasonable,  fixed the encoding failure if explicitly setting
> bitrate through "-b:v 3M".
> And the result matches the behaviour of -kvazaar-params "bitrate=3000000".
>
Prefer to apply if no objection.

- linjie
Linjie Fu Jan. 4, 2021, 3:46 p.m. UTC | #3
On Fri, Jan 1, 2021 at 9:55 PM Linjie Fu <linjie.justin.fu@gmail.com> wrote:
>
> On Thu, Dec 10, 2020 at 3:28 PM Linjie Fu <linjie.justin.fu@gmail.com> wrote:
> >
> > On Thu, Dec 10, 2020 at 2:09 PM Joose Sainio <joose.sainio@tuni.fi> wrote:
> > >
> > > The standalone version of Kvazaar sets a default ratecontrol algorithm when
> > > bitrate is set. Mirror this behaviour.
> > >
> > > Signed-off-by: Joose Sainio <joose.sainio@tuni.fi>
> > > ---
> > >   libavcodec/libkvazaar.c | 3 +++
> > >   1 file changed, 3 insertions(+)
> > >
> > > diff --git a/libavcodec/libkvazaar.c b/libavcodec/libkvazaar.c
> > > index 9032547678..68ce7ad58c 100644
> > > --- a/libavcodec/libkvazaar.c
> > > +++ b/libavcodec/libkvazaar.c
> > > @@ -95,6 +95,9 @@ static av_cold int libkvazaar_init(AVCodecContext *avctx)
> > >       cfg->target_bitrate = avctx->bit_rate;
> > >       cfg->vui.sar_width  = avctx->sample_aspect_ratio.num;
> > >       cfg->vui.sar_height = avctx->sample_aspect_ratio.den;
> > > +    if(avctx->bit_rate){
> > > +        cfg->rc_algorithm = KVZ_LAMBDA;
> > > +    }
> > >
> > >       if (ctx->kvz_params) {
> > >           AVDictionary *dict = NULL;
> > >
> > >
> > Looks reasonable,  fixed the encoding failure if explicitly setting
> > bitrate through "-b:v 3M".
> > And the result matches the behaviour of -kvazaar-params "bitrate=3000000".
> >
> Prefer to apply if no objection.
>
Fixed the coding style, rebased and applied, thx.

- linjie
diff mbox series

Patch

diff --git a/libavcodec/libkvazaar.c b/libavcodec/libkvazaar.c
index 9032547678..68ce7ad58c 100644
--- a/libavcodec/libkvazaar.c
+++ b/libavcodec/libkvazaar.c
@@ -95,6 +95,9 @@  static av_cold int libkvazaar_init(AVCodecContext *avctx)
      cfg->target_bitrate = avctx->bit_rate;
      cfg->vui.sar_width  = avctx->sample_aspect_ratio.num;
      cfg->vui.sar_height = avctx->sample_aspect_ratio.den;
+    if(avctx->bit_rate){
+        cfg->rc_algorithm = KVZ_LAMBDA;
+    }

      if (ctx->kvz_params) {
          AVDictionary *dict = NULL;