FFmpeg
vf_bwdif.c
Go to the documentation of this file.
1 /*
2  * BobWeaver Deinterlacing Filter
3  * Copyright (C) 2016 Thomas Mundt <loudmax@yahoo.de>
4  *
5  * Based on YADIF (Yet Another Deinterlacing Filter)
6  * Copyright (C) 2006-2011 Michael Niedermayer <michaelni@gmx.at>
7  * 2010 James Darnley <james.darnley@gmail.com>
8  *
9  * With use of Weston 3 Field Deinterlacing Filter algorithm
10  * Copyright (C) 2012 British Broadcasting Corporation, All Rights Reserved
11  * Author of de-interlace algorithm: Jim Easterbrook for BBC R&D
12  * Based on the process described by Martin Weston for BBC R&D
13  *
14  * This file is part of FFmpeg.
15  *
16  * FFmpeg is free software; you can redistribute it and/or
17  * modify it under the terms of the GNU Lesser General Public
18  * License as published by the Free Software Foundation; either
19  * version 2.1 of the License, or (at your option) any later version.
20  *
21  * FFmpeg is distributed in the hope that it will be useful,
22  * but WITHOUT ANY WARRANTY; without even the implied warranty of
23  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
24  * Lesser General Public License for more details.
25  *
26  * You should have received a copy of the GNU Lesser General Public
27  * License along with FFmpeg; if not, write to the Free Software
28  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
29  */
30 
31 #include "libavutil/avassert.h"
32 #include "libavutil/common.h"
33 #include "libavutil/opt.h"
34 #include "libavutil/pixdesc.h"
35 #include "libavutil/imgutils.h"
36 #include "avfilter.h"
37 #include "formats.h"
38 #include "internal.h"
39 #include "video.h"
40 #include "bwdif.h"
41 
42 /*
43  * Filter coefficients coef_lf and coef_hf taken from BBC PH-2071 (Weston 3 Field Deinterlacer).
44  * Used when there is spatial and temporal interpolation.
45  * Filter coefficients coef_sp are used when there is spatial interpolation only.
46  * Adjusted for matching visual sharpness impression of spatial and temporal interpolation.
47  */
48 static const uint16_t coef_lf[2] = { 4309, 213 };
49 static const uint16_t coef_hf[3] = { 5570, 3801, 1016 };
50 static const uint16_t coef_sp[2] = { 5077, 981 };
51 
52 typedef struct ThreadData {
54  int plane;
55  int w, h;
56  int parity;
57  int tff;
58 } ThreadData;
59 
60 #define FILTER_INTRA() \
61  for (x = 0; x < w; x++) { \
62  interpol = (coef_sp[0] * (cur[mrefs] + cur[prefs]) - coef_sp[1] * (cur[mrefs3] + cur[prefs3])) >> 13; \
63  dst[0] = av_clip(interpol, 0, clip_max); \
64  \
65  dst++; \
66  cur++; \
67  }
68 
69 #define FILTER1() \
70  for (x = 0; x < w; x++) { \
71  int c = cur[mrefs]; \
72  int d = (prev2[0] + next2[0]) >> 1; \
73  int e = cur[prefs]; \
74  int temporal_diff0 = FFABS(prev2[0] - next2[0]); \
75  int temporal_diff1 =(FFABS(prev[mrefs] - c) + FFABS(prev[prefs] - e)) >> 1; \
76  int temporal_diff2 =(FFABS(next[mrefs] - c) + FFABS(next[prefs] - e)) >> 1; \
77  int diff = FFMAX3(temporal_diff0 >> 1, temporal_diff1, temporal_diff2); \
78  \
79  if (!diff) { \
80  dst[0] = d; \
81  } else {
82 
83 #define SPAT_CHECK() \
84  int b = ((prev2[mrefs2] + next2[mrefs2]) >> 1) - c; \
85  int f = ((prev2[prefs2] + next2[prefs2]) >> 1) - e; \
86  int dc = d - c; \
87  int de = d - e; \
88  int max = FFMAX3(de, dc, FFMIN(b, f)); \
89  int min = FFMIN3(de, dc, FFMAX(b, f)); \
90  diff = FFMAX3(diff, min, -max);
91 
92 #define FILTER_LINE() \
93  SPAT_CHECK() \
94  if (FFABS(c - e) > temporal_diff0) { \
95  interpol = (((coef_hf[0] * (prev2[0] + next2[0]) \
96  - coef_hf[1] * (prev2[mrefs2] + next2[mrefs2] + prev2[prefs2] + next2[prefs2]) \
97  + coef_hf[2] * (prev2[mrefs4] + next2[mrefs4] + prev2[prefs4] + next2[prefs4])) >> 2) \
98  + coef_lf[0] * (c + e) - coef_lf[1] * (cur[mrefs3] + cur[prefs3])) >> 13; \
99  } else { \
100  interpol = (coef_sp[0] * (c + e) - coef_sp[1] * (cur[mrefs3] + cur[prefs3])) >> 13; \
101  }
102 
103 #define FILTER_EDGE() \
104  if (spat) { \
105  SPAT_CHECK() \
106  } \
107  interpol = (c + e) >> 1;
108 
109 #define FILTER2() \
110  if (interpol > d + diff) \
111  interpol = d + diff; \
112  else if (interpol < d - diff) \
113  interpol = d - diff; \
114  \
115  dst[0] = av_clip(interpol, 0, clip_max); \
116  } \
117  \
118  dst++; \
119  cur++; \
120  prev++; \
121  next++; \
122  prev2++; \
123  next2++; \
124  }
125 
126 static void filter_intra(void *dst1, void *cur1, int w, int prefs, int mrefs,
127  int prefs3, int mrefs3, int parity, int clip_max)
128 {
129  uint8_t *dst = dst1;
130  uint8_t *cur = cur1;
131  int interpol, x;
132 
133  FILTER_INTRA()
134 }
135 
136 static void filter_line_c(void *dst1, void *prev1, void *cur1, void *next1,
137  int w, int prefs, int mrefs, int prefs2, int mrefs2,
138  int prefs3, int mrefs3, int prefs4, int mrefs4,
139  int parity, int clip_max)
140 {
141  uint8_t *dst = dst1;
142  uint8_t *prev = prev1;
143  uint8_t *cur = cur1;
144  uint8_t *next = next1;
145  uint8_t *prev2 = parity ? prev : cur ;
146  uint8_t *next2 = parity ? cur : next;
147  int interpol, x;
148 
149  FILTER1()
150  FILTER_LINE()
151  FILTER2()
152 }
153 
154 static void filter_edge(void *dst1, void *prev1, void *cur1, void *next1,
155  int w, int prefs, int mrefs, int prefs2, int mrefs2,
156  int parity, int clip_max, int spat)
157 {
158  uint8_t *dst = dst1;
159  uint8_t *prev = prev1;
160  uint8_t *cur = cur1;
161  uint8_t *next = next1;
162  uint8_t *prev2 = parity ? prev : cur ;
163  uint8_t *next2 = parity ? cur : next;
164  int interpol, x;
165 
166  FILTER1()
167  FILTER_EDGE()
168  FILTER2()
169 }
170 
171 static void filter_intra_16bit(void *dst1, void *cur1, int w, int prefs, int mrefs,
172  int prefs3, int mrefs3, int parity, int clip_max)
173 {
174  uint16_t *dst = dst1;
175  uint16_t *cur = cur1;
176  int interpol, x;
177 
178  FILTER_INTRA()
179 }
180 
181 static void filter_line_c_16bit(void *dst1, void *prev1, void *cur1, void *next1,
182  int w, int prefs, int mrefs, int prefs2, int mrefs2,
183  int prefs3, int mrefs3, int prefs4, int mrefs4,
184  int parity, int clip_max)
185 {
186  uint16_t *dst = dst1;
187  uint16_t *prev = prev1;
188  uint16_t *cur = cur1;
189  uint16_t *next = next1;
190  uint16_t *prev2 = parity ? prev : cur ;
191  uint16_t *next2 = parity ? cur : next;
192  int interpol, x;
193 
194  FILTER1()
195  FILTER_LINE()
196  FILTER2()
197 }
198 
199 static void filter_edge_16bit(void *dst1, void *prev1, void *cur1, void *next1,
200  int w, int prefs, int mrefs, int prefs2, int mrefs2,
201  int parity, int clip_max, int spat)
202 {
203  uint16_t *dst = dst1;
204  uint16_t *prev = prev1;
205  uint16_t *cur = cur1;
206  uint16_t *next = next1;
207  uint16_t *prev2 = parity ? prev : cur ;
208  uint16_t *next2 = parity ? cur : next;
209  int interpol, x;
210 
211  FILTER1()
212  FILTER_EDGE()
213  FILTER2()
214 }
215 
216 static int filter_slice(AVFilterContext *ctx, void *arg, int jobnr, int nb_jobs)
217 {
218  BWDIFContext *s = ctx->priv;
219  YADIFContext *yadif = &s->yadif;
220  ThreadData *td = arg;
221  int linesize = yadif->cur->linesize[td->plane];
222  int clip_max = (1 << (yadif->csp->comp[td->plane].depth)) - 1;
223  int df = (yadif->csp->comp[td->plane].depth + 7) / 8;
224  int refs = linesize / df;
225  int slice_start = (td->h * jobnr ) / nb_jobs;
226  int slice_end = (td->h * (jobnr+1)) / nb_jobs;
227  int y;
228 
229  for (y = slice_start; y < slice_end; y++) {
230  if ((y ^ td->parity) & 1) {
231  uint8_t *prev = &yadif->prev->data[td->plane][y * linesize];
232  uint8_t *cur = &yadif->cur ->data[td->plane][y * linesize];
233  uint8_t *next = &yadif->next->data[td->plane][y * linesize];
234  uint8_t *dst = &td->frame->data[td->plane][y * td->frame->linesize[td->plane]];
235  if (yadif->current_field == YADIF_FIELD_END) {
236  s->filter_intra(dst, cur, td->w, (y + df) < td->h ? refs : -refs,
237  y > (df - 1) ? -refs : refs,
238  (y + 3*df) < td->h ? 3 * refs : -refs,
239  y > (3*df - 1) ? -3 * refs : refs,
240  td->parity ^ td->tff, clip_max);
241  } else if ((y < 4) || ((y + 5) > td->h)) {
242  s->filter_edge(dst, prev, cur, next, td->w,
243  (y + df) < td->h ? refs : -refs,
244  y > (df - 1) ? -refs : refs,
245  refs << 1, -(refs << 1),
246  td->parity ^ td->tff, clip_max,
247  (y < 2) || ((y + 3) > td->h) ? 0 : 1);
248  } else {
249  s->filter_line(dst, prev, cur, next, td->w,
250  refs, -refs, refs << 1, -(refs << 1),
251  3 * refs, -3 * refs, refs << 2, -(refs << 2),
252  td->parity ^ td->tff, clip_max);
253  }
254  } else {
255  memcpy(&td->frame->data[td->plane][y * td->frame->linesize[td->plane]],
256  &yadif->cur->data[td->plane][y * linesize], td->w * df);
257  }
258  }
259  return 0;
260 }
261 
262 static void filter(AVFilterContext *ctx, AVFrame *dstpic,
263  int parity, int tff)
264 {
265  BWDIFContext *bwdif = ctx->priv;
266  YADIFContext *yadif = &bwdif->yadif;
267  ThreadData td = { .frame = dstpic, .parity = parity, .tff = tff };
268  int i;
269 
270  for (i = 0; i < yadif->csp->nb_components; i++) {
271  int w = dstpic->width;
272  int h = dstpic->height;
273 
274  if (i == 1 || i == 2) {
275  w = AV_CEIL_RSHIFT(w, yadif->csp->log2_chroma_w);
276  h = AV_CEIL_RSHIFT(h, yadif->csp->log2_chroma_h);
277  }
278 
279  td.w = w;
280  td.h = h;
281  td.plane = i;
282 
283  ctx->internal->execute(ctx, filter_slice, &td, NULL, FFMIN(h, ff_filter_get_nb_threads(ctx)));
284  }
285  if (yadif->current_field == YADIF_FIELD_END) {
287  }
288 
289  emms_c();
290 }
291 
293 {
294  BWDIFContext *bwdif = ctx->priv;
295  YADIFContext *yadif = &bwdif->yadif;
296 
297  av_frame_free(&yadif->prev);
298  av_frame_free(&yadif->cur );
299  av_frame_free(&yadif->next);
300 }
301 
303 {
304  static const enum AVPixelFormat pix_fmts[] = {
323  };
324 
325  AVFilterFormats *fmts_list = ff_make_format_list(pix_fmts);
326  if (!fmts_list)
327  return AVERROR(ENOMEM);
328 
329  return ff_set_common_formats(ctx, fmts_list);
330 }
331 
333 {
334  AVFilterContext *ctx = link->src;
335  BWDIFContext *s = link->src->priv;
336  YADIFContext *yadif = &s->yadif;
337 
338  link->time_base.num = link->src->inputs[0]->time_base.num;
339  link->time_base.den = link->src->inputs[0]->time_base.den * 2;
340  link->w = link->src->inputs[0]->w;
341  link->h = link->src->inputs[0]->h;
342 
343  if(yadif->mode&1)
344  link->frame_rate = av_mul_q(link->src->inputs[0]->frame_rate, (AVRational){2,1});
345 
346  if (link->w < 3 || link->h < 3) {
347  av_log(ctx, AV_LOG_ERROR, "Video of less than 3 columns or lines is not supported\n");
348  return AVERROR(EINVAL);
349  }
350 
351  yadif->csp = av_pix_fmt_desc_get(link->format);
352  yadif->filter = filter;
353  if (yadif->csp->comp[0].depth > 8) {
357  } else {
361  }
362 
363  if (ARCH_X86)
365 
366  return 0;
367 }
368 
369 
370 #define OFFSET(x) offsetof(YADIFContext, x)
371 #define FLAGS AV_OPT_FLAG_VIDEO_PARAM|AV_OPT_FLAG_FILTERING_PARAM
372 
373 #define CONST(name, help, val, unit) { name, help, 0, AV_OPT_TYPE_CONST, {.i64=val}, INT_MIN, INT_MAX, FLAGS, unit }
374 
375 static const AVOption bwdif_options[] = {
376  { "mode", "specify the interlacing mode", OFFSET(mode), AV_OPT_TYPE_INT, {.i64=YADIF_MODE_SEND_FIELD}, 0, 1, FLAGS, "mode"},
377  CONST("send_frame", "send one frame for each frame", YADIF_MODE_SEND_FRAME, "mode"),
378  CONST("send_field", "send one frame for each field", YADIF_MODE_SEND_FIELD, "mode"),
379 
380  { "parity", "specify the assumed picture field parity", OFFSET(parity), AV_OPT_TYPE_INT, {.i64=YADIF_PARITY_AUTO}, -1, 1, FLAGS, "parity" },
381  CONST("tff", "assume top field first", YADIF_PARITY_TFF, "parity"),
382  CONST("bff", "assume bottom field first", YADIF_PARITY_BFF, "parity"),
383  CONST("auto", "auto detect parity", YADIF_PARITY_AUTO, "parity"),
384 
385  { "deint", "specify which frames to deinterlace", OFFSET(deint), AV_OPT_TYPE_INT, {.i64=YADIF_DEINT_ALL}, 0, 1, FLAGS, "deint" },
386  CONST("all", "deinterlace all frames", YADIF_DEINT_ALL, "deint"),
387  CONST("interlaced", "only deinterlace frames marked as interlaced", YADIF_DEINT_INTERLACED, "deint"),
388 
389  { NULL }
390 };
391 
392 AVFILTER_DEFINE_CLASS(bwdif);
393 
395  {
396  .name = "default",
397  .type = AVMEDIA_TYPE_VIDEO,
398  .filter_frame = ff_yadif_filter_frame,
399  },
400  { NULL }
401 };
402 
404  {
405  .name = "default",
406  .type = AVMEDIA_TYPE_VIDEO,
407  .request_frame = ff_yadif_request_frame,
408  .config_props = config_props,
409  },
410  { NULL }
411 };
412 
414  .name = "bwdif",
415  .description = NULL_IF_CONFIG_SMALL("Deinterlace the input image."),
416  .priv_size = sizeof(BWDIFContext),
417  .priv_class = &bwdif_class,
418  .uninit = uninit,
420  .inputs = avfilter_vf_bwdif_inputs,
421  .outputs = avfilter_vf_bwdif_outputs,
423 };
static const uint16_t coef_sp[2]
Definition: vf_bwdif.c:50
#define NULL
Definition: coverity.c:32
#define AV_PIX_FMT_YUVA422P16
Definition: pixfmt.h:430
static av_cold void uninit(AVFilterContext *ctx)
Definition: vf_bwdif.c:292
void(* filter_edge)(void *dst, void *prev, void *cur, void *next, int w, int prefs, int mrefs, int prefs2, int mrefs2, int parity, int clip_max, int spat)
Definition: bwdif.h:35
#define AV_PIX_FMT_YUVA422P9
Definition: pixfmt.h:422
const AVPixFmtDescriptor * av_pix_fmt_desc_get(enum AVPixelFormat pix_fmt)
Definition: pixdesc.c:2522
static const uint16_t coef_lf[2]
Definition: vf_bwdif.c:48
This structure describes decoded (raw) audio or video data.
Definition: frame.h:295
AVOption.
Definition: opt.h:246
#define AV_PIX_FMT_YUVA420P10
Definition: pixfmt.h:424
#define CONST(name, help, val, unit)
Definition: vf_bwdif.c:373
#define AV_PIX_FMT_YUV444P14
Definition: pixfmt.h:397
#define AV_PIX_FMT_YUVA422P10
Definition: pixfmt.h:425
int tff
Definition: vf_bwdif.c:57
planar YUV 4:4:4, 24bpp, (1 Cr & Cb sample per 1x1 Y samples)
Definition: pixfmt.h:71
misc image utilities
AVFrame * frame
Definition: vf_bwdif.c:53
Main libavfilter public API header.
void ff_bwdif_init_x86(BWDIFContext *bwdif)
Definition: vf_bwdif_init.c:54
void(* filter)(AVFilterContext *ctx, AVFrame *dstpic, int parity, int tff)
Definition: yadif.h:64
planar GBR 4:4:4 24bpp
Definition: pixfmt.h:168
int num
Numerator.
Definition: rational.h:59
int ff_yadif_request_frame(AVFilterLink *link)
Definition: yadif_common.c:159
#define AV_PIX_FMT_GBRP10
Definition: pixfmt.h:403
static int interpol(MBContext *s, uint32_t *color, int x, int y, int linesize)
#define AV_PIX_FMT_YUV420P12
Definition: pixfmt.h:391
A normal field in the middle of a sequence.
Definition: yadif.h:47
static int filter_slice(AVFilterContext *ctx, void *arg, int jobnr, int nb_jobs)
Definition: vf_bwdif.c:216
uint8_t log2_chroma_w
Amount to shift the luma width right to find the chroma width.
Definition: pixdesc.h:92
int current_field
YADIFCurrentField.
Definition: yadif.h:86
AVFilterFormats * ff_make_format_list(const int *fmts)
Create a list of supported formats.
Definition: formats.c:283
const char * name
Pad name.
Definition: internal.h:60
AVFilterLink ** inputs
array of pointers to input links
Definition: avfilter.h:346
AVFrame * cur
Definition: yadif.h:59
planar YUV 4:2:0, 20bpp, (1 Cr & Cb sample per 2x2 Y & A samples)
Definition: pixfmt.h:101
AVComponentDescriptor comp[4]
Parameters that describe how pixels are packed.
Definition: pixdesc.h:117
uint8_t
#define av_cold
Definition: attributes.h:82
AVOptions.
void(* filter_line)(void *dst, void *prev, void *cur, void *next, int w, int prefs, int mrefs, int prefs2, int mrefs2, int prefs3, int mrefs3, int prefs4, int mrefs4, int parity, int clip_max)
Definition: bwdif.h:31
#define AV_PIX_FMT_YUVA420P9
Definition: pixfmt.h:421
#define AV_PIX_FMT_GBRP9
Definition: pixfmt.h:402
AVFrame * next
Definition: yadif.h:60
bottom field first
Definition: yadif.h:35
AVFrame * dst
Definition: vf_blend.c:55
int plane
Definition: vf_blend.c:57
planar YUV 4:4:0 full scale (JPEG), deprecated in favor of AV_PIX_FMT_YUV440P and setting color_range...
Definition: pixfmt.h:100
planar YUV 4:2:2, 16bpp, full scale (JPEG), deprecated in favor of AV_PIX_FMT_YUV422P and setting col...
Definition: pixfmt.h:79
int linesize
Definition: vf_avgblur.c:64
#define AV_PIX_FMT_YUV444P16
Definition: pixfmt.h:400
send 1 frame for each field
Definition: yadif.h:28
#define AV_PIX_FMT_YUV422P12
Definition: pixfmt.h:392
static void filter(AVFilterContext *ctx, AVFrame *dstpic, int parity, int tff)
Definition: vf_bwdif.c:262
#define AV_PIX_FMT_YUVA420P16
Definition: pixfmt.h:429
AVFrame * prev
Definition: yadif.h:61
#define av_log(a,...)
A filter pad used for either input or output.
Definition: internal.h:54
auto detection
Definition: yadif.h:36
planar YUV 4:2:2 24bpp, (1 Cr & Cb sample per 2x1 Y & A samples)
Definition: pixfmt.h:176
#define i(width, name, range_min, range_max)
Definition: cbs_h2645.c:259
int width
Definition: frame.h:353
#define AV_LOG_ERROR
Something went wrong and cannot losslessly be recovered.
Definition: log.h:176
int ff_set_common_formats(AVFilterContext *ctx, AVFilterFormats *formats)
A helper for query_formats() which sets all links to the same list of formats.
Definition: formats.c:568
#define td
Definition: regdef.h:70
uint8_t log2_chroma_h
Amount to shift the luma height right to find the chroma height.
Definition: pixdesc.h:101
static void filter_line_c(void *dst1, void *prev1, void *cur1, void *next1, int w, int prefs, int mrefs, int prefs2, int mrefs2, int prefs3, int mrefs3, int prefs4, int mrefs4, int parity, int clip_max)
Definition: vf_bwdif.c:136
#define FILTER_LINE()
Definition: vf_bwdif.c:92
void av_frame_free(AVFrame **frame)
Free the frame and any dynamically allocated objects in it, e.g.
Definition: frame.c:202
#define NULL_IF_CONFIG_SMALL(x)
Return NULL if CONFIG_SMALL is true, otherwise the argument without modification. ...
Definition: internal.h:186
void * priv
private data for use by the filter
Definition: avfilter.h:353
#define AVFILTER_FLAG_SLICE_THREADS
The filter supports multithreading by splitting frames into multiple parts and processing them concur...
Definition: avfilter.h:116
int parity
Definition: vf_bwdif.c:56
#define AV_PIX_FMT_YUVA444P16
Definition: pixfmt.h:431
#define FILTER2()
Definition: vf_bwdif.c:109
const char * arg
Definition: jacosubdec.c:66
simple assert() macros that are a bit more flexible than ISO C assert().
#define AV_PIX_FMT_YUV444P10
Definition: pixfmt.h:390
#define AV_PIX_FMT_GBRAP16
Definition: pixfmt.h:409
planar YUV 4:2:2, 16bpp, (1 Cr & Cb sample per 2x1 Y samples)
Definition: pixfmt.h:70
#define AV_PIX_FMT_YUV422P9
Definition: pixfmt.h:385
AVFilter ff_vf_bwdif
Definition: vf_bwdif.c:413
static void filter_intra_16bit(void *dst1, void *cur1, int w, int prefs, int mrefs, int prefs3, int mrefs3, int parity, int clip_max)
Definition: vf_bwdif.c:171
uint8_t nb_components
The number of components each pixel has, (1-4)
Definition: pixdesc.h:83
#define AV_PIX_FMT_GBRP16
Definition: pixfmt.h:406
int ff_filter_get_nb_threads(AVFilterContext *ctx)
Get number of threads for current filter instance.
Definition: avfilter.c:802
#define AV_PIX_FMT_GRAY16
Definition: pixfmt.h:371
#define FFMIN(a, b)
Definition: common.h:96
planar YUV 4:2:0, 12bpp, full scale (JPEG), deprecated in favor of AV_PIX_FMT_YUV420P and setting col...
Definition: pixfmt.h:78
AVFormatContext * ctx
Definition: movenc.c:48
AVFILTER_DEFINE_CLASS(bwdif)
static const uint16_t coef_hf[3]
Definition: vf_bwdif.c:49
#define FILTER_EDGE()
Definition: vf_bwdif.c:103
#define FILTER1()
Definition: vf_bwdif.c:69
#define AV_PIX_FMT_YUVA444P10
Definition: pixfmt.h:426
#define AV_PIX_FMT_YUV444P9
Definition: pixfmt.h:386
#define AV_PIX_FMT_GBRP14
Definition: pixfmt.h:405
static const AVFilterPad outputs[]
Definition: af_acontrast.c:203
#define AV_PIX_FMT_YUV420P16
Definition: pixfmt.h:398
#define FILTER_INTRA()
Definition: vf_bwdif.c:60
#define AV_PIX_FMT_YUV420P14
Definition: pixfmt.h:395
#define OFFSET(x)
Definition: vf_bwdif.c:370
Used for passing data between threads.
Definition: af_adeclick.c:487
int linesize[AV_NUM_DATA_POINTERS]
For video, size in bytes of each picture line.
Definition: frame.h:326
static int config_props(AVFilterLink *link)
Definition: vf_bwdif.c:332
planar YUV 4:4:4 32bpp, (1 Cr & Cb sample per 1x1 Y & A samples)
Definition: pixfmt.h:177
AVFrame * cur
Definition: vf_w3fdif.c:339
these buffered frames must be flushed immediately if a new input produces new the filter must not call request_frame to get more It must just process the frame or queue it The task of requesting more frames is left to the filter s request_frame method or the application If a filter has several inputs
#define AV_PIX_FMT_YUV420P10
Definition: pixfmt.h:387
planar YUV 4:1:0, 9bpp, (1 Cr & Cb sample per 4x4 Y samples)
Definition: pixfmt.h:72
Filter definition.
Definition: avfilter.h:144
Rational number (pair of numerator and denominator).
Definition: rational.h:58
int ff_yadif_filter_frame(AVFilterLink *link, AVFrame *frame)
Definition: yadif_common.c:92
static void filter_edge(void *dst1, void *prev1, void *cur1, void *next1, int w, int prefs, int mrefs, int prefs2, int mrefs2, int parity, int clip_max, int spat)
Definition: vf_bwdif.c:154
The first or last field in a sequence.
Definition: yadif.h:46
const char * name
Filter name.
Definition: avfilter.h:148
#define AV_PIX_FMT_YUV420P9
Definition: pixfmt.h:384
Filter the word “frame” indicates either a video frame or a group of audio as stored in an AVFrame structure Format for each input and each output the list of supported formats For video that means pixel format For audio that means channel sample they are references to shared objects When the negotiation mechanism computes the intersection of the formats supported at each end of a link
static const AVFilterPad avfilter_vf_bwdif_inputs[]
Definition: vf_bwdif.c:394
#define AVFILTER_FLAG_SUPPORT_TIMELINE_INTERNAL
Same as AVFILTER_FLAG_SUPPORT_TIMELINE_GENERIC, except that the filter will have its filter_frame() c...
Definition: avfilter.h:133
static enum AVPixelFormat pix_fmts[]
Definition: libkvazaar.c:275
static void filter_line_c_16bit(void *dst1, void *prev1, void *cur1, void *next1, int w, int prefs, int mrefs, int prefs2, int mrefs2, int prefs3, int mrefs3, int prefs4, int mrefs4, int parity, int clip_max)
Definition: vf_bwdif.c:181
#define AV_PIX_FMT_YUV422P14
Definition: pixfmt.h:396
#define AV_PIX_FMT_GBRP12
Definition: pixfmt.h:404
#define flags(name, subs,...)
Definition: cbs_av1.c:561
AVFilterInternal * internal
An opaque struct for libavfilter internal use.
Definition: avfilter.h:378
#define AV_PIX_FMT_YUV422P10
Definition: pixfmt.h:388
static const AVOption bwdif_options[]
Definition: vf_bwdif.c:375
#define AV_PIX_FMT_YUV444P12
Definition: pixfmt.h:394
uint8_t * data[AV_NUM_DATA_POINTERS]
pointer to the picture/channel planes.
Definition: frame.h:309
const AVPixFmtDescriptor * csp
Definition: yadif.h:75
#define FLAGS
Definition: vf_bwdif.c:371
planar YUV 4:2:0, 12bpp, (1 Cr & Cb sample per 2x2 Y samples)
Definition: pixfmt.h:66
Y , 8bpp.
Definition: pixfmt.h:74
common internal and external API header
planar GBRA 4:4:4:4 32bpp
Definition: pixfmt.h:215
static int query_formats(AVFilterContext *ctx)
Definition: vf_bwdif.c:302
#define AV_PIX_FMT_YUVA444P9
Definition: pixfmt.h:423
planar YUV 4:4:4, 24bpp, full scale (JPEG), deprecated in favor of AV_PIX_FMT_YUV444P and setting col...
Definition: pixfmt.h:80
planar YUV 4:1:1, 12bpp, (1 Cr & Cb sample per 4x1 Y samples)
Definition: pixfmt.h:73
int den
Denominator.
Definition: rational.h:60
avfilter_execute_func * execute
Definition: internal.h:155
static int slice_end(AVCodecContext *avctx, AVFrame *pict)
Handle slice ends.
Definition: mpeg12dec.c:2029
deinterlace all frames
Definition: yadif.h:40
YADIFContext yadif
Definition: bwdif.h:27
send 1 frame for each frame
Definition: yadif.h:27
static void filter_intra(void *dst1, void *cur1, int w, int prefs, int mrefs, int prefs3, int mrefs3, int parity, int clip_max)
Definition: vf_bwdif.c:126
A list of supported formats for one end of a filter link.
Definition: formats.h:64
planar YUV 4:1:1, 12bpp, (1 Cr & Cb sample per 4x1 Y samples) full scale (JPEG), deprecated in favor ...
Definition: pixfmt.h:258
An instance of a filter.
Definition: avfilter.h:338
AVRational av_mul_q(AVRational b, AVRational c)
Multiply two rationals.
Definition: rational.c:80
int height
Definition: frame.h:353
planar YUV 4:4:0 (1 Cr & Cb sample per 1x2 Y samples)
Definition: pixfmt.h:99
static const AVFilterPad avfilter_vf_bwdif_outputs[]
Definition: vf_bwdif.c:403
#define df(A, B)
Definition: vf_xbr.c:90
internal API functions
Filter the word “frame” indicates either a video frame or a group of audio as stored in an AVFrame structure Format for each input and each output the list of supported formats For video that means pixel format For audio that means channel sample they are references to shared objects When the negotiation mechanism computes the intersection of the formats supported at each end of a all references to both lists are replaced with a reference to the intersection And when a single format is eventually chosen for a link amongst the remaining all references to the list are updated That means that if a filter requires that its input and output have the same format amongst a supported all it has to do is use a reference to the same list of formats query_formats can leave some formats unset and return AVERROR(EAGAIN) to cause the negotiation mechanism toagain later.That can be used by filters with complex requirements to use the format negotiated on one link to set the formats supported on another.Frame references ownership and permissions
int depth
Number of bits in the component.
Definition: pixdesc.h:58
only deinterlace frames marked as interlaced
Definition: yadif.h:41
AVPixelFormat
Pixel format.
Definition: pixfmt.h:64
top field first
Definition: yadif.h:34
mode
Use these values in ebur128_init (or&#39;ed).
Definition: ebur128.h:83
#define AV_PIX_FMT_YUV422P16
Definition: pixfmt.h:399
int mode
YADIFMode.
Definition: yadif.h:53
static void filter_edge_16bit(void *dst1, void *prev1, void *cur1, void *next1, int w, int prefs, int mrefs, int prefs2, int mrefs2, int parity, int clip_max, int spat)
Definition: vf_bwdif.c:199
void(* filter_intra)(void *dst1, void *cur1, int w, int prefs, int mrefs, int prefs3, int mrefs3, int parity, int clip_max)
Definition: bwdif.h:29
#define AV_CEIL_RSHIFT(a, b)
Definition: common.h:58