]> git.sesse.net Git - ffmpeg/blob - libavfilter/vf_yadif.c
Merge remote-tracking branch 'qatar/master'
[ffmpeg] / libavfilter / vf_yadif.c
1 /*
2  * Copyright (C) 2006-2011 Michael Niedermayer <michaelni@gmx.at>
3  *               2010      James Darnley <james.darnley@gmail.com>
4  *
5  * FFmpeg is free software; you can redistribute it and/or modify
6  * it under the terms of the GNU General Public License as published by
7  * the Free Software Foundation; either version 2 of the License, or
8  * (at your option) any later version.
9  *
10  * FFmpeg is distributed in the hope that it will be useful,
11  * but WITHOUT ANY WARRANTY; without even the implied warranty of
12  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
13  * GNU General Public License for more details.
14  *
15  * You should have received a copy of the GNU General Public License along
16  * with FFmpeg; if not, write to the Free Software Foundation, Inc.,
17  * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
18  */
19
20 #include "libavutil/avassert.h"
21 #include "libavutil/cpu.h"
22 #include "libavutil/common.h"
23 #include "libavutil/opt.h"
24 #include "libavutil/pixdesc.h"
25 #include "libavutil/imgutils.h"
26 #include "libavutil/x86/asm.h"
27 #include "libavutil/x86/cpu.h"
28 #include "avfilter.h"
29 #include "formats.h"
30 #include "internal.h"
31 #include "video.h"
32 #include "yadif.h"
33
34
35 typedef struct ThreadData {
36     AVFrame *frame;
37     int plane;
38     int w, h;
39     int parity;
40     int tff;
41 } ThreadData;
42
43 typedef struct YADIFContext {
44     const AVClass *class;
45
46     enum YADIFMode   mode;
47     enum YADIFParity parity;
48     enum YADIFDeint  deint;
49
50     int frame_pending;
51
52     AVFrame *cur;
53     AVFrame *next;
54     AVFrame *prev;
55     AVFrame *out;
56
57     /**
58      * Required alignment for filter_line
59      */
60     void (*filter_line)(void *dst,
61                         void *prev, void *cur, void *next,
62                         int w, int prefs, int mrefs, int parity, int mode);
63     void (*filter_edges)(void *dst, void *prev, void *cur, void *next,
64                          int w, int prefs, int mrefs, int parity, int mode);
65
66     const AVPixFmtDescriptor *csp;
67     int eof;
68     uint8_t *temp_line;
69     int temp_line_size;
70 } YADIFContext;
71
72 #define CHECK(j)\
73     {   int score = FFABS(cur[mrefs - 1 + j] - cur[prefs - 1 - j])\
74                   + FFABS(cur[mrefs     + j] - cur[prefs     - j])\
75                   + FFABS(cur[mrefs + 1 + j] - cur[prefs + 1 - j]);\
76         if (score < spatial_score) {\
77             spatial_score= score;\
78             spatial_pred= (cur[mrefs    + j] + cur[prefs     - j])>>1;\
79
80 /* The is_not_edge argument here controls when the code will enter a branch
81  * which reads up to and including x-3 and x+3. */
82
83 #define FILTER(start, end, is_not_edge) \
84     for (x = start;  x < end; x++) { \
85         int c = cur[mrefs]; \
86         int d = (prev2[0] + next2[0])>>1; \
87         int e = cur[prefs]; \
88         int temporal_diff0 = FFABS(prev2[0] - next2[0]); \
89         int temporal_diff1 =(FFABS(prev[mrefs] - c) + FFABS(prev[prefs] - e) )>>1; \
90         int temporal_diff2 =(FFABS(next[mrefs] - c) + FFABS(next[prefs] - e) )>>1; \
91         int diff = FFMAX3(temporal_diff0 >> 1, temporal_diff1, temporal_diff2); \
92         int spatial_pred = (c+e) >> 1; \
93  \
94         if (is_not_edge) {\
95             int spatial_score = FFABS(cur[mrefs - 1] - cur[prefs - 1]) + FFABS(c-e) \
96                               + FFABS(cur[mrefs + 1] - cur[prefs + 1]) - 1; \
97             CHECK(-1) CHECK(-2) }} }} \
98             CHECK( 1) CHECK( 2) }} }} \
99         }\
100  \
101         if (!(mode&2)) { \
102             int b = (prev2[2 * mrefs] + next2[2 * mrefs])>>1; \
103             int f = (prev2[2 * prefs] + next2[2 * prefs])>>1; \
104             int max = FFMAX3(d - e, d - c, FFMIN(b - c, f - e)); \
105             int min = FFMIN3(d - e, d - c, FFMAX(b - c, f - e)); \
106  \
107             diff = FFMAX3(diff, min, -max); \
108         } \
109  \
110         if (spatial_pred > d + diff) \
111            spatial_pred = d + diff; \
112         else if (spatial_pred < d - diff) \
113            spatial_pred = d - diff; \
114  \
115         dst[0] = spatial_pred; \
116  \
117         dst++; \
118         cur++; \
119         prev++; \
120         next++; \
121         prev2++; \
122         next2++; \
123     }
124
125 static void filter_line_c(void *dst1,
126                           void *prev1, void *cur1, void *next1,
127                           int w, int prefs, int mrefs, int parity, int mode)
128 {
129     uint8_t *dst  = dst1;
130     uint8_t *prev = prev1;
131     uint8_t *cur  = cur1;
132     uint8_t *next = next1;
133     int x;
134     uint8_t *prev2 = parity ? prev : cur ;
135     uint8_t *next2 = parity ? cur  : next;
136
137     /* The function is called with the pointers already pointing to data[3] and
138      * with 6 subtracted from the width.  This allows the FILTER macro to be
139      * called so that it processes all the pixels normally.  A constant value of
140      * true for is_not_edge lets the compiler ignore the if statement. */
141     FILTER(0, w, 1)
142 }
143
144 #define MAX_ALIGN 8
145 static void filter_edges(void *dst1, void *prev1, void *cur1, void *next1,
146                          int w, int prefs, int mrefs, int parity, int mode)
147 {
148     uint8_t *dst  = dst1;
149     uint8_t *prev = prev1;
150     uint8_t *cur  = cur1;
151     uint8_t *next = next1;
152     int x;
153     uint8_t *prev2 = parity ? prev : cur ;
154     uint8_t *next2 = parity ? cur  : next;
155
156     /* Only edge pixels need to be processed here.  A constant value of false
157      * for is_not_edge should let the compiler ignore the whole branch. */
158     FILTER(0, 3, 0)
159
160     dst  = (uint8_t*)dst1  + w - (MAX_ALIGN-1);
161     prev = (uint8_t*)prev1 + w - (MAX_ALIGN-1);
162     cur  = (uint8_t*)cur1  + w - (MAX_ALIGN-1);
163     next = (uint8_t*)next1 + w - (MAX_ALIGN-1);
164     prev2 = (uint8_t*)(parity ? prev : cur);
165     next2 = (uint8_t*)(parity ? cur  : next);
166
167     FILTER(w - (MAX_ALIGN-1), w - 3, 1)
168     FILTER(w - 3, w, 0)
169 }
170
171
172 static void filter_line_c_16bit(void *dst1,
173                                 void *prev1, void *cur1, void *next1,
174                                 int w, int prefs, int mrefs, int parity,
175                                 int mode)
176 {
177     uint16_t *dst  = dst1;
178     uint16_t *prev = prev1;
179     uint16_t *cur  = cur1;
180     uint16_t *next = next1;
181     int x;
182     uint16_t *prev2 = parity ? prev : cur ;
183     uint16_t *next2 = parity ? cur  : next;
184     mrefs /= 2;
185     prefs /= 2;
186
187     FILTER(0, w, 1)
188 }
189
190 static void filter_edges_16bit(void *dst1, void *prev1, void *cur1, void *next1,
191                                int w, int prefs, int mrefs, int parity, int mode)
192 {
193     uint16_t *dst  = dst1;
194     uint16_t *prev = prev1;
195     uint16_t *cur  = cur1;
196     uint16_t *next = next1;
197     int x;
198     uint16_t *prev2 = parity ? prev : cur ;
199     uint16_t *next2 = parity ? cur  : next;
200     mrefs /= 2;
201     prefs /= 2;
202
203     FILTER(0, 3, 0)
204
205     dst   = (uint16_t*)dst1  + w - (MAX_ALIGN/2-1);
206     prev  = (uint16_t*)prev1 + w - (MAX_ALIGN/2-1);
207     cur   = (uint16_t*)cur1  + w - (MAX_ALIGN/2-1);
208     next  = (uint16_t*)next1 + w - (MAX_ALIGN/2-1);
209     prev2 = (uint16_t*)(parity ? prev : cur);
210     next2 = (uint16_t*)(parity ? cur  : next);
211
212     FILTER(w - (MAX_ALIGN/2-1), w - 3, 1)
213     FILTER(w - 3, w, 0)
214 }
215
216 static int filter_slice(AVFilterContext *ctx, void *arg, int jobnr, int nb_jobs)
217 {
218     YADIFContext *s = ctx->priv;
219     ThreadData *td  = arg;
220     int refs = s->cur->linesize[td->plane];
221     int df = (s->csp->comp[td->plane].depth_minus1 + 8) / 8;
222     int pix_3 = 3 * df;
223     int slice_start = (td->h *  jobnr   ) / nb_jobs;
224     int slice_end   = (td->h * (jobnr+1)) / nb_jobs;
225     int y;
226
227     /* filtering reads 3 pixels to the left/right; to avoid invalid reads,
228      * we need to call the c variant which avoids this for border pixels
229      */
230     for (y = slice_start; y < slice_end; y++) {
231         if ((y ^ td->parity) & 1) {
232             uint8_t *prev = &s->prev->data[td->plane][y * refs];
233             uint8_t *cur  = &s->cur ->data[td->plane][y * refs];
234             uint8_t *next = &s->next->data[td->plane][y * refs];
235             uint8_t *dst  = &td->frame->data[td->plane][y * td->frame->linesize[td->plane]];
236             int     mode  = y == 1 || y + 2 == td->h ? 2 : s->mode;
237             s->filter_line(dst + pix_3, prev + pix_3, cur + pix_3,
238                            next + pix_3, td->w - (3 + MAX_ALIGN/df-1),
239                            y + 1 < td->h ? refs : -refs,
240                            y ? -refs : refs,
241                            td->parity ^ td->tff, mode);
242             s->filter_edges(dst, prev, cur, next, td->w,
243                             y + 1 < td->h ? refs : -refs,
244                             y ? -refs : refs,
245                             td->parity ^ td->tff, mode);
246         } else {
247             memcpy(&td->frame->data[td->plane][y * td->frame->linesize[td->plane]],
248                    &s->cur->data[td->plane][y * refs], td->w * df);
249         }
250     }
251     return 0;
252 }
253
254 static void filter(AVFilterContext *ctx, AVFrame *dstpic,
255                    int parity, int tff)
256 {
257     YADIFContext *yadif = ctx->priv;
258     ThreadData td = { .frame = dstpic, .parity = parity, .tff = tff };
259     int i;
260
261     for (i = 0; i < yadif->csp->nb_components; i++) {
262         int w = dstpic->width;
263         int h = dstpic->height;
264
265         if (i == 1 || i == 2) {
266             w = FF_CEIL_RSHIFT(w, yadif->csp->log2_chroma_w);
267             h = FF_CEIL_RSHIFT(h, yadif->csp->log2_chroma_h);
268         }
269
270
271         td.w       = w;
272         td.h       = h;
273         td.plane   = i;
274
275         ctx->internal->execute(ctx, filter_slice, &td, NULL, FFMIN(h, ctx->graph->nb_threads));
276     }
277
278     emms_c();
279 }
280
281 static int return_frame(AVFilterContext *ctx, int is_second)
282 {
283     YADIFContext *yadif = ctx->priv;
284     AVFilterLink *link  = ctx->outputs[0];
285     int tff, ret;
286
287     if (yadif->parity == -1) {
288         tff = yadif->cur->interlaced_frame ?
289               yadif->cur->top_field_first : 1;
290     } else {
291         tff = yadif->parity ^ 1;
292     }
293
294     if (is_second) {
295         yadif->out = ff_get_video_buffer(link, link->w, link->h);
296         if (!yadif->out)
297             return AVERROR(ENOMEM);
298
299         av_frame_copy_props(yadif->out, yadif->cur);
300         yadif->out->interlaced_frame = 0;
301     }
302
303     filter(ctx, yadif->out, tff ^ !is_second, tff);
304
305     if (is_second) {
306         int64_t cur_pts  = yadif->cur->pts;
307         int64_t next_pts = yadif->next->pts;
308
309         if (next_pts != AV_NOPTS_VALUE && cur_pts != AV_NOPTS_VALUE) {
310             yadif->out->pts = cur_pts + next_pts;
311         } else {
312             yadif->out->pts = AV_NOPTS_VALUE;
313         }
314     }
315     ret = ff_filter_frame(ctx->outputs[0], yadif->out);
316
317     yadif->frame_pending = (yadif->mode&1) && !is_second;
318     return ret;
319 }
320
321 static int checkstride(YADIFContext *yadif, const AVFrame *a, const AVFrame *b)
322 {
323     int i;
324     for (i = 0; i < yadif->csp->nb_components; i++)
325         if (a->linesize[i] != b->linesize[i])
326             return 1;
327     return 0;
328 }
329
330 static void fixstride(AVFilterLink *link, AVFrame *f)
331 {
332     AVFrame *dst = ff_default_get_video_buffer(link, f->width, f->height);
333     if(!dst)
334         return;
335     av_frame_copy_props(dst, f);
336     av_image_copy(dst->data, dst->linesize,
337                   (const uint8_t **)f->data, f->linesize,
338                   dst->format, dst->width, dst->height);
339     av_frame_unref(f);
340     av_frame_move_ref(f, dst);
341     av_frame_free(&dst);
342 }
343
344 static int filter_frame(AVFilterLink *link, AVFrame *frame)
345 {
346     AVFilterContext *ctx = link->dst;
347     YADIFContext *yadif = ctx->priv;
348
349     av_assert0(frame);
350
351     if (yadif->frame_pending)
352         return_frame(ctx, 1);
353
354     if (yadif->prev)
355         av_frame_free(&yadif->prev);
356     yadif->prev = yadif->cur;
357     yadif->cur  = yadif->next;
358     yadif->next = frame;
359
360     if (!yadif->cur)
361         return 0;
362
363     if (checkstride(yadif, yadif->next, yadif->cur)) {
364         av_log(ctx, AV_LOG_VERBOSE, "Reallocating frame due to differing stride\n");
365         fixstride(link, yadif->next);
366     }
367     if (checkstride(yadif, yadif->next, yadif->cur))
368         fixstride(link, yadif->cur);
369     if (yadif->prev && checkstride(yadif, yadif->next, yadif->prev))
370         fixstride(link, yadif->prev);
371     if (checkstride(yadif, yadif->next, yadif->cur) || (yadif->prev && checkstride(yadif, yadif->next, yadif->prev))) {
372         av_log(ctx, AV_LOG_ERROR, "Failed to reallocate frame\n");
373         return -1;
374     }
375
376     if ((yadif->deint && !yadif->cur->interlaced_frame) || ctx->is_disabled) {
377         yadif->out  = av_frame_clone(yadif->cur);
378         if (!yadif->out)
379             return AVERROR(ENOMEM);
380
381         av_frame_free(&yadif->prev);
382         if (yadif->out->pts != AV_NOPTS_VALUE)
383             yadif->out->pts *= 2;
384         return ff_filter_frame(ctx->outputs[0], yadif->out);
385     }
386
387     if (!yadif->prev &&
388         !(yadif->prev = av_frame_clone(yadif->cur)))
389         return AVERROR(ENOMEM);
390
391     yadif->out = ff_get_video_buffer(ctx->outputs[0], link->w, link->h);
392     if (!yadif->out)
393         return AVERROR(ENOMEM);
394
395     av_frame_copy_props(yadif->out, yadif->cur);
396     yadif->out->interlaced_frame = 0;
397
398     if (yadif->out->pts != AV_NOPTS_VALUE)
399         yadif->out->pts *= 2;
400
401     return return_frame(ctx, 0);
402 }
403
404 static int request_frame(AVFilterLink *link)
405 {
406     AVFilterContext *ctx = link->src;
407     YADIFContext *yadif = ctx->priv;
408
409     if (yadif->frame_pending) {
410         return_frame(ctx, 1);
411         return 0;
412     }
413
414     do {
415         int ret;
416
417         if (yadif->eof)
418             return AVERROR_EOF;
419
420         ret  = ff_request_frame(link->src->inputs[0]);
421
422         if (ret == AVERROR_EOF && yadif->cur) {
423             AVFrame *next = av_frame_clone(yadif->next);
424
425             if (!next)
426                 return AVERROR(ENOMEM);
427
428             next->pts = yadif->next->pts * 2 - yadif->cur->pts;
429
430             filter_frame(link->src->inputs[0], next);
431             yadif->eof = 1;
432         } else if (ret < 0) {
433             return ret;
434         }
435     } while (!yadif->cur);
436
437     return 0;
438 }
439
440 static av_cold void uninit(AVFilterContext *ctx)
441 {
442     YADIFContext *yadif = ctx->priv;
443
444     av_frame_free(&yadif->prev);
445     av_frame_free(&yadif->cur );
446     av_frame_free(&yadif->next);
447 }
448
449 static int query_formats(AVFilterContext *ctx)
450 {
451     static const enum AVPixelFormat pix_fmts[] = {
452         AV_PIX_FMT_YUV420P,
453         AV_PIX_FMT_YUV422P,
454         AV_PIX_FMT_YUV444P,
455         AV_PIX_FMT_YUV410P,
456         AV_PIX_FMT_YUV411P,
457         AV_PIX_FMT_GRAY8,
458         AV_PIX_FMT_YUVJ420P,
459         AV_PIX_FMT_YUVJ422P,
460         AV_PIX_FMT_YUVJ444P,
461         AV_PIX_FMT_GRAY16,
462         AV_PIX_FMT_YUV440P,
463         AV_PIX_FMT_YUVJ440P,
464         AV_PIX_FMT_YUV420P9,
465         AV_PIX_FMT_YUV422P9,
466         AV_PIX_FMT_YUV444P9,
467         AV_PIX_FMT_YUV420P10,
468         AV_PIX_FMT_YUV422P10,
469         AV_PIX_FMT_YUV444P10,
470         AV_PIX_FMT_YUV420P12,
471         AV_PIX_FMT_YUV422P12,
472         AV_PIX_FMT_YUV444P12,
473         AV_PIX_FMT_YUV420P14,
474         AV_PIX_FMT_YUV422P14,
475         AV_PIX_FMT_YUV444P14,
476         AV_PIX_FMT_YUV420P16,
477         AV_PIX_FMT_YUV422P16,
478         AV_PIX_FMT_YUV444P16,
479         AV_PIX_FMT_YUVA420P,
480         AV_PIX_FMT_YUVA422P,
481         AV_PIX_FMT_YUVA444P,
482         AV_PIX_FMT_GBRP,
483         AV_PIX_FMT_GBRAP,
484         AV_PIX_FMT_NONE
485     };
486
487     ff_set_common_formats(ctx, ff_make_format_list(pix_fmts));
488
489     return 0;
490 }
491
492 static int config_props(AVFilterLink *link)
493 {
494     AVFilterContext *ctx = link->src;
495     YADIFContext *s = link->src->priv;
496     int cpu_flags = av_get_cpu_flags();
497     int bit_depth = (!s->csp) ? 8
498                                   : s->csp->comp[0].depth_minus1 + 1;
499
500     link->time_base.num = link->src->inputs[0]->time_base.num;
501     link->time_base.den = link->src->inputs[0]->time_base.den * 2;
502     link->w             = link->src->inputs[0]->w;
503     link->h             = link->src->inputs[0]->h;
504
505     if(s->mode&1)
506         link->frame_rate = av_mul_q(link->src->inputs[0]->frame_rate, (AVRational){2,1});
507
508     if (link->w < 3 || link->h < 3) {
509         av_log(ctx, AV_LOG_ERROR, "Video of less than 3 columns or lines is not supported\n");
510         return AVERROR(EINVAL);
511     }
512
513     s->csp = av_pix_fmt_desc_get(link->format);
514     if (s->csp->comp[0].depth_minus1 / 8 == 1) {
515         s->filter_line  = filter_line_c_16bit;
516         s->filter_edges = filter_edges_16bit;
517     } else {
518         s->filter_line  = filter_line_c;
519         s->filter_edges = filter_edges;
520     }
521
522 #if HAVE_YASM
523     if (bit_depth >= 15) {
524         if (EXTERNAL_SSE4(cpu_flags))
525             s->filter_line = ff_yadif_filter_line_16bit_sse4;
526         else if (EXTERNAL_SSSE3(cpu_flags))
527             s->filter_line = ff_yadif_filter_line_16bit_ssse3;
528         else if (EXTERNAL_SSE2(cpu_flags))
529             s->filter_line = ff_yadif_filter_line_16bit_sse2;
530 #if ARCH_X86_32
531         else if (EXTERNAL_MMXEXT(cpu_flags))
532             s->filter_line = ff_yadif_filter_line_16bit_mmxext;
533 #endif /* ARCH_X86_32 */
534     } else if ( bit_depth >= 9 && bit_depth <= 14) {
535         if (EXTERNAL_SSSE3(cpu_flags))
536             s->filter_line = ff_yadif_filter_line_10bit_ssse3;
537         else if (EXTERNAL_SSE2(cpu_flags))
538             s->filter_line = ff_yadif_filter_line_10bit_sse2;
539 #if ARCH_X86_32
540         else if (EXTERNAL_MMXEXT(cpu_flags))
541             s->filter_line = ff_yadif_filter_line_10bit_mmxext;
542 #endif /* ARCH_X86_32 */
543     } else {
544         if (EXTERNAL_SSSE3(cpu_flags))
545             s->filter_line = ff_yadif_filter_line_ssse3;
546         else if (EXTERNAL_SSE2(cpu_flags))
547             s->filter_line = ff_yadif_filter_line_sse2;
548 #if ARCH_X86_32
549         else if (EXTERNAL_MMXEXT(cpu_flags))
550             s->filter_line = ff_yadif_filter_line_mmxext;
551 #endif /* ARCH_X86_32 */
552     }
553 #endif /* HAVE_YASM */
554     return 0;
555 }
556
557
558 #define OFFSET(x) offsetof(YADIFContext, x)
559 #define FLAGS AV_OPT_FLAG_VIDEO_PARAM|AV_OPT_FLAG_FILTERING_PARAM
560
561 #define CONST(name, help, val, unit) { name, help, 0, AV_OPT_TYPE_CONST, {.i64=val}, INT_MIN, INT_MAX, FLAGS, unit }
562
563 static const AVOption yadif_options[] = {
564     { "mode",   "specify the interlacing mode", OFFSET(mode), AV_OPT_TYPE_INT, {.i64=YADIF_MODE_SEND_FRAME}, 0, 3, FLAGS, "mode"},
565     CONST("send_frame",           "send one frame for each frame",                                     YADIF_MODE_SEND_FRAME,           "mode"),
566     CONST("send_field",           "send one frame for each field",                                     YADIF_MODE_SEND_FIELD,           "mode"),
567     CONST("send_frame_nospatial", "send one frame for each frame, but skip spatial interlacing check", YADIF_MODE_SEND_FRAME_NOSPATIAL, "mode"),
568     CONST("send_field_nospatial", "send one frame for each field, but skip spatial interlacing check", YADIF_MODE_SEND_FIELD_NOSPATIAL, "mode"),
569
570     { "parity", "specify the assumed picture field parity", OFFSET(parity), AV_OPT_TYPE_INT, {.i64=YADIF_PARITY_AUTO}, -1, 1, FLAGS, "parity" },
571     CONST("tff",  "assume top field first",    YADIF_PARITY_TFF,  "parity"),
572     CONST("bff",  "assume bottom field first", YADIF_PARITY_BFF,  "parity"),
573     CONST("auto", "auto detect parity",        YADIF_PARITY_AUTO, "parity"),
574
575     { "deint", "specify which frames to deinterlace", OFFSET(deint), AV_OPT_TYPE_INT, {.i64=YADIF_DEINT_ALL}, 0, 1, FLAGS, "deint" },
576     CONST("all",        "deinterlace all frames",                       YADIF_DEINT_ALL,         "deint"),
577     CONST("interlaced", "only deinterlace frames marked as interlaced", YADIF_DEINT_INTERLACED,  "deint"),
578
579     { NULL }
580 };
581
582 AVFILTER_DEFINE_CLASS(yadif);
583
584 AVFilter ff_vf_yadif = {
585     .name          = "yadif",
586     .description   = NULL_IF_CONFIG_SMALL("Deinterlace the input image."),
587     .priv_size     = sizeof(YADIFContext),
588     .priv_class    = &yadif_class,
589     .uninit        = uninit,
590     .query_formats = query_formats,
591
592     .inputs        = (const AVFilterPad[]) {{ .name             = "default",
593                                               .type             = AVMEDIA_TYPE_VIDEO,
594                                               .filter_frame     = filter_frame,
595                                             },
596                                             { .name = NULL}},
597
598     .outputs       = (const AVFilterPad[]) {{ .name             = "default",
599                                               .type             = AVMEDIA_TYPE_VIDEO,
600                                               .request_frame    = request_frame,
601                                               .config_props     = config_props,
602                                             },
603                                             { .name = NULL}},
604
605     .flags         = AVFILTER_FLAG_SUPPORT_TIMELINE_INTERNAL | AVFILTER_FLAG_SLICE_THREADS,
606 };