[Ffmpeg-cvslog] r7213 - trunk/libavcodec/utils.c

Guillaume POIRIER poirierg
Mon Dec 4 14:19:46 CET 2006


Hi,

On 12/4/06, Diego Biurrun <diego at biurrun.de> wrote:
> On Sun, Dec 03, 2006 at 01:48:42AM +0100, Baptiste Coudurier wrote:
> >
> > diego wrote:
> > > [...]
> > >
> > >  {"maxrate", "set max video bitrate tolerance (in bits/s)", OFFSET(rc_max_rate), FF_OPT_TYPE_INT, DEFAULT, INT_MIN, INT_MAX, V|E},
> > >  {"minrate", "set min video bitrate tolerance (in bits/s)", OFFSET(rc_min_rate), FF_OPT_TYPE_INT, DEFAULT, INT_MIN, INT_MAX, V|E},
> > >  {"bufsize", "set ratecontrol buffer size (in bits)", OFFSET(rc_buffer_size), FF_OPT_TYPE_INT, DEFAULT, INT_MIN, INT_MAX, V|E},
> > > -{"rc_buf_aggressivity", NULL, OFFSET(rc_buffer_aggressivity), FF_OPT_TYPE_FLOAT, 1.0, FLT_MIN, FLT_MAX, V|E},
> > > +{"rc_buf_aggressivity", "currently useless", OFFSET(rc_buffer_aggressivity), FF_OPT_TYPE_FLOAT, 1.0, FLT_MIN, FLT_MAX, V|E},
> >
> > Is it ? It seems used in ratecontrol.c

Confirmed:

grep -r "rc_buffer_aggressivity" libavcodec/ | grep -v "svn"
libavcodec/utils.c:{"rc_buf_aggressivity", "currently useless",
OFFSET(rc_buffer_aggressivity), FF_OPT_TYPE_FLOAT, 1.0, FLT_MIN,
FLT_MAX, V|E},
libavcodec/avcodec.h:    float rc_buffer_aggressivity;
libavcodec/ratecontrol.c:            q*= pow(d,
1.0/s->avctx->rc_buffer_aggressivity);
libavcodec/ratecontrol.c:            q/= pow(d,
1.0/s->avctx->rc_buffer_aggressivity);
libavcodec/ratecontrol.c://printf("q:%f max:%f min:%f size:%f index:%d
bits:%f agr:%f\n", q,max_rate, min_rate, buffer_size,
rcc->buffer_index, bits, s->avctx->rc_buffer_aggressivity);

Michael, could you maybe explain what's the use of this option?
Given the name of this option, I'd be tempted to say that it's
equivaleent to Xvid's  overflow_control_strength:

       overflow_control_strength=<0-100>
              During pass one of two pass encoding, a scaled bitrate
curve is computed.  The difference between that expected curve and the
result obtained during encoding is called overflow.  Obvious-
              ly, the two pass rate controller tries to compensate for
that overflow, distributing it over the next frames.  This setting
controls how much of the overflow  is  distributed  every  time
              there  is a new frame.  Low values allow lazy overflow
control, big rate bursts are compensated for more slowly (could lead
to lack of precision for small clips).  Higher values will make
              changes in bit redistribution more abrupt, possibly too
abrupt if you set it too high, creating artifacts (default: 5).
              NOTE: This setting impacts quality a lot, play with it carefully!

If it's not the right description I'm quite confident it's possible to
find an equivalent option in Xvid... :-)


> > >  {"i_qfactor", "qp factor between p and i frames", OFFSET(i_quant_factor), FF_OPT_TYPE_FLOAT, -0.8, -FLT_MAX, FLT_MAX, V|E},
> >
> > Just to say, that option is useless, same for b_qfactor.
>
> Well, then the MPlayer man page needs to be fixed.  Guillaume?

grep doesn't seem to agree:

grep -r "b_quant_factor" libavcodec/ | grep -v "svn"
libavcodec/mpegvideo.c:    b_lambda= s->last_lambda_for[B_TYPE];
//p_lambda *FFABS(s->avctx->b_quant_factor) +
s->avctx->b_quant_offset;
libavcodec/utils.c:{"b_qfactor", "qp factor between p and b frames",
OFFSET(b_quant_factor), FF_OPT_TYPE_FLOAT, 1.25, FLT_MIN, FLT_MAX,
V|E},
libavcodec/x264.c:    x4->params.rc.f_pb_factor = avctx->b_quant_factor;
libavcodec/avcodec.h:    float b_quant_factor;
libavcodec/ratecontrol.c:    else if(pict_type==B_TYPE &&
s->avctx->b_quant_factor<0.0)
libavcodec/ratecontrol.c:        q= -q*s->avctx->b_quant_factor +
s->avctx->b_quant_offset;
libavcodec/ratecontrol.c:    else if(pict_type==B_TYPE && a->b_quant_factor>0.0)
libavcodec/ratecontrol.c:        q= last_non_b_q*    a->b_quant_factor
 + a->b_quant_offset;
libavcodec/ratecontrol.c:        qmin=
(int)(qmin*FFABS(s->avctx->b_quant_factor)+s->avctx->b_quant_offset +
0.5);
libavcodec/ratecontrol.c:        qmax=
(int)(qmax*FFABS(s->avctx->b_quant_factor)+s->avctx->b_quant_offset +
0.5);
libavcodec/xvidff.c:    xvid_enc_create.bquant_ratio = 100 *
avctx->b_quant_factor;
libavcodec/xvid_rc.c:    xvid_plg_data.bquant_ratio = 100; // *
s->avctx->b_quant_factor;
libavcodec/xvid_rc.c:        return xvid_plg_data.quant * FF_QP2LAMBDA
* s->avctx->b_quant_factor + s->avctx->b_quant_offset;



grep -r "i_quant_factor" libavcodec/ | grep -v "svn"
libavcodec/utils.c:{"i_qfactor", "qp factor between p and i frames",
OFFSET(i_quant_factor), FF_OPT_TYPE_FLOAT, -0.8, -FLT_MAX, FLT_MAX,
V|E},
libavcodec/x264.c:    x4->params.rc.f_ip_factor = 1/fabs(avctx->i_quant_factor);
libavcodec/avcodec.h:    float i_quant_factor;
libavcodec/ratecontrol.c:    if     (pict_type==I_TYPE &&
s->avctx->i_quant_factor<0.0)
libavcodec/ratecontrol.c:        q= -q*s->avctx->i_quant_factor +
s->avctx->i_quant_offset;
libavcodec/ratecontrol.c:    if     (pict_type==I_TYPE &&
(a->i_quant_factor>0.0 || rcc->last_non_b_pict_type==P_TYPE))
libavcodec/ratecontrol.c:        q= last_p_q
*FFABS(a->i_quant_factor) + a->i_quant_offset;
libavcodec/ratecontrol.c:        qmin=
(int)(qmin*FFABS(s->avctx->i_quant_factor)+s->avctx->i_quant_offset +
0.5);
libavcodec/ratecontrol.c:        qmax=
(int)(qmax*FFABS(s->avctx->i_quant_factor)+s->avctx->i_quant_offset +
0.5);


If they are useless, maybe they should be removed from the code.

Guillaume
-- 
An association of men who will not quarrel with one another is a thing
which has never yet existed, from the greatest confederacy of nations
down to a town meeting or a vestry.
 -- Thomas Jefferson
(when interviewed about MPlayer ML flamewars)
http://www.brainyquote.com/quotes/quotes/t/thomasjeff157207.html




More information about the ffmpeg-cvslog mailing list