summaryrefslogtreecommitdiff
path: root/libavcodec/mpegvideo.c
diff options
context:
space:
mode:
authorMichael Niedermayer <michaelni@gmx.at>2002-03-28 22:50:22 +0000
committerMichael Niedermayer <michaelni@gmx.at>2002-03-28 22:50:22 +0000
commit4d69fbc99ef807e278165c9ad09b6a38c2a20de4 (patch)
tree5ee2433fd8a323297205de4c538ea871c7597de4 /libavcodec/mpegvideo.c
parent649c00c96d7044aed46d70623e47d7434318e6b9 (diff)
force frame type for 2-pass encoding
Originally committed as revision 365 to svn://svn.ffmpeg.org/ffmpeg/trunk
Diffstat (limited to 'libavcodec/mpegvideo.c')
-rw-r--r--libavcodec/mpegvideo.c7
1 files changed, 4 insertions, 3 deletions
diff --git a/libavcodec/mpegvideo.c b/libavcodec/mpegvideo.c
index 1c8bcbdfa6..2a7aca21d2 100644
--- a/libavcodec/mpegvideo.c
+++ b/libavcodec/mpegvideo.c
@@ -514,9 +514,10 @@ int MPV_encode_picture(AVCodecContext *avctx,
init_put_bits(&s->pb, buf, buf_size, NULL, NULL);
+ s->force_type= avctx->force_type;
if (!s->intra_only) {
/* first picture of GOP is intra */
- if (s->picture_in_gop_number % s->gop_size==0){
+ if (s->picture_in_gop_number % s->gop_size==0 || s->force_type==I_TYPE){
s->picture_in_gop_number=0;
s->pict_type = I_TYPE;
}else
@@ -1313,7 +1314,7 @@ static void encode_picture(MpegEncContext *s, int picture_number)
memset(s->mb_type , MB_TYPE_INTRA, sizeof(UINT8)*s->mb_width*s->mb_height);
}
- if(s->avg_mb_var < s->mc_mb_var && s->pict_type != B_TYPE){ //FIXME subtract MV bits
+ if(s->avg_mb_var < s->mc_mb_var && s->pict_type != B_TYPE && (!s->force_type)){ //FIXME subtract MV bits
s->pict_type= I_TYPE;
s->picture_in_gop_number=0;
memset(s->mb_type , MB_TYPE_INTRA, sizeof(UINT8)*s->mb_width*s->mb_height);
@@ -1955,7 +1956,7 @@ static int rate_estimate_qscale(MpegEncContext *s)
double fps;
INT64 wanted_bits;
emms_c();
-
+
fps= (double)s->frame_rate / FRAME_RATE_BASE;
wanted_bits= s->bit_rate*(double)s->picture_number/fps;