FFmpeg  4.0
vf_overlay_qsv.c
Go to the documentation of this file.
1 /*
2  * This file is part of FFmpeg.
3  *
4  * FFmpeg is free software; you can redistribute it and/or
5  * modify it under the terms of the GNU Lesser General Public
6  * License as published by the Free Software Foundation; either
7  * version 2.1 of the License, or (at your option) any later version.
8  *
9  * FFmpeg is distributed in the hope that it will be useful,
10  * but WITHOUT ANY WARRANTY; without even the implied warranty of
11  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12  * Lesser General Public License for more details.
13  *
14  * You should have received a copy of the GNU Lesser General Public
15  * License along with FFmpeg; if not, write to the Free Software
16  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
17  */
18 
19 /**
20  * @file
21  * A hardware accelerated overlay filter based on Intel Quick Sync Video VPP
22  */
23 
24 #include "libavutil/opt.h"
25 #include "libavutil/common.h"
26 #include "libavutil/pixdesc.h"
27 #include "libavutil/eval.h"
28 #include "libavutil/hwcontext.h"
29 #include "libavutil/avstring.h"
30 #include "libavutil/avassert.h"
31 #include "libavutil/imgutils.h"
32 #include "libavutil/mathematics.h"
33 
34 #include "internal.h"
35 #include "avfilter.h"
36 #include "formats.h"
37 #include "video.h"
38 
39 #include "qsvvpp.h"
40 
41 #define MAIN 0
42 #define OVERLAY 1
43 
44 #define OFFSET(x) offsetof(QSVOverlayContext, x)
45 #define FLAGS (AV_OPT_FLAG_VIDEO_PARAM | AV_OPT_FLAG_FILTERING_PARAM)
46 
47 enum var_name {
57 };
58 
59 enum EOFAction {
62 };
63 
64 typedef struct QSVOverlayContext {
65  const AVClass *class;
66 
69  mfxExtVPPComposite comp_conf;
71 
74 
75  enum EOFAction eof_action; /* action to take on EOF from source */
76 
80 
81 static const char *const var_names[] = {
82  "main_w", "W", /* input width of the main layer */
83  "main_h", "H", /* input height of the main layer */
84  "overlay_iw", /* input width of the overlay layer */
85  "overlay_ih", /* input height of the overlay layer */
86  "overlay_x", "x", /* x position of the overlay layer inside of main */
87  "overlay_y", "y", /* y position of the overlay layer inside of main */
88  "overlay_w", "w", /* output width of overlay layer */
89  "overlay_h", "h", /* output height of overlay layer */
90  NULL
91 };
92 
93 static const AVOption options[] = {
94  { "x", "Overlay x position", OFFSET(overlay_ox), AV_OPT_TYPE_STRING, { .str="0"}, 0, 255, .flags = FLAGS},
95  { "y", "Overlay y position", OFFSET(overlay_oy), AV_OPT_TYPE_STRING, { .str="0"}, 0, 255, .flags = FLAGS},
96  { "w", "Overlay width", OFFSET(overlay_ow), AV_OPT_TYPE_STRING, { .str="overlay_iw"}, 0, 255, .flags = FLAGS},
97  { "h", "Overlay height", OFFSET(overlay_oh), AV_OPT_TYPE_STRING, { .str="overlay_ih*w/overlay_iw"}, 0, 255, .flags = FLAGS},
98  { "alpha", "Overlay global alpha", OFFSET(overlay_alpha), AV_OPT_TYPE_INT, { .i64 = 255}, 0, 255, .flags = FLAGS},
99  { "eof_action", "Action to take when encountering EOF from secondary input ",
101  EOF_ACTION_REPEAT, EOF_ACTION_ENDALL, .flags = FLAGS, "eof_action" },
102  { "repeat", "Repeat the previous frame.", 0, AV_OPT_TYPE_CONST, { .i64 = EOF_ACTION_REPEAT }, .flags = FLAGS, "eof_action" },
103  { "endall", "End both streams.", 0, AV_OPT_TYPE_CONST, { .i64 = EOF_ACTION_ENDALL }, .flags = FLAGS, "eof_action" },
104  { NULL }
105 };
106 
108 {
109  QSVOverlayContext *vpp = ctx->priv;
110  double *var_values = vpp->var_values;
111  int ret = 0;
112  AVExpr *ox_expr = NULL, *oy_expr = NULL;
113  AVExpr *ow_expr = NULL, *oh_expr = NULL;
114 
115 #define PASS_EXPR(e, s) {\
116  ret = av_expr_parse(&e, s, var_names, NULL, NULL, NULL, NULL, 0, ctx); \
117  if (ret < 0) {\
118  av_log(ctx, AV_LOG_ERROR, "Error when passing '%s'.\n", s);\
119  goto release;\
120  }\
121 }
122  PASS_EXPR(ox_expr, vpp->overlay_ox);
123  PASS_EXPR(oy_expr, vpp->overlay_oy);
124  PASS_EXPR(ow_expr, vpp->overlay_ow);
125  PASS_EXPR(oh_expr, vpp->overlay_oh);
126 #undef PASS_EXPR
127 
128  var_values[VAR_OVERLAY_W] =
129  var_values[VAR_OW] = av_expr_eval(ow_expr, var_values, NULL);
130  var_values[VAR_OVERLAY_H] =
131  var_values[VAR_OH] = av_expr_eval(oh_expr, var_values, NULL);
132 
133  /* calc again in case ow is relative to oh */
134  var_values[VAR_OVERLAY_W] =
135  var_values[VAR_OW] = av_expr_eval(ow_expr, var_values, NULL);
136 
137  var_values[VAR_OVERLAY_X] =
138  var_values[VAR_OX] = av_expr_eval(ox_expr, var_values, NULL);
139  var_values[VAR_OVERLAY_Y] =
140  var_values[VAR_OY] = av_expr_eval(oy_expr, var_values, NULL);
141 
142  /* calc again in case ox is relative to oy */
143  var_values[VAR_OVERLAY_X] =
144  var_values[VAR_OX] = av_expr_eval(ox_expr, var_values, NULL);
145 
146  /* calc overlay_w and overlay_h again incase relative to ox,oy */
147  var_values[VAR_OVERLAY_W] =
148  var_values[VAR_OW] = av_expr_eval(ow_expr, var_values, NULL);
149  var_values[VAR_OVERLAY_H] =
150  var_values[VAR_OH] = av_expr_eval(oh_expr, var_values, NULL);
151  var_values[VAR_OVERLAY_W] =
152  var_values[VAR_OW] = av_expr_eval(ow_expr, var_values, NULL);
153 
154 release:
155  av_expr_free(ox_expr);
156  av_expr_free(oy_expr);
157  av_expr_free(ow_expr);
158  av_expr_free(oh_expr);
159 
160  return ret;
161 }
162 
164 {
165  enum AVPixelFormat pix_fmt;
166  const AVPixFmtDescriptor *desc;
167  AVHWFramesContext *fctx;
168 
169  if (link->format == AV_PIX_FMT_QSV) {
170  fctx = (AVHWFramesContext *)link->hw_frames_ctx->data;
171  pix_fmt = fctx->sw_format;
172  }
173 
174  desc = av_pix_fmt_desc_get(pix_fmt);
175  if (!desc)
176  return 0;
177 
178  return !!(desc->flags & AV_PIX_FMT_FLAG_ALPHA);
179 }
180 
181 static int config_main_input(AVFilterLink *inlink)
182 {
183  AVFilterContext *ctx = inlink->dst;
184  QSVOverlayContext *vpp = ctx->priv;
185  mfxVPPCompInputStream *st = &vpp->comp_conf.InputStream[0];
186 
187  av_log(ctx, AV_LOG_DEBUG, "Input[%d] is of %s.\n", FF_INLINK_IDX(inlink),
188  av_get_pix_fmt_name(inlink->format));
189 
190  vpp->var_values[VAR_MAIN_iW] =
191  vpp->var_values[VAR_MW] = inlink->w;
192  vpp->var_values[VAR_MAIN_iH] =
193  vpp->var_values[VAR_MH] = inlink->h;
194 
195  st->DstX = 0;
196  st->DstY = 0;
197  st->DstW = inlink->w;
198  st->DstH = inlink->h;
199  st->GlobalAlphaEnable = 0;
200  st->PixelAlphaEnable = 0;
201 
202  return 0;
203 }
204 
206 {
207  AVFilterContext *ctx = inlink->dst;
208  QSVOverlayContext *vpp = ctx->priv;
209  mfxVPPCompInputStream *st = &vpp->comp_conf.InputStream[1];
210  int ret = 0;
211 
212  av_log(ctx, AV_LOG_DEBUG, "Input[%d] is of %s.\n", FF_INLINK_IDX(inlink),
213  av_get_pix_fmt_name(inlink->format));
214 
215  vpp->var_values[VAR_OVERLAY_iW] = inlink->w;
216  vpp->var_values[VAR_OVERLAY_iH] = inlink->h;
217 
218  ret = eval_expr(ctx);
219  if (ret < 0)
220  return ret;
221 
222  st->DstX = vpp->var_values[VAR_OX];
223  st->DstY = vpp->var_values[VAR_OY];
224  st->DstW = vpp->var_values[VAR_OW];
225  st->DstH = vpp->var_values[VAR_OH];
226  st->GlobalAlpha = vpp->overlay_alpha;
227  st->GlobalAlphaEnable = (st->GlobalAlpha < 255);
228  st->PixelAlphaEnable = have_alpha_planar(inlink);
229 
230  return 0;
231 }
232 
233 static int config_output(AVFilterLink *outlink)
234 {
235  AVFilterContext *ctx = outlink->src;
236  QSVOverlayContext *vpp = ctx->priv;
237  AVFilterLink *in0 = ctx->inputs[0];
238  AVFilterLink *in1 = ctx->inputs[1];
239 
240  av_log(ctx, AV_LOG_DEBUG, "Output is of %s.\n", av_get_pix_fmt_name(outlink->format));
241  if ((in0->format == AV_PIX_FMT_QSV && in1->format != AV_PIX_FMT_QSV) ||
242  (in0->format != AV_PIX_FMT_QSV && in1->format == AV_PIX_FMT_QSV)) {
243  av_log(ctx, AV_LOG_ERROR, "Mixing hardware and software pixel formats is not supported.\n");
244  return AVERROR(EINVAL);
245  } else if (in0->format == AV_PIX_FMT_QSV) {
248 
249  if (hw_frame0->device_ctx != hw_frame1->device_ctx) {
250  av_log(ctx, AV_LOG_ERROR, "Inputs with different underlying QSV devices are forbidden.\n");
251  return AVERROR(EINVAL);
252  }
253  }
254 
255  outlink->w = vpp->var_values[VAR_MW];
256  outlink->h = vpp->var_values[VAR_MH];
257  outlink->frame_rate = in0->frame_rate;
258  outlink->time_base = av_inv_q(outlink->frame_rate);
259 
260  return ff_qsvvpp_create(ctx, &vpp->qsv, &vpp->qsv_param);
261 }
262 
263 static int blend_frame(AVFilterContext *ctx, AVFrame *mpic, AVFrame *opic)
264 {
265  int ret = 0;
266  QSVOverlayContext *vpp = ctx->priv;
267  AVFrame *opic_copy = NULL;
268 
269  ret = ff_qsvvpp_filter_frame(vpp->qsv, ctx->inputs[0], mpic);
270  if (ret == 0 || ret == AVERROR(EAGAIN)) {
271  /* Reference the overlay frame. Because:
272  * 1. ff_qsvvpp_filter_frame will take control of the given frame
273  * 2. We need to repeat the overlay frame when 2nd input goes into EOF
274  */
275  opic_copy = av_frame_clone(opic);
276  if (!opic_copy)
277  return AVERROR(ENOMEM);
278 
279  ret = ff_qsvvpp_filter_frame(vpp->qsv, ctx->inputs[1], opic_copy);
280  }
281 
282  return ret;
283 }
284 
286 {
287  int ret = 0;
288  QSVOverlayContext *s = ctx->priv;
289  /* Repeat previous frame on secondary input */
290  if (s->over_prev && s->eof_action == EOF_ACTION_REPEAT)
291  ret = blend_frame(ctx, s->main, s->over_prev);
292  /* End both streams */
293  else if (s->eof_action == EOF_ACTION_ENDALL)
294  return AVERROR_EOF;
295 
296  s->main = NULL;
297 
298  return ret;
299 }
300 
301 static int request_frame(AVFilterLink *outlink)
302 {
303  AVFilterContext *ctx = outlink->src;
304  QSVOverlayContext *s = ctx->priv;
305  AVRational tb_main = ctx->inputs[MAIN]->time_base;
306  AVRational tb_over = ctx->inputs[OVERLAY]->time_base;
307  int ret = 0;
308 
309  /* get a frame on the main input */
310  if (!s->main) {
311  ret = ff_request_frame(ctx->inputs[MAIN]);
312  if (ret < 0)
313  return ret;
314  }
315 
316  /* get a new frame on the overlay input, on EOF check setting 'eof_action' */
317  if (!s->over_next) {
318  ret = ff_request_frame(ctx->inputs[OVERLAY]);
319  if (ret == AVERROR_EOF)
320  return handle_overlay_eof(ctx);
321  else if (ret < 0)
322  return ret;
323  }
324 
325  while (s->main->pts != AV_NOPTS_VALUE &&
326  s->over_next->pts != AV_NOPTS_VALUE &&
327  av_compare_ts(s->over_next->pts, tb_over, s->main->pts, tb_main) < 0) {
329  FFSWAP(AVFrame*, s->over_prev, s->over_next);
330 
331  ret = ff_request_frame(ctx->inputs[OVERLAY]);
332  if (ret == AVERROR_EOF)
333  return handle_overlay_eof(ctx);
334  else if (ret < 0)
335  return ret;
336  }
337 
338  if (s->main->pts == AV_NOPTS_VALUE ||
339  s->over_next->pts == AV_NOPTS_VALUE ||
340  !av_compare_ts(s->over_next->pts, tb_over, s->main->pts, tb_main)) {
341  ret = blend_frame(ctx, s->main, s->over_next);
343  FFSWAP(AVFrame*, s->over_prev, s->over_next);
344  } else if (s->over_prev) {
345  ret = blend_frame(ctx, s->main, s->over_prev);
346  } else {
347  av_frame_free(&s->main);
348  ret = AVERROR(EAGAIN);
349  }
350 
351  s->main = NULL;
352 
353  return ret;
354 }
355 
357 {
358  QSVOverlayContext *s = inlink->dst->priv;
359 
360  av_assert0(!s->main);
361  s->main = frame;
362 
363  return 0;
364 }
365 
367 {
368  QSVOverlayContext *s = inlink->dst->priv;
369 
370  av_assert0(!s->over_next);
371  s->over_next = frame;
372 
373  return 0;
374 }
375 
377 {
378  QSVOverlayContext *vpp = ctx->priv;
379 
380  /* fill composite config */
381  vpp->comp_conf.Header.BufferId = MFX_EXTBUFF_VPP_COMPOSITE;
382  vpp->comp_conf.Header.BufferSz = sizeof(vpp->comp_conf);
383  vpp->comp_conf.NumInputStream = ctx->nb_inputs;
384  vpp->comp_conf.InputStream = av_mallocz_array(ctx->nb_inputs,
385  sizeof(*vpp->comp_conf.InputStream));
386  if (!vpp->comp_conf.InputStream)
387  return AVERROR(ENOMEM);
388 
389  /* initialize QSVVPP params */
390  vpp->qsv_param.filter_frame = NULL;
391  vpp->qsv_param.ext_buf = av_mallocz(sizeof(*vpp->qsv_param.ext_buf));
392  if (!vpp->qsv_param.ext_buf)
393  return AVERROR(ENOMEM);
394 
395  vpp->qsv_param.ext_buf[0] = (mfxExtBuffer *)&vpp->comp_conf;
396  vpp->qsv_param.num_ext_buf = 1;
398  vpp->qsv_param.num_crop = 0;
399 
400  return 0;
401 }
402 
404 {
405  QSVOverlayContext *vpp = ctx->priv;
406 
407  av_frame_free(&vpp->main);
408  av_frame_free(&vpp->over_prev);
409  av_frame_free(&vpp->over_next);
410  ff_qsvvpp_free(&vpp->qsv);
411  av_freep(&vpp->comp_conf.InputStream);
412  av_freep(&vpp->qsv_param.ext_buf);
413 }
414 
416 {
417  int i;
418  int ret;
419 
420  static const enum AVPixelFormat main_in_fmts[] = {
427  };
428  static const enum AVPixelFormat out_pix_fmts[] = {
431  AV_PIX_FMT_NONE
432  };
433 
434  for (i = 0; i < ctx->nb_inputs; i++) {
435  ret = ff_formats_ref(ff_make_format_list(main_in_fmts), &ctx->inputs[i]->out_formats);
436  if (ret < 0)
437  return ret;
438  }
439 
440  ret = ff_formats_ref(ff_make_format_list(out_pix_fmts), &ctx->outputs[0]->in_formats);
441  if (ret < 0)
442  return ret;
443 
444  return 0;
445 }
446 
447 static const AVClass overlay_qsv_class = {
448  .class_name = "overlay_qsv",
449  .item_name = av_default_item_name,
450  .option = options,
451  .version = LIBAVUTIL_VERSION_INT,
452 };
453 
454 static const AVFilterPad overlay_qsv_inputs[] = {
455  {
456  .name = "main",
457  .type = AVMEDIA_TYPE_VIDEO,
458  .filter_frame = filter_frame_main,
459  .config_props = config_main_input,
460  .needs_fifo = 1,
461  },
462  {
463  .name = "overlay",
464  .type = AVMEDIA_TYPE_VIDEO,
465  .filter_frame = filter_frame_overlay,
466  .config_props = config_overlay_input,
467  .needs_fifo = 1,
468  },
469  { NULL }
470 };
471 
473  {
474  .name = "default",
475  .type = AVMEDIA_TYPE_VIDEO,
476  .config_props = config_output,
477  .request_frame = request_frame,
478  },
479  { NULL }
480 };
481 
483  .name = "overlay_qsv",
484  .description = NULL_IF_CONFIG_SMALL("Quick Sync Video overlay."),
485  .priv_size = sizeof(QSVOverlayContext),
489  .inputs = overlay_qsv_inputs,
490  .outputs = overlay_qsv_outputs,
491  .priv_class = &overlay_qsv_class,
492  .flags_internal = FF_FILTER_FLAG_HWFRAME_AWARE,
493 };
#define NULL
Definition: coverity.c:32
#define PASS_EXPR(e, s)
#define FF_FILTER_FLAG_HWFRAME_AWARE
The filter is aware of hardware frames, and any hardware frame context should not be automatically pr...
Definition: internal.h:385
const char * s
Definition: avisynth_c.h:768
static enum AVPixelFormat pix_fmt
const AVPixFmtDescriptor * av_pix_fmt_desc_get(enum AVPixelFormat pix_fmt)
Definition: pixdesc.c:2363
This structure describes decoded (raw) audio or video data.
Definition: frame.h:218
AVOption.
Definition: opt.h:246
static int overlay_qsv_init(AVFilterContext *ctx)
misc image utilities
#define LIBAVUTIL_VERSION_INT
Definition: version.h:85
Main libavfilter public API header.
const char * desc
Definition: nvenc.c:65
static av_cold int init(AVCodecContext *avctx)
Definition: avrndec.c:35
static int eval_expr(AVFilterContext *ctx)
const char * av_default_item_name(void *ptr)
Return the context name.
Definition: log.c:191
EOFAction
Definition: framesync.h:26
static int config_output(AVFilterLink *outlink)
AVFilterFormats * ff_make_format_list(const int *fmts)
Create a list of supported formats.
Definition: formats.c:283
const char * name
Pad name.
Definition: internal.h:60
const char * class_name
The name of the class; usually it is the same name as the context structure type to which the AVClass...
Definition: log.h:72
AVFilterLink ** inputs
array of pointers to input links
Definition: avfilter.h:346
#define av_assert0(cond)
assert() equivalent, that is always enabled.
Definition: avassert.h:37
static int handle_overlay_eof(AVFilterContext *ctx)
static int filter_frame_main(AVFilterLink *inlink, AVFrame *frame)
int ff_qsvvpp_create(AVFilterContext *avctx, QSVVPPContext **vpp, QSVVPPParam *param)
Definition: qsvvpp.c:554
#define AV_PIX_FMT_FLAG_ALPHA
The pixel format has an alpha channel.
Definition: pixdesc.h:181
static av_cold int uninit(AVCodecContext *avctx)
Definition: crystalhd.c:279
AVOptions.
int64_t pts
Presentation timestamp in time_base units (time when frame should be shown to user).
Definition: frame.h:311
Definition: eval.c:157
static const AVClass overlay_qsv_class
static AVFrame * frame
static int overlay_qsv_query_formats(AVFilterContext *ctx)
#define AVERROR_EOF
End of file.
Definition: error.h:55
static void overlay_qsv_uninit(AVFilterContext *ctx)
#define av_log(a,...)
int num_ext_buf
Definition: qsvvpp.h:54
A filter pad used for either input or output.
Definition: internal.h:54
static int blend_frame(AVFilterContext *ctx, AVFrame *mpic, AVFrame *opic)
static const AVOption options[]
#define AV_LOG_ERROR
Something went wrong and cannot losslessly be recovered.
Definition: log.h:176
#define OVERLAY
#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:202
#define NULL_IF_CONFIG_SMALL(x)
Return NULL if CONFIG_SMALL is true, otherwise the argument without modification. ...
Definition: internal.h:186
void * priv
private data for use by the filter
Definition: avfilter.h:353
#define AV_LOG_DEBUG
Stuff which is only useful for libav* developers.
Definition: log.h:197
static int filter_frame_overlay(AVFilterLink *inlink, AVFrame *frame)
planar YUV 4:2:0, 12bpp, 1 plane for Y and 1 plane for the UV components, which are interleaved (firs...
Definition: pixfmt.h:85
simple assert() macros that are a bit more flexible than ISO C assert().
void * av_mallocz(size_t size)
Allocate a memory block with alignment suitable for all memory accesses (including vectors if availab...
Definition: mem.c:236
int av_compare_ts(int64_t ts_a, AVRational tb_a, int64_t ts_b, AVRational tb_b)
Compare two timestamps each in its own time base.
Definition: mathematics.c:147
var_name
Definition: aeval.c:46
uint64_t flags
Combination of AV_PIX_FMT_FLAG_...
Definition: pixdesc.h:106
mfxExtVPPComposite comp_conf
unsigned nb_inputs
number of input pads
Definition: avfilter.h:347
static const AVFilterPad overlay_qsv_outputs[]
AVHWDeviceContext * device_ctx
The parent AVHWDeviceContext.
Definition: hwcontext.h:148
#define MAIN
int ff_formats_ref(AVFilterFormats *f, AVFilterFormats **ref)
Add *ref as a new reference to formats.
Definition: formats.c:440
#define OFFSET(x)
AVFormatContext * ctx
Definition: movenc.c:48
int num_crop
Definition: qsvvpp.h:61
static const AVFilterPad inputs[]
Definition: af_acontrast.c:193
uint16_t overlay_alpha
AVFrame * av_frame_clone(const AVFrame *src)
Create a new frame that references the same data as src.
Definition: frame.c:538
static const AVFilterPad outputs[]
Definition: af_acontrast.c:203
void av_expr_free(AVExpr *e)
Free a parsed expression previously created with av_expr_parse().
Definition: eval.c:334
#define FLAGS
int ff_qsvvpp_filter_frame(QSVVPPContext *s, AVFilterLink *inlink, AVFrame *picref)
Definition: qsvvpp.c:681
QSVVPPParam qsv_param
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_RGB32
Definition: pixfmt.h:342
uint8_t * data
The data buffer.
Definition: buffer.h:89
packed YUV 4:2:2, 16bpp, Y0 Cb Y1 Cr
Definition: pixfmt.h:63
Describe the class of an AVClass context structure.
Definition: log.h:67
int ff_qsvvpp_free(QSVVPPContext **vpp)
Definition: qsvvpp.c:657
Filter definition.
Definition: avfilter.h:144
Rational number (pair of numerator and denominator).
Definition: rational.h:58
This struct describes a set or pool of "hardware" frames (i.e.
Definition: hwcontext.h:123
HW acceleration through QSV, data[3] contains a pointer to the mfxFrameSurface1 structure.
Definition: pixfmt.h:218
static int config_overlay_input(AVFilterLink *inlink)
const char * name
Filter name.
Definition: avfilter.h:148
AVFilterLink ** outputs
array of pointers to output links
Definition: avfilter.h:350
AVFilter ff_vf_overlay_qsv
static const AVFilterPad overlay_qsv_inputs[]
mfxExtBuffer ** ext_buf
Definition: qsvvpp.h:55
#define FF_INLINK_IDX(link)
Find the index of a link.
Definition: internal.h:348
static av_always_inline AVRational av_inv_q(AVRational q)
Invert a rational.
Definition: rational.h:159
static int have_alpha_planar(AVFilterLink *link)
QSVVPPContext * qsv
planar YUV 4:2:0, 12bpp, (1 Cr & Cb sample per 2x2 Y samples)
Definition: pixfmt.h:62
static int query_formats(AVFilterContext *ctx)
Definition: aeval.c:244
common internal and external API header
double var_values[VAR_VARS_NB]
static enum AVPixelFormat out_pix_fmts[]
Definition: vf_ciescope.c:130
uint16_t overlay_pixel_alpha
enum EOFAction eof_action
static const char *const var_names[]
static int config_main_input(AVFilterLink *inlink)
static int request_frame(AVFilterLink *outlink)
double av_expr_eval(AVExpr *e, const double *const_values, void *opaque)
Evaluate a previously parsed expression.
Definition: eval.c:734
An instance of a filter.
Definition: avfilter.h:338
enum AVPixelFormat out_sw_format
Definition: qsvvpp.h:58
Intel Quick Sync Video VPP base function.
#define av_freep(p)
int(* filter_frame)(AVFilterLink *outlink, AVFrame *frame)
Definition: qsvvpp.h:51
int ff_request_frame(AVFilterLink *link)
Request an input frame from the filter at the other end of the link.
Definition: avfilter.c:407
#define FFSWAP(type, a, b)
Definition: common.h:99
const char * av_get_pix_fmt_name(enum AVPixelFormat pix_fmt)
Return the short name for a pixel format, NULL in case pix_fmt is unknown.
Definition: pixdesc.c:2279
internal API functions
enum AVPixelFormat sw_format
The pixel format identifying the actual data layout of the hardware frames.
Definition: hwcontext.h:221
AVPixelFormat
Pixel format.
Definition: pixfmt.h:60
#define AV_NOPTS_VALUE
Undefined timestamp value.
Definition: avutil.h:248
simple arithmetic expression evaluator
void * av_mallocz_array(size_t nmemb, size_t size)
Allocate a memory block for an array with av_mallocz().
Definition: mem.c:191