me option implemented as an AVOption

patch by Stefano Sabatini: [stefano sabatini-lala poste it]
original thread:
[FFmpeg-devel] [PATCH] ffmpeg.c -me option implemented as an AVOption
date: 07/05/2007 03:12 PM

Originally committed as revision 9501 to svn://svn.ffmpeg.org/ffmpeg/trunk
pull/126/head
Stefano Sabatini 18 years ago committed by Benoit Fouet
parent 3b7660b002
commit c0de00dac5
  1. 4
      doc/ffmpeg-doc.texi
  2. 50
      ffmpeg.c
  3. 12
      libavcodec/utils.c

@ -468,7 +468,7 @@ Set rate control equation (@pxref{FFmpeg formula
evaluator}) (default = @code{tex^qComp}).
@item -rc_override override
rate control override for specific intervals
@item -me method
@item -me_method method
Set motion estimation method to @var{method}.
Available methods are (from lowest to best quality):
@table @samp
@ -477,6 +477,8 @@ Try just the (0, 0) vector.
@item phods
@item log
@item x1
@item hex
@item umh
@item epzs
(default method)
@item full

@ -127,7 +127,6 @@ static int video_rc_qmod_freq=0;
#endif
static char *video_rc_override_string=NULL;
static char *video_rc_eq="tex^qComp";
static int me_method = ME_EPZS;
static int video_disable = 0;
static int video_discard = 0;
static int video_codec_id = CODEC_ID_NONE;
@ -2417,35 +2416,6 @@ static void add_frame_hooker(const char *arg)
}
}
const char *motion_str[] = {
"zero",
"full",
"log",
"phods",
"epzs",
"x1",
"hex",
"umh",
"iter",
NULL,
};
static void opt_motion_estimation(const char *arg)
{
const char **p;
p = motion_str;
for(;;) {
if (!*p) {
fprintf(stderr, "Unknown motion estimation method '%s'\n", arg);
exit(1);
}
if (!strcmp(*p, arg))
break;
p++;
}
me_method = (p - motion_str) + 1;
}
static void opt_video_codec(const char *arg)
{
opt_codec(&video_stream_copy, &video_codec_id, CODEC_TYPE_VIDEO, arg);
@ -2839,8 +2809,6 @@ static void new_video_stream(AVFormatContext *oc)
if (do_psnr)
video_enc->flags|= CODEC_FLAG_PSNR;
video_enc->me_method = me_method;
/* two pass mode */
if (do_pass) {
if (do_pass == 1) {
@ -3167,7 +3135,7 @@ static void show_formats(void)
AVOutputFormat *ofmt;
URLProtocol *up;
AVCodec *p, *p2;
const char **pp, *last_name;
const char *last_name;
printf("File formats:\n");
last_name= "000";
@ -3268,19 +3236,7 @@ static void show_formats(void)
printf("\n");
printf("Frame size, frame rate abbreviations:\n ntsc pal qntsc qpal sntsc spal film ntsc-film sqcif qcif cif 4cif\n");
printf("Motion estimation methods:\n");
pp = motion_str;
while (*pp) {
printf(" %s", *pp);
if ((pp - motion_str + 1) == ME_ZERO)
printf("(fastest)");
else if ((pp - motion_str + 1) == ME_FULL)
printf("(slowest)");
else if ((pp - motion_str + 1) == ME_EPZS)
printf("(default)");
pp++;
}
printf("\n\n");
printf("\n");
printf(
"Note, the names of encoders and decoders do not always match, so there are\n"
"several cases where the above table shows encoder only or decoder only entries\n"
@ -3633,8 +3589,6 @@ const OptionDef options[] = {
{ "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" },
{ "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" },
{ "me_threshold", HAS_ARG | OPT_EXPERT | OPT_VIDEO, {(void*)opt_me_threshold}, "motion estimaton threshold", "" },
{ "strict", HAS_ARG | OPT_EXPERT | OPT_VIDEO, {(void*)opt_strict}, "how strictly to follow the standards", "strictness" },
{ "sameq", OPT_BOOL | OPT_VIDEO, {(void*)&same_quality},

@ -455,6 +455,18 @@ static const AVOption options[]={
{"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", "set motion estimation method", OFFSET(me_method), FF_OPT_TYPE_INT, ME_EPZS, INT_MIN, INT_MAX, V|E, "me_method"},
#if LIBAVCODEC_VERSION_INT < ((52<<16)+(0<<8)+0)
{"me", "set motion estimation method (deprecated, use me_method instead)", OFFSET(me_method), FF_OPT_TYPE_INT, ME_EPZS, INT_MIN, INT_MAX, V|E, "me_method"},
#endif
{"zero", "zero motion estimation (fastest)", 0, FF_OPT_TYPE_CONST, ME_ZERO, INT_MIN, INT_MAX, V|E, "me_method" },
{"full", "full motion estimation (slowest)", 0, FF_OPT_TYPE_CONST, ME_FULL, INT_MIN, INT_MAX, V|E, "me_method" },
{"epzs", "EPZS motion estimation (default)", 0, FF_OPT_TYPE_CONST, ME_EPZS, INT_MIN, INT_MAX, V|E, "me_method" },
{"log", "log motion estimation", 0, FF_OPT_TYPE_CONST, ME_LOG, INT_MIN, INT_MAX, V|E, "me_method" },
{"phods", "phods motion estimation", 0, FF_OPT_TYPE_CONST, ME_PHODS, INT_MIN, INT_MAX, V|E, "me_method" },
{"x1", "X1 motion estimation", 0, FF_OPT_TYPE_CONST, ME_X1, INT_MIN, INT_MAX, V|E, "me_method" },
{"hex", "hex motion estimation", 0, FF_OPT_TYPE_CONST, ME_HEX, INT_MIN, INT_MAX, V|E, "me_method" },
{"umh", "umh motion estimation", 0, FF_OPT_TYPE_CONST, ME_UMH, INT_MIN, INT_MAX, V|E, "me_method" },
{"iter", "iter motion estimation", 0, FF_OPT_TYPE_CONST, ME_ITER, INT_MIN, INT_MAX, V|E, "me_method" },
{"extradata_size", NULL, OFFSET(extradata_size), FF_OPT_TYPE_INT, DEFAULT, INT_MIN, INT_MAX},
{"time_base", NULL, OFFSET(time_base), FF_OPT_TYPE_RATIONAL, DEFAULT, INT_MIN, INT_MAX},
{"g", "set the group of picture size", OFFSET(gop_size), FF_OPT_TYPE_INT, 12, INT_MIN, INT_MAX, V|E},

Loading…
Cancel
Save