diff options
author | Michael Niedermayer <michaelni@gmx.at> | 2004-10-15 02:37:04 +0000 |
---|---|---|
committer | Michael Niedermayer <michaelni@gmx.at> | 2004-10-15 02:37:04 +0000 |
commit | 035817727fc64430631f3489ee10add63ff6cdc0 (patch) | |
tree | 0a557523630c64dd87039e9654f7fd5d555e5cd9 | |
parent | 9efc77c86f0360d8447fe1c655ad0fd35b23f305 (diff) | |
download | ffmpeg-035817727fc64430631f3489ee10add63ff6cdc0.tar.gz |
support strictly enforcing gop size
Originally committed as revision 3594 to svn://svn.ffmpeg.org/ffmpeg/trunk
-rw-r--r-- | ffmpeg.c | 5 | ||||
-rw-r--r-- | libavcodec/avcodec.h | 1 | ||||
-rw-r--r-- | libavcodec/mpegvideo.c | 4 |
3 files changed, 10 insertions, 0 deletions
@@ -162,6 +162,7 @@ static int use_qprd = 0; static int use_cbprd = 0; static int qns = 0; static int closed_gop = 0; +static int strict_gop = 0; static int do_deinterlace = 0; static int do_interlace_dct = 0; static int do_interlace_me = 0; @@ -3075,6 +3076,9 @@ static void opt_output_file(const char *filename) if (closed_gop) { video_enc->flags |= CODEC_FLAG_CLOSED_GOP; } + if (strict_gop) { + video_enc->flags2 |= CODEC_FLAG2_STRICT_GOP; + } if (use_qpel) { video_enc->flags |= CODEC_FLAG_QPEL; } @@ -3847,6 +3851,7 @@ const OptionDef options[] = { { "cbp", OPT_BOOL | OPT_EXPERT | OPT_VIDEO, {(void*)&use_cbprd}, "" }, { "trell", OPT_BOOL | OPT_EXPERT | OPT_VIDEO, {(void*)&use_trell}, "enable trellis quantization" }, { "cgop", OPT_BOOL | OPT_EXPERT | OPT_VIDEO, {(void*)&closed_gop}, "closed gop" }, + { "sgop", OPT_BOOL | OPT_EXPERT | OPT_VIDEO, {(void*)&strict_gop}, "strict gop" }, { "scan_offset", OPT_BOOL | OPT_EXPERT | OPT_VIDEO, {(void*)&use_scan_offset}, "enable SVCD Scan Offset placeholder" }, { "qpel", OPT_BOOL | OPT_EXPERT | OPT_VIDEO, {(void*)&use_qpel}, "enable 1/4-pel" }, { "intra_matrix", HAS_ARG | OPT_EXPERT | OPT_VIDEO, {(void*)opt_intra_matrix}, "specify intra matrix coeffs", "matrix" }, diff --git a/libavcodec/avcodec.h b/libavcodec/avcodec.h index a1888faf2c..e653d32161 100644 --- a/libavcodec/avcodec.h +++ b/libavcodec/avcodec.h @@ -296,6 +296,7 @@ extern int motion_estimation_method; #define CODEC_FLAG_SVCD_SCAN_OFFSET 0x40000000 ///< will reserve space for SVCD scan offset user data #define CODEC_FLAG_CLOSED_GOP 0x80000000 #define CODEC_FLAG2_FAST 0x00000001 ///< allow non spec compliant speedup tricks +#define CODEC_FLAG2_STRICT_GOP 0x00000002 ///< strictly enforce GOP size /* Unsupported options : * Syntax Arithmetic coding (SAC) diff --git a/libavcodec/mpegvideo.c b/libavcodec/mpegvideo.c index f5e835975c..fc7cd00540 100644 --- a/libavcodec/mpegvideo.c +++ b/libavcodec/mpegvideo.c @@ -2064,9 +2064,13 @@ static void select_input_picture(MpegEncContext *s){ } if(s->picture_in_gop_number + b_frames >= s->gop_size){ + if((s->flags2 & CODEC_FLAG2_STRICT_GOP) && s->gop_size > s->picture_in_gop_number){ + b_frames= s->gop_size - s->picture_in_gop_number - 1; + }else{ 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) |