s->lambda_table[mb_xy]= intq;
}
}
+
+void ff_get_2pass_fcode(MpegEncContext *s){
+ RateControlContext *rcc= &s->rc_context;
+ int picture_number= s->picture_number;
+ RateControlEntry *rce;
+
+ rce= &rcc->entry[picture_number];
+ s->f_code= rce->f_code;
+ s->b_code= rce->b_code;
+}
+
//FIXME rd or at least approx for dquant
-float ff_rate_estimate_qscale(MpegEncContext *s)
+float ff_rate_estimate_qscale(MpegEncContext *s, int dry_run)
{
float q;
int qmin, qmax;
fps= 1/av_q2d(s->avctx->time_base);
//printf("input_pic_num:%d pic_num:%d frame_rate:%d\n", s->input_picture_number, s->picture_number, s->frame_rate);
/* update predictors */
- if(picture_number>2){
+ if(picture_number>2 && !dry_run){
const int last_var= s->last_pict_type == I_TYPE ? rcc->last_mb_var_sum : rcc->last_mc_mb_var_sum;
update_predictor(&rcc->pred[s->last_pict_type], rcc->last_qscale, sqrt(last_var), s->frame_bits);
}
else
q= (int)(q + 0.5);
- rcc->last_qscale= q;
- rcc->last_mc_mb_var_sum= pic->mc_mb_var_sum;
- rcc->last_mb_var_sum= pic->mb_var_sum;
+ if(!dry_run){
+ rcc->last_qscale= q;
+ rcc->last_mc_mb_var_sum= pic->mc_mb_var_sum;
+ rcc->last_mb_var_sum= pic->mb_var_sum;
+ }
#if 0
{
static int mvsum=0, texsum=0;