[x264-devel] 2-pass Rate Control Question?
Gabriel Bouvigne
gabriel.bouvigne at joost.com
Wed May 21 17:04:34 CEST 2008
static double count_expected_bits( x264_t *h )
{
x264_ratecontrol_t *rcc = h->rc;
double expected_bits = 0;
int i;
for(i=0; i<rcc->num_entries; i++)
{
ratecontrol_entry_t *rce = &rcc->entry[i];
if ( i>0 ) /*display order to coding order*/
{
if ( rcc->entry[i-1].pict_type == SLICE_TYPE_B )
rce = &rcc->entry[i-1];
else if ( rcc->entry[i].pict_type == SLICE_TYPE_B )
{
int j=i;
do
{
j++;
rce = &rcc->entry[j];
} while (rce->pict_type == SLICE_TYPE_B);
}
}
rce->expected_bits = expected_bits;
expected_bits += qscale2bits(rce, rce->new_qscale);
}
return expected_bits;
}
More information about the x264-devel
mailing list