x86/vf_w3fdif: simplify w3fdif_simple_high
[ffmpeg.git] / libavfilter / vf_field.c
index c113512..72cabdb 100644 (file)
@@ -33,7 +33,7 @@ enum FieldType { FIELD_TYPE_TOP = 0, FIELD_TYPE_BOTTOM };
 
 typedef struct {
     const AVClass *class;
-    enum FieldType type;
+    int type;                   ///< FieldType
     int nb_planes;              ///< number of planes of the current format
 } FieldContext;
 
@@ -44,7 +44,6 @@ static const AVOption field_options[] = {
     {"type", "set field type (top or bottom)", OFFSET(type), AV_OPT_TYPE_INT, {.i64=FIELD_TYPE_TOP}, 0, 1, FLAGS, "field_type" },
     {"top",    "select top field",    0, AV_OPT_TYPE_CONST, {.i64=FIELD_TYPE_TOP},    INT_MIN, INT_MAX, FLAGS, "field_type"},
     {"bottom", "select bottom field", 0, AV_OPT_TYPE_CONST, {.i64=FIELD_TYPE_BOTTOM}, INT_MIN, INT_MAX, FLAGS, "field_type"},
-
     {NULL}
 };
 
@@ -55,12 +54,8 @@ static int config_props_output(AVFilterLink *outlink)
     AVFilterContext *ctx = outlink->src;
     FieldContext *field = ctx->priv;
     AVFilterLink *inlink = ctx->inputs[0];
-    const AVPixFmtDescriptor *desc = av_pix_fmt_desc_get(inlink->format);
-    int i;
 
-    for (i = 0; i < desc->nb_components; i++)
-        field->nb_planes = FFMAX(field->nb_planes, desc->comp[i].plane);
-    field->nb_planes++;
+    field->nb_planes = av_pix_fmt_count_planes(outlink->format);
 
     outlink->w = inlink->w;
     outlink->h = (inlink->h + (field->type == FIELD_TYPE_TOP)) / 2;
@@ -90,31 +85,27 @@ static int filter_frame(AVFilterLink *inlink, AVFrame *inpicref)
 
 static const AVFilterPad field_inputs[] = {
     {
-        .name             = "default",
-        .type             = AVMEDIA_TYPE_VIDEO,
-        .get_video_buffer = ff_null_get_video_buffer,
-        .filter_frame     = filter_frame,
+        .name         = "default",
+        .type         = AVMEDIA_TYPE_VIDEO,
+        .filter_frame = filter_frame,
     },
     { NULL }
 };
 
 static const AVFilterPad field_outputs[] = {
     {
-        .name          = "default",
-        .type          = AVMEDIA_TYPE_VIDEO,
-        .config_props  = config_props_output,
+        .name         = "default",
+        .type         = AVMEDIA_TYPE_VIDEO,
+        .config_props = config_props_output,
     },
     { NULL }
 };
 
-static const char *const shorthand[] = { "type", NULL };
-
-AVFilter avfilter_vf_field = {
-    .name          = "field",
-    .description   = NULL_IF_CONFIG_SMALL("Extract a field from the input video."),
-
-    .priv_size     = sizeof(FieldContext),
-    .inputs        = field_inputs,
-    .outputs       = field_outputs,
-    .priv_class    = &field_class,
+AVFilter ff_vf_field = {
+    .name        = "field",
+    .description = NULL_IF_CONFIG_SMALL("Extract a field from the input video."),
+    .priv_size   = sizeof(FieldContext),
+    .inputs      = field_inputs,
+    .outputs     = field_outputs,
+    .priv_class  = &field_class,
 };