Merge commit '7536c671040f1f3ebc9f0d3b7831dac71436b775'

* commit '7536c671040f1f3ebc9f0d3b7831dac71436b775':
  vf_yadif: switch to an AVOptions-based system.

Conflicts:
	doc/filters.texi
	libavfilter/vf_yadif.c
	libavfilter/yadif.h

Merged-by: Michael Niedermayer <michaelni@gmx.at>
This commit is contained in:
Michael Niedermayer 2013-04-11 01:14:01 +02:00
commit ab6091f8e2
3 changed files with 34 additions and 51 deletions

View File

@ -5668,17 +5668,13 @@ ffmpeg -i in.avi -vf "vflip" out.avi
Deinterlace the input video ("yadif" means "yet another deinterlacing
filter").
The filter accepts parameters as a list of @var{key}=@var{value}
pairs, separated by ":". If the key of the first options is omitted,
the arguments are interpreted according to syntax
@var{mode}:@var{parity}:@var{deint}.
This filter accepts the following options:
The description of the accepted parameters follows.
@table @option
@item mode
Specify the interlacing mode to adopt. Accept one of the following
values:
The interlacing mode to adopt, accepts one of the following values:
@table @option
@item 0, send_frame
@ -5694,8 +5690,8 @@ like @code{send_field} but skip spatial interlacing check
Default value is @code{send_frame}.
@item parity
Specify the picture field parity assumed for the input interlaced
video. Accept one of the following values:
The picture field parity assumed for the input interlaced video, accepts one of
the following values:
@table @option
@item 0, tff

View File

@ -714,6 +714,7 @@ int avfilter_init_filter(AVFilterContext *filter, const char *args, void *opaque
!strcmp(filter->filter->name, "unsharp" ) ||
// !strcmp(filter->filter->name, "scale" ) ||
!strcmp(filter->filter->name, "select") ||
!strcmp(filter->filter->name, "yadif" ) ||
0
;

View File

@ -344,32 +344,6 @@ static int request_frame(AVFilterLink *link)
return 0;
}
#define OFFSET(x) offsetof(YADIFContext, x)
#define FLAGS AV_OPT_FLAG_VIDEO_PARAM|AV_OPT_FLAG_FILTERING_PARAM
#define CONST(name, help, val, unit) { name, help, 0, AV_OPT_TYPE_CONST, {.i64=val}, INT_MIN, INT_MAX, FLAGS, unit }
static const AVOption yadif_options[] = {
{ "mode", "specify the interlacing mode", OFFSET(mode), AV_OPT_TYPE_INT, {.i64=YADIF_MODE_SEND_FRAME}, 0, 3, FLAGS, "mode"},
CONST("send_frame", "send one frame for each frame", YADIF_MODE_SEND_FRAME, "mode"),
CONST("send_field", "send one frame for each field", YADIF_MODE_SEND_FIELD, "mode"),
CONST("send_frame_nospatial", "send one frame for each frame, but skip spatial interlacing check", YADIF_MODE_SEND_FRAME_NOSPATIAL, "mode"),
CONST("send_field_nospatial", "send one frame for each field, but skip spatial interlacing check", YADIF_MODE_SEND_FIELD_NOSPATIAL, "mode"),
{ "parity", "specify the assumed picture field parity", OFFSET(parity), AV_OPT_TYPE_INT, {.i64=YADIF_PARITY_AUTO}, -1, 1, FLAGS, "parity" },
CONST("tff", "assume top field first", YADIF_PARITY_TFF, "parity"),
CONST("bff", "assume bottom field first", YADIF_PARITY_BFF, "parity"),
CONST("auto", "auto detect parity", YADIF_PARITY_AUTO, "parity"),
{ "deint", "specify which frames to deinterlace", OFFSET(deint), AV_OPT_TYPE_INT, {.i64=YADIF_DEINT_ALL}, 0, 1, FLAGS, "deint" },
CONST("all", "deinterlace all frames", YADIF_DEINT_ALL, "deint"),
CONST("interlaced", "only deinterlace frames marked as interlaced", YADIF_DEINT_INTERLACED, "deint"),
{NULL},
};
AVFILTER_DEFINE_CLASS(yadif);
static av_cold void uninit(AVFilterContext *ctx)
{
YADIFContext *yadif = ctx->priv;
@ -420,16 +394,6 @@ static int query_formats(AVFilterContext *ctx)
return 0;
}
static av_cold int init(AVFilterContext *ctx, const char *args)
{
YADIFContext *yadif = ctx->priv;
av_log(ctx, AV_LOG_VERBOSE, "mode:%d parity:%d deint:%d\n",
yadif->mode, yadif->parity, yadif->deint);
return 0;
}
static int config_props(AVFilterLink *link)
{
AVFilterContext *ctx = link->src;
@ -463,6 +427,33 @@ static int config_props(AVFilterLink *link)
return 0;
}
#define OFFSET(x) offsetof(YADIFContext, x)
#define FLAGS AV_OPT_FLAG_VIDEO_PARAM|AV_OPT_FLAG_FILTERING_PARAM
#define CONST(name, help, val, unit) { name, help, 0, AV_OPT_TYPE_CONST, {.i64=val}, INT_MIN, INT_MAX, FLAGS, unit }
static const AVOption yadif_options[] = {
{ "mode", "specify the interlacing mode", OFFSET(mode), AV_OPT_TYPE_INT, {.i64=YADIF_MODE_SEND_FRAME}, 0, 3, FLAGS, "mode"},
CONST("send_frame", "send one frame for each frame", YADIF_MODE_SEND_FRAME, "mode"),
CONST("send_field", "send one frame for each field", YADIF_MODE_SEND_FIELD, "mode"),
CONST("send_frame_nospatial", "send one frame for each frame, but skip spatial interlacing check", YADIF_MODE_SEND_FRAME_NOSPATIAL, "mode"),
CONST("send_field_nospatial", "send one frame for each field, but skip spatial interlacing check", YADIF_MODE_SEND_FIELD_NOSPATIAL, "mode"),
{ "parity", "specify the assumed picture field parity", OFFSET(parity), AV_OPT_TYPE_INT, {.i64=YADIF_PARITY_AUTO}, -1, 1, FLAGS, "parity" },
CONST("tff", "assume top field first", YADIF_PARITY_TFF, "parity"),
CONST("bff", "assume bottom field first", YADIF_PARITY_BFF, "parity"),
CONST("auto", "auto detect parity", YADIF_PARITY_AUTO, "parity"),
{ "deint", "specify which frames to deinterlace", OFFSET(deint), AV_OPT_TYPE_INT, {.i64=YADIF_DEINT_ALL}, 0, 1, FLAGS, "deint" },
CONST("all", "deinterlace all frames", YADIF_DEINT_ALL, "deint"),
CONST("interlaced", "only deinterlace frames marked as interlaced", YADIF_DEINT_INTERLACED, "deint"),
{NULL},
};
AVFILTER_DEFINE_CLASS(yadif);
static const AVFilterPad avfilter_vf_yadif_inputs[] = {
{
.name = "default",
@ -482,20 +473,15 @@ static const AVFilterPad avfilter_vf_yadif_outputs[] = {
{ NULL }
};
static const char *const shorthand[] = { "mode", "parity", "deint", NULL };
AVFilter avfilter_vf_yadif = {
.name = "yadif",
.description = NULL_IF_CONFIG_SMALL("Deinterlace the input image."),
.priv_size = sizeof(YADIFContext),
.init = init,
.priv_class = &yadif_class,
.uninit = uninit,
.query_formats = query_formats,
.inputs = avfilter_vf_yadif_inputs,
.outputs = avfilter_vf_yadif_outputs,
.priv_class = &yadif_class,
.shorthand = shorthand,
};