[x264-devel] Question about the rate control algorithm

Khaled MAMOU khaled_mamou at yahoo.fr
Fri Oct 12 09:48:08 CEST 2012


Dear all,
Please, is there any documentation describing more in details the rate
control algorithm?
I have question regarding the function update_vbv().

static int update_vbv( x264_t *h, int bits )
{
...
    rct->buffer_fill_final -= (uint64_t)bits * h->sps->vui.i_time_scale;

    if( rct->buffer_fill_final < 0 )
        x264_log( h, X264_LOG_WARNING, "VBV underflow (frame %d, %.0f
bits)\n", h->i_frame, (double)rct->buffer_fill_final /
h->sps->vui.i_time_scale );
    rct->buffer_fill_final = X264_MAX( rct->buffer_fill_final, 0 );
    rct->buffer_fill_final += (uint64_t)bitrate *
h->sps->vui.i_num_units_in_tick * h->fenc->i_cpb_duration;
...
}

If I understand well, the decoder buffer level is updated by
subtracting the number of bits used to encode the last AU and adding
the number of bits transmitted during the AU time. Is this supposing
that the encoder buffer will never become empty (i.e., the time needed
to transmit the bits in the encoder buffer is always higher than the
time between two successive AUs)?


Cheers,
--Khaled


More information about the x264-devel mailing list