1
0
mirror of https://github.com/FFmpeg/FFmpeg.git synced 2024-12-23 12:43:46 +02:00

support strictly enforcing gop size

Originally committed as revision 3594 to svn://svn.ffmpeg.org/ffmpeg/trunk
This commit is contained in:
Michael Niedermayer 2004-10-15 02:37:04 +00:00
parent 9efc77c86f
commit 035817727f
3 changed files with 10 additions and 0 deletions

View File

@ -162,6 +162,7 @@ static int use_qprd = 0;
static int use_cbprd = 0; static int use_cbprd = 0;
static int qns = 0; static int qns = 0;
static int closed_gop = 0; static int closed_gop = 0;
static int strict_gop = 0;
static int do_deinterlace = 0; static int do_deinterlace = 0;
static int do_interlace_dct = 0; static int do_interlace_dct = 0;
static int do_interlace_me = 0; static int do_interlace_me = 0;
@ -3075,6 +3076,9 @@ static void opt_output_file(const char *filename)
if (closed_gop) { if (closed_gop) {
video_enc->flags |= CODEC_FLAG_CLOSED_GOP; video_enc->flags |= CODEC_FLAG_CLOSED_GOP;
} }
if (strict_gop) {
video_enc->flags2 |= CODEC_FLAG2_STRICT_GOP;
}
if (use_qpel) { if (use_qpel) {
video_enc->flags |= CODEC_FLAG_QPEL; video_enc->flags |= CODEC_FLAG_QPEL;
} }
@ -3847,6 +3851,7 @@ const OptionDef options[] = {
{ "cbp", OPT_BOOL | OPT_EXPERT | OPT_VIDEO, {(void*)&use_cbprd}, "" }, { "cbp", OPT_BOOL | OPT_EXPERT | OPT_VIDEO, {(void*)&use_cbprd}, "" },
{ "trell", OPT_BOOL | OPT_EXPERT | OPT_VIDEO, {(void*)&use_trell}, "enable trellis quantization" }, { "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" }, { "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" }, { "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" }, { "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" }, { "intra_matrix", HAS_ARG | OPT_EXPERT | OPT_VIDEO, {(void*)opt_intra_matrix}, "specify intra matrix coeffs", "matrix" },

View File

@ -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_SVCD_SCAN_OFFSET 0x40000000 ///< will reserve space for SVCD scan offset user data
#define CODEC_FLAG_CLOSED_GOP 0x80000000 #define CODEC_FLAG_CLOSED_GOP 0x80000000
#define CODEC_FLAG2_FAST 0x00000001 ///< allow non spec compliant speedup tricks #define CODEC_FLAG2_FAST 0x00000001 ///< allow non spec compliant speedup tricks
#define CODEC_FLAG2_STRICT_GOP 0x00000002 ///< strictly enforce GOP size
/* Unsupported options : /* Unsupported options :
* Syntax Arithmetic coding (SAC) * Syntax Arithmetic coding (SAC)

View File

@ -2064,9 +2064,13 @@ static void select_input_picture(MpegEncContext *s){
} }
if(s->picture_in_gop_number + b_frames >= s->gop_size){ 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) if(s->flags & CODEC_FLAG_CLOSED_GOP)
b_frames=0; b_frames=0;
s->input_picture[b_frames]->pict_type= I_TYPE; s->input_picture[b_frames]->pict_type= I_TYPE;
}
} }
if( (s->flags & CODEC_FLAG_CLOSED_GOP) if( (s->flags & CODEC_FLAG_CLOSED_GOP)