FFmpeg
vf_fillborders.c
Go to the documentation of this file.
1 /*
2  * Copyright (c) 2017 Paul B Mahol
3  *
4  * This file is part of FFmpeg.
5  *
6  * FFmpeg is free software; you can redistribute it and/or
7  * modify it under the terms of the GNU Lesser General Public
8  * License as published by the Free Software Foundation; either
9  * version 2.1 of the License, or (at your option) any later version.
10  *
11  * FFmpeg is distributed in the hope that it will be useful,
12  * but WITHOUT ANY WARRANTY; without even the implied warranty of
13  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14  * Lesser General Public License for more details.
15  *
16  * You should have received a copy of the GNU Lesser General Public
17  * License along with FFmpeg; if not, write to the Free Software
18  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
19  */
20 
21 #include "libavutil/colorspace.h"
22 #include "libavutil/common.h"
23 #include "libavutil/opt.h"
24 #include "libavutil/pixdesc.h"
25 #include "avfilter.h"
26 #include "drawutils.h"
27 #include "formats.h"
28 #include "internal.h"
29 #include "video.h"
30 
31 enum { Y, U, V, A };
32 enum { R, G, B };
33 
35 
36 typedef struct Borders {
37  int left, right, top, bottom;
38 } Borders;
39 
40 typedef struct FillBordersContext {
41  const AVClass *class;
42  int left, right, top, bottom;
43  int mode;
44 
45  int nb_planes;
46  int depth;
47  Borders borders[4];
48  int planewidth[4];
49  int planeheight[4];
50  uint8_t fill[4];
51  uint8_t yuv_color[4];
52  uint8_t rgba_color[4];
53 
54  void (*fillborders)(struct FillBordersContext *s, AVFrame *frame);
56 
58 {
59  static const enum AVPixelFormat pix_fmts[] = {
79  };
80  AVFilterFormats *fmts_list = ff_make_format_list(pix_fmts);
81  if (!fmts_list)
82  return AVERROR(ENOMEM);
83  return ff_set_common_formats(ctx, fmts_list);
84 }
85 
87 {
88  int p, y;
89 
90  for (p = 0; p < s->nb_planes; p++) {
91  uint8_t *ptr = frame->data[p];
92  int linesize = frame->linesize[p];
93 
94  for (y = s->borders[p].top; y < s->planeheight[p] - s->borders[p].bottom; y++) {
95  memset(ptr + y * linesize,
96  *(ptr + y * linesize + s->borders[p].left),
97  s->borders[p].left);
98  memset(ptr + y * linesize + s->planewidth[p] - s->borders[p].right,
99  *(ptr + y * linesize + s->planewidth[p] - s->borders[p].right - 1),
100  s->borders[p].right);
101  }
102 
103  for (y = 0; y < s->borders[p].top; y++) {
104  memcpy(ptr + y * linesize,
105  ptr + s->borders[p].top * linesize, s->planewidth[p]);
106  }
107 
108  for (y = s->planeheight[p] - s->borders[p].bottom; y < s->planeheight[p]; y++) {
109  memcpy(ptr + y * linesize,
110  ptr + (s->planeheight[p] - s->borders[p].bottom - 1) * linesize,
111  s->planewidth[p]);
112  }
113  }
114 }
115 
117 {
118  int p, y, x;
119 
120  for (p = 0; p < s->nb_planes; p++) {
121  uint16_t *ptr = (uint16_t *)frame->data[p];
122  int linesize = frame->linesize[p] / 2;
123 
124  for (y = s->borders[p].top; y < s->planeheight[p] - s->borders[p].bottom; y++) {
125  for (x = 0; x < s->borders[p].left; x++) {
126  ptr[y * linesize + x] = *(ptr + y * linesize + s->borders[p].left);
127  }
128 
129  for (x = 0; x < s->borders[p].right; x++) {
130  ptr[y * linesize + s->planewidth[p] - s->borders[p].right + x] =
131  *(ptr + y * linesize + s->planewidth[p] - s->borders[p].right - 1);
132  }
133  }
134 
135  for (y = 0; y < s->borders[p].top; y++) {
136  memcpy(ptr + y * linesize,
137  ptr + s->borders[p].top * linesize, s->planewidth[p] * 2);
138  }
139 
140  for (y = s->planeheight[p] - s->borders[p].bottom; y < s->planeheight[p]; y++) {
141  memcpy(ptr + y * linesize,
142  ptr + (s->planeheight[p] - s->borders[p].bottom - 1) * linesize,
143  s->planewidth[p] * 2);
144  }
145  }
146 }
147 
149 {
150  int p, y, x;
151 
152  for (p = 0; p < s->nb_planes; p++) {
153  uint8_t *ptr = frame->data[p];
154  int linesize = frame->linesize[p];
155 
156  for (y = s->borders[p].top; y < s->planeheight[p] - s->borders[p].bottom; y++) {
157  for (x = 0; x < s->borders[p].left; x++) {
158  ptr[y * linesize + x] = ptr[y * linesize + s->borders[p].left * 2 - 1 - x];
159  }
160 
161  for (x = 0; x < s->borders[p].right; x++) {
162  ptr[y * linesize + s->planewidth[p] - s->borders[p].right + x] =
163  ptr[y * linesize + s->planewidth[p] - s->borders[p].right - 1 - x];
164  }
165  }
166 
167  for (y = 0; y < s->borders[p].top; y++) {
168  memcpy(ptr + y * linesize,
169  ptr + (s->borders[p].top * 2 - 1 - y) * linesize,
170  s->planewidth[p]);
171  }
172 
173  for (y = 0; y < s->borders[p].bottom; y++) {
174  memcpy(ptr + (s->planeheight[p] - s->borders[p].bottom + y) * linesize,
175  ptr + (s->planeheight[p] - s->borders[p].bottom - 1 - y) * linesize,
176  s->planewidth[p]);
177  }
178  }
179 }
180 
182 {
183  int p, y, x;
184 
185  for (p = 0; p < s->nb_planes; p++) {
186  uint16_t *ptr = (uint16_t *)frame->data[p];
187  int linesize = frame->linesize[p] / 2;
188 
189  for (y = s->borders[p].top; y < s->planeheight[p] - s->borders[p].bottom; y++) {
190  for (x = 0; x < s->borders[p].left; x++) {
191  ptr[y * linesize + x] = ptr[y * linesize + s->borders[p].left * 2 - 1 - x];
192  }
193 
194  for (x = 0; x < s->borders[p].right; x++) {
195  ptr[y * linesize + s->planewidth[p] - s->borders[p].right + x] =
196  ptr[y * linesize + s->planewidth[p] - s->borders[p].right - 1 - x];
197  }
198  }
199 
200  for (y = 0; y < s->borders[p].top; y++) {
201  memcpy(ptr + y * linesize,
202  ptr + (s->borders[p].top * 2 - 1 - y) * linesize,
203  s->planewidth[p] * 2);
204  }
205 
206  for (y = 0; y < s->borders[p].bottom; y++) {
207  memcpy(ptr + (s->planeheight[p] - s->borders[p].bottom + y) * linesize,
208  ptr + (s->planeheight[p] - s->borders[p].bottom - 1 - y) * linesize,
209  s->planewidth[p] * 2);
210  }
211  }
212 }
213 
215 {
216  int p, y;
217 
218  for (p = 0; p < s->nb_planes; p++) {
219  uint8_t *ptr = frame->data[p];
220  uint8_t fill = s->fill[p];
221  int linesize = frame->linesize[p];
222 
223  for (y = s->borders[p].top; y < s->planeheight[p] - s->borders[p].bottom; y++) {
224  memset(ptr + y * linesize, fill, s->borders[p].left);
225  memset(ptr + y * linesize + s->planewidth[p] - s->borders[p].right, fill,
226  s->borders[p].right);
227  }
228 
229  for (y = 0; y < s->borders[p].top; y++) {
230  memset(ptr + y * linesize, fill, s->planewidth[p]);
231  }
232 
233  for (y = s->planeheight[p] - s->borders[p].bottom; y < s->planeheight[p]; y++) {
234  memset(ptr + y * linesize, fill, s->planewidth[p]);
235  }
236  }
237 }
238 
240 {
241  int p, y, x;
242 
243  for (p = 0; p < s->nb_planes; p++) {
244  uint16_t *ptr = (uint16_t *)frame->data[p];
245  uint16_t fill = s->fill[p] << (s->depth - 8);
246  int linesize = frame->linesize[p] / 2;
247 
248  for (y = s->borders[p].top; y < s->planeheight[p] - s->borders[p].bottom; y++) {
249  for (x = 0; x < s->borders[p].left; x++) {
250  ptr[y * linesize + x] = fill;
251  }
252 
253  for (x = 0; x < s->borders[p].right; x++) {
254  ptr[y * linesize + s->planewidth[p] - s->borders[p].right + x] = fill;
255  }
256  }
257 
258  for (y = 0; y < s->borders[p].top; y++) {
259  for (x = 0; x < s->planewidth[p]; x++) {
260  ptr[y * linesize + x] = fill;
261  }
262  }
263 
264  for (y = s->planeheight[p] - s->borders[p].bottom; y < s->planeheight[p]; y++) {
265  for (x = 0; x < s->planewidth[p]; x++) {
266  ptr[y * linesize + x] = fill;
267  }
268  }
269  }
270 }
271 
273 {
274  FillBordersContext *s = inlink->dst->priv;
275 
276  s->fillborders(s, frame);
277 
278  return ff_filter_frame(inlink->dst->outputs[0], frame);
279 }
280 
282 {
283  AVFilterContext *ctx = inlink->dst;
284  FillBordersContext *s = ctx->priv;
286 
287  s->nb_planes = desc->nb_components;
288  s->depth = desc->comp[0].depth;
289 
290  s->planeheight[1] = s->planeheight[2] = AV_CEIL_RSHIFT(inlink->h, desc->log2_chroma_h);
291  s->planeheight[0] = s->planeheight[3] = inlink->h;
292  s->planewidth[1] = s->planewidth[2] = AV_CEIL_RSHIFT(inlink->w, desc->log2_chroma_w);
293  s->planewidth[0] = s->planewidth[3] = inlink->w;
294 
295  if (inlink->w < s->left + s->right ||
296  inlink->w <= s->left ||
297  inlink->w <= s->right ||
298  inlink->h < s->top + s->bottom ||
299  inlink->h <= s->top ||
300  inlink->h <= s->bottom ||
301  inlink->w < s->left * 2 ||
302  inlink->w < s->right * 2 ||
303  inlink->h < s->top * 2 ||
304  inlink->h < s->bottom * 2) {
305  av_log(ctx, AV_LOG_ERROR, "Borders are bigger than input frame size.\n");
306  return AVERROR(EINVAL);
307  }
308 
309  s->borders[0].left = s->borders[3].left = s->left;
310  s->borders[0].right = s->borders[3].right = s->right;
311  s->borders[0].top = s->borders[3].top = s->top;
312  s->borders[0].bottom = s->borders[3].bottom = s->bottom;
313 
314  s->borders[1].left = s->left >> desc->log2_chroma_w;
315  s->borders[1].right = s->right >> desc->log2_chroma_w;
316  s->borders[1].top = s->top >> desc->log2_chroma_h;
317  s->borders[1].bottom = s->bottom >> desc->log2_chroma_h;
318 
319  s->borders[2].left = s->left >> desc->log2_chroma_w;
320  s->borders[2].right = s->right >> desc->log2_chroma_w;
321  s->borders[2].top = s->top >> desc->log2_chroma_h;
322  s->borders[2].bottom = s->bottom >> desc->log2_chroma_h;
323 
324  switch (s->mode) {
325  case FM_SMEAR: s->fillborders = s->depth <= 8 ? smear_borders8 : smear_borders16; break;
326  case FM_MIRROR: s->fillborders = s->depth <= 8 ? mirror_borders8 : mirror_borders16; break;
327  case FM_FIXED: s->fillborders = s->depth <= 8 ? fixed_borders8 : fixed_borders16; break;
328  }
329 
331  s->yuv_color[U] = RGB_TO_U_CCIR(s->rgba_color[R], s->rgba_color[G], s->rgba_color[B], 0);
332  s->yuv_color[V] = RGB_TO_V_CCIR(s->rgba_color[R], s->rgba_color[G], s->rgba_color[B], 0);
333  s->yuv_color[A] = s->rgba_color[A];
334 
335  if (desc->flags & AV_PIX_FMT_FLAG_RGB) {
336  uint8_t rgba_map[4];
337  int i;
338 
339  ff_fill_rgba_map(rgba_map, inlink->format);
340  for (i = 0; i < 4; i++)
341  s->fill[rgba_map[i]] = s->rgba_color[i];
342  } else {
343  memcpy(s->fill, s->yuv_color, sizeof(s->yuv_color));
344  }
345 
346  return 0;
347 }
348 
349 static int process_command(AVFilterContext *ctx, const char *cmd, const char *args,
350  char *res, int res_len, int flags)
351 {
352  int ret;
353 
354  ret = ff_filter_process_command(ctx, cmd, args, res, res_len, flags);
355  if (ret < 0)
356  return ret;
357 
358  return config_input(ctx->inputs[0]);
359 }
360 
361 #define OFFSET(x) offsetof(FillBordersContext, x)
362 #define FLAGS AV_OPT_FLAG_VIDEO_PARAM|AV_OPT_FLAG_FILTERING_PARAM|AV_OPT_FLAG_RUNTIME_PARAM
363 
364 static const AVOption fillborders_options[] = {
365  { "left", "set the left fill border", OFFSET(left), AV_OPT_TYPE_INT, {.i64=0}, 0, INT_MAX, FLAGS },
366  { "right", "set the right fill border", OFFSET(right), AV_OPT_TYPE_INT, {.i64=0}, 0, INT_MAX, FLAGS },
367  { "top", "set the top fill border", OFFSET(top), AV_OPT_TYPE_INT, {.i64=0}, 0, INT_MAX, FLAGS },
368  { "bottom", "set the bottom fill border", OFFSET(bottom), AV_OPT_TYPE_INT, {.i64=0}, 0, INT_MAX, FLAGS },
369  { "mode", "set the fill borders mode", OFFSET(mode), AV_OPT_TYPE_INT, {.i64=FM_SMEAR}, 0, FM_NB_MODES-1, FLAGS, "mode" },
370  { "smear", NULL, 0, AV_OPT_TYPE_CONST, {.i64=FM_SMEAR}, 0, 0, FLAGS, "mode" },
371  { "mirror", NULL, 0, AV_OPT_TYPE_CONST, {.i64=FM_MIRROR}, 0, 0, FLAGS, "mode" },
372  { "fixed", NULL, 0, AV_OPT_TYPE_CONST, {.i64=FM_FIXED}, 0, 0, FLAGS, "mode" },
373  { "color", "set the color for the fixed mode", OFFSET(rgba_color), AV_OPT_TYPE_COLOR, {.str = "black"}, .flags = FLAGS },
374  { NULL }
375 };
376 
378 
379 static const AVFilterPad fillborders_inputs[] = {
380  {
381  .name = "default",
382  .type = AVMEDIA_TYPE_VIDEO,
383  .config_props = config_input,
384  .filter_frame = filter_frame,
385  .needs_writable = 1,
386  },
387  { NULL }
388 };
389 
391  {
392  .name = "default",
393  .type = AVMEDIA_TYPE_VIDEO,
394  },
395  { NULL }
396 };
397 
399  .name = "fillborders",
400  .description = NULL_IF_CONFIG_SMALL("Fill borders of the input video."),
401  .priv_size = sizeof(FillBordersContext),
402  .priv_class = &fillborders_class,
404  .inputs = fillborders_inputs,
405  .outputs = fillborders_outputs,
408 };
AVFILTER_DEFINE_CLASS(fillborders)
#define NULL
Definition: coverity.c:32
#define AV_PIX_FMT_YUVA422P16
Definition: pixfmt.h:430
#define AV_PIX_FMT_YUVA422P9
Definition: pixfmt.h:422
const AVPixFmtDescriptor * av_pix_fmt_desc_get(enum AVPixelFormat pix_fmt)
Definition: pixdesc.c:2522
This structure describes decoded (raw) audio or video data.
Definition: frame.h:295
static const AVOption fillborders_options[]
AVOption.
Definition: opt.h:246
#define AV_PIX_FMT_YUVA420P10
Definition: pixfmt.h:424
#define AV_PIX_FMT_YUV444P14
Definition: pixfmt.h:397
#define AV_PIX_FMT_GBRAP10
Definition: pixfmt.h:407
#define AV_PIX_FMT_YUVA422P10
Definition: pixfmt.h:425
planar YUV 4:4:4, 24bpp, (1 Cr & Cb sample per 1x1 Y samples)
Definition: pixfmt.h:71
Main libavfilter public API header.
const char * desc
Definition: nvenc.c:68
planar GBR 4:4:4 24bpp
Definition: pixfmt.h:168
#define AV_PIX_FMT_GBRP10
Definition: pixfmt.h:403
#define AV_PIX_FMT_GRAY9
Definition: pixfmt.h:367
#define AV_PIX_FMT_YUV420P12
Definition: pixfmt.h:391
static void fixed_borders16(FillBordersContext *s, AVFrame *frame)
static const AVFilterPad fillborders_inputs[]
static void mirror_borders8(FillBordersContext *s, AVFrame *frame)
uint8_t log2_chroma_w
Amount to shift the luma width right to find the chroma width.
Definition: pixdesc.h:92
AVFilterFormats * ff_make_format_list(const int *fmts)
Create a list of supported formats.
Definition: formats.c:283
#define AV_PIX_FMT_GRAY10
Definition: pixfmt.h:368
#define AVFILTER_FLAG_SUPPORT_TIMELINE_GENERIC
Some filters support a generic "enable" expression option that can be used to enable or disable a fil...
Definition: avfilter.h:125
const char * name
Pad name.
Definition: internal.h:60
#define AV_PIX_FMT_GRAY12
Definition: pixfmt.h:369
AVFilterLink ** inputs
array of pointers to input links
Definition: avfilter.h:346
int ff_filter_frame(AVFilterLink *link, AVFrame *frame)
Send a frame of data to the next filter.
Definition: avfilter.c:1093
static void mirror_borders16(FillBordersContext *s, AVFrame *frame)
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
AVOptions.
#define FLAGS
#define AV_PIX_FMT_YUVA420P9
Definition: pixfmt.h:421
#define AV_PIX_FMT_GBRP9
Definition: pixfmt.h:402
static void smear_borders16(FillBordersContext *s, AVFrame *frame)
static int process_command(AVFilterContext *ctx, const char *cmd, const char *args, char *res, int res_len, int flags)
static void fixed_borders8(FillBordersContext *s, AVFrame *frame)
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
#define AV_PIX_FMT_YUV444P16
Definition: pixfmt.h:400
#define AV_PIX_FMT_YUV422P12
Definition: pixfmt.h:392
#define AV_PIX_FMT_YUVA420P16
Definition: pixfmt.h:429
#define av_log(a,...)
A filter pad used for either input or output.
Definition: internal.h:54
#define OFFSET(x)
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
uint8_t rgba_color[4]
#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:569
Various defines for YUV<->RGB conversion.
uint8_t log2_chroma_h
Amount to shift the luma height right to find the chroma height.
Definition: pixdesc.h:101
#define AV_PIX_FMT_FLAG_RGB
The pixel format contains RGB-like data (as opposed to YUV/grayscale).
Definition: pixdesc.h:148
#define NULL_IF_CONFIG_SMALL(x)
Return NULL if CONFIG_SMALL is true, otherwise the argument without modification. ...
Definition: internal.h:186
int ff_filter_process_command(AVFilterContext *ctx, const char *cmd, const char *arg, char *res, int res_len, int flags)
Generic processing of user supplied commands that are set in the same way as the filter options...
Definition: avfilter.c:887
void * priv
private data for use by the filter
Definition: avfilter.h:353
#define RGB_TO_U_CCIR(r1, g1, b1, shift)
Definition: colorspace.h:102
#define AV_PIX_FMT_YUVA444P16
Definition: pixfmt.h:431
#define AV_PIX_FMT_GBRAP12
Definition: pixfmt.h:408
#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
uint64_t flags
Combination of AV_PIX_FMT_FLAG_...
Definition: pixdesc.h:106
#define AV_PIX_FMT_YUV422P9
Definition: pixfmt.h:385
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
#define AV_PIX_FMT_GRAY16
Definition: pixfmt.h:371
planar YUV 4:2:0, 12bpp, full scale (JPEG), deprecated in favor of AV_PIX_FMT_YUV420P and setting col...
Definition: pixfmt.h:78
static int filter_frame(AVFilterLink *inlink, AVFrame *frame)
static void smear_borders8(FillBordersContext *s, AVFrame *frame)
#define AV_PIX_FMT_YUVA444P12
Definition: pixfmt.h:428
typedef void(APIENTRY *FF_PFNGLACTIVETEXTUREPROC)(GLenum texture)
static int config_input(AVFilterLink *inlink)
AVFormatContext * ctx
Definition: movenc.c:48
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 the filter must be ready for frames arriving randomly on any input any filter with several inputs will most likely require some kind of queuing mechanism It is perfectly acceptable to have a limited queue and to drop frames when the inputs are too unbalanced request_frame For filters that do not use the this method is called when a frame is wanted on an output For a it should directly call filter_frame on the corresponding output For a if there are queued frames already one of these frames should be pushed If the filter should request a frame on one of its repeatedly until at least one frame has been pushed Return or at least make progress towards producing a frame
#define s(width, name)
Definition: cbs_vp9.c:257
#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
int ff_fill_rgba_map(uint8_t *rgba_map, enum AVPixelFormat pix_fmt)
Definition: drawutils.c:35
#define AV_PIX_FMT_YUV420P16
Definition: pixfmt.h:398
#define AV_PIX_FMT_YUV420P14
Definition: pixfmt.h:395
misc drawing utilities
int linesize[AV_NUM_DATA_POINTERS]
For video, size in bytes of each picture line.
Definition: frame.h:326
uint8_t yuv_color[4]
planar YUV 4:4:4 32bpp, (1 Cr & Cb sample per 1x1 Y & A samples)
Definition: pixfmt.h:177
Descriptor that unambiguously describes how the bits of a pixel are stored in the up to 4 data planes...
Definition: pixdesc.h:81
#define AV_PIX_FMT_GRAY14
Definition: pixfmt.h:370
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
static int query_formats(AVFilterContext *ctx)
Describe the class of an AVClass context structure.
Definition: log.h:67
Filter definition.
Definition: avfilter.h:144
static const AVFilterPad fillborders_outputs[]
const char * name
Filter name.
Definition: avfilter.h:148
#define AV_PIX_FMT_YUV440P12
Definition: pixfmt.h:393
#define AV_PIX_FMT_YUV420P9
Definition: pixfmt.h:384
AVFilterLink ** outputs
array of pointers to output links
Definition: avfilter.h:350
static enum AVPixelFormat pix_fmts[]
Definition: libkvazaar.c:275
#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
#define AV_PIX_FMT_YUV422P10
Definition: pixfmt.h:388
#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
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
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
#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
FillMode
AVFilter ff_vf_fillborders
A list of supported formats for one end of a filter link.
Definition: formats.h:64
#define RGB_TO_V_CCIR(r1, g1, b1, shift)
Definition: colorspace.h:106
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
planar YUV 4:4:0 (1 Cr & Cb sample per 1x2 Y samples)
Definition: pixfmt.h:99
void(* fillborders)(struct FillBordersContext *s, AVFrame *frame)
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
#define RGB_TO_Y_CCIR(r, g, b)
Definition: colorspace.h:98
AVPixelFormat
Pixel format.
Definition: pixfmt.h:64
mode
Use these values in ebur128_init (or&#39;ed).
Definition: ebur128.h:83
#define AV_PIX_FMT_YUV422P16
Definition: pixfmt.h:399
for(j=16;j >0;--j)
#define AV_PIX_FMT_YUVA422P12
Definition: pixfmt.h:427
#define AV_CEIL_RSHIFT(a, b)
Definition: common.h:58