Commit c7634bc6 authored by michael's avatar michael

better f_code guessing in 2nd pass


git-svn-id: file:///var/local/repositories/ffmpeg/trunk@4766 9553f0bf-9b14-0410-a0b8-cfaf0461ba5b
parent 9aef52d7
...@@ -5298,9 +5298,10 @@ static void encode_picture(MpegEncContext *s, int picture_number) ...@@ -5298,9 +5298,10 @@ static void encode_picture(MpegEncContext *s, int picture_number)
s->no_rounding ^= 1; s->no_rounding ^= 1;
} }
if(s->flags & CODEC_FLAG_PASS2) if(s->flags & CODEC_FLAG_PASS2){
estimate_qp(s, 1); estimate_qp(s, 1);
else if(!(s->flags & CODEC_FLAG_QSCALE)){ ff_get_2pass_fcode(s);
}else if(!(s->flags & CODEC_FLAG_QSCALE)){
RateControlContext *rcc= &s->rc_context; RateControlContext *rcc= &s->rc_context;
if(s->pict_type==B_TYPE) if(s->pict_type==B_TYPE)
......
...@@ -980,6 +980,6 @@ double ff_eval(char *s, double *const_value, const char **const_name, ...@@ -980,6 +980,6 @@ double ff_eval(char *s, double *const_value, const char **const_name,
double (**func2)(void *, double, double), char **func2_name, double (**func2)(void *, double, double), char **func2_name,
void *opaque); void *opaque);
int ff_vbv_update(MpegEncContext *s, int frame_size); int ff_vbv_update(MpegEncContext *s, int frame_size);
void ff_get_2pass_fcode(MpegEncContext *s);
#endif /* AVCODEC_MPEGVIDEO_H */ #endif /* AVCODEC_MPEGVIDEO_H */
...@@ -607,6 +607,17 @@ static void adaptive_quantization(MpegEncContext *s, double q){ ...@@ -607,6 +607,17 @@ static void adaptive_quantization(MpegEncContext *s, double q){
s->lambda_table[mb_xy]= intq; 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 //FIXME rd or at least approx for dquant
float ff_rate_estimate_qscale(MpegEncContext *s, int dry_run) float ff_rate_estimate_qscale(MpegEncContext *s, int dry_run)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment