[FFmpeg-devel] From: Sven Dueking <sven at nablet.com>

Sven Dueking sven at nablet.com
Fri Aug 14 12:07:18 CEST 2015



> -----Urspr√ľngliche Nachricht-----
> Von: ffmpeg-devel [mailto:ffmpeg-devel-bounces at ffmpeg.org] Im Auftrag
> von Michael Niedermayer
> Gesendet: Freitag, 14. August 2015 11:55
> An: FFmpeg development discussions and patches
> Betreff: Re: [FFmpeg-devel] From: Sven Dueking <sven at nablet.com>
> 
> On Fri, Aug 14, 2015 at 10:34:29AM +0100, Sven Dueking wrote:
> > ---
> >  libavcodec/qsvenc.c | 2 +-
> >  1 file changed, 1 insertion(+), 1 deletion(-)
> >
> > diff --git a/libavcodec/qsvenc.c b/libavcodec/qsvenc.c index
> > 57f5fe4..af4b5af 100644
> > --- a/libavcodec/qsvenc.c
> > +++ b/libavcodec/qsvenc.c
> > @@ -121,7 +121,7 @@ static int init_video_param(AVCodecContext
> *avctx, QSVEncContext *q)
> >      case MFX_RATECONTROL_VBR:
> >          q->param.mfx.InitialDelayInKB = avctx-
> >rc_initial_buffer_occupancy / 1000;
> >          q->param.mfx.TargetKbps       = avctx->bit_rate / 1000;
> > -        q->param.mfx.MaxKbps          = avctx->bit_rate / 1000;
> > +        q->param.mfx.MaxKbps          = q-
> >param.mfx.RateControlMethod == MFX_RATECONTROL_VBR ? avctx-
> >rc_max_rate / 1000 : avctx->bit_rate / 1000;
> 
> thats still containing the unneeded CBR special case you can either
> explain why this should be done or remove it
> 
> In the code currently MFX_RATECONTROL_CBR implies
> avctx->rc_max_rate == avctx->bit_rate

Correct.

> 
> if avctx->rc_max_rate == avctx->bit_rate then either
> avctx->rc_max_rate or avctx->bit_rate can be used interchagable

Correct.

> 
> q->param.mfx.MaxKbps = avctx->rc_max_rate
> is the correct code for VBR and CBR

Okay, got it. I should do remove

q->param.mfx.MaxKbps          = avctx->bit_rate / 1000;

and use

q->param.mfx.MaxKbps          = avctx-> rc_max_rate / 1000;

for both cases. I will send another patch ...

> 
> if rc_max_rate is unequal bit_rate then its not CBR and
> MFX_RATECONTROL_CBR should not be set.

Correct.

> Is any of the statements above wrong, am i missing something ?


Nope, you are right and I should check double check everything the next
time.

> 
> 
> [...]
> --
> Michael     GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB
> 
> Republics decline into democracies and democracies degenerate into
> despotisms. -- Aristotle



More information about the ffmpeg-devel mailing list