FFmpeg
vf_vpp_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  ** Hardware accelerated common filters based on Intel Quick Sync Video VPP
22  **/
23 
24 #include <float.h>
25 
26 #include "config_components.h"
27 
28 #include "libavutil/opt.h"
29 #include "libavutil/eval.h"
30 #include "libavutil/hwcontext.h"
32 #include "libavutil/pixdesc.h"
33 #include "libavutil/mathematics.h"
34 
35 #include "formats.h"
36 #include "internal.h"
37 #include "avfilter.h"
38 #include "filters.h"
39 
40 #include "qsvvpp.h"
41 #include "transpose.h"
42 
43 #define OFFSET(x) offsetof(VPPContext, x)
44 #define FLAGS (AV_OPT_FLAG_VIDEO_PARAM | AV_OPT_FLAG_FILTERING_PARAM)
45 
46 /* number of video enhancement filters */
47 #define ENH_FILTERS_COUNT (8)
48 
49 typedef struct VPPContext{
51 
52  /* Video Enhancement Algorithms */
53  mfxExtVPPDeinterlacing deinterlace_conf;
54  mfxExtVPPFrameRateConversion frc_conf;
55  mfxExtVPPDenoise denoise_conf;
56  mfxExtVPPDetail detail_conf;
57  mfxExtVPPProcAmp procamp_conf;
58  mfxExtVPPRotation rotation_conf;
59  mfxExtVPPMirroring mirroring_conf;
60  mfxExtVPPScaling scale_conf;
61 
62  /**
63  * New dimensions. Special values are:
64  * 0 = original width/height
65  * -1 = keep original aspect
66  */
67  int out_width;
69  /**
70  * Output sw format. AV_PIX_FMT_NONE for no conversion.
71  */
73 
74  AVRational framerate; /* target framerate */
75  int use_frc; /* use framerate conversion */
76  int deinterlace; /* deinterlace mode : 0=off, 1=bob, 2=advanced */
77  int denoise; /* Enable Denoise algorithm. Value [0, 100] */
78  int detail; /* Enable Detail Enhancement algorithm. */
79  /* Level is the optional, value [0, 100] */
80  int use_crop; /* 1 = use crop; 0=none */
81  int crop_w;
82  int crop_h;
83  int crop_x;
84  int crop_y;
85 
86  int transpose;
87  int rotate; /* rotate angle : [0, 90, 180, 270] */
88  int hflip; /* flip mode : 0 = off, 1 = HORIZONTAL flip */
89 
90  int scale_mode; /* scale mode : 0 = auto, 1 = low power, 2 = high quality */
91 
92  /* param for the procamp */
93  int procamp; /* enable procamp */
94  float hue;
95  float saturation;
96  float contrast;
97  float brightness;
98 
99  char *cx, *cy, *cw, *ch;
100  char *ow, *oh;
102 
103  int has_passthrough; /* apply pass through mode if possible */
104  int field_rate; /* Generate output at frame rate or field rate for deinterlace mode, 0: frame, 1: field */
105 } VPPContext;
106 
107 static const char *const var_names[] = {
108  "iw", "in_w",
109  "ih", "in_h",
110  "ow", "out_w", "w",
111  "oh", "out_h", "h",
112  "cw",
113  "ch",
114  "cx",
115  "cy",
116  "a", "dar",
117  "sar",
118  NULL
119 };
120 
121 enum var_name {
133 };
134 
136 {
137 #define PASS_EXPR(e, s) {\
138  if (s) {\
139  ret = av_expr_parse(&e, s, var_names, NULL, NULL, NULL, NULL, 0, ctx); \
140  if (ret < 0) { \
141  av_log(ctx, AV_LOG_ERROR, "Error when passing '%s'.\n", s); \
142  goto release; \
143  } \
144  }\
145 }
146 #define CALC_EXPR(e, v, i, d) {\
147  if (e)\
148  i = v = av_expr_eval(e, var_values, NULL); \
149  else\
150  i = v = d;\
151 }
152  VPPContext *vpp = ctx->priv;
153  double var_values[VAR_VARS_NB] = { NAN };
154  AVExpr *w_expr = NULL, *h_expr = NULL;
155  AVExpr *cw_expr = NULL, *ch_expr = NULL;
156  AVExpr *cx_expr = NULL, *cy_expr = NULL;
157  int ret = 0;
158 
159  PASS_EXPR(cw_expr, vpp->cw);
160  PASS_EXPR(ch_expr, vpp->ch);
161 
162  PASS_EXPR(w_expr, vpp->ow);
163  PASS_EXPR(h_expr, vpp->oh);
164 
165  PASS_EXPR(cx_expr, vpp->cx);
166  PASS_EXPR(cy_expr, vpp->cy);
167 
168  var_values[VAR_IW] =
169  var_values[VAR_IN_W] = ctx->inputs[0]->w;
170 
171  var_values[VAR_IH] =
172  var_values[VAR_IN_H] = ctx->inputs[0]->h;
173 
174  var_values[VAR_A] = (double)var_values[VAR_IN_W] / var_values[VAR_IN_H];
175  var_values[VAR_SAR] = ctx->inputs[0]->sample_aspect_ratio.num ?
176  (double)ctx->inputs[0]->sample_aspect_ratio.num / ctx->inputs[0]->sample_aspect_ratio.den : 1;
177  var_values[VAR_DAR] = var_values[VAR_A] * var_values[VAR_SAR];
178 
179  /* crop params */
180  CALC_EXPR(cw_expr, var_values[VAR_CW], vpp->crop_w, var_values[VAR_IW]);
181  CALC_EXPR(ch_expr, var_values[VAR_CH], vpp->crop_h, var_values[VAR_IH]);
182 
183  /* calc again in case cw is relative to ch */
184  CALC_EXPR(cw_expr, var_values[VAR_CW], vpp->crop_w, var_values[VAR_IW]);
185 
186  CALC_EXPR(w_expr,
187  var_values[VAR_OUT_W] = var_values[VAR_OW] = var_values[VAR_W],
188  vpp->out_width, var_values[VAR_CW]);
189  CALC_EXPR(h_expr,
190  var_values[VAR_OUT_H] = var_values[VAR_OH] = var_values[VAR_H],
191  vpp->out_height, var_values[VAR_CH]);
192 
193  /* calc again in case ow is relative to oh */
194  CALC_EXPR(w_expr,
195  var_values[VAR_OUT_W] = var_values[VAR_OW] = var_values[VAR_W],
196  vpp->out_width, var_values[VAR_CW]);
197 
198  CALC_EXPR(cx_expr, var_values[VAR_CX], vpp->crop_x, (var_values[VAR_IW] - var_values[VAR_OW]) / 2);
199  CALC_EXPR(cy_expr, var_values[VAR_CY], vpp->crop_y, (var_values[VAR_IH] - var_values[VAR_OH]) / 2);
200 
201  /* calc again in case cx is relative to cy */
202  CALC_EXPR(cx_expr, var_values[VAR_CX], vpp->crop_x, (var_values[VAR_IW] - var_values[VAR_OW]) / 2);
203 
204  if ((vpp->crop_w != var_values[VAR_IW]) || (vpp->crop_h != var_values[VAR_IH]))
205  vpp->use_crop = 1;
206 
207 release:
208  av_expr_free(w_expr);
209  av_expr_free(h_expr);
210  av_expr_free(cw_expr);
211  av_expr_free(ch_expr);
212  av_expr_free(cx_expr);
213  av_expr_free(cy_expr);
214 #undef PASS_EXPR
215 #undef CALC_EXPR
216 
217  return ret;
218 }
219 
221 {
222  VPPContext *vpp = ctx->priv;
223  /* For AV_OPT_TYPE_STRING options, NULL is handled in other way so
224  * we needn't set default value here
225  */
226  vpp->saturation = 1.0;
227  vpp->contrast = 1.0;
228  vpp->transpose = -1;
229 
230  vpp->has_passthrough = 1;
231 
232  return 0;
233 }
234 
236 {
237  VPPContext *vpp = ctx->priv;
238 
239  if (!vpp->output_format_str || !strcmp(vpp->output_format_str, "same")) {
241  } else {
243  if (vpp->out_format == AV_PIX_FMT_NONE) {
244  av_log(ctx, AV_LOG_ERROR, "Unrecognized output pixel format: %s\n", vpp->output_format_str);
245  return AVERROR(EINVAL);
246  }
247  }
248 
249  return 0;
250 }
251 
253 {
254  AVFilterContext *ctx = inlink->dst;
255  VPPContext *vpp = ctx->priv;
256  int ret;
257  int64_t ow, oh;
258 
259  if (vpp->framerate.den == 0 || vpp->framerate.num == 0) {
260  vpp->framerate = inlink->frame_rate;
261 
262  if (vpp->deinterlace && vpp->field_rate)
263  vpp->framerate = av_mul_q(inlink->frame_rate,
264  (AVRational){ 2, 1 });
265  }
266 
267  if (av_cmp_q(vpp->framerate, inlink->frame_rate))
268  vpp->use_frc = 1;
269 
270  ret = eval_expr(ctx);
271  if (ret != 0) {
272  av_log(ctx, AV_LOG_ERROR, "Fail to eval expr.\n");
273  return ret;
274  }
275 
276  ow = vpp->out_width;
277  oh = vpp->out_height;
278 
279  /* sanity check params */
280  if (ow < -1 || oh < -1) {
281  av_log(ctx, AV_LOG_ERROR, "Size values less than -1 are not acceptable.\n");
282  return AVERROR(EINVAL);
283  }
284 
285  if (ow == -1 && oh == -1)
286  vpp->out_width = vpp->out_height = 0;
287 
288  if (!(ow = vpp->out_width))
289  ow = inlink->w;
290 
291  if (!(oh = vpp->out_height))
292  oh = inlink->h;
293 
294  if (ow == -1)
295  ow = av_rescale(oh, inlink->w, inlink->h);
296 
297  if (oh == -1)
298  oh = av_rescale(ow, inlink->h, inlink->w);
299 
300  if (ow > INT_MAX || oh > INT_MAX ||
301  (oh * inlink->w) > INT_MAX ||
302  (ow * inlink->h) > INT_MAX)
303  av_log(ctx, AV_LOG_ERROR, "Rescaled value for width or height is too big.\n");
304 
305  vpp->out_width = ow;
306  vpp->out_height = oh;
307 
308  if (vpp->use_crop) {
309  vpp->crop_x = FFMAX(vpp->crop_x, 0);
310  vpp->crop_y = FFMAX(vpp->crop_y, 0);
311 
312  if(vpp->crop_w + vpp->crop_x > inlink->w)
313  vpp->crop_x = inlink->w - vpp->crop_w;
314  if(vpp->crop_h + vpp->crop_y > inlink->h)
315  vpp->crop_y = inlink->h - vpp->crop_h;
316  }
317 
318  return 0;
319 }
320 
321 static mfxStatus get_mfx_version(const AVFilterContext *ctx, mfxVersion *mfx_version)
322 {
323  const AVFilterLink *inlink = ctx->inputs[0];
324  AVBufferRef *device_ref;
325  AVHWDeviceContext *device_ctx;
326  AVQSVDeviceContext *device_hwctx;
327 
328  if (inlink->hw_frames_ctx) {
329  AVHWFramesContext *frames_ctx = (AVHWFramesContext *)inlink->hw_frames_ctx->data;
330  device_ref = frames_ctx->device_ref;
331  } else if (ctx->hw_device_ctx) {
332  device_ref = ctx->hw_device_ctx;
333  } else {
334  // Unavailable hw context doesn't matter in pass-through mode,
335  // so don't error here but let runtime version checks fail by setting to 0.0
336  mfx_version->Major = 0;
337  mfx_version->Minor = 0;
338  return MFX_ERR_NONE;
339  }
340 
341  device_ctx = (AVHWDeviceContext *)device_ref->data;
342  device_hwctx = device_ctx->hwctx;
343 
344  return MFXQueryVersion(device_hwctx->session, mfx_version);
345 }
346 
347 static int config_output(AVFilterLink *outlink)
348 {
349  AVFilterContext *ctx = outlink->src;
350  VPPContext *vpp = ctx->priv;
351  QSVVPPParam param = { NULL };
352  QSVVPPCrop crop = { 0 };
353  mfxExtBuffer *ext_buf[ENH_FILTERS_COUNT];
354  mfxVersion mfx_version;
355  AVFilterLink *inlink = ctx->inputs[0];
356  enum AVPixelFormat in_format;
357 
358  outlink->w = vpp->out_width;
359  outlink->h = vpp->out_height;
360  outlink->frame_rate = vpp->framerate;
361  outlink->time_base = av_inv_q(vpp->framerate);
362 
363  param.filter_frame = NULL;
364  param.num_ext_buf = 0;
365  param.ext_buf = ext_buf;
366 
367  if (get_mfx_version(ctx, &mfx_version) != MFX_ERR_NONE) {
368  av_log(ctx, AV_LOG_ERROR, "Failed to query mfx version.\n");
369  return AVERROR(EINVAL);
370  }
371 
372  if (inlink->format == AV_PIX_FMT_QSV) {
373  if (!inlink->hw_frames_ctx || !inlink->hw_frames_ctx->data)
374  return AVERROR(EINVAL);
375  else
376  in_format = ((AVHWFramesContext*)inlink->hw_frames_ctx->data)->sw_format;
377  } else
378  in_format = inlink->format;
379 
380  if (vpp->out_format == AV_PIX_FMT_NONE)
381  vpp->out_format = in_format;
382  param.out_sw_format = vpp->out_format;
383 
384  if (vpp->use_crop) {
385  crop.in_idx = 0;
386  crop.x = vpp->crop_x;
387  crop.y = vpp->crop_y;
388  crop.w = vpp->crop_w;
389  crop.h = vpp->crop_h;
390 
391  param.num_crop = 1;
392  param.crop = &crop;
393  }
394 
395 #define INIT_MFX_EXTBUF(extbuf, id) do { \
396  memset(&vpp->extbuf, 0, sizeof(vpp->extbuf)); \
397  vpp->extbuf.Header.BufferId = id; \
398  vpp->extbuf.Header.BufferSz = sizeof(vpp->extbuf); \
399  param.ext_buf[param.num_ext_buf++] = (mfxExtBuffer*)&vpp->extbuf; \
400  } while (0)
401 
402 #define SET_MFX_PARAM_FIELD(extbuf, field, value) do { \
403  vpp->extbuf.field = value; \
404  } while (0)
405 
406  if (vpp->deinterlace) {
407  INIT_MFX_EXTBUF(deinterlace_conf, MFX_EXTBUFF_VPP_DEINTERLACING);
408  SET_MFX_PARAM_FIELD(deinterlace_conf, Mode, (vpp->deinterlace == 1 ?
409  MFX_DEINTERLACING_BOB : MFX_DEINTERLACING_ADVANCED));
410  }
411 
412  if (vpp->use_frc) {
413  INIT_MFX_EXTBUF(frc_conf, MFX_EXTBUFF_VPP_FRAME_RATE_CONVERSION);
414  SET_MFX_PARAM_FIELD(frc_conf, Algorithm, MFX_FRCALGM_DISTRIBUTED_TIMESTAMP);
415  }
416 
417  if (vpp->denoise) {
418  INIT_MFX_EXTBUF(denoise_conf, MFX_EXTBUFF_VPP_DENOISE);
419  SET_MFX_PARAM_FIELD(denoise_conf, DenoiseFactor, vpp->denoise);
420  }
421 
422  if (vpp->detail) {
423  INIT_MFX_EXTBUF(detail_conf, MFX_EXTBUFF_VPP_DETAIL);
424  SET_MFX_PARAM_FIELD(detail_conf, DetailFactor, vpp->detail);
425  }
426 
427  if (vpp->procamp) {
428  INIT_MFX_EXTBUF(procamp_conf, MFX_EXTBUFF_VPP_PROCAMP);
429  SET_MFX_PARAM_FIELD(procamp_conf, Hue, vpp->hue);
430  SET_MFX_PARAM_FIELD(procamp_conf, Saturation, vpp->saturation);
431  SET_MFX_PARAM_FIELD(procamp_conf, Contrast, vpp->contrast);
432  SET_MFX_PARAM_FIELD(procamp_conf, Brightness, vpp->brightness);
433  }
434 
435  if (vpp->transpose >= 0) {
436  if (QSV_RUNTIME_VERSION_ATLEAST(mfx_version, 1, 17)) {
437  switch (vpp->transpose) {
439  vpp->rotate = MFX_ANGLE_270;
440  vpp->hflip = MFX_MIRRORING_HORIZONTAL;
441  break;
442  case TRANSPOSE_CLOCK:
443  vpp->rotate = MFX_ANGLE_90;
444  vpp->hflip = MFX_MIRRORING_DISABLED;
445  break;
446  case TRANSPOSE_CCLOCK:
447  vpp->rotate = MFX_ANGLE_270;
448  vpp->hflip = MFX_MIRRORING_DISABLED;
449  break;
451  vpp->rotate = MFX_ANGLE_90;
452  vpp->hflip = MFX_MIRRORING_HORIZONTAL;
453  break;
454  case TRANSPOSE_REVERSAL:
455  vpp->rotate = MFX_ANGLE_180;
456  vpp->hflip = MFX_MIRRORING_DISABLED;
457  break;
458  case TRANSPOSE_HFLIP:
459  vpp->rotate = MFX_ANGLE_0;
460  vpp->hflip = MFX_MIRRORING_HORIZONTAL;
461  break;
462  case TRANSPOSE_VFLIP:
463  vpp->rotate = MFX_ANGLE_180;
464  vpp->hflip = MFX_MIRRORING_HORIZONTAL;
465  break;
466  default:
467  av_log(ctx, AV_LOG_ERROR, "Failed to set transpose mode to %d.\n", vpp->transpose);
468  return AVERROR(EINVAL);
469  }
470  } else {
471  av_log(ctx, AV_LOG_WARNING, "The QSV VPP transpose option is "
472  "not supported with this MSDK version.\n");
473  vpp->transpose = 0;
474  }
475  }
476 
477  if (vpp->rotate) {
478  if (QSV_RUNTIME_VERSION_ATLEAST(mfx_version, 1, 17)) {
479  INIT_MFX_EXTBUF(rotation_conf, MFX_EXTBUFF_VPP_ROTATION);
480  SET_MFX_PARAM_FIELD(rotation_conf, Angle, vpp->rotate);
481 
482  if (MFX_ANGLE_90 == vpp->rotate || MFX_ANGLE_270 == vpp->rotate) {
483  FFSWAP(int, vpp->out_width, vpp->out_height);
484  FFSWAP(int, outlink->w, outlink->h);
485  av_log(ctx, AV_LOG_DEBUG, "Swap width and height for clock/cclock rotation.\n");
486  }
487  } else {
488  av_log(ctx, AV_LOG_WARNING, "The QSV VPP rotate option is "
489  "not supported with this MSDK version.\n");
490  vpp->rotate = 0;
491  }
492  }
493 
494  if (vpp->hflip) {
495  if (QSV_RUNTIME_VERSION_ATLEAST(mfx_version, 1, 19)) {
496  INIT_MFX_EXTBUF(mirroring_conf, MFX_EXTBUFF_VPP_MIRRORING);
497  SET_MFX_PARAM_FIELD(mirroring_conf, Type, vpp->hflip);
498  } else {
499  av_log(ctx, AV_LOG_WARNING, "The QSV VPP hflip option is "
500  "not supported with this MSDK version.\n");
501  vpp->hflip = 0;
502  }
503  }
504 
505  if (inlink->w != outlink->w || inlink->h != outlink->h || in_format != vpp->out_format) {
506  if (QSV_RUNTIME_VERSION_ATLEAST(mfx_version, 1, 19)) {
507  INIT_MFX_EXTBUF(scale_conf, MFX_EXTBUFF_VPP_SCALING);
508  SET_MFX_PARAM_FIELD(scale_conf, ScalingMode, vpp->scale_mode);
509  } else
510  av_log(ctx, AV_LOG_WARNING, "The QSV VPP Scale & format conversion "
511  "option is not supported with this MSDK version.\n");
512  }
513 
514 #undef INIT_MFX_EXTBUF
515 #undef SET_MFX_PARAM_FIELD
516 
517  if (vpp->use_frc || vpp->use_crop || vpp->deinterlace || vpp->denoise ||
518  vpp->detail || vpp->procamp || vpp->rotate || vpp->hflip ||
519  inlink->w != outlink->w || inlink->h != outlink->h || in_format != vpp->out_format ||
520  !vpp->has_passthrough)
521  return ff_qsvvpp_init(ctx, &param);
522  else {
523  /* No MFX session is created in this case */
524  av_log(ctx, AV_LOG_VERBOSE, "qsv vpp pass through mode.\n");
525  if (inlink->hw_frames_ctx)
526  outlink->hw_frames_ctx = av_buffer_ref(inlink->hw_frames_ctx);
527  }
528 
529  return 0;
530 }
531 
533 {
534  AVFilterLink *inlink = ctx->inputs[0];
535  AVFilterLink *outlink = ctx->outputs[0];
536  QSVVPPContext *qsv = ctx->priv;
537  AVFrame *in = NULL;
538  int ret, status = 0;
539  int64_t pts = AV_NOPTS_VALUE;
540 
542 
543  if (!qsv->eof) {
545  if (ret < 0)
546  return ret;
547 
549  if (status == AVERROR_EOF) {
550  qsv->eof = 1;
551  }
552  }
553  }
554 
555  if (qsv->session) {
556  if (in || qsv->eof) {
557  ret = ff_qsvvpp_filter_frame(qsv, inlink, in);
558  av_frame_free(&in);
559  if (ret == AVERROR(EAGAIN))
560  goto not_ready;
561  else if (ret < 0)
562  return ret;
563 
564  if (qsv->eof)
565  goto eof;
566 
567  if (qsv->got_frame) {
568  qsv->got_frame = 0;
569  return 0;
570  }
571  }
572  } else {
573  /* No MFX session is created in pass-through mode */
574  if (in) {
575  if (in->pts != AV_NOPTS_VALUE)
576  in->pts = av_rescale_q(in->pts, inlink->time_base, outlink->time_base);
577 
578  ret = ff_filter_frame(outlink, in);
579  if (ret < 0)
580  return ret;
581 
582  if (qsv->eof)
583  goto eof;
584 
585  return 0;
586  }
587  }
588 
589 not_ready:
590  if (qsv->eof)
591  goto eof;
592 
594 
595  return FFERROR_NOT_READY;
596 
597 eof:
598  ff_outlink_set_status(outlink, status, pts);
599  return 0;
600 }
601 
603 {
605 }
606 
607 static const AVFilterPad vpp_inputs[] = {
608  {
609  .name = "default",
610  .type = AVMEDIA_TYPE_VIDEO,
611  .config_props = config_input,
612  .get_buffer.video = ff_qsvvpp_get_video_buffer,
613  },
614 };
615 
616 static const AVFilterPad vpp_outputs[] = {
617  {
618  .name = "default",
619  .type = AVMEDIA_TYPE_VIDEO,
620  .config_props = config_output,
621  },
622 };
623 
624 #define DEFINE_QSV_FILTER(x, sn, ln, fmts) \
625 static const AVClass x##_class = { \
626  .class_name = #sn "_qsv", \
627  .item_name = av_default_item_name, \
628  .option = x##_options, \
629  .version = LIBAVUTIL_VERSION_INT, \
630 }; \
631 const AVFilter ff_vf_##sn##_qsv = { \
632  .name = #sn "_qsv", \
633  .description = NULL_IF_CONFIG_SMALL("Quick Sync Video " #ln), \
634  .preinit = x##_preinit, \
635  .init = vpp_init, \
636  .uninit = vpp_uninit, \
637  .priv_size = sizeof(VPPContext), \
638  .priv_class = &x##_class, \
639  FILTER_INPUTS(vpp_inputs), \
640  FILTER_OUTPUTS(vpp_outputs), \
641  fmts, \
642  .activate = activate, \
643  .flags_internal = FF_FILTER_FLAG_HWFRAME_AWARE, \
644 };
645 
646 #if CONFIG_VPP_QSV_FILTER
647 
648 static const AVOption vpp_options[] = {
649  { "deinterlace", "deinterlace mode: 0=off, 1=bob, 2=advanced", OFFSET(deinterlace), AV_OPT_TYPE_INT, { .i64 = 0 }, 0, MFX_DEINTERLACING_ADVANCED, .flags = FLAGS, "deinterlace" },
650  { "bob", "Bob deinterlace mode.", 0, AV_OPT_TYPE_CONST, { .i64 = MFX_DEINTERLACING_BOB }, .flags = FLAGS, "deinterlace" },
651  { "advanced", "Advanced deinterlace mode. ", 0, AV_OPT_TYPE_CONST, { .i64 = MFX_DEINTERLACING_ADVANCED }, .flags = FLAGS, "deinterlace" },
652 
653  { "denoise", "denoise level [0, 100]", OFFSET(denoise), AV_OPT_TYPE_INT, { .i64 = 0 }, 0, 100, .flags = FLAGS },
654  { "detail", "enhancement level [0, 100]", OFFSET(detail), AV_OPT_TYPE_INT, { .i64 = 0 }, 0, 100, .flags = FLAGS },
655  { "framerate", "output framerate", OFFSET(framerate), AV_OPT_TYPE_RATIONAL, { .dbl = 0.0 },0, DBL_MAX, .flags = FLAGS },
656  { "procamp", "Enable ProcAmp", OFFSET(procamp), AV_OPT_TYPE_INT, { .i64 = 0 }, 0, 1, .flags = FLAGS},
657  { "hue", "ProcAmp hue", OFFSET(hue), AV_OPT_TYPE_FLOAT, { .dbl = 0.0 }, -180.0, 180.0, .flags = FLAGS},
658  { "saturation", "ProcAmp saturation", OFFSET(saturation), AV_OPT_TYPE_FLOAT, { .dbl = 1.0 }, 0.0, 10.0, .flags = FLAGS},
659  { "contrast", "ProcAmp contrast", OFFSET(contrast), AV_OPT_TYPE_FLOAT, { .dbl = 1.0 }, 0.0, 10.0, .flags = FLAGS},
660  { "brightness", "ProcAmp brightness", OFFSET(brightness), AV_OPT_TYPE_FLOAT, { .dbl = 0.0 }, -100.0, 100.0, .flags = FLAGS},
661 
662  { "transpose", "set transpose direction", OFFSET(transpose), AV_OPT_TYPE_INT, { .i64 = -1 }, -1, 6, FLAGS, "transpose"},
663  { "cclock_hflip", "rotate counter-clockwise with horizontal flip", 0, AV_OPT_TYPE_CONST, { .i64 = TRANSPOSE_CCLOCK_FLIP }, .flags=FLAGS, .unit = "transpose" },
664  { "clock", "rotate clockwise", 0, AV_OPT_TYPE_CONST, { .i64 = TRANSPOSE_CLOCK }, .flags=FLAGS, .unit = "transpose" },
665  { "cclock", "rotate counter-clockwise", 0, AV_OPT_TYPE_CONST, { .i64 = TRANSPOSE_CCLOCK }, .flags=FLAGS, .unit = "transpose" },
666  { "clock_hflip", "rotate clockwise with horizontal flip", 0, AV_OPT_TYPE_CONST, { .i64 = TRANSPOSE_CLOCK_FLIP }, .flags=FLAGS, .unit = "transpose" },
667  { "reversal", "rotate by half-turn", 0, AV_OPT_TYPE_CONST, { .i64 = TRANSPOSE_REVERSAL }, .flags=FLAGS, .unit = "transpose" },
668  { "hflip", "flip horizontally", 0, AV_OPT_TYPE_CONST, { .i64 = TRANSPOSE_HFLIP }, .flags=FLAGS, .unit = "transpose" },
669  { "vflip", "flip vertically", 0, AV_OPT_TYPE_CONST, { .i64 = TRANSPOSE_VFLIP }, .flags=FLAGS, .unit = "transpose" },
670 
671  { "cw", "set the width crop area expression", OFFSET(cw), AV_OPT_TYPE_STRING, { .str = "iw" }, 0, 0, FLAGS },
672  { "ch", "set the height crop area expression", OFFSET(ch), AV_OPT_TYPE_STRING, { .str = "ih" }, 0, 0, FLAGS },
673  { "cx", "set the x crop area expression", OFFSET(cx), AV_OPT_TYPE_STRING, { .str = "(in_w-out_w)/2" }, 0, 0, FLAGS },
674  { "cy", "set the y crop area expression", OFFSET(cy), AV_OPT_TYPE_STRING, { .str = "(in_h-out_h)/2" }, 0, 0, FLAGS },
675 
676  { "w", "Output video width(0=input video width, -1=keep input video aspect)", OFFSET(ow), AV_OPT_TYPE_STRING, { .str="cw" }, 0, 255, .flags = FLAGS },
677  { "width", "Output video width(0=input video width, -1=keep input video aspect)", OFFSET(ow), AV_OPT_TYPE_STRING, { .str="cw" }, 0, 255, .flags = FLAGS },
678  { "h", "Output video height(0=input video height, -1=keep input video aspect)", OFFSET(oh), AV_OPT_TYPE_STRING, { .str="w*ch/cw" }, 0, 255, .flags = FLAGS },
679  { "height", "Output video height(0=input video height, -1=keep input video aspect)", OFFSET(oh), AV_OPT_TYPE_STRING, { .str="w*ch/cw" }, 0, 255, .flags = FLAGS },
680  { "format", "Output pixel format", OFFSET(output_format_str), AV_OPT_TYPE_STRING, { .str = "same" }, .flags = FLAGS },
681  { "async_depth", "Internal parallelization depth, the higher the value the higher the latency.", OFFSET(qsv.async_depth), AV_OPT_TYPE_INT, { .i64 = 0 }, 0, INT_MAX, .flags = FLAGS },
682  { "scale_mode", "scale & format conversion mode: 0=auto, 1=low power, 2=high quality", OFFSET(scale_mode), AV_OPT_TYPE_INT, { .i64 = MFX_SCALING_MODE_DEFAULT }, MFX_SCALING_MODE_DEFAULT, MFX_SCALING_MODE_QUALITY, .flags = FLAGS, "scale mode" },
683  { "auto", "auto mode", 0, AV_OPT_TYPE_CONST, { .i64 = MFX_SCALING_MODE_DEFAULT}, INT_MIN, INT_MAX, FLAGS, "scale mode"},
684  { "low_power", "low power mode", 0, AV_OPT_TYPE_CONST, { .i64 = MFX_SCALING_MODE_LOWPOWER}, INT_MIN, INT_MAX, FLAGS, "scale mode"},
685  { "hq", "high quality mode", 0, AV_OPT_TYPE_CONST, { .i64 = MFX_SCALING_MODE_QUALITY}, INT_MIN, INT_MAX, FLAGS, "scale mode"},
686 
687  { "rate", "Generate output at frame rate or field rate, available only for deinterlace mode",
688  OFFSET(field_rate), AV_OPT_TYPE_INT, { .i64 = 0 }, 0, 1, FLAGS, "rate" },
689  { "frame", "Output at frame rate (one frame of output for each field-pair)",
690  0, AV_OPT_TYPE_CONST, { .i64 = 0 }, 0, 0, FLAGS, "rate" },
691  { "field", "Output at field rate (one frame of output for each field)",
692  0, AV_OPT_TYPE_CONST, { .i64 = 1 }, 0, 0, FLAGS, "rate" },
693 
694  { NULL }
695 };
696 
697 static int vpp_query_formats(AVFilterContext *ctx)
698 {
699  int ret;
700  static const enum AVPixelFormat in_pix_fmts[] = {
708  };
709  static const enum AVPixelFormat out_pix_fmts[] = {
714  };
715 
717  &ctx->inputs[0]->outcfg.formats);
718  if (ret < 0)
719  return ret;
721  &ctx->outputs[0]->incfg.formats);
722 }
723 
724 DEFINE_QSV_FILTER(vpp, vpp, "VPP", FILTER_QUERY_FUNC(vpp_query_formats));
725 
726 #endif
727 
728 #if CONFIG_SCALE_QSV_FILTER
729 
730 static const AVOption qsvscale_options[] = {
731  { "w", "Output video width(0=input video width, -1=keep input video aspect)", OFFSET(ow), AV_OPT_TYPE_STRING, { .str = "iw" }, .flags = FLAGS },
732  { "h", "Output video height(0=input video height, -1=keep input video aspect)", OFFSET(oh), AV_OPT_TYPE_STRING, { .str = "ih" }, .flags = FLAGS },
733  { "format", "Output pixel format", OFFSET(output_format_str), AV_OPT_TYPE_STRING, { .str = "same" }, .flags = FLAGS },
734 
735  { "mode", "set scaling mode", OFFSET(scale_mode), AV_OPT_TYPE_INT, { .i64 = MFX_SCALING_MODE_DEFAULT}, MFX_SCALING_MODE_DEFAULT, MFX_SCALING_MODE_QUALITY, FLAGS, "mode"},
736  { "low_power", "low power mode", 0, AV_OPT_TYPE_CONST, { .i64 = MFX_SCALING_MODE_LOWPOWER}, INT_MIN, INT_MAX, FLAGS, "mode"},
737  { "hq", "high quality mode", 0, AV_OPT_TYPE_CONST, { .i64 = MFX_SCALING_MODE_QUALITY}, INT_MIN, INT_MAX, FLAGS, "mode"},
738 
739  { NULL },
740 };
741 
742 static av_cold int qsvscale_preinit(AVFilterContext *ctx)
743 {
744  VPPContext *vpp = ctx->priv;
745 
746  vpp_preinit(ctx);
747  vpp->has_passthrough = 0;
748 
749  return 0;
750 }
751 
752 DEFINE_QSV_FILTER(qsvscale, scale, "scaling and format conversion", FILTER_SINGLE_PIXFMT(AV_PIX_FMT_QSV));
753 
754 #endif
755 
756 #if CONFIG_DEINTERLACE_QSV_FILTER
757 
758 static const AVOption qsvdeint_options[] = {
759  { "mode", "set deinterlace mode", OFFSET(deinterlace), AV_OPT_TYPE_INT, {.i64 = MFX_DEINTERLACING_ADVANCED}, MFX_DEINTERLACING_BOB, MFX_DEINTERLACING_ADVANCED, FLAGS, "mode"},
760  { "bob", "bob algorithm", 0, AV_OPT_TYPE_CONST, {.i64 = MFX_DEINTERLACING_BOB}, MFX_DEINTERLACING_BOB, MFX_DEINTERLACING_ADVANCED, FLAGS, "mode"},
761  { "advanced", "Motion adaptive algorithm", 0, AV_OPT_TYPE_CONST, {.i64 = MFX_DEINTERLACING_ADVANCED}, MFX_DEINTERLACING_BOB, MFX_DEINTERLACING_ADVANCED, FLAGS, "mode"},
762 
763  { NULL },
764 };
765 
766 static av_cold int qsvdeint_preinit(AVFilterContext *ctx)
767 {
768  VPPContext *vpp = ctx->priv;
769 
770  vpp_preinit(ctx);
771  vpp->has_passthrough = 0;
772  vpp->field_rate = 1;
773 
774  return 0;
775 }
776 
777 DEFINE_QSV_FILTER(qsvdeint, deinterlace, "deinterlacing", FILTER_SINGLE_PIXFMT(AV_PIX_FMT_QSV))
778 
779 #endif
AVHWDeviceContext::hwctx
void * hwctx
The format-specific data, allocated and freed by libavutil along with this context.
Definition: hwcontext.h:92
QSVVPPCrop::in_idx
int in_idx
Input index.
Definition: qsvvpp.h:89
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
status
they must not be accessed directly The fifo field contains the frames that are queued in the input for processing by the filter The status_in and status_out fields contains the queued status(EOF or error) of the link
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
ff_make_format_list
AVFilterFormats * ff_make_format_list(const int *fmts)
Create a list of supported formats.
Definition: formats.c:380
OFFSET
#define OFFSET(x)
Definition: vf_vpp_qsv.c:43
VAR_CW
@ VAR_CW
Definition: vf_vpp_qsv.c:126
QSVVPPParam::crop
QSVVPPCrop * crop
Definition: qsvvpp.h:106
QSVVPPParam::out_sw_format
enum AVPixelFormat out_sw_format
Definition: qsvvpp.h:102
ff_filter_frame
int ff_filter_frame(AVFilterLink *link, AVFrame *frame)
Send a frame of data to the next filter.
Definition: avfilter.c:978
AVERROR_EOF
#define AVERROR_EOF
End of file.
Definition: error.h:57
AVBufferRef::data
uint8_t * data
The data buffer.
Definition: buffer.h:90
FFERROR_NOT_READY
return FFERROR_NOT_READY
Definition: filter_design.txt:204
VPPContext::cx
char * cx
Definition: vf_vpp_qsv.c:99
ff_qsvvpp_get_video_buffer
AVFrame * ff_qsvvpp_get_video_buffer(AVFilterLink *inlink, int w, int h)
Definition: qsvvpp.c:1017
VAR_CY
@ VAR_CY
Definition: vf_vpp_qsv.c:129
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
VPPContext::crop_w
int crop_w
Definition: vf_vpp_qsv.c:81
VAR_CH
@ VAR_CH
Definition: vf_vpp_qsv.c:127
QSVVPPContext::session
mfxSession session
Definition: qsvvpp.h:58
VPPContext::crop_h
int crop_h
Definition: vf_vpp_qsv.c:82
VPPContext::detail
int detail
Definition: vf_vpp_qsv.c:78
av_frame_free
void av_frame_free(AVFrame **frame)
Free the frame and any dynamically allocated objects in it, e.g.
Definition: frame.c:116
AVFrame
This structure describes decoded (raw) audio or video data.
Definition: frame.h:330
pixdesc.h
AVFrame::pts
int64_t pts
Presentation timestamp in time_base units (time when frame should be shown to user).
Definition: frame.h:437
AVQSVDeviceContext
This struct is allocated as AVHWDeviceContext.hwctx.
Definition: hwcontext_qsv.h:35
VAR_CX
@ VAR_CX
Definition: vf_vpp_qsv.c:128
AVOption
AVOption.
Definition: opt.h:251
VPPContext::scale_mode
int scale_mode
Definition: vf_vpp_qsv.c:90
FILTER_QUERY_FUNC
#define FILTER_QUERY_FUNC(func)
Definition: internal.h:167
VPPContext::contrast
float contrast
Definition: vf_vpp_qsv.c:96
vpp_uninit
static av_cold void vpp_uninit(AVFilterContext *ctx)
Definition: vf_vpp_qsv.c:602
AV_LOG_VERBOSE
#define AV_LOG_VERBOSE
Detailed information.
Definition: log.h:196
float.h
TRANSPOSE_CLOCK_FLIP
@ TRANSPOSE_CLOCK_FLIP
Definition: transpose.h:34
VAR_OUT_H
@ VAR_OUT_H
Definition: vf_vpp_qsv.c:125
VPPContext::hue
float hue
Definition: vf_vpp_qsv.c:94
mathematics.h
FFMAX
#define FFMAX(a, b)
Definition: macros.h:47
av_buffer_ref
AVBufferRef * av_buffer_ref(const AVBufferRef *buf)
Create a new reference to an AVBuffer.
Definition: buffer.c:103
VAR_IN_H
@ VAR_IN_H
Definition: vf_vpp_qsv.c:123
AV_OPT_TYPE_RATIONAL
@ AV_OPT_TYPE_RATIONAL
Definition: opt.h:230
FF_FILTER_FORWARD_STATUS_BACK
#define FF_FILTER_FORWARD_STATUS_BACK(outlink, inlink)
Forward the status on an output link to an input link.
Definition: filters.h:199
formats.h
TRANSPOSE_CCLOCK
@ TRANSPOSE_CCLOCK
Definition: transpose.h:33
framerate
int framerate
Definition: h264_levels.c:65
ff_inlink_consume_frame
int ff_inlink_consume_frame(AVFilterLink *link, AVFrame **rframe)
Take a frame from the link's FIFO and update the link's stats.
Definition: avfilter.c:1373
VPPContext::saturation
float saturation
Definition: vf_vpp_qsv.c:95
qsvvpp.h
VAR_IN_W
@ VAR_IN_W
Definition: vf_vpp_qsv.c:122
VPPContext::transpose
int transpose
Definition: vf_vpp_qsv.c:86
scale
static av_always_inline float scale(float x, float s)
Definition: vf_v360.c:1389
pts
static int64_t pts
Definition: transcode_aac.c:654
PASS_EXPR
#define PASS_EXPR(e, s)
VPPContext::out_format
enum AVPixelFormat out_format
Output sw format.
Definition: vf_vpp_qsv.c:72
av_expr_free
void av_expr_free(AVExpr *e)
Free a parsed expression previously created with av_expr_parse().
Definition: eval.c:336
AVRational::num
int num
Numerator.
Definition: rational.h:59
AVFilterPad
A filter pad used for either input or output.
Definition: internal.h:49
AVHWDeviceContext
This struct aggregates all the (hardware/vendor-specific) "high-level" state, i.e.
Definition: hwcontext.h:61
VPPContext::out_width
int out_width
New dimensions.
Definition: vf_vpp_qsv.c:67
FLAGS
#define FLAGS
Definition: vf_vpp_qsv.c:44
TRANSPOSE_HFLIP
@ TRANSPOSE_HFLIP
Definition: transpose.h:36
in_pix_fmts
static enum AVPixelFormat in_pix_fmts[]
Definition: vf_ciescope.c:128
VPPContext::crop_x
int crop_x
Definition: vf_vpp_qsv.c:83
AV_LOG_ERROR
#define AV_LOG_ERROR
Something went wrong and cannot losslessly be recovered.
Definition: log.h:180
av_cold
#define av_cold
Definition: attributes.h:90
Mode
Mode
Frame type (Table 1a in 3GPP TS 26.101)
Definition: amrnbdata.h:39
VPPContext::use_frc
int use_frc
Definition: vf_vpp_qsv.c:75
ff_outlink_set_status
static void ff_outlink_set_status(AVFilterLink *link, int status, int64_t pts)
Set the status field of a link from the source filter.
Definition: filters.h:189
QSVVPPCrop::w
int w
Definition: qsvvpp.h:90
VPPContext::denoise_conf
mfxExtVPPDenoise denoise_conf
Definition: vf_vpp_qsv.c:55
QSV_RUNTIME_VERSION_ATLEAST
#define QSV_RUNTIME_VERSION_ATLEAST(MFX_VERSION, MAJOR, MINOR)
Definition: qsv_internal.h:64
ff_formats_ref
int ff_formats_ref(AVFilterFormats *f, AVFilterFormats **ref)
Add *ref as a new reference to formats.
Definition: formats.c:596
VPPContext::field_rate
int field_rate
Definition: vf_vpp_qsv.c:104
filters.h
var_name
var_name
Definition: noise_bsf.c:46
AV_LOG_DEBUG
#define AV_LOG_DEBUG
Stuff which is only useful for libav* developers.
Definition: log.h:201
ctx
AVFormatContext * ctx
Definition: movenc.c:48
activate
static int activate(AVFilterContext *ctx)
Definition: vf_vpp_qsv.c:532
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:142
AVExpr
Definition: eval.c:157
VPPContext::detail_conf
mfxExtVPPDetail detail_conf
Definition: vf_vpp_qsv.c:56
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
NAN
#define NAN
Definition: mathematics.h:64
VPPContext::has_passthrough
int has_passthrough
Definition: vf_vpp_qsv.c:103
INIT_MFX_EXTBUF
#define INIT_MFX_EXTBUF(extbuf, id)
QSVVPPContext
Definition: qsvvpp.h:55
ff_qsvvpp_close
int ff_qsvvpp_close(AVFilterContext *avctx)
Definition: qsvvpp.c:811
NULL
#define NULL
Definition: coverity.c:32
ENH_FILTERS_COUNT
#define ENH_FILTERS_COUNT
Definition: vf_vpp_qsv.c:47
QSVVPPParam::num_crop
int num_crop
Definition: qsvvpp.h:105
QSVVPPParam
Definition: qsvvpp.h:93
QSVVPPCrop::x
int x
Definition: qsvvpp.h:90
VPPContext::cw
char * cw
Definition: vf_vpp_qsv.c:99
AV_PIX_FMT_YUYV422
@ AV_PIX_FMT_YUYV422
packed YUV 4:2:2, 16bpp, Y0 Cb Y1 Cr
Definition: pixfmt.h:67
VAR_IW
@ VAR_IW
Definition: vf_vpp_qsv.c:122
AVRational
Rational number (pair of numerator and denominator).
Definition: rational.h:58
AVHWFramesContext::device_ref
AVBufferRef * device_ref
A reference to the parent AVHWDeviceContext.
Definition: hwcontext.h:141
VPPContext::qsv
QSVVPPContext qsv
Definition: vf_vpp_qsv.c:50
VPPContext::deinterlace
int deinterlace
Definition: vf_vpp_qsv.c:76
VAR_H
@ VAR_H
Definition: vf_vpp_qsv.c:125
VPPContext::deinterlace_conf
mfxExtVPPDeinterlacing deinterlace_conf
Definition: vf_vpp_qsv.c:53
VPPContext::frc_conf
mfxExtVPPFrameRateConversion frc_conf
Definition: vf_vpp_qsv.c:54
double
double
Definition: af_crystalizer.c:132
vpp_inputs
static const AVFilterPad vpp_inputs[]
Definition: vf_vpp_qsv.c:607
VPPContext::denoise
int denoise
Definition: vf_vpp_qsv.c:77
DEFINE_QSV_FILTER
#define DEFINE_QSV_FILTER(x, sn, ln, fmts)
Definition: vf_vpp_qsv.c:624
AV_PIX_FMT_QSV
@ AV_PIX_FMT_QSV
HW acceleration through QSV, data[3] contains a pointer to the mfxFrameSurface1 structure.
Definition: pixfmt.h:240
VPPContext
Definition: vf_vpp_qsv.c:49
QSVVPPContext::got_frame
int got_frame
Definition: qsvvpp.h:81
ff_inlink_acknowledge_status
int ff_inlink_acknowledge_status(AVFilterLink *link, int *rstatus, int64_t *rpts)
Test and acknowledge the change of status on the link.
Definition: avfilter.c:1327
VPPContext::ow
char * ow
Definition: vf_vpp_qsv.c:100
VPPContext::hflip
int hflip
Definition: vf_vpp_qsv.c:88
VPPContext::scale_conf
mfxExtVPPScaling scale_conf
Definition: vf_vpp_qsv.c:60
eval.h
VAR_OH
@ VAR_OH
Definition: vf_vpp_qsv.c:125
VAR_W
@ VAR_W
Definition: vf_vpp_qsv.c:124
config_input
static int config_input(AVFilterLink *inlink)
Definition: vf_vpp_qsv.c:252
VPPContext::rotate
int rotate
Definition: vf_vpp_qsv.c:87
AV_NOPTS_VALUE
#define AV_NOPTS_VALUE
Undefined timestamp value.
Definition: avutil.h:248
VAR_OUT_W
@ VAR_OUT_W
Definition: vf_vpp_qsv.c:124
VPPContext::output_format_str
char * output_format_str
Definition: vf_vpp_qsv.c:101
VAR_VARS_NB
@ VAR_VARS_NB
Definition: vf_vpp_qsv.c:132
VPPContext::ch
char * ch
Definition: vf_vpp_qsv.c:99
VPPContext::procamp_conf
mfxExtVPPProcAmp procamp_conf
Definition: vf_vpp_qsv.c:57
AV_PIX_FMT_RGB32
#define AV_PIX_FMT_RGB32
Definition: pixfmt.h:432
FF_FILTER_FORWARD_WANTED
FF_FILTER_FORWARD_WANTED(outlink, inlink)
QSVVPPContext::eof
int eof
Definition: qsvvpp.h:83
internal.h
AV_OPT_TYPE_FLOAT
@ AV_OPT_TYPE_FLOAT
Definition: opt.h:228
denoise
#define denoise(...)
Definition: vf_hqdn3d.c:156
FILTER_SINGLE_PIXFMT
#define FILTER_SINGLE_PIXFMT(pix_fmt_)
Definition: internal.h:180
hwcontext_qsv.h
Type
Type
Definition: vf_idet.h:29
config_output
static int config_output(AVFilterLink *outlink)
Definition: vf_vpp_qsv.c:347
VAR_A
@ VAR_A
Definition: vf_vpp_qsv.c:130
VPPContext::rotation_conf
mfxExtVPPRotation rotation_conf
Definition: vf_vpp_qsv.c:58
out_pix_fmts
static enum AVPixelFormat out_pix_fmts[]
Definition: vf_ciescope.c:137
QSVVPPParam::num_ext_buf
int num_ext_buf
Definition: qsvvpp.h:98
get_mfx_version
static mfxStatus get_mfx_version(const AVFilterContext *ctx, mfxVersion *mfx_version)
Definition: vf_vpp_qsv.c:321
TRANSPOSE_CLOCK
@ TRANSPOSE_CLOCK
Definition: transpose.h:32
av_inv_q
static av_always_inline AVRational av_inv_q(AVRational q)
Invert a rational.
Definition: rational.h:159
QSVVPPParam::filter_frame
int(* filter_frame)(AVFilterLink *outlink, AVFrame *frame)
Definition: qsvvpp.h:95
ff_qsvvpp_init
int ff_qsvvpp_init(AVFilterContext *avctx, QSVVPPParam *param)
Definition: qsvvpp.c:690
VPPContext::crop_y
int crop_y
Definition: vf_vpp_qsv.c:84
VPPContext::framerate
AVRational framerate
Definition: vf_vpp_qsv.c:74
AVFilterPad::name
const char * name
Pad name.
Definition: internal.h:55
VPPContext::out_height
int out_height
Definition: vf_vpp_qsv.c:68
av_rescale
int64_t av_rescale(int64_t a, int64_t b, int64_t c)
Rescale a 64-bit integer with rounding to nearest.
Definition: mathematics.c:129
vpp_init
static av_cold int vpp_init(AVFilterContext *ctx)
Definition: vf_vpp_qsv.c:235
CALC_EXPR
#define CALC_EXPR(e, v, i, d)
av_cmp_q
static int av_cmp_q(AVRational a, AVRational b)
Compare two rationals.
Definition: rational.h:89
AVHWFramesContext
This struct describes a set or pool of "hardware" frames (i.e.
Definition: hwcontext.h:124
ret
ret
Definition: filter_design.txt:187
AV_PIX_FMT_NV12
@ AV_PIX_FMT_NV12
planar YUV 4:2:0, 12bpp, 1 plane for Y and 1 plane for the UV components, which are interleaved (firs...
Definition: pixfmt.h:89
FFSWAP
#define FFSWAP(type, a, b)
Definition: macros.h:52
VAR_SAR
@ VAR_SAR
Definition: vf_vpp_qsv.c:131
av_get_pix_fmt
enum AVPixelFormat av_get_pix_fmt(const char *name)
Return the pixel format corresponding to name.
Definition: pixdesc.c:2820
QSVVPPCrop::h
int h
Crop rectangle.
Definition: qsvvpp.h:90
QSVVPPCrop::y
int y
Definition: qsvvpp.h:90
VPPContext::oh
char * oh
Definition: vf_vpp_qsv.c:100
TRANSPOSE_CCLOCK_FLIP
@ TRANSPOSE_CCLOCK_FLIP
Definition: transpose.h:31
ff_qsvvpp_filter_frame
int ff_qsvvpp_filter_frame(QSVVPPContext *s, AVFilterLink *inlink, AVFrame *picref)
Definition: qsvvpp.c:835
eval_expr
static int eval_expr(AVFilterContext *ctx)
Definition: vf_vpp_qsv.c:135
AVQSVDeviceContext::session
mfxSession session
Definition: hwcontext_qsv.h:36
AVRational::den
int den
Denominator.
Definition: rational.h:60
AV_PIX_FMT_NONE
@ AV_PIX_FMT_NONE
Definition: pixfmt.h:65
AV_OPT_TYPE_INT
@ AV_OPT_TYPE_INT
Definition: opt.h:225
avfilter.h
vpp_preinit
static av_cold int vpp_preinit(AVFilterContext *ctx)
Definition: vf_vpp_qsv.c:220
VPPContext::use_crop
int use_crop
Definition: vf_vpp_qsv.c:80
transpose.h
VAR_DAR
@ VAR_DAR
Definition: vf_vpp_qsv.c:130
TRANSPOSE_REVERSAL
@ TRANSPOSE_REVERSAL
Definition: transpose.h:35
VPPContext::cy
char * cy
Definition: vf_vpp_qsv.c:99
av_mul_q
AVRational av_mul_q(AVRational b, AVRational c)
Multiply two rationals.
Definition: rational.c:80
AVFilterContext
An instance of a filter.
Definition: avfilter.h:402
TRANSPOSE_VFLIP
@ TRANSPOSE_VFLIP
Definition: transpose.h:37
AV_PIX_FMT_P010
#define AV_PIX_FMT_P010
Definition: pixfmt.h:508
AVMEDIA_TYPE_VIDEO
@ AVMEDIA_TYPE_VIDEO
Definition: avutil.h:201
SET_MFX_PARAM_FIELD
#define SET_MFX_PARAM_FIELD(extbuf, field, value)
AVBufferRef
A reference to a data buffer.
Definition: buffer.h:82
var_names
static const char *const var_names[]
Definition: vf_vpp_qsv.c:107
VPPContext::mirroring_conf
mfxExtVPPMirroring mirroring_conf
Definition: vf_vpp_qsv.c:59
hwcontext.h
av_log
#define av_log(a,...)
Definition: tableprint_vlc.h:27
QSVVPPCrop
Definition: qsvvpp.h:88
AV_OPT_TYPE_STRING
@ AV_OPT_TYPE_STRING
Definition: opt.h:229
transpose
#define transpose(x)
VAR_IH
@ VAR_IH
Definition: vf_vpp_qsv.c:123
VAR_OW
@ VAR_OW
Definition: vf_vpp_qsv.c:124
AV_OPT_TYPE_CONST
@ AV_OPT_TYPE_CONST
Definition: opt.h:234
VPPContext::brightness
float brightness
Definition: vf_vpp_qsv.c:97
VPPContext::procamp
int procamp
Definition: vf_vpp_qsv.c:93
QSVVPPParam::ext_buf
mfxExtBuffer ** ext_buf
Definition: qsvvpp.h:99
vpp_outputs
static const AVFilterPad vpp_outputs[]
Definition: vf_vpp_qsv.c:616