Commit 03581772 authored by Michael Niedermayer's avatar Michael Niedermayer

support strictly enforcing gop size

Originally committed as revision 3594 to svn://svn.ffmpeg.org/ffmpeg/trunk
parent 9efc77c8
......@@ -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" },
......
......@@ -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)
......
......@@ -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)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment