[x264-devel] comments is not consistent with source code.

jogging song joggingsong at gmail.com
Sun Apr 29 05:23:14 CEST 2007


Hi,
   Now I am reading the source code of rate control in x264. The function
clip_qscale adjusts qscale according to vbv buffer state.
I find some comments are not consistent with source codes.
Here is the codes:

        /* Check B-frame complexity, and use up any bits that would
         * overflow before the next P-frame. */
        if( h->sh.i_type == SLICE_TYPE_P )
        {
            int nb = rcc->bframes;
            double pbbits = bits;
            double bbits = predict_size( rcc->pred_b_from_p, q * h->
param.rc.f_pb_factor, rcc->last_satd );
            double space;

            if( bbits > rcc->buffer_rate )
                nb = 0;
            pbbits += nb * bbits;

            space = rcc->buffer_fill + (1+nb)*rcc->buffer_rate -
rcc->buffer_size;
            if( pbbits < space )
            {
                q *= X264_MAX( pbbits / space,
                               bits / (0.5 * rcc->buffer_size) );
            }
            q = X264_MAX( q0-5, q );
        }

The comments tell us that the following codes adjust qscale for B slices.
But the codes are executed in the case the slice is P.
I have one question. VBV buffer allows us to change the rate according the
content of current frame. But how do we make good use of
vbv buffer? What is the objective pf vbv buffer in rate control? Try to make
it full always?

Thanks
Jogging
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mailman.videolan.org/pipermail/x264-devel/attachments/20070429/abcd0e60/attachment.htm 


More information about the x264-devel mailing list