vf_tinterlace.c
Go to the documentation of this file.
1 /*
2  * Copyright (c) 2011 Stefano Sabatini
3  * Copyright (c) 2010 Baptiste Coudurier
4  * Copyright (c) 2003 Michael Zucchi <notzed@ximian.com>
5  *
6  * This file is part of FFmpeg.
7  *
8  * FFmpeg is free software; you can redistribute it and/or modify
9  * it under the terms of the GNU General Public License as published by
10  * the Free Software Foundation; either version 2 of the License, or
11  * (at your option) any later version.
12  *
13  * FFmpeg is distributed in the hope that it will be useful,
14  * but WITHOUT ANY WARRANTY; without even the implied warranty of
15  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16  * GNU General Public License for more details.
17  *
18  * You should have received a copy of the GNU General Public License along
19  * with FFmpeg if not, write to the Free Software Foundation, Inc.,
20  * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
21  */
22 
23 /**
24  * @file
25  * temporal field interlace filter, ported from MPlayer/libmpcodecs
26  */
27 
28 #include "libavutil/opt.h"
29 #include "libavutil/imgutils.h"
30 #include "libavutil/avassert.h"
31 #include "avfilter.h"
32 #include "internal.h"
33 
43 };
44 
45 typedef struct {
46  const AVClass *class;
47  enum TInterlaceMode mode; ///< interlace mode selected
48  int flags; ///< flags affecting interlacing algorithm
49  int frame; ///< number of the output frame
50  int vsub; ///< chroma vertical subsampling
53  uint8_t *black_data[4]; ///< buffer used to fill padded lines
54  int black_linesize[4];
56 
57 #define OFFSET(x) offsetof(TInterlaceContext, x)
58 #define FLAGS AV_OPT_FLAG_FILTERING_PARAM|AV_OPT_FLAG_VIDEO_PARAM
59 #define TINTERLACE_FLAG_VLPF 01
60 
61 static const AVOption tinterlace_options[] = {
62  {"mode", "select interlace mode", OFFSET(mode), AV_OPT_TYPE_INT, {.i64=MODE_MERGE}, 0, MODE_NB-1, FLAGS, "mode"},
63  {"merge", "merge fields", 0, AV_OPT_TYPE_CONST, {.i64=MODE_MERGE}, INT_MIN, INT_MAX, FLAGS, "mode"},
64  {"drop_even", "drop even fields", 0, AV_OPT_TYPE_CONST, {.i64=MODE_DROP_EVEN}, INT_MIN, INT_MAX, FLAGS, "mode"},
65  {"drop_odd", "drop odd fields", 0, AV_OPT_TYPE_CONST, {.i64=MODE_DROP_ODD}, INT_MIN, INT_MAX, FLAGS, "mode"},
66  {"pad", "pad alternate lines with black", 0, AV_OPT_TYPE_CONST, {.i64=MODE_PAD}, INT_MIN, INT_MAX, FLAGS, "mode"},
67  {"interleave_top", "interleave top and bottom fields", 0, AV_OPT_TYPE_CONST, {.i64=MODE_INTERLEAVE_TOP}, INT_MIN, INT_MAX, FLAGS, "mode"},
68  {"interleave_bottom", "interleave bottom and top fields", 0, AV_OPT_TYPE_CONST, {.i64=MODE_INTERLEAVE_BOTTOM}, INT_MIN, INT_MAX, FLAGS, "mode"},
69  {"interlacex2", "interlace fields from two consecutive frames", 0, AV_OPT_TYPE_CONST, {.i64=MODE_INTERLACEX2}, INT_MIN, INT_MAX, FLAGS, "mode"},
70 
71  {"flags", "set flags", OFFSET(flags), AV_OPT_TYPE_FLAGS, {.i64 = 0}, 0, INT_MAX, 0, "flags" },
72  {"low_pass_filter", "enable vertical low-pass filter", 0, AV_OPT_TYPE_CONST, {.i64 = TINTERLACE_FLAG_VLPF}, INT_MIN, INT_MAX, FLAGS, "flags" },
73  {"vlpf", "enable vertical low-pass filter", 0, AV_OPT_TYPE_CONST, {.i64 = TINTERLACE_FLAG_VLPF}, INT_MIN, INT_MAX, FLAGS, "flags" },
74 
75  {NULL}
76 };
77 
78 AVFILTER_DEFINE_CLASS(tinterlace);
79 
80 #define FULL_SCALE_YUVJ_FORMATS \
81  AV_PIX_FMT_YUVJ420P, AV_PIX_FMT_YUVJ422P, AV_PIX_FMT_YUVJ444P, AV_PIX_FMT_YUVJ440P
82 
85 };
86 
88 {
89  static const enum AVPixelFormat pix_fmts[] = {
94  };
95 
97  return 0;
98 }
99 
101 {
102  TInterlaceContext *tinterlace = ctx->priv;
103 
104  av_frame_free(&tinterlace->cur );
105  av_frame_free(&tinterlace->next);
106  av_freep(&tinterlace->black_data[0]);
107 }
108 
109 static int config_out_props(AVFilterLink *outlink)
110 {
111  AVFilterContext *ctx = outlink->src;
112  AVFilterLink *inlink = outlink->src->inputs[0];
113  const AVPixFmtDescriptor *desc = av_pix_fmt_desc_get(outlink->format);
114  TInterlaceContext *tinterlace = ctx->priv;
115 
116  tinterlace->vsub = desc->log2_chroma_h;
117  outlink->w = inlink->w;
118  outlink->h = tinterlace->mode == MODE_MERGE || tinterlace->mode == MODE_PAD ?
119  inlink->h*2 : inlink->h;
120 
121  if (tinterlace->mode == MODE_PAD) {
122  uint8_t black[4] = { 16, 128, 128, 16 };
123  int i, ret;
125  black[0] = black[3] = 0;
126  ret = av_image_alloc(tinterlace->black_data, tinterlace->black_linesize,
127  outlink->w, outlink->h, outlink->format, 1);
128  if (ret < 0)
129  return ret;
130 
131  /* fill black picture with black */
132  for (i = 0; i < 4 && tinterlace->black_data[i]; i++) {
133  int h = i == 1 || i == 2 ? outlink->h >> desc->log2_chroma_h : outlink->h;
134  memset(tinterlace->black_data[i], black[i],
135  tinterlace->black_linesize[i] * h);
136  }
137  }
138  if ((tinterlace->flags & TINTERLACE_FLAG_VLPF)
139  && !(tinterlace->mode == MODE_INTERLEAVE_TOP
140  || tinterlace->mode == MODE_INTERLEAVE_BOTTOM)) {
141  av_log(ctx, AV_LOG_WARNING, "low_pass_filter flag ignored with mode %d\n",
142  tinterlace->mode);
143  tinterlace->flags &= ~TINTERLACE_FLAG_VLPF;
144  }
145  av_log(ctx, AV_LOG_VERBOSE, "mode:%d filter:%s h:%d -> h:%d\n",
146  tinterlace->mode, (tinterlace->flags & TINTERLACE_FLAG_VLPF) ? "on" : "off",
147  inlink->h, outlink->h);
148 
149  return 0;
150 }
151 
152 #define FIELD_UPPER 0
153 #define FIELD_LOWER 1
154 #define FIELD_UPPER_AND_LOWER 2
155 
156 /**
157  * Copy picture field from src to dst.
158  *
159  * @param src_field copy from upper, lower field or both
160  * @param interleave leave a padding line between each copied line
161  * @param dst_field copy to upper or lower field,
162  * only meaningful when interleave is selected
163  * @param flags context flags
164  */
165 static inline
166 void copy_picture_field(uint8_t *dst[4], int dst_linesize[4],
167  const uint8_t *src[4], int src_linesize[4],
168  enum AVPixelFormat format, int w, int src_h,
169  int src_field, int interleave, int dst_field,
170  int flags)
171 {
172  const AVPixFmtDescriptor *desc = av_pix_fmt_desc_get(format);
173  int plane, vsub = desc->log2_chroma_h;
174  int k = src_field == FIELD_UPPER_AND_LOWER ? 1 : 2;
175  int h, i;
176 
177  for (plane = 0; plane < desc->nb_components; plane++) {
178  int lines = plane == 1 || plane == 2 ? src_h >> vsub : src_h;
179  int linesize = av_image_get_linesize(format, w, plane);
180  uint8_t *dstp = dst[plane];
181  const uint8_t *srcp = src[plane];
182 
183  if (linesize < 0)
184  return;
185 
186  lines /= k;
187  if (src_field == FIELD_LOWER)
188  srcp += src_linesize[plane];
189  if (interleave && dst_field == FIELD_LOWER)
190  dstp += dst_linesize[plane];
191  if (flags & TINTERLACE_FLAG_VLPF) {
192  // Low-pass filtering is required when creating an interlaced destination from
193  // a progressive source which contains high-frequency vertical detail.
194  // Filtering will reduce interlace 'twitter' and Moire patterning.
195  int srcp_linesize = src_linesize[plane] * k;
196  int dstp_linesize = dst_linesize[plane] * (interleave ? 2 : 1);
197  for (h = lines; h > 0; h--) {
198  const uint8_t *srcp_above = srcp - src_linesize[plane];
199  const uint8_t *srcp_below = srcp + src_linesize[plane];
200  if (h == lines) srcp_above = srcp; // there is no line above
201  if (h == 1) srcp_below = srcp; // there is no line below
202  for (i = 0; i < linesize; i++) {
203  // this calculation is an integer representation of
204  // '0.5 * current + 0.25 * above + 0.25 + below'
205  // '1 +' is for rounding. */
206  dstp[i] = (1 + srcp[i] + srcp[i] + srcp_above[i] + srcp_below[i]) >> 2;
207  }
208  dstp += dstp_linesize;
209  srcp += srcp_linesize;
210  }
211  } else {
212  av_image_copy_plane(dstp, dst_linesize[plane] * (interleave ? 2 : 1),
213  srcp, src_linesize[plane]*k, linesize, lines);
214  }
215  }
216 }
217 
218 static int filter_frame(AVFilterLink *inlink, AVFrame *picref)
219 {
220  AVFilterContext *ctx = inlink->dst;
221  AVFilterLink *outlink = ctx->outputs[0];
222  TInterlaceContext *tinterlace = ctx->priv;
223  AVFrame *cur, *next, *out;
224  int field, tff, ret;
225 
226  av_frame_free(&tinterlace->cur);
227  tinterlace->cur = tinterlace->next;
228  tinterlace->next = picref;
229 
230  cur = tinterlace->cur;
231  next = tinterlace->next;
232  /* we need at least two frames */
233  if (!tinterlace->cur)
234  return 0;
235 
236  switch (tinterlace->mode) {
237  case MODE_MERGE: /* move the odd frame into the upper field of the new image, even into
238  * the lower field, generating a double-height video at half framerate */
239  out = ff_get_video_buffer(outlink, outlink->w, outlink->h);
240  if (!out)
241  return AVERROR(ENOMEM);
242  av_frame_copy_props(out, cur);
243  out->height = outlink->h;
244  out->interlaced_frame = 1;
245  out->top_field_first = 1;
246 
247  /* write odd frame lines into the upper field of the new frame */
248  copy_picture_field(out->data, out->linesize,
249  (const uint8_t **)cur->data, cur->linesize,
250  inlink->format, inlink->w, inlink->h,
251  FIELD_UPPER_AND_LOWER, 1, FIELD_UPPER, tinterlace->flags);
252  /* write even frame lines into the lower field of the new frame */
253  copy_picture_field(out->data, out->linesize,
254  (const uint8_t **)next->data, next->linesize,
255  inlink->format, inlink->w, inlink->h,
256  FIELD_UPPER_AND_LOWER, 1, FIELD_LOWER, tinterlace->flags);
257  av_frame_free(&tinterlace->next);
258  break;
259 
260  case MODE_DROP_ODD: /* only output even frames, odd frames are dropped; height unchanged, half framerate */
261  case MODE_DROP_EVEN: /* only output odd frames, even frames are dropped; height unchanged, half framerate */
262  out = av_frame_clone(tinterlace->mode == MODE_DROP_EVEN ? cur : next);
263  av_frame_free(&tinterlace->next);
264  break;
265 
266  case MODE_PAD: /* expand each frame to double height, but pad alternate
267  * lines with black; framerate unchanged */
268  out = ff_get_video_buffer(outlink, outlink->w, outlink->h);
269  if (!out)
270  return AVERROR(ENOMEM);
271  av_frame_copy_props(out, cur);
272  out->height = outlink->h;
273 
274  field = (1 + tinterlace->frame) & 1 ? FIELD_UPPER : FIELD_LOWER;
275  /* copy upper and lower fields */
276  copy_picture_field(out->data, out->linesize,
277  (const uint8_t **)cur->data, cur->linesize,
278  inlink->format, inlink->w, inlink->h,
279  FIELD_UPPER_AND_LOWER, 1, field, tinterlace->flags);
280  /* pad with black the other field */
281  copy_picture_field(out->data, out->linesize,
282  (const uint8_t **)tinterlace->black_data, tinterlace->black_linesize,
283  inlink->format, inlink->w, inlink->h,
284  FIELD_UPPER_AND_LOWER, 1, !field, tinterlace->flags);
285  break;
286 
287  /* interleave upper/lower lines from odd frames with lower/upper lines from even frames,
288  * halving the frame rate and preserving image height */
289  case MODE_INTERLEAVE_TOP: /* top field first */
290  case MODE_INTERLEAVE_BOTTOM: /* bottom field first */
291  tff = tinterlace->mode == MODE_INTERLEAVE_TOP;
292  out = ff_get_video_buffer(outlink, outlink->w, outlink->h);
293  if (!out)
294  return AVERROR(ENOMEM);
295  av_frame_copy_props(out, cur);
296  out->interlaced_frame = 1;
297  out->top_field_first = tff;
298 
299  /* copy upper/lower field from cur */
300  copy_picture_field(out->data, out->linesize,
301  (const uint8_t **)cur->data, cur->linesize,
302  inlink->format, inlink->w, inlink->h,
303  tff ? FIELD_UPPER : FIELD_LOWER, 1, tff ? FIELD_UPPER : FIELD_LOWER,
304  tinterlace->flags);
305  /* copy lower/upper field from next */
306  copy_picture_field(out->data, out->linesize,
307  (const uint8_t **)next->data, next->linesize,
308  inlink->format, inlink->w, inlink->h,
309  tff ? FIELD_LOWER : FIELD_UPPER, 1, tff ? FIELD_LOWER : FIELD_UPPER,
310  tinterlace->flags);
311  av_frame_free(&tinterlace->next);
312  break;
313  case MODE_INTERLACEX2: /* re-interlace preserving image height, double frame rate */
314  /* output current frame first */
315  out = av_frame_clone(cur);
316  if (!out)
317  return AVERROR(ENOMEM);
318  out->interlaced_frame = 1;
319 
320  if ((ret = ff_filter_frame(outlink, out)) < 0)
321  return ret;
322 
323  /* output mix of current and next frame */
324  tff = next->top_field_first;
325  out = ff_get_video_buffer(outlink, outlink->w, outlink->h);
326  if (!out)
327  return AVERROR(ENOMEM);
328  av_frame_copy_props(out, next);
329  out->interlaced_frame = 1;
330 
331  /* write current frame second field lines into the second field of the new frame */
332  copy_picture_field(out->data, out->linesize,
333  (const uint8_t **)cur->data, cur->linesize,
334  inlink->format, inlink->w, inlink->h,
335  tff ? FIELD_LOWER : FIELD_UPPER, 1, tff ? FIELD_LOWER : FIELD_UPPER,
336  tinterlace->flags);
337  /* write next frame first field lines into the first field of the new frame */
338  copy_picture_field(out->data, out->linesize,
339  (const uint8_t **)next->data, next->linesize,
340  inlink->format, inlink->w, inlink->h,
341  tff ? FIELD_UPPER : FIELD_LOWER, 1, tff ? FIELD_UPPER : FIELD_LOWER,
342  tinterlace->flags);
343  break;
344  default:
345  av_assert0(0);
346  }
347 
348  ret = ff_filter_frame(outlink, out);
349  tinterlace->frame++;
350 
351  return ret;
352 }
353 
354 static int request_frame(AVFilterLink *outlink)
355 {
356  TInterlaceContext *tinterlace = outlink->src->priv;
357  AVFilterLink *inlink = outlink->src->inputs[0];
358 
359  do {
360  int ret;
361 
362  if ((ret = ff_request_frame(inlink)) < 0)
363  return ret;
364  } while (!tinterlace->cur);
365 
366  return 0;
367 }
368 
369 static const AVFilterPad tinterlace_inputs[] = {
370  {
371  .name = "default",
372  .type = AVMEDIA_TYPE_VIDEO,
373  .filter_frame = filter_frame,
374  },
375  { NULL }
376 };
377 
378 static const AVFilterPad tinterlace_outputs[] = {
379  {
380  .name = "default",
381  .type = AVMEDIA_TYPE_VIDEO,
382  .config_props = config_out_props,
383  .request_frame = request_frame,
384  },
385  { NULL }
386 };
387 
389  .name = "tinterlace",
390  .description = NULL_IF_CONFIG_SMALL("Perform temporal field interlacing."),
391  .priv_size = sizeof(TInterlaceContext),
392  .uninit = uninit,
394  .inputs = tinterlace_inputs,
395  .outputs = tinterlace_outputs,
396  .priv_class = &tinterlace_class,
397 };
int av_image_get_linesize(enum AVPixelFormat pix_fmt, int width, int plane)
Compute the size of an image line with format pix_fmt and width width for the plane plane...
Definition: imgutils.c:73
static enum AVPixelFormat full_scale_yuvj_pix_fmts[]
Definition: vf_tinterlace.c:83
static int query_formats(AVFilterContext *ctx)
Definition: vf_tinterlace.c:87
int av_frame_copy_props(AVFrame *dst, const AVFrame *src)
Copy only "metadata" fields from src to dst.
Definition: frame.c:424
const AVPixFmtDescriptor * av_pix_fmt_desc_get(enum AVPixelFormat pix_fmt)
Definition: pixdesc.c:1778
This structure describes decoded (raw) audio or video data.
Definition: frame.h:76
#define OFFSET(x)
Definition: vf_tinterlace.c:57
AVOption.
Definition: opt.h:251
planar YUV 4:4:4, 24bpp, (1 Cr & Cb sample per 1x1 Y samples)
Definition: pixfmt.h:73
misc image utilities
static const AVFilterPad outputs[]
Definition: af_ashowinfo.c:117
external API header
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:190
#define AV_LOG_WARNING
Something somehow does not look correct.
Definition: log.h:154
#define FIELD_LOWER
AVFrame * ff_get_video_buffer(AVFilterLink *link, int w, int h)
Request a picture buffer with a specific set of permissions.
Definition: video.c:143
output residual component w
int flags
flags affecting interlacing algorithm
Definition: vf_tinterlace.c:48
void av_freep(void *arg)
Free a memory block which has been allocated with av_malloc(z)() or av_realloc() and set the pointer ...
Definition: mem.c:198
AVFilterFormats * ff_make_format_list(const int *fmts)
Create a list of supported formats.
Definition: formats.c:308
#define FULL_SCALE_YUVJ_FORMATS
Definition: vf_tinterlace.c:80
BYTE int const BYTE * srcp
Definition: avisynth_c.h:713
const char * name
Pad name.
AVFilterLink ** inputs
array of pointers to input links
Definition: avfilter.h:532
#define av_assert0(cond)
assert() equivalent, that is always enabled.
Definition: avassert.h:37
planar YUV 4:2:0, 20bpp, (1 Cr & Cb sample per 2x2 Y & A samples)
Definition: pixfmt.h:105
uint8_t
it can be given away to ff_start_frame *A reference passed to ff_filter_frame(or the deprecated ff_start_frame) is given away and must no longer be used.*A reference created with avfilter_ref_buffer belongs to the code that created it.*A reference obtained with ff_get_video_buffer or ff_get_audio_buffer belongs to the code that requested it.*A reference given as return value by the get_video_buffer or get_audio_buffer method is given away and must no longer be used.Link reference fields---------------------The AVFilterLink structure has a few AVFilterBufferRef fields.The cur_buf and out_buf were used with the deprecated start_frame/draw_slice/end_frame API and should no longer be used.src_buf
#define av_cold
Definition: attributes.h:78
static const AVOption tinterlace_options[]
Definition: vf_tinterlace.c:61
mode
Definition: f_perms.c:27
AVOptions.
int frame
number of the output frame
Definition: vf_tinterlace.c:49
TInterlaceMode
Definition: vf_tinterlace.c:34
int interlaced_frame
The content of the picture is interlaced.
Definition: frame.h:270
void 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:545
int ff_fmt_is_in(int fmt, const int *fmts)
Tell is a format is contained in the provided list terminated by -1.
Definition: formats.c:254
int mode
Definition: vf_ilpack.c:38
A filter pad used for either input or output.
static int request_frame(AVFilterLink *outlink)
uint8_t log2_chroma_h
Amount to shift the luma height right to find the chroma height.
Definition: pixdesc.h:75
int vsub
chroma vertical subsampling
Definition: vf_tinterlace.c:50
BYTE * dstp
Definition: avisynth_c.h:713
#define NULL_IF_CONFIG_SMALL(x)
Return NULL if CONFIG_SMALL is true, otherwise the argument without modification. ...
void * priv
private data for use by the filter
Definition: avfilter.h:545
struct pullup_context * ctx
Definition: vf_pullup.c:39
int interleave
Definition: vf_fil.c:30
#define FLAGS
Definition: vf_tinterlace.c:58
simple assert() macros that are a bit more flexible than ISO C assert().
void av_log(void *avcl, int level, const char *fmt,...)
Definition: log.c:246
AVFILTER_DEFINE_CLASS(tinterlace)
uint8_t * src
Definition: vf_fspp.c:98
planar YUV 4:2:2, 16bpp, (1 Cr & Cb sample per 2x1 Y samples)
Definition: pixfmt.h:72
#define AV_LOG_VERBOSE
Definition: log.h:157
uint8_t nb_components
The number of components each pixel has, (1-4)
Definition: pixdesc.h:57
#define FIELD_UPPER
static av_cold void uninit(AVFilterContext *ctx)
long long out
ret
Definition: avfilter.c:821
enum TInterlaceMode mode
interlace mode selected
Definition: vf_tinterlace.c:47
Filter the word “frame” indicates either a video frame or a group of audio as stored in an AVFilterBuffer 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 format(the sample packing is implied by the sample format) and sample rate.The lists are not just lists
static const AVFilterPad tinterlace_outputs[]
static int filter_frame(AVFilterLink *inlink, AVFrame *picref)
AVFrame * av_frame_clone(AVFrame *src)
Create a new frame that references the same data as src.
Definition: frame.c:317
for k
NULL
Definition: eval.c:55
int linesize[AV_NUM_DATA_POINTERS]
For video, size in bytes of each picture line.
Definition: frame.h:101
Descriptor that unambiguously describes how the bits of a pixel are stored in the up to 4 data planes...
Definition: pixdesc.h:55
uint8_t * black_data[4]
buffer used to fill padded lines
Definition: vf_tinterlace.c:53
planar YUV 4:1:0, 9bpp, (1 Cr & Cb sample per 4x4 Y samples)
Definition: pixfmt.h:74
Describe the class of an AVClass context structure.
Definition: log.h:50
Filter definition.
Definition: avfilter.h:436
synthesis window for stochastic i
const char * name
filter name
Definition: avfilter.h:437
Filter the word “frame” indicates either a video frame or a group of audio as stored in an AVFilterBuffer 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.Buffer references ownership and permissions
AVFilterLink ** outputs
array of pointers to output links
Definition: avfilter.h:539
static const AVFilterPad tinterlace_inputs[]
static int flags
Definition: cpu.c:23
uint8_t * data[AV_NUM_DATA_POINTERS]
pointer to the picture/channel planes.
Definition: frame.h:87
planar YUV 4:2:0, 12bpp, (1 Cr & Cb sample per 2x2 Y samples)
Definition: pixfmt.h:68
Y , 8bpp.
Definition: pixfmt.h:76
void av_frame_free(AVFrame **frame)
Free the frame and any dynamically allocated objects in it, e.g.
Definition: frame.c:108
static int config_out_props(AVFilterLink *outlink)
float * plane[16][4]
Definition: vf_ow.c:58
static void copy_picture_field(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.
int top_field_first
If the content is interlaced, is top field displayed first.
Definition: frame.h:275
AVFilter avfilter_vf_tinterlace
else dst[i][x+y *dst_stride[i]]
Definition: vf_mcdeint.c:160
An instance of a filter.
Definition: avfilter.h:524
int height
Definition: frame.h:122
int ff_request_frame(AVFilterLink *link)
Request an input frame from the filter at the other end of the link.
Definition: avfilter.c:319
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:242
internal API functions
#define FIELD_UPPER_AND_LOWER
AVPixelFormat
Pixel format.
Definition: pixfmt.h:66
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 TINTERLACE_FLAG_VLPF
Definition: vf_tinterlace.c:59