diff options
author | Michael Niedermayer <michaelni@gmx.at> | 2004-01-22 19:48:28 +0000 |
---|---|---|
committer | Michael Niedermayer <michaelni@gmx.at> | 2004-01-22 19:48:28 +0000 |
commit | 303e50e65b8b9dc66ef9929a5a638a16378da64c (patch) | |
tree | 1c4844019a66159a182fa2b059d008deda908c59 /libavcodec/mpegvideo.c | |
parent | d398a27e0b98f2d575d4e69ce4974768dff9f7d8 (diff) | |
download | ffmpeg-303e50e65b8b9dc66ef9929a5a638a16378da64c.tar.gz |
closed gop support & flags2 as all bits in flags are used
and a few minor things i forgot to commit ...
Originally committed as revision 2718 to svn://svn.ffmpeg.org/ffmpeg/trunk
Diffstat (limited to 'libavcodec/mpegvideo.c')
-rw-r--r-- | libavcodec/mpegvideo.c | 24 |
1 files changed, 19 insertions, 5 deletions
diff --git a/libavcodec/mpegvideo.c b/libavcodec/mpegvideo.c index 3f21349385..ec29e4d8bf 100644 --- a/libavcodec/mpegvideo.c +++ b/libavcodec/mpegvideo.c @@ -408,6 +408,7 @@ int MPV_common_init(MpegEncContext *s) DCT_common_init(s); s->flags= s->avctx->flags; + s->flags2= s->avctx->flags2; s->mb_width = (s->width + 15) / 16; s->mb_height = (s->height + 15) / 16; @@ -700,6 +701,7 @@ int MPV_encode_init(AVCodecContext *avctx) s->gop_size = avctx->gop_size; s->avctx = avctx; s->flags= avctx->flags; + s->flags2= avctx->flags2; s->max_b_frames= avctx->max_b_frames; s->codec_id= avctx->codec->id; s->luma_elim_threshold = avctx->luma_elim_threshold; @@ -789,6 +791,11 @@ int MPV_encode_init(AVCodecContext *avctx) return -1; } + if(s->avctx->scenechange_threshold < 1000000000 && (s->flags & CODEC_FLAG_CLOSED_GOP)){ + av_log(avctx, AV_LOG_ERROR, "closed gop with scene change detection arent supported yet\n"); + return -1; + } + if(s->codec_id==CODEC_ID_MJPEG){ s->intra_quant_bias= 1<<(QUANT_BIAS_SHIFT-1); //(a + x/2)/x s->inter_quant_bias= 0; @@ -1809,12 +1816,19 @@ static void select_input_picture(MpegEncContext *s){ //static int b_count=0; //b_count+= b_frames; //av_log(s->avctx, AV_LOG_DEBUG, "b_frames: %d\n", b_count); - + if(s->picture_in_gop_number + b_frames >= s->gop_size){ + if(s->flags & CODEC_FLAG_CLOSED_GOP) + b_frames=0; + s->input_picture[b_frames]->pict_type= I_TYPE; + } + + if( (s->flags & CODEC_FLAG_CLOSED_GOP) + && b_frames + && s->input_picture[b_frames]->pict_type== I_TYPE) + b_frames--; + s->reordered_input_picture[0]= s->input_picture[b_frames]; - if( s->picture_in_gop_number + b_frames >= s->gop_size - || s->reordered_input_picture[0]->pict_type== I_TYPE) - s->reordered_input_picture[0]->pict_type= I_TYPE; - else + if(s->reordered_input_picture[0]->pict_type != I_TYPE) s->reordered_input_picture[0]->pict_type= P_TYPE; s->reordered_input_picture[0]->coded_picture_number= s->coded_picture_number++; for(i=0; i<b_frames; i++){ |