Re: [FFmpeg-devel] [PATCH] Changed max bitrate for VBV mode (according to Ivan Uskow)

2015-08-14 Thread Michael Niedermayer
On Fri, Aug 14, 2015 at 10:42:38AM +0200, Sven Dueking wrote:
> 
> 
> > -Ursprüngliche Nachricht-
> > Von: ffmpeg-devel [mailto:ffmpeg-devel-boun...@ffmpeg.org] Im Auftrag
> > von Michael Niedermayer
> > Gesendet: Freitag, 14. August 2015 10:32
> > An: FFmpeg development discussions and patches
> > Betreff: Re: [FFmpeg-devel] [PATCH] Changed max bitrate for VBV mode
> > (according to Ivan Uskow)
> > 
> > On Fri, Aug 14, 2015 at 07:37:08AM +0200, Sven Dueking wrote:
> > >
> > >
> > > > -Ursprüngliche Nachricht-
> > > > Von: ffmpeg-devel [mailto:ffmpeg-devel-boun...@ffmpeg.org] Im
> > > > Auftrag von Michael Niedermayer
> > > > Gesendet: Donnerstag, 13. August 2015 17:41
> > > > An: FFmpeg development discussions and patches
> > > > Cc: Sven Dueking
> > > > Betreff: Re: [FFmpeg-devel] [PATCH] Changed max bitrate for VBV
> > mode
> > > > (according to Ivan Uskow)
> > > >
> > > > On Thu, Aug 13, 2015 at 11:30:45AM +0100, Sven Dueking wrote:
> > > > > From: Sven Dueking 
> > > > >
> > > > > ---
> > > > >  libavcodec/qsvenc.c | 6 +-
> > > > >  1 file changed, 5 insertions(+), 1 deletion(-)
> > > > >
> > > > > diff --git a/libavcodec/qsvenc.c b/libavcodec/qsvenc.c index
> > > > > 57f5fe4..b56e4b4 100644
> > > > > --- a/libavcodec/qsvenc.c
> > > > > +++ b/libavcodec/qsvenc.c
> > > > > @@ -118,10 +118,14 @@ static int init_video_param(AVCodecContext
> > > > > *avctx, QSVEncContext *q)
> > > > >
> > > > >  switch (q->param.mfx.RateControlMethod) {
> > > > >  case MFX_RATECONTROL_CBR:
> > > > > + 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;
> > > > > +break;
> > > > >  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  = avctx->rc_max_rate /
> > 1000;
> > > >
> > > > why is rc_max_rate not used for MFX_RATECONTROL_CBR ?
> > >
> > > Hi Michael,
> > >
> > > Ivan is on vacation and I did the fix according to his last command :
> > >
> > > "This correct for MFX_RATECONTROL_CBR but a bug for
> > MFX_RATECONTROL_VBR.
> > > Will fixed later. For any case part of ratecontrol setup should be
> > > re-designed to support more advanced LA rate contol"
> > >
> > > The Intel Documentation states that :
> > >
> > > For variable bitrate control, the MaxKbps parameter specifies the
> > > maximum bitrate at which the encoded data enters the Video Buffering
> > > Verifier (VBV) buffer.
> > >
> > > And for CBR the target bitrate and max bitrate should be equal to
> > > archive a bitrate that is near a desired target for streaming (no
> > > peaks etc.)
> > 
> > In the code there is this:
> > 
> > } else if (avctx->rc_max_rate == avctx->bit_rate) {
> > q->param.mfx.RateControlMethod = MFX_RATECONTROL_CBR;
> > ratecontrol_desc = "constant bitrate (CBR)";
> > 
> > assuming thats how CBR is set, the variables are equal and the special
> > case is not needed am i missing something ?
> 
> No, you are right. I missed that. So max_rate and bit_rate have the same
> value..  means you can ignore my patch or keep it for readability.

the patch also changes MaxKbps for
MFX_RATECONTROL_VBR

that change looks correct, do you agree ?
if so please resubmit a patch with only it

thanks

[...]
-- 
Michael GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB

Those who are too smart to engage in politics are punished by being
governed by those who are dumber. -- Plato 


signature.asc
Description: Digital signature
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-devel


Re: [FFmpeg-devel] [PATCH] Changed max bitrate for VBV mode (according to Ivan Uskow)

2015-08-14 Thread Sven Dueking


> -Ursprüngliche Nachricht-
> Von: ffmpeg-devel [mailto:ffmpeg-devel-boun...@ffmpeg.org] Im Auftrag
> von Michael Niedermayer
> Gesendet: Freitag, 14. August 2015 10:32
> An: FFmpeg development discussions and patches
> Betreff: Re: [FFmpeg-devel] [PATCH] Changed max bitrate for VBV mode
> (according to Ivan Uskow)
> 
> On Fri, Aug 14, 2015 at 07:37:08AM +0200, Sven Dueking wrote:
> >
> >
> > > -Ursprüngliche Nachricht-
> > > Von: ffmpeg-devel [mailto:ffmpeg-devel-boun...@ffmpeg.org] Im
> > > Auftrag von Michael Niedermayer
> > > Gesendet: Donnerstag, 13. August 2015 17:41
> > > An: FFmpeg development discussions and patches
> > > Cc: Sven Dueking
> > > Betreff: Re: [FFmpeg-devel] [PATCH] Changed max bitrate for VBV
> mode
> > > (according to Ivan Uskow)
> > >
> > > On Thu, Aug 13, 2015 at 11:30:45AM +0100, Sven Dueking wrote:
> > > > From: Sven Dueking 
> > > >
> > > > ---
> > > >  libavcodec/qsvenc.c | 6 +-
> > > >  1 file changed, 5 insertions(+), 1 deletion(-)
> > > >
> > > > diff --git a/libavcodec/qsvenc.c b/libavcodec/qsvenc.c index
> > > > 57f5fe4..b56e4b4 100644
> > > > --- a/libavcodec/qsvenc.c
> > > > +++ b/libavcodec/qsvenc.c
> > > > @@ -118,10 +118,14 @@ static int init_video_param(AVCodecContext
> > > > *avctx, QSVEncContext *q)
> > > >
> > > >  switch (q->param.mfx.RateControlMethod) {
> > > >  case MFX_RATECONTROL_CBR:
> > > > +   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;
> > > > +break;
> > > >  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  = avctx->rc_max_rate /
> 1000;
> > >
> > > why is rc_max_rate not used for MFX_RATECONTROL_CBR ?
> >
> > Hi Michael,
> >
> > Ivan is on vacation and I did the fix according to his last command :
> >
> > "This correct for MFX_RATECONTROL_CBR but a bug for
> MFX_RATECONTROL_VBR.
> > Will fixed later. For any case part of ratecontrol setup should be
> > re-designed to support more advanced LA rate contol"
> >
> > The Intel Documentation states that :
> >
> > For variable bitrate control, the MaxKbps parameter specifies the
> > maximum bitrate at which the encoded data enters the Video Buffering
> > Verifier (VBV) buffer.
> >
> > And for CBR the target bitrate and max bitrate should be equal to
> > archive a bitrate that is near a desired target for streaming (no
> > peaks etc.)
> 
> In the code there is this:
> 
> } else if (avctx->rc_max_rate == avctx->bit_rate) {
> q->param.mfx.RateControlMethod = MFX_RATECONTROL_CBR;
> ratecontrol_desc = "constant bitrate (CBR)";
> 
> assuming thats how CBR is set, the variables are equal and the special
> case is not needed am i missing something ?

No, you are right. I missed that. So max_rate and bit_rate have the same
value..  means you can ignore my patch or keep it for readability.

> 
> [...]
> --
> Michael GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB
> 
> The misfortune of the wise is better than the prosperity of the fool.
> -- Epicurus

___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-devel


Re: [FFmpeg-devel] [PATCH] Changed max bitrate for VBV mode (according to Ivan Uskow)

2015-08-14 Thread Michael Niedermayer
On Fri, Aug 14, 2015 at 07:37:08AM +0200, Sven Dueking wrote:
> 
> 
> > -Ursprüngliche Nachricht-
> > Von: ffmpeg-devel [mailto:ffmpeg-devel-boun...@ffmpeg.org] Im Auftrag
> > von Michael Niedermayer
> > Gesendet: Donnerstag, 13. August 2015 17:41
> > An: FFmpeg development discussions and patches
> > Cc: Sven Dueking
> > Betreff: Re: [FFmpeg-devel] [PATCH] Changed max bitrate for VBV mode
> > (according to Ivan Uskow)
> > 
> > On Thu, Aug 13, 2015 at 11:30:45AM +0100, Sven Dueking wrote:
> > > From: Sven Dueking 
> > >
> > > ---
> > >  libavcodec/qsvenc.c | 6 +-
> > >  1 file changed, 5 insertions(+), 1 deletion(-)
> > >
> > > diff --git a/libavcodec/qsvenc.c b/libavcodec/qsvenc.c index
> > > 57f5fe4..b56e4b4 100644
> > > --- a/libavcodec/qsvenc.c
> > > +++ b/libavcodec/qsvenc.c
> > > @@ -118,10 +118,14 @@ static int init_video_param(AVCodecContext
> > > *avctx, QSVEncContext *q)
> > >
> > >  switch (q->param.mfx.RateControlMethod) {
> > >  case MFX_RATECONTROL_CBR:
> > > + 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;
> > > +break;
> > >  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  = avctx->rc_max_rate / 1000;
> > 
> > why is rc_max_rate not used for MFX_RATECONTROL_CBR ?
> 
> Hi Michael,
> 
> Ivan is on vacation and I did the fix according to his last command : 
> 
> "This correct for MFX_RATECONTROL_CBR but a bug for MFX_RATECONTROL_VBR.
> Will fixed later. For any case part of ratecontrol setup should be
> re-designed to support more advanced LA rate contol"
> 
> The Intel Documentation states that : 
> 
> For variable bitrate control, the MaxKbps parameter specifies the maximum
> bitrate at which the encoded data enters the Video Buffering Verifier (VBV)
> buffer. 
> 
> And for CBR the target bitrate and max bitrate should be equal to archive a
> bitrate that is near a desired target for streaming (no peaks etc.)

In the code there is this:

} else if (avctx->rc_max_rate == avctx->bit_rate) {
q->param.mfx.RateControlMethod = MFX_RATECONTROL_CBR;
ratecontrol_desc = "constant bitrate (CBR)";

assuming thats how CBR is set, the variables are equal and the special
case is not needed
am i missing something ?

[...]
-- 
Michael GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB

The misfortune of the wise is better than the prosperity of the fool.
-- Epicurus


signature.asc
Description: Digital signature
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-devel


Re: [FFmpeg-devel] [PATCH] Changed max bitrate for VBV mode (according to Ivan Uskow)

2015-08-13 Thread Sven Dueking


> -Ursprüngliche Nachricht-
> Von: ffmpeg-devel [mailto:ffmpeg-devel-boun...@ffmpeg.org] Im Auftrag
> von Michael Niedermayer
> Gesendet: Donnerstag, 13. August 2015 17:41
> An: FFmpeg development discussions and patches
> Cc: Sven Dueking
> Betreff: Re: [FFmpeg-devel] [PATCH] Changed max bitrate for VBV mode
> (according to Ivan Uskow)
> 
> On Thu, Aug 13, 2015 at 11:30:45AM +0100, Sven Dueking wrote:
> > From: Sven Dueking 
> >
> > ---
> >  libavcodec/qsvenc.c | 6 +-
> >  1 file changed, 5 insertions(+), 1 deletion(-)
> >
> > diff --git a/libavcodec/qsvenc.c b/libavcodec/qsvenc.c index
> > 57f5fe4..b56e4b4 100644
> > --- a/libavcodec/qsvenc.c
> > +++ b/libavcodec/qsvenc.c
> > @@ -118,10 +118,14 @@ static int init_video_param(AVCodecContext
> > *avctx, QSVEncContext *q)
> >
> >  switch (q->param.mfx.RateControlMethod) {
> >  case MFX_RATECONTROL_CBR:
> > +   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;
> > +break;
> >  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  = avctx->rc_max_rate / 1000;
> 
> why is rc_max_rate not used for MFX_RATECONTROL_CBR ?

Hi Michael,

Ivan is on vacation and I did the fix according to his last command : 

"This correct for MFX_RATECONTROL_CBR but a bug for MFX_RATECONTROL_VBR.
Will fixed later. For any case part of ratecontrol setup should be
re-designed to support more advanced LA rate contol"

The Intel Documentation states that : 

For variable bitrate control, the MaxKbps parameter specifies the maximum
bitrate at which the encoded data enters the Video Buffering Verifier (VBV)
buffer. 

And for CBR the target bitrate and max bitrate should be equal to archive a
bitrate that is near a desired target for streaming (no peaks etc.)

Btw, sorry for sending the patch twice
> 
> [...]
> --
> Michael GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB
> 
> There will always be a question for which you do not know the correct
> answer.

___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-devel


Re: [FFmpeg-devel] [PATCH] Changed max bitrate for VBV mode (according to Ivan Uskow)

2015-08-13 Thread Michael Niedermayer
On Thu, Aug 13, 2015 at 11:30:45AM +0100, Sven Dueking wrote:
> From: Sven Dueking 
> 
> ---
>  libavcodec/qsvenc.c | 6 +-
>  1 file changed, 5 insertions(+), 1 deletion(-)
> 
> diff --git a/libavcodec/qsvenc.c b/libavcodec/qsvenc.c
> index 57f5fe4..b56e4b4 100644
> --- a/libavcodec/qsvenc.c
> +++ b/libavcodec/qsvenc.c
> @@ -118,10 +118,14 @@ static int init_video_param(AVCodecContext *avctx, 
> QSVEncContext *q)
>  
>  switch (q->param.mfx.RateControlMethod) {
>  case MFX_RATECONTROL_CBR:
> + 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;
> +break;
>  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  = avctx->rc_max_rate / 1000;

why is rc_max_rate not used for MFX_RATECONTROL_CBR ?

[...]
-- 
Michael GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB

There will always be a question for which you do not know the correct answer.


signature.asc
Description: Digital signature
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-devel


[FFmpeg-devel] [PATCH] Changed max bitrate for VBV mode (according to Ivan Uskow)

2015-08-13 Thread Sven Dueking
From: Sven Dueking 

---
 libavcodec/qsvenc.c | 6 +-
 1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/libavcodec/qsvenc.c b/libavcodec/qsvenc.c
index 57f5fe4..b56e4b4 100644
--- a/libavcodec/qsvenc.c
+++ b/libavcodec/qsvenc.c
@@ -118,10 +118,14 @@ static int init_video_param(AVCodecContext *avctx, 
QSVEncContext *q)
 
 switch (q->param.mfx.RateControlMethod) {
 case MFX_RATECONTROL_CBR:
+   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;
+break;
 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  = avctx->rc_max_rate / 1000;
 break;
 case MFX_RATECONTROL_CQP:
 quant = avctx->global_quality / FF_QP2LAMBDA;
-- 
1.8.3.1

___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-devel


[FFmpeg-devel] [PATCH] Changed max bitrate for VBV mode (according to Ivan Uskow)

2015-08-13 Thread Sven Dueking
From: Sven Dueking 

---
 libavcodec/qsvenc.c | 6 +-
 1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/libavcodec/qsvenc.c b/libavcodec/qsvenc.c
index 57f5fe4..b56e4b4 100644
--- a/libavcodec/qsvenc.c
+++ b/libavcodec/qsvenc.c
@@ -118,10 +118,14 @@ static int init_video_param(AVCodecContext *avctx, 
QSVEncContext *q)
 
 switch (q->param.mfx.RateControlMethod) {
 case MFX_RATECONTROL_CBR:
+   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;
+break;
 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  = avctx->rc_max_rate / 1000;
 break;
 case MFX_RATECONTROL_CQP:
 quant = avctx->global_quality / FF_QP2LAMBDA;
-- 
1.8.3.1

___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-devel