static float video_b_qoffset = 1.25;
static float video_i_qfactor = -0.8;
static float video_i_qoffset = 0.0;
+static int video_intra_quant_bias= FF_DEFAULT_QUANT_BIAS;
+static int video_inter_quant_bias= FF_DEFAULT_QUANT_BIAS;
static int me_method = ME_EPZS;
static int video_disable = 0;
static int video_codec_id = CODEC_ID_NONE;
static int use_alt_scan = 0;
static int use_trell = 0;
static int use_scan_offset = 0;
+static int closed_gop = 0;
static int do_deinterlace = 0;
static int do_interlace_dct = 0;
static int do_interlace_me = 0;
static int strict = 0;
static int top_field_first = -1;
static int noise_reduction = 0;
+static int sc_threshold = 0;
static int debug = 0;
static int debug_mv = 0;
extern int loop_input; /* currently a hack */
file_table[file_index].eof_reached = 1;
continue;
}
+
if (!pkt.size) {
stream_no_data = is;
} else {
video_i_qoffset = atof(arg);
}
+static void opt_ibias(const char *arg)
+{
+ video_intra_quant_bias = atoi(arg);
+}
+static void opt_pbias(const char *arg)
+{
+ video_inter_quant_bias = atoi(arg);
+}
+
static void opt_packet_size(const char *arg)
{
packet_size= atoi(arg);
noise_reduction= atoi(arg);
}
+static void opt_sc_threshold(const char *arg)
+{
+ sc_threshold= atoi(arg);
+}
+
static void opt_audio_bitrate(const char *arg)
{
audio_bit_rate = atoi(arg) * 1000;
if (use_scan_offset) {
video_enc->flags |= CODEC_FLAG_SVCD_SCAN_OFFSET;
}
+ if (closed_gop) {
+ video_enc->flags |= CODEC_FLAG_CLOSED_GOP;
+ }
if (b_frames) {
video_enc->max_b_frames = b_frames;
video_enc->b_frame_strategy = 0;
video_enc->b_quant_factor = video_b_qfactor;
video_enc->i_quant_offset = video_i_qoffset;
video_enc->b_quant_offset = video_b_qoffset;
+ video_enc->intra_quant_bias = video_intra_quant_bias;
+ video_enc->inter_quant_bias = video_inter_quant_bias;
video_enc->dct_algo = dct_algo;
video_enc->idct_algo = idct_algo;
video_enc->strict_std_compliance = strict;
video_enc->error_rate = error_rate;
video_enc->noise_reduction= noise_reduction;
+ video_enc->scenechange_threshold= sc_threshold;
if(packet_size){
video_enc->rtp_mode= 1;
video_enc->rtp_payload_size= packet_size;
{ "i_qfactor", HAS_ARG | OPT_EXPERT | OPT_VIDEO, {(void*)opt_i_qfactor}, "qp factor between p and i frames", "factor" },
{ "b_qoffset", HAS_ARG | OPT_EXPERT | OPT_VIDEO, {(void*)opt_b_qoffset}, "qp offset between p and b frames", "offset" },
{ "i_qoffset", HAS_ARG | OPT_EXPERT | OPT_VIDEO, {(void*)opt_i_qoffset}, "qp offset between p and i frames", "offset" },
+ { "ibias", HAS_ARG | OPT_EXPERT | OPT_VIDEO, {(void*)opt_ibias}, "intra quant bias", "bias" },
+ { "pbias", HAS_ARG | OPT_EXPERT | OPT_VIDEO, {(void*)opt_pbias}, "inter quant bias", "bias" },
// { "b_strategy", HAS_ARG | OPT_EXPERT, {(void*)opt_b_strategy}, "dynamic b frame selection strategy", "strategy" },
{ "rc_eq", HAS_ARG | OPT_EXPERT | OPT_VIDEO, {(void*)opt_video_rc_eq}, "set rate control equation", "equation" },
{ "rc_override", HAS_ARG | OPT_EXPERT | OPT_VIDEO, {(void*)opt_video_rc_override_string}, "rate control override for specific intervals", "override" },
{ "umv", OPT_BOOL | OPT_EXPERT | OPT_VIDEO, {(void*)&use_umv}, "enable Unlimited Motion Vector (h263+)" },
{ "alt", OPT_BOOL | OPT_EXPERT | OPT_VIDEO, {(void*)&use_alt_scan}, "enable alternate scantable (mpeg2)" },
{ "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" },
{ "scan_offset", OPT_BOOL | OPT_EXPERT | OPT_VIDEO, {(void*)&use_scan_offset}, "enable SVCD Scan Offset placeholder" },
{ "intra_matrix", HAS_ARG | OPT_EXPERT | OPT_VIDEO, {(void*)opt_intra_matrix}, "specify intra matrix coeffs", "matrix" },
{ "inter_matrix", HAS_ARG | OPT_EXPERT | OPT_VIDEO, {(void*)opt_inter_matrix}, "specify inter matrix coeffs", "matrix" },
{ "top", HAS_ARG | OPT_EXPERT | OPT_VIDEO, {(void*)opt_top_field_first}, "top=1/bottom=0/auto=-1 field first", "" },
{ "nr", HAS_ARG | OPT_EXPERT | OPT_VIDEO, {(void*)opt_noise_reduction}, "noise reduction", "" },
+ { "sc_threshold", HAS_ARG | OPT_EXPERT | OPT_VIDEO, {(void*)opt_sc_threshold}, "scene change threshold", "threshold" },
/* audio options */
{ "ab", HAS_ARG | OPT_AUDIO, {(void*)opt_audio_bitrate}, "set audio bitrate (in kbit/s)", "bitrate", },
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;
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;
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;
//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++){