FFmpeg
vf_tinterlace.c
Go to the documentation of this file.
1 /*
2  * Copyright (c) 2017 Thomas Mundt <tmundt75@gmail.com>
3  * Copyright (c) 2011 Stefano Sabatini
4  * Copyright (c) 2010 Baptiste Coudurier
5  * Copyright (c) 2003 Michael Zucchi <notzed@ximian.com>
6  *
7  * This file is part of FFmpeg.
8  *
9  * FFmpeg is free software; you can redistribute it and/or modify
10  * it under the terms of the GNU General Public License as published by
11  * the Free Software Foundation; either version 2 of the License, or
12  * (at your option) any later version.
13  *
14  * FFmpeg is distributed in the hope that it will be useful,
15  * but WITHOUT ANY WARRANTY; without even the implied warranty of
16  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17  * GNU General Public License for more details.
18  *
19  * You should have received a copy of the GNU General Public License along
20  * with FFmpeg if not, write to the Free Software Foundation, Inc.,
21  * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
22  */
23 
24 /**
25  * @file
26  * temporal field interlace filter, ported from MPlayer/libmpcodecs
27  */
28 
29 #include "libavutil/opt.h"
30 #include "libavutil/imgutils.h"
31 #include "libavutil/avassert.h"
32 #include "avfilter.h"
33 #include "internal.h"
34 #include "tinterlace.h"
35 
36 #define OFFSET(x) offsetof(TInterlaceContext, x)
37 #define FLAGS AV_OPT_FLAG_FILTERING_PARAM|AV_OPT_FLAG_VIDEO_PARAM
38 
39 static const AVOption tinterlace_options[] = {
40  {"mode", "select interlace mode", OFFSET(mode), AV_OPT_TYPE_INT, {.i64=MODE_MERGE}, 0, MODE_NB-1, FLAGS, "mode"},
41  {"merge", "merge fields", 0, AV_OPT_TYPE_CONST, {.i64=MODE_MERGE}, INT_MIN, INT_MAX, FLAGS, "mode"},
42  {"drop_even", "drop even fields", 0, AV_OPT_TYPE_CONST, {.i64=MODE_DROP_EVEN}, INT_MIN, INT_MAX, FLAGS, "mode"},
43  {"drop_odd", "drop odd fields", 0, AV_OPT_TYPE_CONST, {.i64=MODE_DROP_ODD}, INT_MIN, INT_MAX, FLAGS, "mode"},
44  {"pad", "pad alternate lines with black", 0, AV_OPT_TYPE_CONST, {.i64=MODE_PAD}, INT_MIN, INT_MAX, FLAGS, "mode"},
45  {"interleave_top", "interleave top and bottom fields", 0, AV_OPT_TYPE_CONST, {.i64=MODE_INTERLEAVE_TOP}, INT_MIN, INT_MAX, FLAGS, "mode"},
46  {"interleave_bottom", "interleave bottom and top fields", 0, AV_OPT_TYPE_CONST, {.i64=MODE_INTERLEAVE_BOTTOM}, INT_MIN, INT_MAX, FLAGS, "mode"},
47  {"interlacex2", "interlace fields from two consecutive frames", 0, AV_OPT_TYPE_CONST, {.i64=MODE_INTERLACEX2}, INT_MIN, INT_MAX, FLAGS, "mode"},
48  {"mergex2", "merge fields keeping same frame rate", 0, AV_OPT_TYPE_CONST, {.i64=MODE_MERGEX2}, INT_MIN, INT_MAX, FLAGS, "mode"},
49 
50  {"flags", "set flags", OFFSET(flags), AV_OPT_TYPE_FLAGS, {.i64 = 0}, 0, INT_MAX, 0, "flags" },
51  {"low_pass_filter", "enable vertical low-pass filter", 0, AV_OPT_TYPE_CONST, {.i64 = TINTERLACE_FLAG_VLPF}, INT_MIN, INT_MAX, FLAGS, "flags" },
52  {"vlpf", "enable vertical low-pass filter", 0, AV_OPT_TYPE_CONST, {.i64 = TINTERLACE_FLAG_VLPF}, INT_MIN, INT_MAX, FLAGS, "flags" },
53  {"complex_filter", "enable complex vertical low-pass filter", 0, AV_OPT_TYPE_CONST, {.i64 = TINTERLACE_FLAG_CVLPF},INT_MIN, INT_MAX, FLAGS, "flags" },
54  {"cvlpf", "enable complex vertical low-pass filter", 0, AV_OPT_TYPE_CONST, {.i64 = TINTERLACE_FLAG_CVLPF},INT_MIN, INT_MAX, FLAGS, "flags" },
55  {"exact_tb", "force a timebase which can represent timestamps exactly", 0, AV_OPT_TYPE_CONST, {.i64 = TINTERLACE_FLAG_EXACT_TB}, INT_MIN, INT_MAX, FLAGS, "flags" },
56  {"bypass_il", "bypass already interlaced frames", 0, AV_OPT_TYPE_CONST, {.i64 = TINTERLACE_FLAG_BYPASS_IL}, INT_MIN, INT_MAX, FLAGS, "flags" },
57 
58  {NULL}
59 };
60 
61 AVFILTER_DEFINE_CLASS(tinterlace);
62 
63 static const AVOption interlace_options[] = {
64  { "scan", "scanning mode", OFFSET(mode), AV_OPT_TYPE_INT, {.i64 = MODE_TFF}, 0, 1, FLAGS, "mode"},
65  { "tff", "top field first", 0, AV_OPT_TYPE_CONST, {.i64 = MODE_TFF}, INT_MIN, INT_MAX, FLAGS, .unit = "mode"},
66  { "bff", "bottom field first", 0, AV_OPT_TYPE_CONST, {.i64 = MODE_BFF}, INT_MIN, INT_MAX, FLAGS, .unit = "mode"},
67  { "lowpass", "set vertical low-pass filter", OFFSET(lowpass), AV_OPT_TYPE_INT, {.i64 = VLPF_LIN}, 0, 2, FLAGS, "lowpass" },
68  { "off", "disable vertical low-pass filter", 0, AV_OPT_TYPE_CONST, {.i64 = VLPF_OFF}, INT_MIN, INT_MAX, FLAGS, "lowpass" },
69  { "linear", "linear vertical low-pass filter", 0, AV_OPT_TYPE_CONST, {.i64 = VLPF_LIN}, INT_MIN, INT_MAX, FLAGS, "lowpass" },
70  { "complex", "complex vertical low-pass filter", 0, AV_OPT_TYPE_CONST, {.i64 = VLPF_CMP}, INT_MIN, INT_MAX, FLAGS, "lowpass" },
71 
72  { NULL }
73 };
74 
75 AVFILTER_DEFINE_CLASS(interlace);
76 
77 #define FULL_SCALE_YUVJ_FORMATS \
78  AV_PIX_FMT_YUVJ420P, AV_PIX_FMT_YUVJ422P, AV_PIX_FMT_YUVJ444P, AV_PIX_FMT_YUVJ440P
79 
80 static const enum AVPixelFormat full_scale_yuvj_pix_fmts[] = {
82 };
83 
84 static const AVRational standard_tbs[] = {
85  {1, 25},
86  {1, 30},
87  {1001, 30000},
88 };
89 
90 static const enum AVPixelFormat pix_fmts[] = {
102 };
103 
104 static void lowpass_line_c(uint8_t *dstp, ptrdiff_t width, const uint8_t *srcp,
105  ptrdiff_t mref, ptrdiff_t pref, int clip_max)
106 {
107  const uint8_t *srcp_above = srcp + mref;
108  const uint8_t *srcp_below = srcp + pref;
109  int i;
110  for (i = 0; i < width; i++) {
111  // this calculation is an integer representation of
112  // '0.5 * current + 0.25 * above + 0.25 * below'
113  // '1 +' is for rounding.
114  dstp[i] = (1 + srcp[i] + srcp[i] + srcp_above[i] + srcp_below[i]) >> 2;
115  }
116 }
117 
118 static void lowpass_line_c_16(uint8_t *dst8, ptrdiff_t width, const uint8_t *src8,
119  ptrdiff_t mref, ptrdiff_t pref, int clip_max)
120 {
121  uint16_t *dstp = (uint16_t *)dst8;
122  const uint16_t *srcp = (const uint16_t *)src8;
123  const uint16_t *srcp_above = srcp + mref / 2;
124  const uint16_t *srcp_below = srcp + pref / 2;
125  int i, src_x;
126  for (i = 0; i < width; i++) {
127  // this calculation is an integer representation of
128  // '0.5 * current + 0.25 * above + 0.25 * below'
129  // '1 +' is for rounding.
130  src_x = av_le2ne16(srcp[i]) << 1;
131  dstp[i] = av_le2ne16((1 + src_x + av_le2ne16(srcp_above[i])
132  + av_le2ne16(srcp_below[i])) >> 2);
133  }
134 }
135 
136 static void lowpass_line_complex_c(uint8_t *dstp, ptrdiff_t width, const uint8_t *srcp,
137  ptrdiff_t mref, ptrdiff_t pref, int clip_max)
138 {
139  const uint8_t *srcp_above = srcp + mref;
140  const uint8_t *srcp_below = srcp + pref;
141  const uint8_t *srcp_above2 = srcp + mref * 2;
142  const uint8_t *srcp_below2 = srcp + pref * 2;
143  int i, src_x, src_ab;
144  for (i = 0; i < width; i++) {
145  // this calculation is an integer representation of
146  // '0.75 * current + 0.25 * above + 0.25 * below - 0.125 * above2 - 0.125 * below2'
147  // '4 +' is for rounding.
148  src_x = srcp[i] << 1;
149  src_ab = srcp_above[i] + srcp_below[i];
150  dstp[i] = av_clip_uint8((4 + ((srcp[i] + src_x + src_ab) << 1)
151  - srcp_above2[i] - srcp_below2[i]) >> 3);
152  // Prevent over-sharpening:
153  // dst must not exceed src when the average of above and below
154  // is less than src. And the other way around.
155  if (src_ab > src_x) {
156  if (dstp[i] < srcp[i])
157  dstp[i] = srcp[i];
158  } else if (dstp[i] > srcp[i])
159  dstp[i] = srcp[i];
160  }
161 }
162 
163 static void lowpass_line_complex_c_16(uint8_t *dst8, ptrdiff_t width, const uint8_t *src8,
164  ptrdiff_t mref, ptrdiff_t pref, int clip_max)
165 {
166  uint16_t *dstp = (uint16_t *)dst8;
167  const uint16_t *srcp = (const uint16_t *)src8;
168  const uint16_t *srcp_above = srcp + mref / 2;
169  const uint16_t *srcp_below = srcp + pref / 2;
170  const uint16_t *srcp_above2 = srcp + mref;
171  const uint16_t *srcp_below2 = srcp + pref;
172  int i, dst_le, src_le, src_x, src_ab;
173  for (i = 0; i < width; i++) {
174  // this calculation is an integer representation of
175  // '0.75 * current + 0.25 * above + 0.25 * below - 0.125 * above2 - 0.125 * below2'
176  // '4 +' is for rounding.
177  src_le = av_le2ne16(srcp[i]);
178  src_x = src_le << 1;
179  src_ab = av_le2ne16(srcp_above[i]) + av_le2ne16(srcp_below[i]);
180  dst_le = av_clip((4 + ((src_le + src_x + src_ab) << 1)
181  - av_le2ne16(srcp_above2[i])
182  - av_le2ne16(srcp_below2[i])) >> 3, 0, clip_max);
183  // Prevent over-sharpening:
184  // dst must not exceed src when the average of above and below
185  // is less than src. And the other way around.
186  if (src_ab > src_x) {
187  if (dst_le < src_le)
188  dstp[i] = av_le2ne16(src_le);
189  else
190  dstp[i] = av_le2ne16(dst_le);
191  } else if (dst_le > src_le) {
192  dstp[i] = av_le2ne16(src_le);
193  } else
194  dstp[i] = av_le2ne16(dst_le);
195  }
196 }
197 
199 {
200  TInterlaceContext *tinterlace = ctx->priv;
201 
202  av_frame_free(&tinterlace->cur );
203  av_frame_free(&tinterlace->next);
204  av_freep(&tinterlace->black_data[0]);
205 }
206 
207 static int config_out_props(AVFilterLink *outlink)
208 {
209  AVFilterContext *ctx = outlink->src;
210  AVFilterLink *inlink = outlink->src->inputs[0];
212  TInterlaceContext *tinterlace = ctx->priv;
213  int i;
214 
215  tinterlace->vsub = desc->log2_chroma_h;
216  outlink->w = inlink->w;
217  outlink->h = tinterlace->mode == MODE_MERGE || tinterlace->mode == MODE_PAD || tinterlace->mode == MODE_MERGEX2?
218  inlink->h*2 : inlink->h;
219  if (tinterlace->mode == MODE_MERGE || tinterlace->mode == MODE_PAD || tinterlace->mode == MODE_MERGEX2)
220  outlink->sample_aspect_ratio = av_mul_q(inlink->sample_aspect_ratio,
221  av_make_q(2, 1));
222 
223  if (tinterlace->mode == MODE_PAD) {
224  uint8_t black[4] = { 0, 0, 0, 16 };
225  int ret;
226  ff_draw_init(&tinterlace->draw, outlink->format, 0);
227  ff_draw_color(&tinterlace->draw, &tinterlace->color, black);
229  tinterlace->color.comp[0].u8[0] = 0;
230  ret = av_image_alloc(tinterlace->black_data, tinterlace->black_linesize,
231  outlink->w, outlink->h, outlink->format, 16);
232  if (ret < 0)
233  return ret;
234 
235  ff_fill_rectangle(&tinterlace->draw, &tinterlace->color, tinterlace->black_data,
236  tinterlace->black_linesize, 0, 0, outlink->w, outlink->h);
237  }
238  if (tinterlace->flags & (TINTERLACE_FLAG_VLPF | TINTERLACE_FLAG_CVLPF)
239  && !(tinterlace->mode == MODE_INTERLEAVE_TOP
240  || tinterlace->mode == MODE_INTERLEAVE_BOTTOM)) {
241  av_log(ctx, AV_LOG_WARNING, "low_pass_filter flags ignored with mode %d\n",
242  tinterlace->mode);
244  }
245  tinterlace->preout_time_base = inlink->time_base;
246  if (tinterlace->mode == MODE_INTERLACEX2) {
247  tinterlace->preout_time_base.den *= 2;
248  outlink->frame_rate = av_mul_q(inlink->frame_rate, (AVRational){2,1});
249  outlink->time_base = av_mul_q(inlink->time_base , (AVRational){1,2});
250  } else if (tinterlace->mode == MODE_MERGEX2) {
251  outlink->frame_rate = inlink->frame_rate;
252  outlink->time_base = inlink->time_base;
253  } else if (tinterlace->mode != MODE_PAD) {
254  outlink->frame_rate = av_mul_q(inlink->frame_rate, (AVRational){1,2});
255  outlink->time_base = av_mul_q(inlink->time_base , (AVRational){2,1});
256  }
257 
258  for (i = 0; i<FF_ARRAY_ELEMS(standard_tbs); i++){
259  if (!av_cmp_q(standard_tbs[i], outlink->time_base))
260  break;
261  }
262  if (i == FF_ARRAY_ELEMS(standard_tbs) ||
263  (tinterlace->flags & TINTERLACE_FLAG_EXACT_TB))
264  outlink->time_base = tinterlace->preout_time_base;
265 
266  tinterlace->csp = av_pix_fmt_desc_get(outlink->format);
267  if (tinterlace->flags & TINTERLACE_FLAG_CVLPF) {
268  if (tinterlace->csp->comp[0].depth > 8)
270  else
271  tinterlace->lowpass_line = lowpass_line_complex_c;
272  if (ARCH_X86)
273  ff_tinterlace_init_x86(tinterlace);
274  } else if (tinterlace->flags & TINTERLACE_FLAG_VLPF) {
275  if (tinterlace->csp->comp[0].depth > 8)
276  tinterlace->lowpass_line = lowpass_line_c_16;
277  else
278  tinterlace->lowpass_line = lowpass_line_c;
279  if (ARCH_X86)
280  ff_tinterlace_init_x86(tinterlace);
281  }
282 
283  av_log(ctx, AV_LOG_VERBOSE, "mode:%d filter:%s h:%d -> h:%d\n", tinterlace->mode,
284  (tinterlace->flags & TINTERLACE_FLAG_CVLPF) ? "complex" :
285  (tinterlace->flags & TINTERLACE_FLAG_VLPF) ? "linear" : "off",
286  inlink->h, outlink->h);
287 
288  return 0;
289 }
290 
291 #define FIELD_UPPER 0
292 #define FIELD_LOWER 1
293 #define FIELD_UPPER_AND_LOWER 2
294 
295 /**
296  * Copy picture field from src to dst.
297  *
298  * @param src_field copy from upper, lower field or both
299  * @param interleave leave a padding line between each copied line
300  * @param dst_field copy to upper or lower field,
301  * only meaningful when interleave is selected
302  * @param flags context flags
303  */
304 static inline
306  uint8_t *dst[4], int dst_linesize[4],
307  const uint8_t *src[4], int src_linesize[4],
308  enum AVPixelFormat format, int w, int src_h,
309  int src_field, int interleave, int dst_field,
310  int flags)
311 {
313  int hsub = desc->log2_chroma_w;
314  int plane, vsub = desc->log2_chroma_h;
315  int k = src_field == FIELD_UPPER_AND_LOWER ? 1 : 2;
316  int h;
317 
318  for (plane = 0; plane < desc->nb_components; plane++) {
319  int lines = plane == 1 || plane == 2 ? AV_CEIL_RSHIFT(src_h, vsub) : src_h;
320  int cols = plane == 1 || plane == 2 ? AV_CEIL_RSHIFT( w, hsub) : w;
321  uint8_t *dstp = dst[plane];
322  const uint8_t *srcp = src[plane];
323  int srcp_linesize = src_linesize[plane] * k;
324  int dstp_linesize = dst_linesize[plane] * (interleave ? 2 : 1);
325  int clip_max = (1 << tinterlace->csp->comp[plane].depth) - 1;
326 
327  lines = (lines + (src_field == FIELD_UPPER)) / k;
328  if (src_field == FIELD_LOWER)
329  srcp += src_linesize[plane];
330  if (interleave && dst_field == FIELD_LOWER)
331  dstp += dst_linesize[plane];
332  // Low-pass filtering is required when creating an interlaced destination from
333  // a progressive source which contains high-frequency vertical detail.
334  // Filtering will reduce interlace 'twitter' and Moire patterning.
336  int x = !!(flags & TINTERLACE_FLAG_CVLPF);
337  for (h = lines; h > 0; h--) {
338  ptrdiff_t pref = src_linesize[plane];
339  ptrdiff_t mref = -pref;
340  if (h >= (lines - x)) mref = 0; // there is no line above
341  else if (h <= (1 + x)) pref = 0; // there is no line below
342 
343  tinterlace->lowpass_line(dstp, cols, srcp, mref, pref, clip_max);
344  dstp += dstp_linesize;
345  srcp += srcp_linesize;
346  }
347  } else {
348  if (tinterlace->csp->comp[plane].depth > 8)
349  cols *= 2;
350  av_image_copy_plane(dstp, dstp_linesize, srcp, srcp_linesize, cols, lines);
351  }
352  }
353 }
354 
356 {
357  AVFilterContext *ctx = inlink->dst;
358  AVFilterLink *outlink = ctx->outputs[0];
359  TInterlaceContext *tinterlace = ctx->priv;
360  AVFrame *cur, *next, *out;
361  int field, tff, ret;
362 
363  av_frame_free(&tinterlace->cur);
364  tinterlace->cur = tinterlace->next;
365  tinterlace->next = picref;
366 
367  cur = tinterlace->cur;
368  next = tinterlace->next;
369  /* we need at least two frames */
370  if (!tinterlace->cur)
371  return 0;
372 
373  switch (tinterlace->mode) {
374  case MODE_MERGEX2: /* move the odd frame into the upper field of the new image, even into
375  * the lower field, generating a double-height video at same framerate */
376  case MODE_MERGE: /* move the odd frame into the upper field of the new image, even into
377  * the lower field, generating a double-height video at half framerate */
378  out = ff_get_video_buffer(outlink, outlink->w, outlink->h);
379  if (!out)
380  return AVERROR(ENOMEM);
381  av_frame_copy_props(out, cur);
382  out->height = outlink->h;
383  out->interlaced_frame = 1;
384  out->top_field_first = 1;
385  out->sample_aspect_ratio = av_mul_q(cur->sample_aspect_ratio, av_make_q(2, 1));
386 
387  /* write odd frame lines into the upper field of the new frame */
388  copy_picture_field(tinterlace, out->data, out->linesize,
389  (const uint8_t **)cur->data, cur->linesize,
390  inlink->format, inlink->w, inlink->h,
391  FIELD_UPPER_AND_LOWER, 1, tinterlace->mode == MODE_MERGEX2 ? (1 + inlink->frame_count_out) & 1 ? FIELD_LOWER : FIELD_UPPER : FIELD_UPPER, tinterlace->flags);
392  /* write even frame lines into the lower field of the new frame */
393  copy_picture_field(tinterlace, out->data, out->linesize,
394  (const uint8_t **)next->data, next->linesize,
395  inlink->format, inlink->w, inlink->h,
396  FIELD_UPPER_AND_LOWER, 1, tinterlace->mode == MODE_MERGEX2 ? (1 + inlink->frame_count_out) & 1 ? FIELD_UPPER : FIELD_LOWER : FIELD_LOWER, tinterlace->flags);
397  if (tinterlace->mode != MODE_MERGEX2)
398  av_frame_free(&tinterlace->next);
399  break;
400 
401  case MODE_DROP_ODD: /* only output even frames, odd frames are dropped; height unchanged, half framerate */
402  case MODE_DROP_EVEN: /* only output odd frames, even frames are dropped; height unchanged, half framerate */
403  out = av_frame_clone(tinterlace->mode == MODE_DROP_EVEN ? cur : next);
404  if (!out)
405  return AVERROR(ENOMEM);
406  av_frame_free(&tinterlace->next);
407  break;
408 
409  case MODE_PAD: /* expand each frame to double height, but pad alternate
410  * lines with black; framerate unchanged */
411  out = ff_get_video_buffer(outlink, outlink->w, outlink->h);
412  if (!out)
413  return AVERROR(ENOMEM);
414  av_frame_copy_props(out, cur);
415  out->height = outlink->h;
416  out->sample_aspect_ratio = av_mul_q(cur->sample_aspect_ratio, av_make_q(2, 1));
417 
418  field = (1 + outlink->frame_count_in) & 1 ? FIELD_UPPER : FIELD_LOWER;
419  /* copy upper and lower fields */
420  copy_picture_field(tinterlace, out->data, out->linesize,
421  (const uint8_t **)cur->data, cur->linesize,
422  inlink->format, inlink->w, inlink->h,
423  FIELD_UPPER_AND_LOWER, 1, field, tinterlace->flags);
424  /* pad with black the other field */
425  copy_picture_field(tinterlace, out->data, out->linesize,
426  (const uint8_t **)tinterlace->black_data, tinterlace->black_linesize,
427  inlink->format, inlink->w, inlink->h,
428  FIELD_UPPER_AND_LOWER, 1, !field, tinterlace->flags);
429  break;
430 
431  /* interleave upper/lower lines from odd frames with lower/upper lines from even frames,
432  * halving the frame rate and preserving image height */
433  case MODE_INTERLEAVE_TOP: /* top field first */
434  case MODE_INTERLEAVE_BOTTOM: /* bottom field first */
435  if ((tinterlace->flags & TINTERLACE_FLAG_BYPASS_IL) && cur->interlaced_frame) {
437  "video is already interlaced, adjusting framerate only\n");
438  out = av_frame_clone(cur);
439  if (!out)
440  return AVERROR(ENOMEM);
441  out->pts /= 2; // adjust pts to new framerate
442  ret = ff_filter_frame(outlink, out);
443  return ret;
444  }
445  tff = tinterlace->mode == MODE_INTERLEAVE_TOP;
446  out = ff_get_video_buffer(outlink, outlink->w, outlink->h);
447  if (!out)
448  return AVERROR(ENOMEM);
449  av_frame_copy_props(out, cur);
450  out->interlaced_frame = 1;
451  out->top_field_first = tff;
452 
453  /* copy upper/lower field from cur */
454  copy_picture_field(tinterlace, out->data, out->linesize,
455  (const uint8_t **)cur->data, cur->linesize,
456  inlink->format, inlink->w, inlink->h,
457  tff ? FIELD_UPPER : FIELD_LOWER, 1, tff ? FIELD_UPPER : FIELD_LOWER,
458  tinterlace->flags);
459  /* copy lower/upper field from next */
460  copy_picture_field(tinterlace, out->data, out->linesize,
461  (const uint8_t **)next->data, next->linesize,
462  inlink->format, inlink->w, inlink->h,
463  tff ? FIELD_LOWER : FIELD_UPPER, 1, tff ? FIELD_LOWER : FIELD_UPPER,
464  tinterlace->flags);
465  av_frame_free(&tinterlace->next);
466  break;
467  case MODE_INTERLACEX2: /* re-interlace preserving image height, double frame rate */
468  /* output current frame first */
469  out = av_frame_clone(cur);
470  if (!out)
471  return AVERROR(ENOMEM);
472  out->interlaced_frame = 1;
473  if (cur->pts != AV_NOPTS_VALUE)
474  out->pts = cur->pts*2;
475 
476  out->pts = av_rescale_q(out->pts, tinterlace->preout_time_base, outlink->time_base);
477  if ((ret = ff_filter_frame(outlink, out)) < 0)
478  return ret;
479 
480  /* output mix of current and next frame */
481  tff = next->top_field_first;
482  out = ff_get_video_buffer(outlink, outlink->w, outlink->h);
483  if (!out)
484  return AVERROR(ENOMEM);
485  av_frame_copy_props(out, next);
486  out->interlaced_frame = 1;
487  out->top_field_first = !tff;
488 
489  if (next->pts != AV_NOPTS_VALUE && cur->pts != AV_NOPTS_VALUE)
490  out->pts = cur->pts + next->pts;
491  else
492  out->pts = AV_NOPTS_VALUE;
493  /* write current frame second field lines into the second field of the new frame */
494  copy_picture_field(tinterlace, out->data, out->linesize,
495  (const uint8_t **)cur->data, cur->linesize,
496  inlink->format, inlink->w, inlink->h,
497  tff ? FIELD_LOWER : FIELD_UPPER, 1, tff ? FIELD_LOWER : FIELD_UPPER,
498  tinterlace->flags);
499  /* write next frame first field lines into the first field of the new frame */
500  copy_picture_field(tinterlace, out->data, out->linesize,
501  (const uint8_t **)next->data, next->linesize,
502  inlink->format, inlink->w, inlink->h,
503  tff ? FIELD_UPPER : FIELD_LOWER, 1, tff ? FIELD_UPPER : FIELD_LOWER,
504  tinterlace->flags);
505  break;
506  default:
507  av_assert0(0);
508  }
509 
510  out->pts = av_rescale_q(out->pts, tinterlace->preout_time_base, outlink->time_base);
511  ret = ff_filter_frame(outlink, out);
512 
513  return ret;
514 }
515 
517 {
518  TInterlaceContext *tinterlace = ctx->priv;
519 
520  if (tinterlace->mode <= MODE_BFF)
521  tinterlace->mode += MODE_INTERLEAVE_TOP;
522 
523  tinterlace->flags |= TINTERLACE_FLAG_BYPASS_IL;
524  if (tinterlace->lowpass == VLPF_LIN)
525  tinterlace->flags |= TINTERLACE_FLAG_VLPF;
526  if (tinterlace->lowpass == VLPF_CMP)
527  tinterlace->flags |= TINTERLACE_FLAG_CVLPF;
528 
529  return 0;
530 }
531 
532 static const AVFilterPad tinterlace_inputs[] = {
533  {
534  .name = "default",
535  .type = AVMEDIA_TYPE_VIDEO,
536  .filter_frame = filter_frame,
537  },
538 };
539 
540 static const AVFilterPad tinterlace_outputs[] = {
541  {
542  .name = "default",
543  .type = AVMEDIA_TYPE_VIDEO,
544  .config_props = config_out_props,
545  },
546 };
547 
549  .name = "tinterlace",
550  .description = NULL_IF_CONFIG_SMALL("Perform temporal field interlacing."),
551  .priv_size = sizeof(TInterlaceContext),
552  .uninit = uninit,
556  .priv_class = &tinterlace_class,
557 };
558 
559 
561  .name = "interlace",
562  .description = NULL_IF_CONFIG_SMALL("Convert progressive video into interlaced."),
563  .priv_size = sizeof(TInterlaceContext),
564  .init = init_interlace,
565  .uninit = uninit,
569  .priv_class = &interlace_class,
570 };
ff_get_video_buffer
AVFrame * ff_get_video_buffer(AVFilterLink *link, int w, int h)
Request a picture buffer with a specific set of permissions.
Definition: video.c:98
filter_frame
static int filter_frame(AVFilterLink *inlink, AVFrame *picref)
Definition: vf_tinterlace.c:355
MODE_MERGE
@ MODE_MERGE
Definition: tinterlace.h:48
AV_LOG_WARNING
#define AV_LOG_WARNING
Something somehow does not look correct.
Definition: log.h:186
AVPixelFormat
AVPixelFormat
Pixel format.
Definition: pixfmt.h:64
av_clip
#define av_clip
Definition: common.h:96
init
static av_cold int init(AVCodecContext *avctx)
Definition: avrndec.c:31
init_interlace
static int init_interlace(AVFilterContext *ctx)
Definition: vf_tinterlace.c:516
AVERROR
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
opt.h
out
FILE * out
Definition: movenc.c:54
TINTERLACE_FLAG_BYPASS_IL
#define TINTERLACE_FLAG_BYPASS_IL
Definition: tinterlace.h:39
standard_tbs
static const AVRational standard_tbs[]
Definition: vf_tinterlace.c:84
ff_filter_frame
int ff_filter_frame(AVFilterLink *link, AVFrame *frame)
Send a frame of data to the next filter.
Definition: avfilter.c:1018
av_pix_fmt_desc_get
const AVPixFmtDescriptor * av_pix_fmt_desc_get(enum AVPixelFormat pix_fmt)
Definition: pixdesc.c:2564
FILTER_PIXFMTS_ARRAY
#define FILTER_PIXFMTS_ARRAY(array)
Definition: internal.h:171
inlink
The exact code depends on how similar the blocks are and how related they are to the and needs to apply these operations to the correct inlink or outlink if there are several Macros are available to factor that when no extra processing is inlink
Definition: filter_design.txt:212
TInterlaceContext::lowpass_line
void(* lowpass_line)(uint8_t *dstp, ptrdiff_t width, const uint8_t *srcp, ptrdiff_t mref, ptrdiff_t pref, int clip_max)
Definition: tinterlace.h:78
lowpass_line_complex_c
static void lowpass_line_complex_c(uint8_t *dstp, ptrdiff_t width, const uint8_t *srcp, ptrdiff_t mref, ptrdiff_t pref, int clip_max)
Definition: vf_tinterlace.c:136
FIELD_UPPER_AND_LOWER
#define FIELD_UPPER_AND_LOWER
Definition: vf_tinterlace.c:293
av_frame_free
void av_frame_free(AVFrame **frame)
Free the frame and any dynamically allocated objects in it, e.g.
Definition: frame.c:112
AVFrame
This structure describes decoded (raw) audio or video data.
Definition: frame.h:303
AVFrame::pts
int64_t pts
Presentation timestamp in time_base units (time when frame should be shown to user).
Definition: frame.h:396
w
uint8_t w
Definition: llviddspenc.c:38
TInterlaceContext
Definition: tinterlace.h:64
AVComponentDescriptor::depth
int depth
Number of bits in the component.
Definition: pixdesc.h:57
TInterlaceContext::color
FFDrawColor color
Definition: tinterlace.h:76
AVOption
AVOption.
Definition: opt.h:247
TInterlaceContext::black_linesize
int black_linesize[4]
Definition: tinterlace.h:74
AV_LOG_VERBOSE
#define AV_LOG_VERBOSE
Detailed information.
Definition: log.h:196
AV_PIX_FMT_YUV440P
@ AV_PIX_FMT_YUV440P
planar YUV 4:4:0 (1 Cr & Cb sample per 1x2 Y samples)
Definition: pixfmt.h:99
TInterlaceContext::black_data
uint8_t * black_data[4]
buffer used to fill padded lines
Definition: tinterlace.h:73
AVFilter::name
const char * name
Filter name.
Definition: avfilter.h:153
AVFrame::data
uint8_t * data[AV_NUM_DATA_POINTERS]
pointer to the picture/channel planes.
Definition: frame.h:317
av_image_copy_plane
void av_image_copy_plane(uint8_t *dst, int dst_linesize, const uint8_t *src, int src_linesize, int bytewidth, int height)
Copy image plane from src to dst.
Definition: imgutils.c:374
hsub
static void hsub(htype *dst, const htype *src, int bins)
Definition: vf_median.c:74
VLPF_LIN
@ VLPF_LIN
Definition: tinterlace.h:43
MODE_INTERLEAVE_TOP
@ MODE_INTERLEAVE_TOP
Definition: tinterlace.h:52
TInterlaceContext::vsub
int vsub
chroma vertical subsampling
Definition: tinterlace.h:70
TInterlaceContext::preout_time_base
AVRational preout_time_base
Definition: tinterlace.h:67
AV_PIX_FMT_YUV420P12LE
@ AV_PIX_FMT_YUV420P12LE
planar YUV 4:2:0,18bpp, (1 Cr & Cb sample per 2x2 Y samples), little-endian
Definition: pixfmt.h:233
OFFSET
#define OFFSET(x)
Definition: vf_tinterlace.c:36
config_out_props
static int config_out_props(AVFilterLink *outlink)
Definition: vf_tinterlace.c:207
FIELD_LOWER
#define FIELD_LOWER
Definition: vf_tinterlace.c:292
tinterlace_inputs
static const AVFilterPad tinterlace_inputs[]
Definition: vf_tinterlace.c:532
AVFilterPad
A filter pad used for either input or output.
Definition: internal.h:50
AV_PIX_FMT_YUV420P10LE
@ AV_PIX_FMT_YUV420P10LE
planar YUV 4:2:0, 15bpp, (1 Cr & Cb sample per 2x2 Y samples), little-endian
Definition: pixfmt.h:149
uninit
static av_cold void uninit(AVFilterContext *ctx)
Definition: vf_tinterlace.c:198
AV_PIX_FMT_YUV444P12LE
@ AV_PIX_FMT_YUV444P12LE
planar YUV 4:4:4,36bpp, (1 Cr & Cb sample per 1x1 Y samples), little-endian
Definition: pixfmt.h:241
avassert.h
FF_ARRAY_ELEMS
#define FF_ARRAY_ELEMS(a)
Definition: sinewin_tablegen.c:29
av_cold
#define av_cold
Definition: attributes.h:90
MODE_MERGEX2
@ MODE_MERGEX2
Definition: tinterlace.h:55
TInterlaceContext::flags
int flags
flags affecting interlacing algorithm
Definition: tinterlace.h:68
TInterlaceContext::csp
const AVPixFmtDescriptor * csp
Definition: tinterlace.h:77
width
#define width
TInterlaceContext::cur
AVFrame * cur
Definition: tinterlace.h:71
AV_PIX_FMT_YUVA420P
@ AV_PIX_FMT_YUVA420P
planar YUV 4:2:0, 20bpp, (1 Cr & Cb sample per 2x2 Y & A samples)
Definition: pixfmt.h:101
AV_CEIL_RSHIFT
#define AV_CEIL_RSHIFT(a, b)
Definition: common.h:51
VLPF_CMP
@ VLPF_CMP
Definition: tinterlace.h:44
av_assert0
#define av_assert0(cond)
assert() equivalent, that is always enabled.
Definition: avassert.h:37
TInterlaceContext::next
AVFrame * next
Definition: tinterlace.h:72
ctx
AVFormatContext * ctx
Definition: movenc.c:48
av_frame_clone
AVFrame * av_frame_clone(const AVFrame *src)
Create a new frame that references the same data as src.
Definition: frame.c:424
av_rescale_q
int64_t av_rescale_q(int64_t a, AVRational bq, AVRational cq)
Rescale a 64-bit integer by 2 rational numbers.
Definition: mathematics.c:141
field
it s the only field you need to keep assuming you have a context There is some magic you don t need to care about around this field
Definition: writing_filters.txt:78
ff_draw_init
int ff_draw_init(FFDrawContext *draw, enum AVPixelFormat format, unsigned flags)
Init a draw context.
Definition: drawutils.c:82
ff_tinterlace_init_x86
void ff_tinterlace_init_x86(TInterlaceContext *interlace)
Definition: vf_tinterlace_init.c:57
AV_PIX_FMT_YUV420P
@ AV_PIX_FMT_YUV420P
planar YUV 4:2:0, 12bpp, (1 Cr & Cb sample per 2x2 Y samples)
Definition: pixfmt.h:66
FILTER_INPUTS
#define FILTER_INPUTS(array)
Definition: internal.h:191
ff_vf_tinterlace
const AVFilter ff_vf_tinterlace
Definition: vf_tinterlace.c:548
AV_PIX_FMT_YUV444P10LE
@ AV_PIX_FMT_YUV444P10LE
planar YUV 4:4:4, 30bpp, (1 Cr & Cb sample per 1x1 Y samples), little-endian
Definition: pixfmt.h:155
AV_PIX_FMT_YUVA422P10LE
@ AV_PIX_FMT_YUVA422P10LE
planar YUV 4:2:2 30bpp, (1 Cr & Cb sample per 2x1 Y & A samples, little-endian)
Definition: pixfmt.h:177
TINTERLACE_FLAG_EXACT_TB
#define TINTERLACE_FLAG_EXACT_TB
Definition: tinterlace.h:38
NULL
#define NULL
Definition: coverity.c:32
av_frame_copy_props
int av_frame_copy_props(AVFrame *dst, const AVFrame *src)
Copy only "metadata" fields from src to dst.
Definition: frame.c:537
tinterlace_options
static const AVOption tinterlace_options[]
Definition: vf_tinterlace.c:39
AVRational
Rational number (pair of numerator and denominator).
Definition: rational.h:58
ff_vf_interlace
const AVFilter ff_vf_interlace
Definition: vf_tinterlace.c:560
AVFilterContext::inputs
AVFilterLink ** inputs
array of pointers to input links
Definition: avfilter.h:394
src
#define src
Definition: vp8dsp.c:255
TInterlaceContext::mode
int mode
TInterlaceMode, interlace mode selected.
Definition: tinterlace.h:66
ff_fmt_is_in
int ff_fmt_is_in(int fmt, const int *fmts)
Tell if an integer is contained in the provided -1-terminated list of integers.
Definition: formats.c:352
MODE_DROP_EVEN
@ MODE_DROP_EVEN
Definition: tinterlace.h:49
FFDrawColor::u8
uint8_t u8[16]
Definition: drawutils.h:54
AV_PIX_FMT_YUV440P10LE
@ AV_PIX_FMT_YUV440P10LE
planar YUV 4:4:0,20bpp, (1 Cr & Cb sample per 1x2 Y samples), little-endian
Definition: pixfmt.h:265
AV_PIX_FMT_GRAY8
@ AV_PIX_FMT_GRAY8
Y , 8bpp.
Definition: pixfmt.h:74
av_image_alloc
int av_image_alloc(uint8_t *pointers[4], int linesizes[4], int w, int h, enum AVPixelFormat pix_fmt, int align)
Allocate an image with size w and h and pixel format pix_fmt, and fill pointers and linesizes accordi...
Definition: imgutils.c:218
interleave
static void interleave(uint8_t *dst, uint8_t *src, int w, int h, int dst_linesize, int src_linesize, enum FilterMode mode, int swap)
Definition: vf_il.c:108
lowpass
@ lowpass
Definition: af_biquads.c:82
AV_PIX_FMT_YUV440P12LE
@ AV_PIX_FMT_YUV440P12LE
planar YUV 4:4:0,24bpp, (1 Cr & Cb sample per 1x2 Y samples), little-endian
Definition: pixfmt.h:267
NULL_IF_CONFIG_SMALL
#define NULL_IF_CONFIG_SMALL(x)
Return NULL if CONFIG_SMALL is true, otherwise the argument without modification.
Definition: internal.h:117
pix_fmts
static enum AVPixelFormat pix_fmts[]
Definition: vf_tinterlace.c:90
AV_PIX_FMT_YUV422P10LE
@ AV_PIX_FMT_YUV422P10LE
planar YUV 4:2:2, 20bpp, (1 Cr & Cb sample per 2x1 Y samples), little-endian
Definition: pixfmt.h:151
TINTERLACE_FLAG_CVLPF
#define TINTERLACE_FLAG_CVLPF
Definition: tinterlace.h:37
av_make_q
static AVRational av_make_q(int num, int den)
Create an AVRational.
Definition: rational.h:71
AV_NOPTS_VALUE
#define AV_NOPTS_VALUE
Undefined timestamp value.
Definition: avutil.h:248
ff_fill_rectangle
void ff_fill_rectangle(FFDrawContext *draw, FFDrawColor *color, uint8_t *dst[], int dst_linesize[], int dst_x, int dst_y, int w, int h)
Fill a rectangle with an uniform color.
Definition: drawutils.c:222
av_le2ne16
#define av_le2ne16(x)
Definition: bswap.h:95
AV_PIX_FMT_YUVA444P
@ AV_PIX_FMT_YUVA444P
planar YUV 4:4:4 32bpp, (1 Cr & Cb sample per 1x1 Y & A samples)
Definition: pixfmt.h:167
FULL_SCALE_YUVJ_FORMATS
#define FULL_SCALE_YUVJ_FORMATS
Definition: vf_tinterlace.c:77
copy_picture_field
static void copy_picture_field(TInterlaceContext *tinterlace, uint8_t *dst[4], int dst_linesize[4], const uint8_t *src[4], int src_linesize[4], enum AVPixelFormat format, int w, int src_h, int src_field, int interleave, int dst_field, int flags)
Copy picture field from src to dst.
Definition: vf_tinterlace.c:305
AV_PIX_FMT_YUVA420P10LE
@ AV_PIX_FMT_YUVA420P10LE
planar YUV 4:2:0 25bpp, (1 Cr & Cb sample per 2x2 Y & A samples, little-endian)
Definition: pixfmt.h:175
internal.h
AVFrame::interlaced_frame
int interlaced_frame
The content of the picture is interlaced.
Definition: frame.h:433
MODE_NB
@ MODE_NB
Definition: avf_avectorscope.c:41
i
#define i(width, name, range_min, range_max)
Definition: cbs_h2645.c:271
MODE_INTERLEAVE_BOTTOM
@ MODE_INTERLEAVE_BOTTOM
Definition: tinterlace.h:53
FIELD_UPPER
#define FIELD_UPPER
Definition: vf_tinterlace.c:291
MODE_BFF
@ MODE_BFF
Definition: tinterlace.h:61
AVFilterPad::name
const char * name
Pad name.
Definition: internal.h:56
ff_draw_color
void ff_draw_color(FFDrawContext *draw, FFDrawColor *color, const uint8_t rgba[4])
Prepare a color.
Definition: drawutils.c:135
av_cmp_q
static int av_cmp_q(AVRational a, AVRational b)
Compare two rationals.
Definition: rational.h:89
AVFilter
Filter definition.
Definition: avfilter.h:149
TInterlaceContext::lowpass
int lowpass
legacy interlace filter lowpass mode
Definition: tinterlace.h:69
ret
ret
Definition: filter_design.txt:187
AVFrame::sample_aspect_ratio
AVRational sample_aspect_ratio
Sample aspect ratio for the video frame, 0/1 if unknown/unspecified.
Definition: frame.h:391
tinterlace.h
AVRational::den
int den
Denominator.
Definition: rational.h:60
mode
mode
Definition: ebur128.h:83
AV_PIX_FMT_NONE
@ AV_PIX_FMT_NONE
Definition: pixfmt.h:65
FFDrawColor::comp
union FFDrawColor::@201 comp[MAX_PLANES]
AV_OPT_TYPE_INT
@ AV_OPT_TYPE_INT
Definition: opt.h:224
MODE_PAD
@ MODE_PAD
Definition: tinterlace.h:51
avfilter.h
TInterlaceContext::draw
FFDrawContext draw
Definition: tinterlace.h:75
AVPixFmtDescriptor::comp
AVComponentDescriptor comp[4]
Parameters that describe how pixels are packed.
Definition: pixdesc.h:105
av_mul_q
AVRational av_mul_q(AVRational b, AVRational c)
Multiply two rationals.
Definition: rational.c:80
av_clip_uint8
#define av_clip_uint8
Definition: common.h:102
AV_PIX_FMT_YUV444P
@ AV_PIX_FMT_YUV444P
planar YUV 4:4:4, 24bpp, (1 Cr & Cb sample per 1x1 Y samples)
Definition: pixfmt.h:71
AVFilterContext
An instance of a filter.
Definition: avfilter.h:386
MODE_INTERLACEX2
@ MODE_INTERLACEX2
Definition: tinterlace.h:54
lowpass_line_c
static void lowpass_line_c(uint8_t *dstp, ptrdiff_t width, const uint8_t *srcp, ptrdiff_t mref, ptrdiff_t pref, int clip_max)
Definition: vf_tinterlace.c:104
desc
const char * desc
Definition: libsvtav1.c:79
AVMEDIA_TYPE_VIDEO
@ AVMEDIA_TYPE_VIDEO
Definition: avutil.h:201
VLPF_OFF
@ VLPF_OFF
Definition: tinterlace.h:42
AV_PIX_FMT_YUV422P
@ AV_PIX_FMT_YUV422P
planar YUV 4:2:2, 16bpp, (1 Cr & Cb sample per 2x1 Y samples)
Definition: pixfmt.h:70
full_scale_yuvj_pix_fmts
static enum AVPixelFormat full_scale_yuvj_pix_fmts[]
Definition: vf_tinterlace.c:80
AV_PIX_FMT_YUVA444P10LE
@ AV_PIX_FMT_YUVA444P10LE
planar YUV 4:4:4 40bpp, (1 Cr & Cb sample per 1x1 Y & A samples, little-endian)
Definition: pixfmt.h:179
lowpass_line_complex_c_16
static void lowpass_line_complex_c_16(uint8_t *dst8, ptrdiff_t width, const uint8_t *src8, ptrdiff_t mref, ptrdiff_t pref, int clip_max)
Definition: vf_tinterlace.c:163
AVPixFmtDescriptor
Descriptor that unambiguously describes how the bits of a pixel are stored in the up to 4 data planes...
Definition: pixdesc.h:69
FILTER_OUTPUTS
#define FILTER_OUTPUTS(array)
Definition: internal.h:192
av_freep
#define av_freep(p)
Definition: tableprint_vlc.h:35
MODE_TFF
@ MODE_TFF
Definition: tinterlace.h:60
AV_PIX_FMT_YUV411P
@ AV_PIX_FMT_YUV411P
planar YUV 4:1:1, 12bpp, (1 Cr & Cb sample per 4x1 Y samples)
Definition: pixfmt.h:73
format
fg outputs[0] format
Definition: ffmpeg_filter.c:175
TINTERLACE_FLAG_VLPF
#define TINTERLACE_FLAG_VLPF
Definition: tinterlace.h:36
AV_OPT_TYPE_FLAGS
@ AV_OPT_TYPE_FLAGS
Definition: opt.h:223
imgutils.h
interlace_options
static const AVOption interlace_options[]
Definition: vf_tinterlace.c:63
flags
#define flags(name, subs,...)
Definition: cbs_av1.c:561
lowpass_line_c_16
static void lowpass_line_c_16(uint8_t *dst8, ptrdiff_t width, const uint8_t *src8, ptrdiff_t mref, ptrdiff_t pref, int clip_max)
Definition: vf_tinterlace.c:118
AVFrame::linesize
int linesize[AV_NUM_DATA_POINTERS]
For video, size in bytes of each picture line.
Definition: frame.h:334
AV_PIX_FMT_YUV410P
@ AV_PIX_FMT_YUV410P
planar YUV 4:1:0, 9bpp, (1 Cr & Cb sample per 4x4 Y samples)
Definition: pixfmt.h:72
av_log
#define av_log(a,...)
Definition: tableprint_vlc.h:28
h
h
Definition: vp9dsp_template.c:2038
FLAGS
#define FLAGS
Definition: vf_tinterlace.c:37
AV_OPT_TYPE_CONST
@ AV_OPT_TYPE_CONST
Definition: opt.h:233
AV_PIX_FMT_YUV422P12LE
@ AV_PIX_FMT_YUV422P12LE
planar YUV 4:2:2,24bpp, (1 Cr & Cb sample per 2x1 Y samples), little-endian
Definition: pixfmt.h:237
AVFILTER_DEFINE_CLASS
AVFILTER_DEFINE_CLASS(tinterlace)
AV_PIX_FMT_YUVA422P
@ AV_PIX_FMT_YUVA422P
planar YUV 4:2:2 24bpp, (1 Cr & Cb sample per 2x1 Y & A samples)
Definition: pixfmt.h:166
MODE_DROP_ODD
@ MODE_DROP_ODD
Definition: tinterlace.h:50
tinterlace_outputs
static const AVFilterPad tinterlace_outputs[]
Definition: vf_tinterlace.c:540