summaryrefslogtreecommitdiff
path: root/libavcodec/ratecontrol.c
diff options
context:
space:
mode:
authorMichael Niedermayer <michaelni@gmx.at>2002-12-06 13:30:13 +0000
committerMichael Niedermayer <michaelni@gmx.at>2002-12-06 13:30:13 +0000
commit0d1e924668b1384ffbf4282e077f262a2c538596 (patch)
tree153573a16989ffab7da464071019365dd05d3428 /libavcodec/ratecontrol.c
parent32db2b1d47804ca0b722449b17868eda723bc822 (diff)
downloadffmpeg-0d1e924668b1384ffbf4282e077f262a2c538596.tar.gz
fixing 2pass assert failure
better dynamic b frame selection, still not very good though allthough it works fine without 2pass now Originally committed as revision 1316 to svn://svn.ffmpeg.org/ffmpeg/trunk
Diffstat (limited to 'libavcodec/ratecontrol.c')
-rw-r--r--libavcodec/ratecontrol.c33
1 files changed, 1 insertions, 32 deletions
diff --git a/libavcodec/ratecontrol.c b/libavcodec/ratecontrol.c
index caea09b24b..e4f2340c74 100644
--- a/libavcodec/ratecontrol.c
+++ b/libavcodec/ratecontrol.c
@@ -714,38 +714,7 @@ static int init_pass2(MpegEncContext *s)
for(i=0; i<rcc->num_entries; i++){
RateControlEntry *rce= &rcc->entry[i];
- if(s->b_frame_strategy==0 || s->max_b_frames==0){
- rce->new_pict_type= rce->pict_type;
- }else{
- int j;
- int next_non_b_type=P_TYPE;
-
- switch(rce->pict_type){
- case I_TYPE:
- if(i-last_i_frame>s->gop_size/2){ //FIXME this is not optimal
- rce->new_pict_type= I_TYPE;
- last_i_frame= i;
- }else{
- rce->new_pict_type= P_TYPE; // will be caught by the scene detection anyway
- }
- break;
- case P_TYPE:
- rce->new_pict_type= P_TYPE;
- break;
- case B_TYPE:
- for(j=i+1; j<i+s->max_b_frames+2 && j<rcc->num_entries; j++){
- if(rcc->entry[j].pict_type != B_TYPE){
- next_non_b_type= rcc->entry[j].pict_type;
- break;
- }
- }
- if(next_non_b_type==I_TYPE)
- rce->new_pict_type= P_TYPE;
- else
- rce->new_pict_type= B_TYPE;
- break;
- }
- }
+ rce->new_pict_type= rce->pict_type;
rcc->i_cplx_sum [rce->pict_type] += rce->i_tex_bits*rce->qscale;
rcc->p_cplx_sum [rce->pict_type] += rce->p_tex_bits*rce->qscale;
rcc->mv_bits_sum[rce->pict_type] += rce->mv_bits;