diff options
author | Michael Niedermayer <michaelni@gmx.at> | 2005-09-12 10:23:52 +0000 |
---|---|---|
committer | Michael Niedermayer <michaelni@gmx.at> | 2005-09-12 10:23:52 +0000 |
commit | 637b5326f3441b53e2f1004085c4d570ba2d7758 (patch) | |
tree | c4aa46543c6451b669d811a9ffa60331880c8307 | |
parent | a1689e2f19957c45b6f2b2fc0063b304826a8887 (diff) | |
download | ffmpeg-637b5326f3441b53e2f1004085c4d570ba2d7758.tar.gz |
convert some options in ffmpeg.c to AVOptions
Originally committed as revision 4586 to svn://svn.ffmpeg.org/ffmpeg/trunk
-rw-r--r-- | ffmpeg.c | 222 | ||||
-rw-r--r-- | libavcodec/opt.c | 37 | ||||
-rw-r--r-- | libavcodec/utils.c | 124 | ||||
-rw-r--r-- | tests/libav.regression.ref | 2 | ||||
-rwxr-xr-x | tests/regression.sh | 42 |
5 files changed, 186 insertions, 241 deletions
@@ -66,6 +66,7 @@ extern const OptionDef options[]; static void show_help(void); static void show_license(void); +static int opt_default(const char *opt, const char *arg); #define MAX_FILES 20 @@ -154,61 +155,31 @@ static float dark_mask = 0; static float scplx_mask = 0; static float tcplx_mask = 0; static float p_mask = 0; -static int use_4mv = 0; -static int use_obmc = 0; -static int use_loop = 0; -static int use_aic = 0; -static int use_aiv = 0; -static int use_umv = 0; -static int use_ss = 0; -static int use_alt_scan = 0; -static int use_trell = 0; -static int use_scan_offset = 0; -static int use_qpel = 0; -static int use_qprd = 0; -static int use_cbprd = 0; -static int use_mv0 = 0; -static int do_normalize_aqp = 0; static int qns = 0; -static int closed_gop = 0; -static int strict_gop = 0; -static int no_output = 0; static int do_deinterlace = 0; -static int do_interlace_dct = 0; -static int do_interlace_me = 0; static int workaround_bugs = FF_BUG_AUTODETECT; static int error_resilience = FF_ER_CAREFULL; static int error_concealment = 3; -static int dct_algo = 0; -static int idct_algo = 0; -static int use_part = 0; static int packet_size = 0; static int error_rate = 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; static int me_threshold = 0; static int mb_threshold = 0; static int intra_dc_precision = 8; static int coder = 0; static int context = 0; static int predictor = 0; -static int video_profile = FF_PROFILE_UNKNOWN; -static int video_level = FF_LEVEL_UNKNOWN; static int nsse_weight = 8; -static int subpel_quality= 8; static int me_penalty_compensation= 256; -static int lowres= 0; static int frame_skip_threshold= 0; static int frame_skip_factor= 0; static int frame_skip_exp= 0; static int frame_skip_cmp= FF_CMP_DCTMAX; extern int loop_input; /* currently a hack */ static int loop_output = AVFMT_NOOUTPUTLOOP; -static int gray_only = 0; static int genpts = 0; static int gop_size = 12; @@ -246,7 +217,6 @@ static int do_pkt_dump = 0; static int do_psnr = 0; static int do_vstats = 0; static int do_pass = 0; -static int bitexact = 0; static char *pass_logfilename = NULL; static int audio_stream_copy = 0; static int video_stream_copy = 0; @@ -983,7 +953,7 @@ static void do_video_out(AVFormatContext *s, /* better than nothing: use input picture interlaced settings */ big_picture.interlaced_frame = in_picture->interlaced_frame; - if(do_interlace_me || do_interlace_dct){ + if(avctx_opts->flags & (CODEC_FLAG_INTERLACED_DCT|CODEC_FLAG_INTERLACED_ME)){ if(top_field_first == -1) big_picture.top_field_first = in_picture->top_field_first; else @@ -2289,16 +2259,6 @@ static void opt_workaround_bugs(const char *arg) workaround_bugs = atoi(arg); } -static void opt_dct_algo(const char *arg) -{ - dct_algo = atoi(arg); -} - -static void opt_idct_algo(const char *arg) -{ - idct_algo = atoi(arg); -} - static void opt_me_threshold(const char *arg) { me_threshold = atoi(arg); @@ -2319,17 +2279,6 @@ static void opt_error_concealment(const char *arg) error_concealment = atoi(arg); } -static void opt_debug(const char *arg) -{ - debug = atoi(arg); - av_log_set_level(AV_LOG_DEBUG); -} - -static void opt_vismv(const char *arg) -{ - debug_mv = atoi(arg); -} - static void opt_verbose(const char *arg) { verbose = atoi(arg); @@ -3059,6 +3008,7 @@ static void opt_input_file(const char *filename) /* update the current parameters so that they match the one of the input stream */ for(i=0;i<ic->nb_streams;i++) { + int j; AVCodecContext *enc = ic->streams[i]->codec; #if defined(HAVE_THREADS) if(thread_count>1) @@ -3067,6 +3017,12 @@ static void opt_input_file(const char *filename) enc->thread_count= thread_count; switch(enc->codec_type) { case CODEC_TYPE_AUDIO: + for(j=0; j<opt_name_count; j++){ + AVOption *opt; + double d= av_get_double(avctx_opts, opt_names[j], &opt); + if(d==d && (opt->flags&AV_OPT_FLAG_AUDIO_PARAM) && (opt->flags&AV_OPT_FLAG_DECODING_PARAM)) + av_set_double(enc, opt_names[j], d); + } //fprintf(stderr, "\nInput Audio channels: %d", enc->channels); audio_channels = enc->channels; audio_sample_rate = enc->sample_rate; @@ -3074,6 +3030,12 @@ static void opt_input_file(const char *filename) ic->streams[i]->discard= AVDISCARD_ALL; break; case CODEC_TYPE_VIDEO: + for(j=0; j<opt_name_count; j++){ + AVOption *opt; + double d= av_get_double(avctx_opts, opt_names[j], &opt); + if(d==d && (opt->flags&AV_OPT_FLAG_VIDEO_PARAM) && (opt->flags&AV_OPT_FLAG_DECODING_PARAM)) + av_set_double(enc, opt_names[j], d); + } frame_height = enc->height; frame_width = enc->width; frame_aspect_ratio = av_q2d(enc->sample_aspect_ratio) * enc->width / enc->height; @@ -3083,17 +3045,9 @@ static void opt_input_file(const char *filename) enc->workaround_bugs = workaround_bugs; enc->error_resilience = error_resilience; enc->error_concealment = error_concealment; - enc->idct_algo = idct_algo; - enc->debug = debug; - enc->debug_mv = debug_mv; - enc->lowres= lowres; - if(lowres) enc->flags |= CODEC_FLAG_EMU_EDGE; - if(bitexact) - enc->flags|= CODEC_FLAG_BITEXACT; + if(enc->lowres) enc->flags |= CODEC_FLAG_EMU_EDGE; if(me_threshold) enc->debug |= FF_DEBUG_MV; - if(gray_only) - enc->flags |= CODEC_FLAG_GRAY; if (enc->time_base.den != rfps || enc->time_base.num != rfps_base) { @@ -3200,10 +3154,14 @@ static void new_video_stream(AVFormatContext *oc) video_enc->codec_tag= video_codec_tag; if( (video_global_header&1) - || (video_global_header==0 && (oc->oformat->flags & AVFMT_GLOBALHEADER))) + || (video_global_header==0 && (oc->oformat->flags & AVFMT_GLOBALHEADER))){ video_enc->flags |= CODEC_FLAG_GLOBAL_HEADER; - if(video_global_header&2) + avctx_opts->flags|= CODEC_FLAG_GLOBAL_HEADER; + } + if(video_global_header&2){ video_enc->flags2 |= CODEC_FLAG2_LOCAL_HEADER; + avctx_opts->flags2|= CODEC_FLAG2_LOCAL_HEADER; + } if (video_stream_copy) { st->stream_copy = 1; @@ -3278,9 +3236,6 @@ static void new_video_stream(AVFormatContext *oc) if(inter_matrix) video_enc->inter_matrix = inter_matrix; - if(bitexact) - video_enc->flags |= CODEC_FLAG_BITEXACT; - video_enc->mb_decision = mb_decision; video_enc->mb_cmp = mb_cmp; video_enc->ildct_cmp = ildct_cmp; @@ -3295,78 +3250,11 @@ static void new_video_stream(AVFormatContext *oc) video_enc->p_masking = p_mask; video_enc->quantizer_noise_shaping= qns; - if (use_umv) { - video_enc->flags |= CODEC_FLAG_H263P_UMV; - } - if (use_ss) { - video_enc->flags |= CODEC_FLAG_H263P_SLICE_STRUCT; - } - if (use_aic) { - video_enc->flags |= CODEC_FLAG_H263P_AIC; - } - if (use_aiv) { - video_enc->flags |= CODEC_FLAG_H263P_AIV; - } - if (use_4mv) { - video_enc->flags |= CODEC_FLAG_4MV; - } - if (use_obmc) { - video_enc->flags |= CODEC_FLAG_OBMC; - } - if (use_loop) { - video_enc->flags |= CODEC_FLAG_LOOP_FILTER; - } - - if(use_part) { - video_enc->flags |= CODEC_FLAG_PART; - } - if (use_alt_scan) { - video_enc->flags |= CODEC_FLAG_ALT_SCAN; - } - if (use_trell) { - video_enc->flags |= CODEC_FLAG_TRELLIS_QUANT; - } - if (use_mv0) { - video_enc->flags |= CODEC_FLAG_MV0; - } - if (do_normalize_aqp) { - video_enc->flags |= CODEC_FLAG_NORMALIZE_AQP; - } - if (use_scan_offset) { - video_enc->flags |= CODEC_FLAG_SVCD_SCAN_OFFSET; - } - 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; - } - if (use_qprd) { - video_enc->flags |= CODEC_FLAG_QP_RD; - } - if (use_cbprd) { - video_enc->flags |= CODEC_FLAG_CBP_RD; - } if (b_frames) { video_enc->max_b_frames = b_frames; video_enc->b_frame_strategy = b_strategy; video_enc->b_quant_factor = 2.0; } - if (do_interlace_dct) { - video_enc->flags |= CODEC_FLAG_INTERLACED_DCT; - } - if (do_interlace_me) { - video_enc->flags |= CODEC_FLAG_INTERLACED_ME; - } - if (no_output) { - video_enc->flags2 |= CODEC_FLAG2_NO_OUTPUT; - } - if (gray_only) { - video_enc->flags |= CODEC_FLAG_GRAY; - } video_enc->qmin = video_qmin; video_enc->qmax = video_qmax; video_enc->lmin = video_lmin; @@ -3378,8 +3266,6 @@ static void new_video_stream(AVFormatContext *oc) video_enc->qblur = video_qblur; video_enc->qcompress = video_qcomp; video_enc->rc_eq = video_rc_eq; - video_enc->debug = debug; - video_enc->debug_mv = debug_mv; video_enc->workaround_bugs = workaround_bugs; video_enc->thread_count = thread_count; p= video_rc_override_string; @@ -3420,8 +3306,6 @@ static void new_video_stream(AVFormatContext *oc) 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->me_threshold= me_threshold; video_enc->mb_threshold= mb_threshold; video_enc->intra_dc_precision= intra_dc_precision - 8; @@ -3433,10 +3317,7 @@ static void new_video_stream(AVFormatContext *oc) video_enc->coder_type= coder; video_enc->context_model= context; video_enc->prediction_method= predictor; - video_enc->profile= video_profile; - video_enc->level= video_level; video_enc->nsse_weight= nsse_weight; - video_enc->me_subpel_quality= subpel_quality; video_enc->me_penalty_compensation= me_penalty_compensation; video_enc->frame_skip_threshold= frame_skip_threshold; video_enc->frame_skip_factor= frame_skip_factor; @@ -3491,8 +3372,10 @@ static void new_audio_stream(AVFormatContext *oc) if(audio_codec_tag) audio_enc->codec_tag= audio_codec_tag; - if (oc->oformat->flags & AVFMT_GLOBALHEADER) + if (oc->oformat->flags & AVFMT_GLOBALHEADER) { audio_enc->flags |= CODEC_FLAG_GLOBAL_HEADER; + avctx_opts->flags|= CODEC_FLAG_GLOBAL_HEADER; + } if (audio_stream_copy) { st->stream_copy = 1; audio_enc->channels = audio_channels; @@ -3864,13 +3747,6 @@ static int64_t getutime(void) extern int ffm_nopts; -static void opt_bitexact(void) -{ - bitexact=1; - /* disable generate of real time pts in ffm (need to be supressed anyway) */ - ffm_nopts = 1; -} - static void show_formats(void) { AVInputFormat *ifmt; @@ -4139,7 +4015,8 @@ static void opt_target(const char *arg) video_rc_max_rate = 2516000; video_rc_min_rate = 0; //1145000; video_rc_buffer_size = 224*1024*8; - use_scan_offset = 1; + opt_default("flags", "+SCAN_OFFSET"); + audio_bit_rate = 224000; audio_sample_rate = 44100; @@ -4196,11 +4073,19 @@ static int opt_default(const char *opt, const char *arg){ AVOption *o= av_set_string(avctx_opts, opt, arg); if(!o) return -1; + +// av_log(NULL, AV_LOG_ERROR, "%s:%s: %f 0x%0X\n", opt, arg, av_get_double(avctx_opts, opt, NULL), (int)av_get_int(avctx_opts, opt, NULL)); //FIXME we should always use avctx_opts, ... for storing options so there wont be any need to keep track of whats set over this opt_names= av_realloc(opt_names, sizeof(void*)*(opt_name_count+1)); - opt_names[opt_name_count++]= opt; - + opt_names[opt_name_count++]= o->name; + + /* disable generate of real time pts in ffm (need to be supressed anyway) */ + if(avctx_opts->flags & CODEC_FLAG_BITEXACT) + ffm_nopts = 1; + + if(avctx_opts->debug) + av_log_set_level(AV_LOG_DEBUG); return 0; } @@ -4225,15 +4110,12 @@ const OptionDef options[] = { { "author", HAS_ARG | OPT_STRING, {(void*)&str_author}, "set the author", "string" }, { "copyright", HAS_ARG | OPT_STRING, {(void*)&str_copyright}, "set the copyright", "string" }, { "comment", HAS_ARG | OPT_STRING, {(void*)&str_comment}, "set the comment", "string" }, - { "debug", HAS_ARG | OPT_EXPERT, {(void*)opt_debug}, "print specific debug info", "" }, - { "vismv", HAS_ARG | OPT_EXPERT, {(void*)opt_vismv}, "visualize motion vectors", "" }, { "benchmark", OPT_BOOL | OPT_EXPERT, {(void*)&do_benchmark}, "add timings for benchmarking" }, { "dump", OPT_BOOL | OPT_EXPERT, {(void*)&do_pkt_dump}, "dump each input packet" }, { "hex", OPT_BOOL | OPT_EXPERT, {(void*)&do_hex_dump}, "when dumping packets, also dump the payload" }, - { "bitexact", OPT_EXPERT, {(void*)opt_bitexact}, "only use bit exact algorithms (for codec testing)" }, { "re", OPT_BOOL | OPT_EXPERT, {(void*)&rate_emu}, "read input at native frame rate", "" }, { "loop", OPT_BOOL | OPT_EXPERT, {(void*)&loop_input}, "loop (current only works with images)" }, { "loop_output", HAS_ARG | OPT_INT | OPT_EXPERT, {(void*)&loop_output}, "number of times to loop output in formats that support looping (0 loops forever)", "" }, @@ -4296,8 +4178,6 @@ const OptionDef options[] = { { "vcodec", HAS_ARG | OPT_VIDEO, {(void*)opt_video_codec}, "force video codec ('copy' to copy stream)", "codec" }, { "me", HAS_ARG | OPT_EXPERT | OPT_VIDEO, {(void*)opt_motion_estimation}, "set motion estimation method", "method" }, - { "dct_algo", HAS_ARG | OPT_EXPERT | OPT_VIDEO, {(void*)opt_dct_algo}, "set dct algo", "algo" }, - { "idct_algo", HAS_ARG | OPT_EXPERT | OPT_VIDEO, {(void*)opt_idct_algo}, "set idct algo", "algo" }, { "me_threshold", HAS_ARG | OPT_EXPERT | OPT_VIDEO, {(void*)opt_me_threshold}, "motion estimaton threshold", "" }, { "mb_threshold", HAS_ARG | OPT_EXPERT | OPT_VIDEO, {(void*)opt_mb_threshold}, "macroblock threshold", "" }, { "er", HAS_ARG | OPT_EXPERT | OPT_VIDEO, {(void*)opt_error_resilience}, "set error resilience", "n" }, @@ -4316,10 +4196,6 @@ const OptionDef options[] = { { "scplx_mask", HAS_ARG | OPT_EXPERT | OPT_VIDEO, {(void*)opt_scplx_mask}, "spatial complexity masking", "" }, { "tcplx_mask", HAS_ARG | OPT_EXPERT | OPT_VIDEO, {(void*)opt_tcplx_mask}, "temporal complexity masking", "" }, { "p_mask", HAS_ARG | OPT_EXPERT | OPT_VIDEO, {(void*)opt_p_mask}, "inter masking", "" }, - { "4mv", OPT_BOOL | OPT_EXPERT | OPT_VIDEO, {(void*)&use_4mv}, "use four motion vector by macroblock (MPEG4)" }, - { "obmc", OPT_BOOL | OPT_EXPERT | OPT_VIDEO, {(void*)&use_obmc}, "use overlapped block motion compensation (h263+)" }, - { "lf", OPT_BOOL | OPT_EXPERT | OPT_VIDEO, {(void*)&use_loop}, "use loop filter (h263+)" }, - { "part", OPT_BOOL | OPT_EXPERT | OPT_VIDEO, {(void*)&use_part}, "use data partitioning (MPEG4)" }, { "bug", HAS_ARG | OPT_EXPERT | OPT_VIDEO, {(void*)opt_workaround_bugs}, "workaround not auto detected encoder bugs", "param" }, { "ps", HAS_ARG | OPT_EXPERT, {(void*)opt_packet_size}, "set packet size in bits", "size" }, { "error", HAS_ARG | OPT_EXPERT, {(void*)opt_error_rate}, "error rate", "rate" }, @@ -4330,28 +4206,9 @@ const OptionDef options[] = { { "passlogfile", HAS_ARG | OPT_STRING | OPT_VIDEO, {(void*)&pass_logfilename}, "select two pass log file name", "file" }, { "deinterlace", OPT_BOOL | OPT_EXPERT | OPT_VIDEO, {(void*)&do_deinterlace}, "deinterlace pictures" }, - { "ildct", OPT_BOOL | OPT_EXPERT | OPT_VIDEO, {(void*)&do_interlace_dct}, - "force interlaced dct support in encoder (MPEG2/MPEG4)" }, - { "ilme", OPT_BOOL | OPT_EXPERT | OPT_VIDEO, {(void*)&do_interlace_me}, - "force interlaced me support in encoder (MPEG2/MPEG4)" }, { "psnr", OPT_BOOL | OPT_EXPERT | OPT_VIDEO, {(void*)&do_psnr}, "calculate PSNR of compressed frames" }, { "vstats", OPT_BOOL | OPT_EXPERT | OPT_VIDEO, {(void*)&do_vstats}, "dump video coding statistics to file" }, { "vhook", HAS_ARG | OPT_EXPERT | OPT_VIDEO, {(void*)add_frame_hooker}, "insert video processing module", "module" }, - { "aic", OPT_BOOL | OPT_EXPERT | OPT_VIDEO, {(void*)&use_aic}, "enable Advanced intra coding (h263+)" }, - { "aiv", OPT_BOOL | OPT_EXPERT | OPT_VIDEO, {(void*)&use_aiv}, "enable Alternative inter vlc (h263+)" }, - { "umv", OPT_BOOL | OPT_EXPERT | OPT_VIDEO, {(void*)&use_umv}, "enable Unlimited Motion Vector (h263+)" }, - { "ssm", OPT_BOOL | OPT_EXPERT | OPT_VIDEO, {(void*)&use_ss}, "enable Slice Structured mode (h263+)" }, - { "alt", OPT_BOOL | OPT_EXPERT | OPT_VIDEO, {(void*)&use_alt_scan}, "enable alternate scantable (MPEG2/MPEG4)" }, - { "qprd", OPT_BOOL | OPT_EXPERT | OPT_VIDEO, {(void*)&use_qprd}, "" }, - { "cbp", OPT_BOOL | OPT_EXPERT | OPT_VIDEO, {(void*)&use_cbprd}, "" }, - { "trell", OPT_BOOL | OPT_EXPERT | OPT_VIDEO, {(void*)&use_trell}, "enable trellis quantization" }, - { "mv0", OPT_BOOL | OPT_EXPERT | OPT_VIDEO, {(void*)&use_mv0}, "try to encode each MB with MV=<0,0> and choose the better one (has no effect if mbd=0)" }, - { "naq", OPT_BOOL | OPT_EXPERT | OPT_VIDEO, {(void*)&do_normalize_aqp}, "normalize adaptive 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" }, - { "noout", OPT_BOOL | OPT_EXPERT | OPT_VIDEO, {(void*)&no_output}, "skip bitstream encoding" }, - { "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" }, { "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", "" }, @@ -4363,18 +4220,13 @@ const OptionDef options[] = { { "coder", OPT_INT | HAS_ARG | OPT_EXPERT | OPT_VIDEO, {(void*)&coder}, "coder type", "" }, { "context", OPT_INT | HAS_ARG | OPT_EXPERT | OPT_VIDEO, {(void*)&context}, "context model", "" }, { "pred", OPT_INT | HAS_ARG | OPT_EXPERT | OPT_VIDEO, {(void*)&predictor}, "prediction method", "" }, - { "vprofile", OPT_INT | HAS_ARG | OPT_EXPERT | OPT_VIDEO, {(void*)&video_profile}, "profile", "" }, - { "vlevel", OPT_INT | HAS_ARG | OPT_EXPERT | OPT_VIDEO, {(void*)&video_level}, "level", "" }, { "nssew", OPT_INT | HAS_ARG | OPT_EXPERT | OPT_VIDEO, {(void*)&nsse_weight}, "weight", "" }, - { "subq", OPT_INT | HAS_ARG | OPT_EXPERT | OPT_VIDEO, {(void*)&subpel_quality}, "", "" }, { "mepc", OPT_INT | HAS_ARG | OPT_EXPERT | OPT_VIDEO, {(void*)&me_penalty_compensation}, "motion estimation bitrate penalty compensation", "factor (1.0 = 256)" }, - { "lowres", OPT_INT | HAS_ARG | OPT_EXPERT | OPT_VIDEO, {(void*)&lowres}, "", "" }, { "vtag", HAS_ARG | OPT_EXPERT | OPT_VIDEO, {(void*)opt_video_tag}, "force video tag/fourcc", "fourcc/tag" }, { "skip_threshold", OPT_INT | HAS_ARG | OPT_EXPERT | OPT_VIDEO, {(void*)&frame_skip_threshold}, "frame skip threshold", "threshold" }, { "skip_factor", OPT_INT | HAS_ARG | OPT_EXPERT | OPT_VIDEO, {(void*)&frame_skip_factor}, "frame skip factor", "factor" }, { "skip_exp", OPT_INT | HAS_ARG | OPT_EXPERT | OPT_VIDEO, {(void*)&frame_skip_exp}, "frame skip exponent", "exponent" }, { "skip_cmp", OPT_INT | HAS_ARG | OPT_EXPERT | OPT_VIDEO, {(void*)&frame_skip_cmp}, "frame skip compare function", "compare function" }, - { "gray", OPT_BOOL | OPT_EXPERT | OPT_VIDEO, { (void *)&gray_only }, "encode/decode grayscale" }, { "newvideo", OPT_VIDEO, {(void*)opt_new_video_stream}, "add a new video stream to the current output stream" }, { "genpts", OPT_BOOL | OPT_EXPERT | OPT_VIDEO, { (void *)&genpts }, "generate pts" }, diff --git a/libavcodec/opt.c b/libavcodec/opt.c index bf49767185..80770549b9 100644 --- a/libavcodec/opt.c +++ b/libavcodec/opt.c @@ -35,12 +35,12 @@ static double av_parse_num(const char *name, char **tail){ } //FIXME order them and do a bin search -static AVOption *find_opt(void *v, const char *name){ +static AVOption *find_opt(void *v, const char *name, const char *unit){ AVClass *c= *(AVClass**)v; //FIXME silly way of storing AVClass AVOption *o= c->option; for(;o && o->name; o++){ - if(!strcmp(o->name, name)) + if(!strcmp(o->name, name) && (!unit || !strcmp(o->unit, unit)) ) return o; } return NULL; @@ -53,7 +53,7 @@ AVOption *av_next_option(void *obj, AVOption *last){ } static AVOption *av_set_number(void *obj, const char *name, double num, int den, int64_t intnum){ - AVOption *o= find_opt(obj, name); + AVOption *o= find_opt(obj, name, NULL); void *dst; if(!o || o->offset<=0) return NULL; @@ -78,9 +78,30 @@ static AVOption *av_set_number(void *obj, const char *name, double num, int den, return o; } +static AVOption *set_all_opt(void *v, const char *unit, double d){ + AVClass *c= *(AVClass**)v; //FIXME silly way of storing AVClass + AVOption *o= c->option; + AVOption *ret=NULL; + + for(;o && o->name; o++){ + if(o->type != FF_OPT_TYPE_CONST && o->unit && !strcmp(o->unit, unit)){ + double tmp= d; + if(o->type == FF_OPT_TYPE_FLAGS) + tmp= av_get_int(v, o->name, NULL) | (int64_t)d; + + av_set_number(v, o->name, tmp, 1, 1); + ret= o; + } + } + return ret; +} + //FIXME use eval.c maybe? AVOption *av_set_string(void *obj, const char *name, const char *val){ - AVOption *o= find_opt(obj, name); + AVOption *o= find_opt(obj, name, NULL); + if(o && o->offset==0 && o->type == FF_OPT_TYPE_CONST && o->unit){ + return set_all_opt(obj, o->unit, o->default_val); + } if(!o || !val || o->offset<=0) return NULL; if(o->type != FF_OPT_TYPE_STRING){ @@ -100,8 +121,8 @@ AVOption *av_set_string(void *obj, const char *name, const char *val){ d= av_parse_num(buf, &tail); if(tail <= buf){ - AVOption *o_named= find_opt(obj, buf); - if(o_named && o_named->type == FF_OPT_TYPE_CONST && !strcmp(o_named->unit, o->unit)) + AVOption *o_named= find_opt(obj, buf, o->unit); + if(o_named && o_named->type == FF_OPT_TYPE_CONST) d= o_named->default_val; else if(!strcmp(buf, "default")) d= o->default_val; else if(!strcmp(buf, "max" )) d= o->max; @@ -143,7 +164,7 @@ AVOption *av_set_int(void *obj, const char *name, int64_t n){ * @param buf_len allocated length in bytes of buf */ const char *av_get_string(void *obj, const char *name, AVOption **o_out, char *buf, int buf_len){ - AVOption *o= find_opt(obj, name); + AVOption *o= find_opt(obj, name, NULL); void *dst; if(!o || o->offset<=0) return NULL; @@ -169,7 +190,7 @@ const char *av_get_string(void *obj, const char *name, AVOption **o_out, char *b } static int av_get_number(void *obj, const char *name, AVOption **o_out, double *num, int *den, int64_t *intnum){ - AVOption *o= find_opt(obj, name); + AVOption *o= find_opt(obj, name, NULL); void *dst; if(!o || o->offset<=0) goto error; diff --git a/libavcodec/utils.c b/libavcodec/utils.c index cc73d670ab..daca07f515 100644 --- a/libavcodec/utils.c +++ b/libavcodec/utils.c @@ -447,10 +447,43 @@ static const char* context_to_name(void* ptr) { static AVOption options[]={ {"bit_rate", NULL, OFFSET(bit_rate), FF_OPT_TYPE_INT, DEFAULT, INT_MIN, INT_MAX, V|A|E}, {"bit_rate_tolerance", NULL, OFFSET(bit_rate_tolerance), FF_OPT_TYPE_INT, DEFAULT, INT_MIN, INT_MAX, V|E}, -{"flags", NULL, OFFSET(flags), FF_OPT_TYPE_FLAGS, DEFAULT, INT_MIN, INT_MAX, V|E, "flags"}, -{"MV4", NULL, 0, FF_OPT_TYPE_CONST, CODEC_FLAG_4MV, INT_MIN, INT_MAX, V|E, "flags"}, -{"OBMC", NULL, 0, FF_OPT_TYPE_CONST, CODEC_FLAG_OBMC, INT_MIN, INT_MAX, V|E, "flags"}, -{"QPEL", NULL, 0, FF_OPT_TYPE_CONST, CODEC_FLAG_QPEL, INT_MIN, INT_MAX, V|E, "flags"}, +{"flags", NULL, OFFSET(flags), FF_OPT_TYPE_FLAGS, DEFAULT, INT_MIN, INT_MAX, V|A|E|D, "flags"}, +{"MV4", "use four motion vector by macroblock (MPEG4)", 0, FF_OPT_TYPE_CONST, CODEC_FLAG_4MV, INT_MIN, INT_MAX, V|E, "flags"}, +{"OBMC", "use overlapped block motion compensation (h263+)", 0, FF_OPT_TYPE_CONST, CODEC_FLAG_OBMC, INT_MIN, INT_MAX, V|E, "flags"}, +{"QPEL", "use 1/4 pel motion compensation", 0, FF_OPT_TYPE_CONST, CODEC_FLAG_QPEL, INT_MIN, INT_MAX, V|E, "flags"}, +{"LOOP", "use loop filter", 0, FF_OPT_TYPE_CONST, CODEC_FLAG_LOOP_FILTER, INT_MIN, INT_MAX, V|E, "flags"}, +{"QSCALE", "use fixed qscale", 0, FF_OPT_TYPE_CONST, CODEC_FLAG_QSCALE, INT_MIN, INT_MAX, 0, "flags"}, +{"GMC", "use GMC", 0, FF_OPT_TYPE_CONST, CODEC_FLAG_GMC, INT_MIN, INT_MAX, V|E, "flags"}, +{"MV0", "always try a MB with MV=<0,0>", 0, FF_OPT_TYPE_CONST, CODEC_FLAG_MV0, INT_MIN, INT_MAX, V|E, "flags"}, +{"PART", "use data partitioning", 0, FF_OPT_TYPE_CONST, CODEC_FLAG_PART, INT_MIN, INT_MAX, V|E, "flags"}, +{"INPUT_PRESERVED", NULL, 0, FF_OPT_TYPE_CONST, CODEC_FLAG_INPUT_PRESERVED, INT_MIN, INT_MAX, 0, "flags"}, +{"PASS1", "use internal 2pass ratecontrol in first pass mode", 0, FF_OPT_TYPE_CONST, CODEC_FLAG_PASS1, INT_MIN, INT_MAX, 0, "flags"}, +{"PASS2", "use internal 2pass ratecontrol in second pass mode", 0, FF_OPT_TYPE_CONST, CODEC_FLAG_PASS2, INT_MIN, INT_MAX, 0, "flags"}, +{"EXTERN_HUFF", "use external huffman table (for mjpeg)", 0, FF_OPT_TYPE_CONST, CODEC_FLAG_EXTERN_HUFF, INT_MIN, INT_MAX, 0, "flags"}, +{"GRAY", "only decode/encode grayscale", 0, FF_OPT_TYPE_CONST, CODEC_FLAG_GRAY, INT_MIN, INT_MAX, V|E|D, "flags"}, +{"EMU_EDGE", "don't draw edges", 0, FF_OPT_TYPE_CONST, CODEC_FLAG_EMU_EDGE, INT_MIN, INT_MAX, 0, "flags"}, +{"PSNR", "error[?] variables will be set during encoding", 0, FF_OPT_TYPE_CONST, CODEC_FLAG_PSNR, INT_MIN, INT_MAX, V|E, "flags"}, +{"TRUNCATED", NULL, 0, FF_OPT_TYPE_CONST, CODEC_FLAG_TRUNCATED, INT_MIN, INT_MAX, 0, "flags"}, +{"NAQ", "normalize adaptive quantization", 0, FF_OPT_TYPE_CONST, CODEC_FLAG_NORMALIZE_AQP, INT_MIN, INT_MAX, V|E, "flags"}, +{"ILDCT", "use interlaced dct", 0, FF_OPT_TYPE_CONST, CODEC_FLAG_INTERLACED_DCT, INT_MIN, INT_MAX, V|E, "flags"}, +{"LOW_DELAY", "force low delay", 0, FF_OPT_TYPE_CONST, CODEC_FLAG_LOW_DELAY, INT_MIN, INT_MAX, V|D, "flags"}, +{"ALT", "enable alternate scantable (MPEG2/MPEG4)", 0, FF_OPT_TYPE_CONST, CODEC_FLAG_ALT_SCAN, INT_MIN, INT_MAX, V|E, "flags"}, +{"TRELL", "use trellis quantization", 0, FF_OPT_TYPE_CONST, CODEC_FLAG_TRELLIS_QUANT, INT_MIN, INT_MAX, V|E, "flags"}, +{"GLOBAL_HEADER", "place global headers in extradata instead of every keyframe", 0, FF_OPT_TYPE_CONST, CODEC_FLAG_GLOBAL_HEADER, INT_MIN, INT_MAX, 0, "flags"}, +{"BITEXACT", "use only bitexact stuff (except (i)dct)", 0, FF_OPT_TYPE_CONST, CODEC_FLAG_BITEXACT, INT_MIN, INT_MAX, A|V|S|D|E, "flags"}, +{"AIC", "H263 Advanced intra coding / MPEG4 AC prediction", 0, FF_OPT_TYPE_CONST, CODEC_FLAG_AC_PRED, INT_MIN, INT_MAX, V|E, "flags"}, +{"UMV", "use unlimited motion vectors", 0, FF_OPT_TYPE_CONST, CODEC_FLAG_H263P_UMV, INT_MIN, INT_MAX, V|E, "flags"}, +{"CBP", "use rate distortion optimization for cbp", 0, FF_OPT_TYPE_CONST, CODEC_FLAG_CBP_RD, INT_MIN, INT_MAX, V|E, "flags"}, +{"QPRD", "use rate distortion optimization for qp selectioon", 0, FF_OPT_TYPE_CONST, CODEC_FLAG_QP_RD, INT_MIN, INT_MAX, V|E, "flags"}, +{"AIV", "H263 Alternative inter vlc", 0, FF_OPT_TYPE_CONST, CODEC_FLAG_H263P_AIV, INT_MIN, INT_MAX, V|E, "flags"}, +{"SLICE", NULL, 0, FF_OPT_TYPE_CONST, CODEC_FLAG_H263P_SLICE_STRUCT, INT_MIN, INT_MAX, V|E, "flags"}, +{"ILME", "interlaced motion estimation", 0, FF_OPT_TYPE_CONST, CODEC_FLAG_INTERLACED_ME, INT_MIN, INT_MAX, V|E, "flags"}, +{"SCAN_OFFSET", "will reserve space for SVCD scan offset user data", 0, FF_OPT_TYPE_CONST, CODEC_FLAG_SVCD_SCAN_OFFSET, INT_MIN, INT_MAX, V|E, "flags"}, +{"CGOP", NULL, 0, FF_OPT_TYPE_CONST, CODEC_FLAG_CLOSED_GOP, INT_MIN, INT_MAX, V|E, "flags"}, +{"FAST", "allow non spec compliant speedup tricks", 0, FF_OPT_TYPE_CONST, CODEC_FLAG2_FAST, INT_MIN, INT_MAX, V|E, "flags2"}, +{"SGOP", "strictly enforce GOP size", 0, FF_OPT_TYPE_CONST, CODEC_FLAG2_STRICT_GOP, INT_MIN, INT_MAX, V|E, "flags2"}, +{"NOOUT", "skip bitstream encoding", 0, FF_OPT_TYPE_CONST, CODEC_FLAG2_NO_OUTPUT, INT_MIN, INT_MAX, V|E, "flags2"}, +{"LOCAL_HEADER", "place global headers at every keyframe instead of in extradata", 0, FF_OPT_TYPE_CONST, CODEC_FLAG2_LOCAL_HEADER, INT_MIN, INT_MAX, V|E, "flags2"}, {"sub_id", NULL, OFFSET(sub_id), FF_OPT_TYPE_INT, DEFAULT, INT_MIN, INT_MAX}, {"me_method", NULL, OFFSET(me_method), FF_OPT_TYPE_INT, DEFAULT, INT_MIN, INT_MAX, V|E, "me_method"}, {"extradata_size", NULL, OFFSET(extradata_size), FF_OPT_TYPE_INT, DEFAULT, INT_MIN, INT_MAX}, @@ -509,34 +542,73 @@ static AVOption options[]={ {"i_quant_factor", NULL, OFFSET(i_quant_factor), FF_OPT_TYPE_FLOAT, DEFAULT, FLT_MIN, FLT_MAX, V|E}, {"i_quant_offset", NULL, OFFSET(i_quant_offset), FF_OPT_TYPE_FLOAT, DEFAULT, FLT_MIN, FLT_MAX, V|E}, {"rc_initial_cplx", NULL, OFFSET(rc_initial_cplx), FF_OPT_TYPE_FLOAT, DEFAULT, FLT_MIN, FLT_MAX, V|E}, -{"dct_algo", NULL, OFFSET(dct_algo), FF_OPT_TYPE_INT, DEFAULT, INT_MIN, INT_MAX, V|E}, +{"dct", NULL, OFFSET(dct_algo), FF_OPT_TYPE_INT, DEFAULT, 0, INT_MAX, V|E, "dct"}, +{"AUTO", NULL, 0, FF_OPT_TYPE_CONST, FF_DCT_AUTO, INT_MIN, INT_MAX, V|E, "dct"}, +{"FASTINT", NULL, 0, FF_OPT_TYPE_CONST, FF_DCT_FASTINT, INT_MIN, INT_MAX, V|E, "dct"}, +{"INT", NULL, 0, FF_OPT_TYPE_CONST, FF_DCT_INT, INT_MIN, INT_MAX, V|E, "dct"}, +{"MMX", NULL, 0, FF_OPT_TYPE_CONST, FF_DCT_MMX, INT_MIN, INT_MAX, V|E, "dct"}, +{"MLIB", NULL, 0, FF_OPT_TYPE_CONST, FF_DCT_MLIB, INT_MIN, INT_MAX, V|E, "dct"}, +{"ALTIVEC", NULL, 0, FF_OPT_TYPE_CONST, FF_DCT_ALTIVEC, INT_MIN, INT_MAX, V|E, "dct"}, +{"FAAN", NULL, 0, FF_OPT_TYPE_CONST, FF_DCT_FAAN, INT_MIN, INT_MAX, V|E, "dct"}, {"lumi_mask", NULL, OFFSET(lumi_masking), FF_OPT_TYPE_FLOAT, DEFAULT, FLT_MIN, FLT_MAX, V|E}, {"tcplx_mask", NULL, OFFSET(temporal_cplx_masking), FF_OPT_TYPE_FLOAT, DEFAULT, FLT_MIN, FLT_MAX, V|E}, {"scplx_mask", NULL, OFFSET(spatial_cplx_masking), FF_OPT_TYPE_FLOAT, DEFAULT, FLT_MIN, FLT_MAX, V|E}, {"p_mask", NULL, OFFSET(p_masking), FF_OPT_TYPE_FLOAT, DEFAULT, FLT_MIN, FLT_MAX, V|E}, {"dark_mask", NULL, OFFSET(dark_masking), FF_OPT_TYPE_FLOAT, DEFAULT, FLT_MIN, FLT_MAX, V|E}, {"unused", NULL, OFFSET(unused), FF_OPT_TYPE_INT, DEFAULT, INT_MIN, INT_MAX}, -{"idct_algo", NULL, OFFSET(idct_algo), FF_OPT_TYPE_INT, DEFAULT, INT_MIN, INT_MAX, V|E|D}, +{"idct", NULL, OFFSET(idct_algo), FF_OPT_TYPE_INT, DEFAULT, 0, INT_MAX, V|E|D, "idct"}, +{"AUTO", NULL, 0, FF_OPT_TYPE_CONST, FF_IDCT_AUTO, INT_MIN, INT_MAX, V|E|D, "idct"}, +{"INT", NULL, 0, FF_OPT_TYPE_CONST, FF_IDCT_INT, INT_MIN, INT_MAX, V|E|D, "idct"}, +{"SIMPLE", NULL, 0, FF_OPT_TYPE_CONST, FF_IDCT_SIMPLE, INT_MIN, INT_MAX, V|E|D, "idct"}, +{"SIMPLEMMX", NULL, 0, FF_OPT_TYPE_CONST, FF_IDCT_SIMPLEMMX, INT_MIN, INT_MAX, V|E|D, "idct"}, +{"LIBMPEG2MMX", NULL, 0, FF_OPT_TYPE_CONST, FF_IDCT_LIBMPEG2MMX, INT_MIN, INT_MAX, V|E|D, "idct"}, +{"PS2", NULL, 0, FF_OPT_TYPE_CONST, FF_IDCT_PS2, INT_MIN, INT_MAX, V|E|D, "idct"}, +{"MLIB", NULL, 0, FF_OPT_TYPE_CONST, FF_IDCT_MLIB, INT_MIN, INT_MAX, V|E|D, "idct"}, +{"ARM", NULL, 0, FF_OPT_TYPE_CONST, FF_IDCT_ARM, INT_MIN, INT_MAX, V|E|D, "idct"}, +{"ALTIVEC", NULL, 0, FF_OPT_TYPE_CONST, FF_IDCT_ALTIVEC, INT_MIN, INT_MAX, V|E|D, "idct"}, +{"SH4", NULL, 0, FF_OPT_TYPE_CONST, FF_IDCT_SH4, INT_MIN, INT_MAX, V|E|D, "idct"}, +{"SIMPLEARM", NULL, 0, FF_OPT_TYPE_CONST, FF_IDCT_SIMPLEARM, INT_MIN, INT_MAX, V|E|D, "idct"}, +{"H264", NULL, 0, FF_OPT_TYPE_CONST, FF_IDCT_H264, INT_MIN, INT_MAX, V|E|D, "idct"}, +{"VP3", NULL, 0, FF_OPT_TYPE_CONST, FF_IDCT_VP3, INT_MIN, INT_MAX, V|E|D, "idct"}, +{"IPP", NULL, 0, FF_OPT_TYPE_CONST, FF_IDCT_IPP, INT_MIN, INT_MAX, V|E|D, "idct"}, +{"XVIDMMX", NULL, 0, FF_OPT_TYPE_CONST, FF_IDCT_XVIDMMX, INT_MIN, INT_MAX, V|E|D, "idct"}, {"slice_count", NULL, OFFSET(slice_count), FF_OPT_TYPE_INT, DEFAULT, INT_MIN, INT_MAX}, -{"error_concealment", NULL, OFFSET(error_concealment), FF_OPT_TYPE_INT, DEFAULT, INT_MIN, INT_MAX, V|D}, +{"ec", NULL, OFFSET(error_concealment), FF_OPT_TYPE_INT, DEFAULT, INT_MIN, INT_MAX, V|D}, {"bits_per_sample", NULL, OFFSET(bits_per_sample), FF_OPT_TYPE_INT, DEFAULT, INT_MIN, INT_MAX}, {"prediction_method", NULL, OFFSET(prediction_method), FF_OPT_TYPE_INT, DEFAULT, INT_MIN, INT_MAX, V|E}, -{"aspect", NULL, OFFSET(sample_aspect_ratio), FF_OPT_TYPE_RATIONAL, DEFAULT, INT_MIN, INT_MAX, V|E}, -{"debug", NULL, OFFSET(debug), FF_OPT_TYPE_FLAGS, DEFAULT, INT_MIN, INT_MAX, V|A|S|E|D, "debug"}, -{"PICT", NULL, 0, FF_OPT_TYPE_CONST, FF_DEBUG_PICT_INFO, INT_MIN, INT_MAX, V|E, "debug"}, -{"debug_mv", NULL, OFFSET(debug_mv), FF_OPT_TYPE_INT, DEFAULT, INT_MIN, INT_MAX, V|D}, +{"aspect", NULL, OFFSET(sample_aspect_ratio), FF_OPT_TYPE_RATIONAL, DEFAULT, 0, 10, V|E}, +{"debug", "print specific debug info", OFFSET(debug), FF_OPT_TYPE_FLAGS, DEFAULT, 0, INT_MAX, V|A|S|E|D, "debug"}, +{"PICT", NULL, 0, FF_OPT_TYPE_CONST, FF_DEBUG_PICT_INFO, INT_MIN, INT_MAX, V|D, "debug"}, +{"RC", NULL, 0, FF_OPT_TYPE_CONST, FF_DEBUG_RC, INT_MIN, INT_MAX, V|E, "debug"}, +{"BITSTREAM", NULL, 0, FF_OPT_TYPE_CONST, FF_DEBUG_BITSTREAM, INT_MIN, INT_MAX, V|D, "debug"}, +{"MB_TYPE", NULL, 0, FF_OPT_TYPE_CONST, FF_DEBUG_MB_TYPE, INT_MIN, INT_MAX, V|D, "debug"}, +{"QP", NULL, 0, FF_OPT_TYPE_CONST, FF_DEBUG_QP, INT_MIN, INT_MAX, V|D, "debug"}, +{"MV", NULL, 0, FF_OPT_TYPE_CONST, FF_DEBUG_MV, INT_MIN, INT_MAX, V|D, "debug"}, +{"DCT_COEFF", NULL, 0, FF_OPT_TYPE_CONST, FF_DEBUG_DCT_COEFF, INT_MIN, INT_MAX, V|D, "debug"}, +{"SKIP", NULL, 0, FF_OPT_TYPE_CONST, FF_DEBUG_SKIP, INT_MIN, INT_MAX, V|D, "debug"}, +{"STARTCODE", NULL, 0, FF_OPT_TYPE_CONST, FF_DEBUG_STARTCODE, INT_MIN, INT_MAX, V|D, "debug"}, +{"PTS", NULL, 0, FF_OPT_TYPE_CONST, FF_DEBUG_PTS, INT_MIN, INT_MAX, V|D, "debug"}, +{"ER", NULL, 0, FF_OPT_TYPE_CONST, FF_DEBUG_ER, INT_MIN, INT_MAX, V|D, "debug"}, +{"MMCO", NULL, 0, FF_OPT_TYPE_CONST, FF_DEBUG_MMCO, INT_MIN, INT_MAX, V|D, "debug"}, +{"BUGS", NULL, 0, FF_OPT_TYPE_CONST, FF_DEBUG_BUGS, INT_MIN, INT_MAX, V|D, "debug"}, +{"VIS_QP", NULL, 0, FF_OPT_TYPE_CONST, FF_DEBUG_VIS_QP, INT_MIN, INT_MAX, V|D, "debug"}, +{"VIS_MB_TYPE", NULL, 0, FF_OPT_TYPE_CONST, FF_DEBUG_VIS_MB_TYPE, INT_MIN, INT_MAX, V|D, "debug"}, +{"vismv", "visualize motion vectors", OFFSET(debug_mv), FF_OPT_TYPE_INT, DEFAULT, 0, INT_MAX, V|D, "debug_mv"}, +{"PF", NULL, 0, FF_OPT_TYPE_CONST, FF_DEBUG_VIS_MV_P_FOR, INT_MIN, INT_MAX, V|D, "debug_mv"}, +{"BF", NULL, 0, FF_OPT_TYPE_CONST, FF_DEBUG_VIS_MV_B_FOR, INT_MIN, INT_MAX, V|D, "debug_mv"}, +{"BB", NULL, 0, FF_OPT_TYPE_CONST, FF_DEBUG_VIS_MV_B_BACK, INT_MIN, INT_MAX, V|D, "debug_mv"}, {"mb_qmin", NULL, OFFSET(mb_qmin), FF_OPT_TYPE_INT, DEFAULT, INT_MIN, INT_MAX, V|E}, {"mb_qmax", NULL, OFFSET(mb_qmax), FF_OPT_TYPE_INT, DEFAULT, INT_MIN, INT_MAX, V|E}, -{"me_cmp", NULL, OFFSET(me_cmp), FF_OPT_TYPE_INT, DEFAULT, INT_MIN, INT_MAX, V|E}, -{"me_sub_cmp", NULL, OFFSET(me_sub_cmp), FF_OPT_TYPE_INT, DEFAULT, INT_MIN, INT_MAX, V|E}, -{"mb_cmp", NULL, OFFSET(mb_cmp), FF_OPT_TYPE_INT, DEFAULT, INT_MIN, INT_MAX, V|E}, -{"ildct_cmp", NULL, OFFSET(ildct_cmp), FF_OPT_TYPE_INT, DEFAULT, INT_MIN, INT_MAX, V|E}, -{"dia_size", NULL, OFFSET(dia_size), FF_OPT_TYPE_INT, DEFAULT, INT_MIN, INT_MAX, V|E}, +{"cmp", NULL, OFFSET(me_cmp), FF_OPT_TYPE_INT, DEFAULT, INT_MIN, INT_MAX, V|E, "cmp_func"}, +{"subcmp", NULL, OFFSET(me_sub_cmp), FF_OPT_TYPE_INT, DEFAULT, INT_MIN, INT_MAX, V|E, "cmp_func"}, +{"mbcmp", NULL, OFFSET(mb_cmp), FF_OPT_TYPE_INT, DEFAULT, INT_MIN, INT_MAX, V|E, "cmp_func"}, +{"ildctcmp", NULL, OFFSET(ildct_cmp), FF_OPT_TYPE_INT, DEFAULT, INT_MIN, INT_MAX, V|E, "cmp_func"}, +{"dia_size", NULL, OFFSET(dia_size), FF_OPT_TYPE_INT, DEFAULT, INT_MIN, INT_MAX, V|E, "cmp_func"}, {"last_pred", NULL, OFFSET(last_predictor_count), FF_OPT_TYPE_INT, DEFAULT, INT_MIN, INT_MAX, V|E}, -{"pre_me", NULL, OFFSET(pre_me), FF_OPT_TYPE_INT, DEFAULT, INT_MIN, INT_MAX, V|E}, -{"me_pre_cmp", NULL, OFFSET(me_pre_cmp), FF_OPT_TYPE_INT, DEFAULT, INT_MIN, INT_MAX, V|E}, +{"preme", NULL, OFFSET(pre_me), FF_OPT_TYPE_INT, DEFAULT, INT_MIN, INT_MAX, V|E}, +{"me_pre_cmp", NULL, OFFSET(me_pre_cmp), FF_OPT_TYPE_INT, DEFAULT, INT_MIN, INT_MAX, V|E, "cmp_func"}, {"pre_dia_size", NULL, OFFSET(pre_dia_size), FF_OPT_TYPE_INT, DEFAULT, INT_MIN, INT_MAX, V|E}, -{"me_subpel_quality", NULL, OFFSET(me_subpel_quality), FF_OPT_TYPE_INT, DEFAULT, INT_MIN, INT_MAX, V|E}, +{"subq", NULL, OFFSET(me_subpel_quality), FF_OPT_TYPE_INT, DEFAULT, INT_MIN, INT_MAX, V|E}, {"dtg_active_format", NULL, OFFSET(dtg_active_format), FF_OPT_TYPE_INT, DEFAULT, INT_MIN, INT_MAX}, {"me_range", NULL, OFFSET(me_range), FF_OPT_TYPE_INT, DEFAULT, INT_MIN, INT_MAX, V|E}, {"ibias", NULL, OFFSET(intra_quant_bias), FF_OPT_TYPE_INT, DEFAULT, INT_MIN, INT_MAX, V|E}, @@ -551,25 +623,25 @@ static AVOption options[]={ {"mb_decision", NULL, OFFSET(mb_decision), FF_OPT_TYPE_INT, DEFAULT, INT_MIN, INT_MAX, V|E}, {"stream_codec_tag", NULL, OFFSET(stream_codec_tag), FF_OPT_TYPE_INT, DEFAULT, INT_MIN, INT_MAX}, {"sc_threshold", NULL, OFFSET(scenechange_threshold), FF_OPT_TYPE_INT, DEFAULT, INT_MIN, INT_MAX, V|E}, -{"lmin", NULL, OFFSET(lmin), FF_OPT_TYPE_INT, DEFAULT, INT_MIN, INT_MAX, V|E}, -{"lmax", NULL, OFFSET(lmax), FF_OPT_TYPE_INT, DEFAULT, INT_MIN, INT_MAX, V|E}, +{"lmin", "min lagrange factor", OFFSET(lmin), FF_OPT_TYPE_INT, 2*FF_QP2LAMBDA, 0, INT_MAX, V|E}, +{"lmax", "max lagrange factor", OFFSET(lmax), FF_OPT_TYPE_INT, 31*FF_QP2LAMBDA, 0, INT_MAX, V|E}, {"noise_reduction", NULL, OFFSET(noise_reduction), FF_OPT_TYPE_INT, DEFAULT, INT_MIN, INT_MAX, V|E}, {"rc_init_occupancy", NULL, OFFSET(rc_initial_buffer_occupancy), FF_OPT_TYPE_INT, DEFAULT, INT_MIN, INT_MAX, V|E}, {"inter_threshold", NULL, OFFSET(inter_threshold), FF_OPT_TYPE_INT, DEFAULT, INT_MIN, INT_MAX, V|E}, {"flags2", NULL, OFFSET(flags2), FF_OPT_TYPE_INT, DEFAULT, INT_MIN, INT_MAX}, {"error_rate", NULL, OFFSET(error_rate), FF_OPT_TYPE_INT, DEFAULT, INT_MIN, INT_MAX}, {"antialias_algo", NULL, OFFSET(antialias_algo), FF_OPT_TYPE_INT, DEFAULT, INT_MIN, INT_MAX}, -{"quantizer_noise_shaping", NULL, OFFSET(quantizer_noise_shaping), FF_OPT_TYPE_INT, DEFAULT, INT_MIN, INT_MAX, V|E}, +{"qns", NULL, OFFSET(quantizer_noise_shaping), FF_OPT_TYPE_INT, DEFAULT, INT_MIN, INT_MAX, V|E}, {"thread_count", NULL, OFFSET(thread_count), FF_OPT_TYPE_INT, DEFAULT, INT_MIN, INT_MAX, V|E|D}, -{"me_threshold", NULL, OFFSET(me_threshold), FF_OPT_TYPE_INT, DEFAULT, INT_MIN, INT_MAX}, +{"me_threshold", "motion estimaton threshold", OFFSET(me_threshold), FF_OPT_TYPE_INT, DEFAULT, INT_MIN, INT_MAX}, {"mb_threshold", NULL, OFFSET(mb_threshold), FF_OPT_TYPE_INT, DEFAULT, INT_MIN, INT_MAX}, {"dc", NULL, OFFSET(intra_dc_precision), FF_OPT_TYPE_INT, DEFAULT, INT_MIN, INT_MAX, V|E}, {"nsse_weight", NULL, OFFSET(nsse_weight), FF_OPT_TYPE_INT, DEFAULT, INT_MIN, INT_MAX, V|E}, {"skip_top", NULL, OFFSET(skip_top), FF_OPT_TYPE_INT, DEFAULT, INT_MIN, INT_MAX, V|D}, {"skip_bottom", NULL, OFFSET(skip_bottom), FF_OPT_TYPE_INT, DEFAULT, INT_MIN, INT_MAX, V|D}, -{"profile", NULL, OFFSET(profile), FF_OPT_TYPE_INT, DEFAULT, INT_MIN, INT_MAX, V|A|E}, -{"level", NULL, OFFSET(level), FF_OPT_TYPE_INT, DEFAULT, INT_MIN, INT_MAX, V|A|E}, -{"lowres", NULL, OFFSET(lowres), FF_OPT_TYPE_INT, DEFAULT, INT_MIN, INT_MAX, V|D}, +{"profile", NULL, OFFSET(profile), FF_OPT_TYPE_INT, FF_PROFILE_UNKNOWN, INT_MIN, INT_MAX, V|A|E}, +{"level", NULL, OFFSET(level), FF_OPT_TYPE_INT, FF_LEVEL_UNKNOWN, INT_MIN, INT_MAX, V|A|E}, +{"lowres", NULL, OFFSET(lowres), FF_OPT_TYPE_INT, 0, 0, INT_MAX, V|D}, {"frame_skip_threshold", NULL, OFFSET(frame_skip_threshold), FF_OPT_TYPE_INT, DEFAULT, INT_MIN, INT_MAX, V|E}, {"frame_skip_factor", NULL, OFFSET(frame_skip_factor), FF_OPT_TYPE_INT, DEFAULT, INT_MIN, INT_MAX, V|E}, {"frame_skip_exp", NULL, OFFSET(frame_skip_exp), FF_OPT_TYPE_INT, DEFAULT, INT_MIN, INT_MAX, V|E}, diff --git a/tests/libav.regression.ref b/tests/libav.regression.ref index 60857d70cf..2fed4e6e88 100644 --- a/tests/libav.regression.ref +++ b/tests/libav.regression.ref @@ -16,7 +16,7 @@ c9050b51f6d6636cdda3160d43463bc3 *./data/b-libav.ts 57a8dfc7926802bb337a9d8918de94a8 *./data/b-libav.swf 41816 ./data/b-libav.swf ./data/b-libav.swf CRC=2b273fea -c85c98bb1c9a5fe833eed5d23fbf8499 *./data/b-libav.ffm +8f908b4651a7e5915f0f6e505bafb0b1 *./data/b-libav.ffm 389120 ./data/b-libav.ffm ./data/b-libav.ffm CRC=688bd1eb 794934a02582f8dfc85d1856514cf37c *./data/b-libav.flv diff --git a/tests/regression.sh b/tests/regression.sh index 80e28feb5a..3aa3fa5cdc 100755 --- a/tests/regression.sh +++ b/tests/regression.sh @@ -107,8 +107,8 @@ do_ffmpeg() { f="$1" shift - echo $ffmpeg -y -bitexact -dct_algo 1 -idct_algo 2 $* - $ffmpeg -y -bitexact -dct_algo 1 -idct_algo 2 -benchmark $* > $datadir/bench.tmp 2> /tmp/ffmpeg$$ + echo $ffmpeg -y -flags +BITEXACT -dct FASTINT -idct SIMPLE $* + $ffmpeg -y -flags +BITEXACT -dct FASTINT -idct SIMPLE -benchmark $* > $datadir/bench.tmp 2> /tmp/ffmpeg$$ egrep -v "^(Stream|Press|Input|Output|frame| Stream| Duration|video:)" /tmp/ffmpeg$$ || true rm -f /tmp/ffmpeg$$ do_md5sum $f >> $logfile @@ -127,8 +127,8 @@ do_ffmpeg_crc() { f="$1" shift - echo $ffmpeg -y -bitexact -dct_algo 1 -idct_algo 2 $* -f crc $datadir/ffmpeg.crc - $ffmpeg -y -bitexact -dct_algo 1 -idct_algo 2 $* -f crc $datadir/ffmpeg.crc > /tmp/ffmpeg$$ 2>&1 + echo $ffmpeg -y -flags +BITEXACT -dct FASTINT -idct SIMPLE $* -f crc $datadir/ffmpeg.crc + $ffmpeg -y -flags +BITEXACT -dct FASTINT -idct SIMPLE $* -f crc $datadir/ffmpeg.crc > /tmp/ffmpeg$$ 2>&1 egrep -v "^(Stream|Press|Input|Output|frame| Stream| Duration|video:|ffmpeg version| configuration| built)" /tmp/ffmpeg$$ || true rm -f /tmp/ffmpeg$$ echo "$f `cat $datadir/ffmpeg.crc`" >> $logfile @@ -138,8 +138,8 @@ do_ffmpeg_nocheck() { f="$1" shift - echo $ffmpeg -y -bitexact -dct_algo 1 -idct_algo 2 $* - $ffmpeg -y -bitexact -dct_algo 1 -idct_algo 2 -benchmark $* > $datadir/bench.tmp 2> /tmp/ffmpeg$$ + echo $ffmpeg -y -flags +BITEXACT -dct FASTINT -idct SIMPLE $* + $ffmpeg -y -flags +BITEXACT -dct FASTINT -idct SIMPLE -benchmark $* > $datadir/bench.tmp 2> /tmp/ffmpeg$$ egrep -v "^(Stream|Press|Input|Output|frame| Stream| Duration|video:)" /tmp/ffmpeg$$ || true rm -f /tmp/ffmpeg$$ expr "`cat $datadir/bench.tmp`" : '.*utime=\(.*s\)' > $datadir/bench2.tmp @@ -175,14 +175,14 @@ do_ffmpeg $raw_dst -y -i $file -f rawvideo $raw_dst # mpeg2 encoding file=${outfile}mpeg2.mpg -do_ffmpeg $file -y -qscale 10 -f pgmyuv -i $raw_src -vcodec mpeg2video -idct_algo 1 -dct_algo 2 -f mpeg1video $file +do_ffmpeg $file -y -qscale 10 -f pgmyuv -i $raw_src -vcodec mpeg2video -idct INT -dct INT -f mpeg1video $file # mpeg2 decoding -do_ffmpeg $raw_dst -y -idct_algo 1 -i $file -f rawvideo $raw_dst +do_ffmpeg $raw_dst -y -idct INT -i $file -f rawvideo $raw_dst # mpeg2 encoding interlaced file=${outfile}mpeg2i.mpg -do_ffmpeg $file -y -qscale 10 -f pgmyuv -i $raw_src -vcodec mpeg2video -f mpeg1video -ildct -ilme $file +do_ffmpeg $file -y -qscale 10 -f pgmyuv -i $raw_src -vcodec mpeg2video -f mpeg1video -flags +ILDCT+ILME $file # mpeg2 decoding do_ffmpeg $raw_dst -y -i $file -f rawvideo $raw_dst @@ -192,14 +192,14 @@ fi if [ -n "$do_mpeg2thread" ] ; then # mpeg2 encoding interlaced file=${outfile}mpeg2thread.mpg -do_ffmpeg $file -y -qscale 10 -f pgmyuv -i $raw_src -vcodec mpeg2video -f mpeg1video -bf 2 -ildct -ilme -threads 2 $file +do_ffmpeg $file -y -qscale 10 -f pgmyuv -i $raw_src -vcodec mpeg2video -f mpeg1video -bf 2 -flags +ILDCT+ILME -threads 2 $file # mpeg2 decoding do_ffmpeg $raw_dst -y -i $file -f rawvideo $raw_dst # mpeg2 encoding interlaced file=${outfile}mpeg2reuse.mpg -do_ffmpeg $file -y -sameq -me_threshold 256 -mb_threshold 1024 -i ${outfile}mpeg2thread.mpg -vcodec mpeg2video -f mpeg1video -bf 2 -ildct -ilme -threads 4 $file +do_ffmpeg $file -y -sameq -me_threshold 256 -mb_threshold 1024 -i ${outfile}mpeg2thread.mpg -vcodec mpeg2video -f mpeg1video -bf 2 -flags +ILDCT+ILME -threads 4 $file # mpeg2 decoding do_ffmpeg $raw_dst -y -i $file -f rawvideo $raw_dst @@ -269,7 +269,7 @@ fi if [ -n "$do_h263p" ] ; then # h263p encoding file=${outfile}h263p.avi -do_ffmpeg $file -y -qscale 2 -umv -aiv -aic -f pgmyuv -i $raw_src -s 352x288 -an -vcodec h263p -ps 300 $file +do_ffmpeg $file -y -qscale 2 -flags +UMV+AIV+AIC -f pgmyuv -i $raw_src -s 352x288 -an -vcodec h263p -ps 300 $file # h263p decoding do_ffmpeg $raw_dst -y -i $file -f rawvideo $raw_dst @@ -279,7 +279,7 @@ fi if [ -n "$do_mpeg4" ] ; then # mpeg4 file=${outfile}odivx.mp4 -do_ffmpeg $file -y -4mv -hq -qscale 10 -f pgmyuv -i $raw_src -an -vcodec mpeg4 $file +do_ffmpeg $file -y -flags +MV4 -hq -qscale 10 -f pgmyuv -i $raw_src -an -vcodec mpeg4 $file # mpeg4 decoding do_ffmpeg $raw_dst -y -i $file -f rawvideo $raw_dst @@ -309,7 +309,7 @@ fi if [ -n "$do_mpeg4adv" ] ; then # mpeg4 file=${outfile}mpeg4-adv.avi -do_ffmpeg $file -y -qscale 9 -4mv -hq -part -ps 200 -aic -trell -f pgmyuv -i $raw_src -an -vcodec mpeg4 $file +do_ffmpeg $file -y -qscale 9 -flags +MV4+PART+AIC+TRELL -hq -ps 200 -f pgmyuv -i $raw_src -an -vcodec mpeg4 $file # mpeg4 decoding do_ffmpeg $raw_dst -y -i $file -f rawvideo $raw_dst @@ -319,7 +319,7 @@ fi if [ -n "$do_mpeg4thread" ] ; then # mpeg4 file=${outfile}mpeg4-thread.avi -do_ffmpeg $file -y -b 500 -4mv -hq -part -ps 200 -aic -trell -bf 2 -f pgmyuv -i $raw_src -an -vcodec mpeg4 -threads 2 $file +do_ffmpeg $file -y -b 500 -flags +MV4+PART+AIC+TRELL -hq -ps 200 -bf 2 -f pgmyuv -i $raw_src -an -vcodec mpeg4 -threads 2 $file # mpeg4 decoding do_ffmpeg $raw_dst -y -i $file -f rawvideo $raw_dst @@ -329,7 +329,7 @@ fi if [ -n "$do_mpeg4adv" ] ; then # mpeg4 file=${outfile}mpeg4-Q.avi -do_ffmpeg $file -y -qscale 7 -4mv -mbd 2 -qpel -bf 2 -cmp 1 -subcmp 2 -f pgmyuv -i $raw_src -an -vcodec mpeg4 $file +do_ffmpeg $file -y -qscale 7 -flags +MV4+QPEL -mbd 2 -bf 2 -cmp 1 -subcmp 2 -f pgmyuv -i $raw_src -an -vcodec mpeg4 $file # mpeg4 decoding do_ffmpeg $raw_dst -y -i $file -f rawvideo $raw_dst @@ -339,7 +339,7 @@ fi if [ -n "$do_error" ] ; then # damaged mpeg4 file=${outfile}error-mpeg4-adv.avi -do_ffmpeg $file -y -qscale 7 -4mv -mbd 2 -part -ps 250 -error 10 -aic -f pgmyuv -i $raw_src -an -vcodec mpeg4 $file +do_ffmpeg $file -y -qscale 7 -flags +MV4+PART+AIC -mbd 2 -ps 250 -error 10 -f pgmyuv -i $raw_src -an -vcodec mpeg4 $file # damaged mpeg4 decoding do_ffmpeg $raw_dst -y -i $file -f rawvideo $raw_dst @@ -349,7 +349,7 @@ fi if [ -n "$do_mpeg4nr" ] ; then # noise reduction file=${outfile}mpeg4-nr.avi -do_ffmpeg $file -y -qscale 8 -4mv -mbd 2 -nr 200 -f pgmyuv -i $raw_src -an -vcodec mpeg4 $file +do_ffmpeg $file -y -qscale 8 -flags +MV4 -mbd 2 -nr 200 -f pgmyuv -i $raw_src -an -vcodec mpeg4 $file # mpeg4 decoding do_ffmpeg $raw_dst -y -i $file -f rawvideo $raw_dst @@ -456,7 +456,7 @@ do_ffmpeg $raw_dst -y -i $file -f rawvideo $raw_dst # snow encoding file=${outfile}snow53.avi -do_ffmpeg $file -y -strict -2 -f pgmyuv -i $raw_src -an -vcodec snow -pred 1 -qpel -4mv $file +do_ffmpeg $file -y -strict -2 -f pgmyuv -i $raw_src -an -vcodec snow -pred 1 -flags +MV4+QPEL $file # snow decoding do_ffmpeg $raw_dst -y -i $file -f rawvideo $raw_dst @@ -466,7 +466,7 @@ fi if [ -n "$do_dv" ] ; then # dv encoding file=${outfile}dv.dv -do_ffmpeg $file -dct_algo 2 -y -f pgmyuv -i $raw_src -s pal -an $file +do_ffmpeg $file -dct INT -y -f pgmyuv -i $raw_src -s pal -an $file # dv decoding do_ffmpeg $raw_dst -y -i $file -f rawvideo -s cif $raw_dst @@ -651,7 +651,7 @@ do_ffmpeg_crc $file -i $file # jpeg (we do not do md5 on image files yet) file=${outfile}libav%d.jpg -$ffmpeg -t 0.5 -y -qscale 10 -f pgmyuv -i $raw_src -bitexact -dct_algo 1 -idct_algo 2 -pix_fmt yuvj420p -f image2 $file +$ffmpeg -t 0.5 -y -qscale 10 -f pgmyuv -i $raw_src -flags +BITEXACT -dct FASTINT -idct SIMPLE -pix_fmt yuvj420p -f image2 $file do_ffmpeg_crc $file -f image2 -i $file #################### |