b frames + cbr fix

Originally committed as revision 2730 to svn://svn.ffmpeg.org/ffmpeg/trunk
This commit is contained in:
Michael Niedermayer 2004-01-29 15:50:54 +00:00
parent 8fd19ab286
commit 2c8b796fa9
1 changed files with 46 additions and 43 deletions

View File

@ -1939,7 +1939,6 @@ int MPV_encode_picture(AVCodecContext *avctx,
for(i=0; i<4; i++){
avctx->error[i] += s->current_picture_ptr->error[i];
}
}
flush_put_bits(&s->pb);
s->frame_bits = (pbBufPtr(&s->pb) - s->pb.buf) * 8;
@ -1983,9 +1982,13 @@ int MPV_encode_picture(AVCodecContext *avctx,
s->vbv_delay_ptr[2] &= 0x07;
s->vbv_delay_ptr[2] |= vbv_delay<<3;
}
s->total_bits += s->frame_bits;
avctx->frame_bits = s->frame_bits;
}else{
assert((pbBufPtr(&s->pb) == s->pb.buf));
s->frame_bits=0;
}
assert((s->frame_bits&7)==0);
return s->frame_bits/8;
}