FFmpeg  4.4.8
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 "filters.h"
38 #include "formats.h"
39 #include "internal.h"
40 #include "video.h"
41 #include "bwdif.h"
42 
43 /*
44  * Filter coefficients coef_lf and coef_hf taken from BBC PH-2071 (Weston 3 Field Deinterlacer).
45  * Used when there is spatial and temporal interpolation.
46  * Filter coefficients coef_sp are used when there is spatial interpolation only.
47  * Adjusted for matching visual sharpness impression of spatial and temporal interpolation.
48  */
49 static const uint16_t coef_lf[2] = { 4309, 213 };
50 static const uint16_t coef_hf[3] = { 5570, 3801, 1016 };
51 static const uint16_t coef_sp[2] = { 5077, 981 };
52 
53 typedef struct ThreadData {
54  AVFrame *frame;
55  int plane;
56  int w, h;
57  int parity;
58  int tff;
59 } ThreadData;
60 
61 #define FILTER_INTRA() \
62  for (x = 0; x < w; x++) { \
63  interpol = (coef_sp[0] * (cur[mrefs] + cur[prefs]) - coef_sp[1] * (cur[mrefs3] + cur[prefs3])) >> 13; \
64  dst[0] = av_clip(interpol, 0, clip_max); \
65  \
66  dst++; \
67  cur++; \
68  }
69 
70 #define FILTER1() \
71  for (x = 0; x < w; x++) { \
72  int c = cur[mrefs]; \
73  int d = (prev2[0] + next2[0]) >> 1; \
74  int e = cur[prefs]; \
75  int temporal_diff0 = FFABS(prev2[0] - next2[0]); \
76  int temporal_diff1 =(FFABS(prev[mrefs] - c) + FFABS(prev[prefs] - e)) >> 1; \
77  int temporal_diff2 =(FFABS(next[mrefs] - c) + FFABS(next[prefs] - e)) >> 1; \
78  int diff = FFMAX3(temporal_diff0 >> 1, temporal_diff1, temporal_diff2); \
79  \
80  if (!diff) { \
81  dst[0] = d; \
82  } else {
83 
84 #define SPAT_CHECK() \
85  int b = ((prev2[mrefs2] + next2[mrefs2]) >> 1) - c; \
86  int f = ((prev2[prefs2] + next2[prefs2]) >> 1) - e; \
87  int dc = d - c; \
88  int de = d - e; \
89  int max = FFMAX3(de, dc, FFMIN(b, f)); \
90  int min = FFMIN3(de, dc, FFMAX(b, f)); \
91  diff = FFMAX3(diff, min, -max);
92 
93 #define FILTER_LINE() \
94  SPAT_CHECK() \
95  if (FFABS(c - e) > temporal_diff0) { \
96  interpol = (((coef_hf[0] * (prev2[0] + next2[0]) \
97  - coef_hf[1] * (prev2[mrefs2] + next2[mrefs2] + prev2[prefs2] + next2[prefs2]) \
98  + coef_hf[2] * (prev2[mrefs4] + next2[mrefs4] + prev2[prefs4] + next2[prefs4])) >> 2) \
99  + coef_lf[0] * (c + e) - coef_lf[1] * (cur[mrefs3] + cur[prefs3])) >> 13; \
100  } else { \
101  interpol = (coef_sp[0] * (c + e) - coef_sp[1] * (cur[mrefs3] + cur[prefs3])) >> 13; \
102  }
103 
104 #define FILTER_EDGE() \
105  if (spat) { \
106  SPAT_CHECK() \
107  } \
108  interpol = (c + e) >> 1;
109 
110 #define FILTER2() \
111  if (interpol > d + diff) \
112  interpol = d + diff; \
113  else if (interpol < d - diff) \
114  interpol = d - diff; \
115  \
116  dst[0] = av_clip(interpol, 0, clip_max); \
117  } \
118  \
119  dst++; \
120  cur++; \
121  prev++; \
122  next++; \
123  prev2++; \
124  next2++; \
125  }
126 
127 static void filter_intra(void *dst1, void *cur1, int w, int prefs, int mrefs,
128  int prefs3, int mrefs3, int parity, int clip_max)
129 {
130  uint8_t *dst = dst1;
131  uint8_t *cur = cur1;
132  int interpol, x;
133 
134  FILTER_INTRA()
135 }
136 
137 static void filter_line_c(void *dst1, void *prev1, void *cur1, void *next1,
138  int w, int prefs, int mrefs, int prefs2, int mrefs2,
139  int prefs3, int mrefs3, int prefs4, int mrefs4,
140  int parity, int clip_max)
141 {
142  uint8_t *dst = dst1;
143  uint8_t *prev = prev1;
144  uint8_t *cur = cur1;
145  uint8_t *next = next1;
146  uint8_t *prev2 = parity ? prev : cur ;
147  uint8_t *next2 = parity ? cur : next;
148  int interpol, x;
149 
150  FILTER1()
151  FILTER_LINE()
152  FILTER2()
153 }
154 
155 static void filter_edge(void *dst1, void *prev1, void *cur1, void *next1,
156  int w, int prefs, int mrefs, int prefs2, int mrefs2,
157  int parity, int clip_max, int spat)
158 {
159  uint8_t *dst = dst1;
160  uint8_t *prev = prev1;
161  uint8_t *cur = cur1;
162  uint8_t *next = next1;
163  uint8_t *prev2 = parity ? prev : cur ;
164  uint8_t *next2 = parity ? cur : next;
165  int interpol, x;
166 
167  FILTER1()
168  FILTER_EDGE()
169  FILTER2()
170 }
171 
172 static void filter_intra_16bit(void *dst1, void *cur1, int w, int prefs, int mrefs,
173  int prefs3, int mrefs3, int parity, int clip_max)
174 {
175  uint16_t *dst = dst1;
176  uint16_t *cur = cur1;
177  int interpol, x;
178 
179  FILTER_INTRA()
180 }
181 
182 static void filter_line_c_16bit(void *dst1, void *prev1, void *cur1, void *next1,
183  int w, int prefs, int mrefs, int prefs2, int mrefs2,
184  int prefs3, int mrefs3, int prefs4, int mrefs4,
185  int parity, int clip_max)
186 {
187  uint16_t *dst = dst1;
188  uint16_t *prev = prev1;
189  uint16_t *cur = cur1;
190  uint16_t *next = next1;
191  uint16_t *prev2 = parity ? prev : cur ;
192  uint16_t *next2 = parity ? cur : next;
193  int interpol, x;
194 
195  FILTER1()
196  FILTER_LINE()
197  FILTER2()
198 }
199 
200 static void filter_edge_16bit(void *dst1, void *prev1, void *cur1, void *next1,
201  int w, int prefs, int mrefs, int prefs2, int mrefs2,
202  int parity, int clip_max, int spat)
203 {
204  uint16_t *dst = dst1;
205  uint16_t *prev = prev1;
206  uint16_t *cur = cur1;
207  uint16_t *next = next1;
208  uint16_t *prev2 = parity ? prev : cur ;
209  uint16_t *next2 = parity ? cur : next;
210  int interpol, x;
211 
212  FILTER1()
213  FILTER_EDGE()
214  FILTER2()
215 }
216 
217 static int filter_slice(AVFilterContext *ctx, void *arg, int jobnr, int nb_jobs)
218 {
219  BWDIFContext *s = ctx->priv;
220  YADIFContext *yadif = &s->yadif;
221  ThreadData *td = arg;
222  int linesize = yadif->cur->linesize[td->plane];
223  int clip_max = (1 << (yadif->csp->comp[td->plane].depth)) - 1;
224  int df = (yadif->csp->comp[td->plane].depth + 7) / 8;
225  int refs = linesize / df;
226  int slice_start = ff_slice_pos(td->h, jobnr, nb_jobs);
227  int slice_end = ff_slice_pos(td->h, jobnr + 1, nb_jobs);
228  int y;
229 
230  for (y = slice_start; y < slice_end; y++) {
231  if ((y ^ td->parity) & 1) {
232  uint8_t *prev = &yadif->prev->data[td->plane][y * linesize];
233  uint8_t *cur = &yadif->cur ->data[td->plane][y * linesize];
234  uint8_t *next = &yadif->next->data[td->plane][y * linesize];
235  uint8_t *dst = &td->frame->data[td->plane][y * td->frame->linesize[td->plane]];
236  if (yadif->current_field == YADIF_FIELD_END) {
237  if ((y < 3) || ((y + 3) >= td->h)) {
238  s->filter_edge(dst, prev, cur, next, td->w,
239  (y + df) < td->h ? refs : -refs,
240  y > (df - 1) ? -refs : refs,
241  refs << 1, -(refs << 1),
242  td->parity ^ td->tff, clip_max,
243  (y < 2) || ((y + 3) > td->h) ? 0 : 1);
244  } else {
245  s->filter_intra(dst, cur, td->w, (y + df) < td->h ? refs : -refs,
246  y > (df - 1) ? -refs : refs,
247  (y + 3*df) < td->h ? 3 * refs : -refs,
248  y > (3*df - 1) ? -3 * refs : refs,
249  td->parity ^ td->tff, clip_max);
250  }
251  } else if ((y < 4) || ((y + 5) > td->h)) {
252  s->filter_edge(dst, prev, cur, next, td->w,
253  (y + df) < td->h ? refs : -refs,
254  y > (df - 1) ? -refs : refs,
255  refs << 1, -(refs << 1),
256  td->parity ^ td->tff, clip_max,
257  (y < 2) || ((y + 3) > td->h) ? 0 : 1);
258  } else {
259  s->filter_line(dst, prev, cur, next, td->w,
260  refs, -refs, refs << 1, -(refs << 1),
261  3 * refs, -3 * refs, refs << 2, -(refs << 2),
262  td->parity ^ td->tff, clip_max);
263  }
264  } else {
265  memcpy(&td->frame->data[td->plane][y * td->frame->linesize[td->plane]],
266  &yadif->cur->data[td->plane][y * linesize], td->w * df);
267  }
268  }
269  return 0;
270 }
271 
272 static void filter(AVFilterContext *ctx, AVFrame *dstpic,
273  int parity, int tff)
274 {
275  BWDIFContext *bwdif = ctx->priv;
276  YADIFContext *yadif = &bwdif->yadif;
277  ThreadData td = { .frame = dstpic, .parity = parity, .tff = tff };
278  int i;
279 
280  for (i = 0; i < yadif->csp->nb_components; i++) {
281  int w = dstpic->width;
282  int h = dstpic->height;
283 
284  if (i == 1 || i == 2) {
285  w = AV_CEIL_RSHIFT(w, yadif->csp->log2_chroma_w);
286  h = AV_CEIL_RSHIFT(h, yadif->csp->log2_chroma_h);
287  }
288 
289  td.w = w;
290  td.h = h;
291  td.plane = i;
292 
294  }
295  if (yadif->current_field == YADIF_FIELD_END) {
297  }
298 
299  emms_c();
300 }
301 
303 {
304  BWDIFContext *bwdif = ctx->priv;
305  YADIFContext *yadif = &bwdif->yadif;
306 
307  av_frame_free(&yadif->prev);
308  av_frame_free(&yadif->cur );
309  av_frame_free(&yadif->next);
310 }
311 
313 {
314  static const enum AVPixelFormat pix_fmts[] = {
333  };
334 
336  if (!fmts_list)
337  return AVERROR(ENOMEM);
338 
339  return ff_set_common_formats(ctx, fmts_list);
340 }
341 
342 static int config_props(AVFilterLink *link)
343 {
344  AVFilterContext *ctx = link->src;
345  BWDIFContext *s = link->src->priv;
346  YADIFContext *yadif = &s->yadif;
347 
348  link->time_base.num = link->src->inputs[0]->time_base.num;
349  link->time_base.den = link->src->inputs[0]->time_base.den * 2;
350  link->w = link->src->inputs[0]->w;
351  link->h = link->src->inputs[0]->h;
352 
353  if(yadif->mode&1)
354  link->frame_rate = av_mul_q(link->src->inputs[0]->frame_rate, (AVRational){2,1});
355 
356  yadif->csp = av_pix_fmt_desc_get(link->format);
357  yadif->filter = filter;
358 
359  if (AV_CEIL_RSHIFT(link->w, yadif->csp->log2_chroma_w) < 3 || AV_CEIL_RSHIFT(link->h, yadif->csp->log2_chroma_h) < 4) {
360  av_log(ctx, AV_LOG_ERROR, "Video with planes less than 3 columns or 4 lines is not supported\n");
361  return AVERROR(EINVAL);
362  }
363 
364  if (yadif->csp->comp[0].depth > 8) {
365  s->filter_intra = filter_intra_16bit;
366  s->filter_line = filter_line_c_16bit;
367  s->filter_edge = filter_edge_16bit;
368  } else {
369  s->filter_intra = filter_intra;
370  s->filter_line = filter_line_c;
371  s->filter_edge = filter_edge;
372  }
373 
374  if (ARCH_X86)
376 
377  return 0;
378 }
379 
380 
381 #define OFFSET(x) offsetof(YADIFContext, x)
382 #define FLAGS AV_OPT_FLAG_VIDEO_PARAM|AV_OPT_FLAG_FILTERING_PARAM
383 
384 #define CONST(name, help, val, unit) { name, help, 0, AV_OPT_TYPE_CONST, {.i64=val}, INT_MIN, INT_MAX, FLAGS, unit }
385 
386 static const AVOption bwdif_options[] = {
387  { "mode", "specify the interlacing mode", OFFSET(mode), AV_OPT_TYPE_INT, {.i64=YADIF_MODE_SEND_FIELD}, 0, 1, FLAGS, "mode"},
388  CONST("send_frame", "send one frame for each frame", YADIF_MODE_SEND_FRAME, "mode"),
389  CONST("send_field", "send one frame for each field", YADIF_MODE_SEND_FIELD, "mode"),
390 
391  { "parity", "specify the assumed picture field parity", OFFSET(parity), AV_OPT_TYPE_INT, {.i64=YADIF_PARITY_AUTO}, -1, 1, FLAGS, "parity" },
392  CONST("tff", "assume top field first", YADIF_PARITY_TFF, "parity"),
393  CONST("bff", "assume bottom field first", YADIF_PARITY_BFF, "parity"),
394  CONST("auto", "auto detect parity", YADIF_PARITY_AUTO, "parity"),
395 
396  { "deint", "specify which frames to deinterlace", OFFSET(deint), AV_OPT_TYPE_INT, {.i64=YADIF_DEINT_ALL}, 0, 1, FLAGS, "deint" },
397  CONST("all", "deinterlace all frames", YADIF_DEINT_ALL, "deint"),
398  CONST("interlaced", "only deinterlace frames marked as interlaced", YADIF_DEINT_INTERLACED, "deint"),
399 
400  { NULL }
401 };
402 
404 
406  {
407  .name = "default",
408  .type = AVMEDIA_TYPE_VIDEO,
409  .filter_frame = ff_yadif_filter_frame,
410  },
411  { NULL }
412 };
413 
415  {
416  .name = "default",
417  .type = AVMEDIA_TYPE_VIDEO,
418  .request_frame = ff_yadif_request_frame,
419  .config_props = config_props,
420  },
421  { NULL }
422 };
423 
425  .name = "bwdif",
426  .description = NULL_IF_CONFIG_SMALL("Deinterlace the input image."),
427  .priv_size = sizeof(BWDIFContext),
428  .priv_class = &bwdif_class,
429  .uninit = uninit,
434 };
static const AVFilterPad inputs[]
Definition: af_acontrast.c:193
static const AVFilterPad outputs[]
Definition: af_acontrast.c:203
#define av_cold
Definition: attributes.h:88
uint8_t
simple assert() macros that are a bit more flexible than ISO C assert().
int ff_filter_get_nb_threads(AVFilterContext *ctx)
Get number of threads for current filter instance.
Definition: avfilter.c:802
Main libavfilter public API header.
void ff_bwdif_init_x86(BWDIFContext *bwdif)
Definition: vf_bwdif_init.c:54
#define flags(name, subs,...)
Definition: cbs_av1.c:572
#define s(width, name)
Definition: cbs_vp9.c:257
common internal and external API header
#define FFMIN(a, b)
Definition: common.h:105
#define AV_CEIL_RSHIFT(a, b)
Definition: common.h:58
#define ARCH_X86
Definition: config.h:39
#define NULL
Definition: coverity.c:32
mode
Use these values in ebur128_init (or'ed).
Definition: ebur128.h:83
static int ff_slice_pos(int total, int jobnr, int nb_jobs)
Compute the boundary index for a slice when work of size total is split into nb_jobs slices.
Definition: filters.h:271
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:587
AVFilterFormats * ff_make_format_list(const int *fmts)
Create a list of supported formats.
Definition: formats.c:286
@ AV_OPT_TYPE_INT
Definition: opt.h:225
#define AVFILTER_FLAG_SLICE_THREADS
The filter supports multithreading by splitting frames into multiple parts and processing them concur...
Definition: avfilter.h:117
#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:134
#define AVERROR(e)
Definition: error.h:43
void av_frame_free(AVFrame **frame)
Free the frame and any dynamically allocated objects in it, e.g.
Definition: frame.c:203
#define AV_LOG_ERROR
Something went wrong and cannot losslessly be recovered.
Definition: log.h:194
AVRational av_mul_q(AVRational b, AVRational c)
Multiply two rationals.
Definition: rational.c:80
@ AVMEDIA_TYPE_VIDEO
Definition: avutil.h:201
misc image utilities
int i
Definition: input.c:407
const char * arg
Definition: jacosubdec.c:66
common internal API header
#define NULL_IF_CONFIG_SMALL(x)
Return NULL if CONFIG_SMALL is true, otherwise the argument without modification.
Definition: internal.h:117
#define emms_c()
Definition: internal.h:54
static enum AVPixelFormat pix_fmts[]
Definition: libkvazaar.c:309
uint8_t w
Definition: llviddspenc.c:39
static int slice_end(AVCodecContext *avctx, AVFrame *pict)
Handle slice ends.
Definition: mpeg12dec.c:2033
AVOptions.
const AVPixFmtDescriptor * av_pix_fmt_desc_get(enum AVPixelFormat pix_fmt)
Definition: pixdesc.c:2573
#define AV_PIX_FMT_YUV420P16
Definition: pixfmt.h:410
#define AV_PIX_FMT_YUV444P12
Definition: pixfmt.h:406
#define AV_PIX_FMT_YUV444P9
Definition: pixfmt.h:398
#define AV_PIX_FMT_YUV420P10
Definition: pixfmt.h:399
#define AV_PIX_FMT_GBRAP16
Definition: pixfmt.h:421
#define AV_PIX_FMT_GBRP9
Definition: pixfmt.h:414
#define AV_PIX_FMT_YUV422P9
Definition: pixfmt.h:397
#define AV_PIX_FMT_YUVA444P10
Definition: pixfmt.h:438
#define AV_PIX_FMT_YUVA420P16
Definition: pixfmt.h:441
#define AV_PIX_FMT_YUV420P12
Definition: pixfmt.h:403
#define AV_PIX_FMT_YUVA420P10
Definition: pixfmt.h:436
#define AV_PIX_FMT_YUVA422P9
Definition: pixfmt.h:434
#define AV_PIX_FMT_YUV422P12
Definition: pixfmt.h:404
#define AV_PIX_FMT_GBRP10
Definition: pixfmt.h:415
#define AV_PIX_FMT_YUV422P10
Definition: pixfmt.h:400
#define AV_PIX_FMT_GBRP12
Definition: pixfmt.h:416
#define AV_PIX_FMT_YUV420P9
Definition: pixfmt.h:396
#define AV_PIX_FMT_YUVA420P9
Definition: pixfmt.h:433
#define AV_PIX_FMT_YUVA422P10
Definition: pixfmt.h:437
#define AV_PIX_FMT_YUV420P14
Definition: pixfmt.h:407
AVPixelFormat
Pixel format.
Definition: pixfmt.h:64
@ AV_PIX_FMT_NONE
Definition: pixfmt.h:65
@ AV_PIX_FMT_YUV420P
planar YUV 4:2:0, 12bpp, (1 Cr & Cb sample per 2x2 Y samples)
Definition: pixfmt.h:66
@ AV_PIX_FMT_YUV440P
planar YUV 4:4:0 (1 Cr & Cb sample per 1x2 Y samples)
Definition: pixfmt.h:99
@ AV_PIX_FMT_YUV422P
planar YUV 4:2:2, 16bpp, (1 Cr & Cb sample per 2x1 Y samples)
Definition: pixfmt.h:70
@ AV_PIX_FMT_GRAY8
Y , 8bpp.
Definition: pixfmt.h:74
@ AV_PIX_FMT_YUVA420P
planar YUV 4:2:0, 20bpp, (1 Cr & Cb sample per 2x2 Y & A samples)
Definition: pixfmt.h:101
@ AV_PIX_FMT_YUVJ440P
planar YUV 4:4:0 full scale (JPEG), deprecated in favor of AV_PIX_FMT_YUV440P and setting color_range
Definition: pixfmt.h:100
@ AV_PIX_FMT_YUV410P
planar YUV 4:1:0, 9bpp, (1 Cr & Cb sample per 4x4 Y samples)
Definition: pixfmt.h:72
@ AV_PIX_FMT_YUV411P
planar YUV 4:1:1, 12bpp, (1 Cr & Cb sample per 4x1 Y samples)
Definition: pixfmt.h:73
@ AV_PIX_FMT_YUV444P
planar YUV 4:4:4, 24bpp, (1 Cr & Cb sample per 1x1 Y samples)
Definition: pixfmt.h:71
@ AV_PIX_FMT_YUVA444P
planar YUV 4:4:4 32bpp, (1 Cr & Cb sample per 1x1 Y & A samples)
Definition: pixfmt.h:177
@ AV_PIX_FMT_YUVJ411P
planar YUV 4:1:1, 12bpp, (1 Cr & Cb sample per 4x1 Y samples) full scale (JPEG), deprecated in favor ...
Definition: pixfmt.h:258
@ AV_PIX_FMT_GBRAP
planar GBRA 4:4:4:4 32bpp
Definition: pixfmt.h:215
@ AV_PIX_FMT_YUVJ422P
planar YUV 4:2:2, 16bpp, full scale (JPEG), deprecated in favor of AV_PIX_FMT_YUV422P and setting col...
Definition: pixfmt.h:79
@ AV_PIX_FMT_YUVA422P
planar YUV 4:2:2 24bpp, (1 Cr & Cb sample per 2x1 Y & A samples)
Definition: pixfmt.h:176
@ AV_PIX_FMT_GBRP
planar GBR 4:4:4 24bpp
Definition: pixfmt.h:168
@ AV_PIX_FMT_YUVJ444P
planar YUV 4:4:4, 24bpp, full scale (JPEG), deprecated in favor of AV_PIX_FMT_YUV444P and setting col...
Definition: pixfmt.h:80
@ AV_PIX_FMT_YUVJ420P
planar YUV 4:2:0, 12bpp, full scale (JPEG), deprecated in favor of AV_PIX_FMT_YUV420P and setting col...
Definition: pixfmt.h:78
#define AV_PIX_FMT_YUV422P14
Definition: pixfmt.h:408
#define AV_PIX_FMT_YUV422P16
Definition: pixfmt.h:411
#define AV_PIX_FMT_GRAY16
Definition: pixfmt.h:383
#define AV_PIX_FMT_YUVA444P16
Definition: pixfmt.h:443
#define AV_PIX_FMT_YUVA422P16
Definition: pixfmt.h:442
#define AV_PIX_FMT_GBRP16
Definition: pixfmt.h:418
#define AV_PIX_FMT_YUV444P14
Definition: pixfmt.h:409
#define AV_PIX_FMT_YUVA444P9
Definition: pixfmt.h:435
#define AV_PIX_FMT_GBRP14
Definition: pixfmt.h:417
#define AV_PIX_FMT_YUV444P16
Definition: pixfmt.h:412
#define AV_PIX_FMT_YUV444P10
Definition: pixfmt.h:402
#define td
Definition: regdef.h:70
int depth
Number of bits in the component.
Definition: pixdesc.h:58
An instance of a filter.
Definition: avfilter.h:341
AVFilterLink ** inputs
array of pointers to input links
Definition: avfilter.h:349
void * priv
private data for use by the filter
Definition: avfilter.h:356
A list of supported formats for one end of a filter link.
Definition: formats.h:65
A filter pad used for either input or output.
Definition: internal.h:54
const char * name
Pad name.
Definition: internal.h:60
Filter definition.
Definition: avfilter.h:145
const char * name
Filter name.
Definition: avfilter.h:149
AVFormatInternal * internal
An opaque field for libavformat internal usage.
Definition: avformat.h:1699
This structure describes decoded (raw) audio or video data.
Definition: frame.h:318
uint8_t * data[AV_NUM_DATA_POINTERS]
pointer to the picture/channel planes.
Definition: frame.h:332
int width
Definition: frame.h:376
int height
Definition: frame.h:376
int linesize[AV_NUM_DATA_POINTERS]
For video, size in bytes of each picture line.
Definition: frame.h:349
AVOption.
Definition: opt.h:248
AVComponentDescriptor comp[4]
Parameters that describe how pixels are packed.
Definition: pixdesc.h:117
uint8_t log2_chroma_w
Amount to shift the luma width right to find the chroma width.
Definition: pixdesc.h:92
uint8_t log2_chroma_h
Amount to shift the luma height right to find the chroma height.
Definition: pixdesc.h:101
uint8_t nb_components
The number of components each pixel has, (1-4)
Definition: pixdesc.h:83
Rational number (pair of numerator and denominator).
Definition: rational.h:58
int num
Numerator.
Definition: rational.h:59
int den
Denominator.
Definition: rational.h:60
YADIFContext yadif
Definition: bwdif.h:27
Used for passing data between threads.
Definition: dsddec.c:67
int tff
Definition: vf_bwdif.c:58
int parity
Definition: vf_bwdif.c:57
AVFrame * frame
Definition: dsddec.c:68
int plane
Definition: vf_blend.c:59
AVFrame * prev
Definition: yadif.h:61
AVFrame * cur
Definition: yadif.h:59
AVFrame * next
Definition: yadif.h:60
void(* filter)(AVFilterContext *ctx, AVFrame *dstpic, int parity, int tff)
Definition: yadif.h:64
int mode
YADIFMode.
Definition: yadif.h:53
int current_field
YADIFCurrentField.
Definition: yadif.h:86
const AVPixFmtDescriptor * csp
Definition: yadif.h:75
#define av_log(a,...)
AVFormatContext * ctx
Definition: movenc.c:48
static int filter_slice(AVFilterContext *ctx, void *arg, int jobnr, int nb_jobs)
Definition: vf_bwdif.c:217
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:155
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:137
static const AVFilterPad avfilter_vf_bwdif_outputs[]
Definition: vf_bwdif.c:414
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:182
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:127
#define FILTER2()
Definition: vf_bwdif.c:110
static const uint16_t coef_hf[3]
Definition: vf_bwdif.c:50
static void filter(AVFilterContext *ctx, AVFrame *dstpic, int parity, int tff)
Definition: vf_bwdif.c:272
#define CONST(name, help, val, unit)
Definition: vf_bwdif.c:384
static int query_formats(AVFilterContext *ctx)
Definition: vf_bwdif.c:312
#define FLAGS
Definition: vf_bwdif.c:382
static const uint16_t coef_sp[2]
Definition: vf_bwdif.c:51
#define FILTER_EDGE()
Definition: vf_bwdif.c:104
#define FILTER_INTRA()
Definition: vf_bwdif.c:61
#define FILTER_LINE()
Definition: vf_bwdif.c:93
AVFilter ff_vf_bwdif
Definition: vf_bwdif.c:424
#define FILTER1()
Definition: vf_bwdif.c:70
static const AVOption bwdif_options[]
Definition: vf_bwdif.c:386
static const AVFilterPad avfilter_vf_bwdif_inputs[]
Definition: vf_bwdif.c:405
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:172
static av_cold void uninit(AVFilterContext *ctx)
Definition: vf_bwdif.c:302
AVFILTER_DEFINE_CLASS(bwdif)
#define OFFSET(x)
Definition: vf_bwdif.c:381
static const uint16_t coef_lf[2]
Definition: vf_bwdif.c:49
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:200
static int config_props(AVFilterLink *link)
Definition: vf_bwdif.c:342
mcdeint parity
Definition: vf_mcdeint.c:277
#define df(A, B)
Definition: vf_xbr.c:91
static int interpol(MBContext *s, uint32_t *color, int x, int y, int linesize)
@ YADIF_DEINT_INTERLACED
only deinterlace frames marked as interlaced
Definition: yadif.h:41
@ YADIF_DEINT_ALL
deinterlace all frames
Definition: yadif.h:40
@ YADIF_PARITY_TFF
top field first
Definition: yadif.h:34
@ YADIF_PARITY_BFF
bottom field first
Definition: yadif.h:35
@ YADIF_PARITY_AUTO
auto detection
Definition: yadif.h:36
@ YADIF_FIELD_NORMAL
A normal field in the middle of a sequence.
Definition: yadif.h:47
@ YADIF_FIELD_END
The first or last field in a sequence.
Definition: yadif.h:46
int ff_yadif_filter_frame(AVFilterLink *link, AVFrame *frame)
Definition: yadif_common.c:92
@ YADIF_MODE_SEND_FIELD
send 1 frame for each field
Definition: yadif.h:28
@ YADIF_MODE_SEND_FRAME
send 1 frame for each frame
Definition: yadif.h:27
int ff_yadif_request_frame(AVFilterLink *link)
Definition: yadif_common.c:159