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"
35 
36 #include "formats.h"
37 #include "internal.h"
38 #include "avfilter.h"
39 #include "filters.h"
40 
41 #include "qsvvpp.h"
42 #include "transpose.h"
43 
44 #define OFFSET(x) offsetof(VPPContext, x)
45 #define FLAGS (AV_OPT_FLAG_VIDEO_PARAM | AV_OPT_FLAG_FILTERING_PARAM)
46 
47 /* number of video enhancement filters */
48 #define ENH_FILTERS_COUNT (8)
49 
50 typedef struct VPPContext{
52 
53  /* Video Enhancement Algorithms */
54  mfxExtVPPDeinterlacing deinterlace_conf;
55  mfxExtVPPFrameRateConversion frc_conf;
56  mfxExtVPPDenoise denoise_conf;
57  mfxExtVPPDetail detail_conf;
58  mfxExtVPPProcAmp procamp_conf;
59  mfxExtVPPRotation rotation_conf;
60  mfxExtVPPMirroring mirroring_conf;
61  mfxExtVPPScaling scale_conf;
62 #if QSV_ONEVPL
63  /** Video signal info attached on the input frame */
64  mfxExtVideoSignalInfo invsi_conf;
65  /** Video signal info attached on the output frame */
66  mfxExtVideoSignalInfo outvsi_conf;
67  /** HDR parameters attached on the input frame */
68  mfxExtMasteringDisplayColourVolume mdcv_conf;
69  mfxExtContentLightLevelInfo clli_conf;
70 #endif
71 
72  /**
73  * New dimensions. Special values are:
74  * 0 = original width/height
75  * -1 = keep original aspect
76  */
77  int out_width;
79  /**
80  * Output sw format. AV_PIX_FMT_NONE for no conversion.
81  */
83 
84  AVRational framerate; /* target framerate */
85  int use_frc; /* use framerate conversion */
86  int deinterlace; /* deinterlace mode : 0=off, 1=bob, 2=advanced */
87  int denoise; /* Enable Denoise algorithm. Value [0, 100] */
88  int detail; /* Enable Detail Enhancement algorithm. */
89  /* Level is the optional, value [0, 100] */
90  int use_crop; /* 1 = use crop; 0=none */
91  int crop_w;
92  int crop_h;
93  int crop_x;
94  int crop_y;
95 
96  int transpose;
97  int rotate; /* rotate angle : [0, 90, 180, 270] */
98  int hflip; /* flip mode : 0 = off, 1 = HORIZONTAL flip */
99 
100  int scale_mode; /* scale mode : 0 = auto, 1 = low power, 2 = high quality */
101 
102  /* param for the procamp */
103  int procamp; /* enable procamp */
104  float hue;
105  float saturation;
106  float contrast;
107  float brightness;
108 
109  char *cx, *cy, *cw, *ch;
110  char *ow, *oh;
112 
113  /** The color properties for output */
117 
122 
123  int has_passthrough; /* apply pass through mode if possible */
124  int field_rate; /* Generate output at frame rate or field rate for deinterlace mode, 0: frame, 1: field */
125  int tonemap; /* 1: perform tonemapping if the input has HDR metadata, 0: always disable tonemapping */
126 } VPPContext;
127 
128 static const char *const var_names[] = {
129  "iw", "in_w",
130  "ih", "in_h",
131  "ow", "out_w", "w",
132  "oh", "out_h", "h",
133  "cw",
134  "ch",
135  "cx",
136  "cy",
137  "a", "dar",
138  "sar",
139  NULL
140 };
141 
142 enum var_name {
154 };
155 
157 {
158 #define PASS_EXPR(e, s) {\
159  if (s) {\
160  ret = av_expr_parse(&e, s, var_names, NULL, NULL, NULL, NULL, 0, ctx); \
161  if (ret < 0) { \
162  av_log(ctx, AV_LOG_ERROR, "Error when passing '%s'.\n", s); \
163  goto release; \
164  } \
165  }\
166 }
167 #define CALC_EXPR(e, v, i, d) {\
168  if (e)\
169  i = v = av_expr_eval(e, var_values, NULL); \
170  else\
171  i = v = d;\
172 }
173  VPPContext *vpp = ctx->priv;
174  double var_values[VAR_VARS_NB] = { NAN };
175  AVExpr *w_expr = NULL, *h_expr = NULL;
176  AVExpr *cw_expr = NULL, *ch_expr = NULL;
177  AVExpr *cx_expr = NULL, *cy_expr = NULL;
178  int ret = 0;
179 
180  PASS_EXPR(cw_expr, vpp->cw);
181  PASS_EXPR(ch_expr, vpp->ch);
182 
183  PASS_EXPR(w_expr, vpp->ow);
184  PASS_EXPR(h_expr, vpp->oh);
185 
186  PASS_EXPR(cx_expr, vpp->cx);
187  PASS_EXPR(cy_expr, vpp->cy);
188 
189  var_values[VAR_IW] =
190  var_values[VAR_IN_W] = ctx->inputs[0]->w;
191 
192  var_values[VAR_IH] =
193  var_values[VAR_IN_H] = ctx->inputs[0]->h;
194 
195  var_values[VAR_A] = (double)var_values[VAR_IN_W] / var_values[VAR_IN_H];
196  var_values[VAR_SAR] = ctx->inputs[0]->sample_aspect_ratio.num ?
197  (double)ctx->inputs[0]->sample_aspect_ratio.num / ctx->inputs[0]->sample_aspect_ratio.den : 1;
198  var_values[VAR_DAR] = var_values[VAR_A] * var_values[VAR_SAR];
199 
200  /* crop params */
201  CALC_EXPR(cw_expr, var_values[VAR_CW], vpp->crop_w, var_values[VAR_IW]);
202  CALC_EXPR(ch_expr, var_values[VAR_CH], vpp->crop_h, var_values[VAR_IH]);
203 
204  /* calc again in case cw is relative to ch */
205  CALC_EXPR(cw_expr, var_values[VAR_CW], vpp->crop_w, var_values[VAR_IW]);
206 
207  CALC_EXPR(w_expr,
208  var_values[VAR_OUT_W] = var_values[VAR_OW] = var_values[VAR_W],
209  vpp->out_width, var_values[VAR_CW]);
210  CALC_EXPR(h_expr,
211  var_values[VAR_OUT_H] = var_values[VAR_OH] = var_values[VAR_H],
212  vpp->out_height, var_values[VAR_CH]);
213 
214  /* calc again in case ow is relative to oh */
215  CALC_EXPR(w_expr,
216  var_values[VAR_OUT_W] = var_values[VAR_OW] = var_values[VAR_W],
217  vpp->out_width, var_values[VAR_CW]);
218 
219  CALC_EXPR(cx_expr, var_values[VAR_CX], vpp->crop_x, (var_values[VAR_IW] - var_values[VAR_OW]) / 2);
220  CALC_EXPR(cy_expr, var_values[VAR_CY], vpp->crop_y, (var_values[VAR_IH] - var_values[VAR_OH]) / 2);
221 
222  /* calc again in case cx is relative to cy */
223  CALC_EXPR(cx_expr, var_values[VAR_CX], vpp->crop_x, (var_values[VAR_IW] - var_values[VAR_OW]) / 2);
224 
225  if ((vpp->crop_w != var_values[VAR_IW]) || (vpp->crop_h != var_values[VAR_IH]))
226  vpp->use_crop = 1;
227 
228 release:
229  av_expr_free(w_expr);
230  av_expr_free(h_expr);
231  av_expr_free(cw_expr);
232  av_expr_free(ch_expr);
233  av_expr_free(cx_expr);
234  av_expr_free(cy_expr);
235 #undef PASS_EXPR
236 #undef CALC_EXPR
237 
238  return ret;
239 }
240 
242 {
243  VPPContext *vpp = ctx->priv;
244  /* For AV_OPT_TYPE_STRING options, NULL is handled in other way so
245  * we needn't set default value here
246  */
247  vpp->saturation = 1.0;
248  vpp->contrast = 1.0;
249  vpp->transpose = -1;
250 
255 
256  vpp->has_passthrough = 1;
257 
258  return 0;
259 }
260 
262 {
263  VPPContext *vpp = ctx->priv;
264 
265  if (!vpp->output_format_str || !strcmp(vpp->output_format_str, "same")) {
267  } else {
269  if (vpp->out_format == AV_PIX_FMT_NONE) {
270  av_log(ctx, AV_LOG_ERROR, "Unrecognized output pixel format: %s\n", vpp->output_format_str);
271  return AVERROR(EINVAL);
272  }
273  }
274 
275 #define STRING_OPTION(var_name, func_name, default_value) do { \
276  if (vpp->var_name ## _str) { \
277  int var = av_ ## func_name ## _from_name(vpp->var_name ## _str); \
278  if (var < 0) { \
279  av_log(ctx, AV_LOG_ERROR, "Invalid %s.\n", #var_name); \
280  return AVERROR(EINVAL); \
281  } \
282  vpp->var_name = var; \
283  } else { \
284  vpp->var_name = default_value; \
285  } \
286  } while (0)
287 
289  STRING_OPTION(color_transfer, color_transfer, AVCOL_TRC_UNSPECIFIED);
290  STRING_OPTION(color_matrix, color_space, AVCOL_SPC_UNSPECIFIED);
291 
292 #undef STRING_OPTION
293  return 0;
294 }
295 
297 {
298  AVFilterContext *ctx = inlink->dst;
299  VPPContext *vpp = ctx->priv;
300  int ret;
301  int64_t ow, oh;
302 
303  if (vpp->framerate.den == 0 || vpp->framerate.num == 0) {
304  vpp->framerate = inlink->frame_rate;
305 
306  if (vpp->deinterlace && vpp->field_rate)
307  vpp->framerate = av_mul_q(inlink->frame_rate,
308  (AVRational){ 2, 1 });
309  }
310 
311  if (av_cmp_q(vpp->framerate, inlink->frame_rate))
312  vpp->use_frc = 1;
313 
314  ret = eval_expr(ctx);
315  if (ret != 0) {
316  av_log(ctx, AV_LOG_ERROR, "Fail to eval expr.\n");
317  return ret;
318  }
319 
320  ow = vpp->out_width;
321  oh = vpp->out_height;
322 
323  /* sanity check params */
324  if (ow < -1 || oh < -1) {
325  av_log(ctx, AV_LOG_ERROR, "Size values less than -1 are not acceptable.\n");
326  return AVERROR(EINVAL);
327  }
328 
329  if (ow == -1 && oh == -1)
330  vpp->out_width = vpp->out_height = 0;
331 
332  if (!(ow = vpp->out_width))
333  ow = inlink->w;
334 
335  if (!(oh = vpp->out_height))
336  oh = inlink->h;
337 
338  if (ow == -1)
339  ow = av_rescale(oh, inlink->w, inlink->h);
340 
341  if (oh == -1)
342  oh = av_rescale(ow, inlink->h, inlink->w);
343 
344  if (ow > INT_MAX || oh > INT_MAX ||
345  (oh * inlink->w) > INT_MAX ||
346  (ow * inlink->h) > INT_MAX)
347  av_log(ctx, AV_LOG_ERROR, "Rescaled value for width or height is too big.\n");
348 
349  vpp->out_width = ow;
350  vpp->out_height = oh;
351 
352  if (vpp->use_crop) {
353  vpp->crop_x = FFMAX(vpp->crop_x, 0);
354  vpp->crop_y = FFMAX(vpp->crop_y, 0);
355 
356  if(vpp->crop_w + vpp->crop_x > inlink->w)
357  vpp->crop_x = inlink->w - vpp->crop_w;
358  if(vpp->crop_h + vpp->crop_y > inlink->h)
359  vpp->crop_y = inlink->h - vpp->crop_h;
360  }
361 
362  return 0;
363 }
364 
365 static mfxStatus get_mfx_version(const AVFilterContext *ctx, mfxVersion *mfx_version)
366 {
367  const AVFilterLink *inlink = ctx->inputs[0];
368  AVBufferRef *device_ref;
369  AVHWDeviceContext *device_ctx;
370  AVQSVDeviceContext *device_hwctx;
371 
372  if (inlink->hw_frames_ctx) {
373  AVHWFramesContext *frames_ctx = (AVHWFramesContext *)inlink->hw_frames_ctx->data;
374  device_ref = frames_ctx->device_ref;
375  } else if (ctx->hw_device_ctx) {
376  device_ref = ctx->hw_device_ctx;
377  } else {
378  // Unavailable hw context doesn't matter in pass-through mode,
379  // so don't error here but let runtime version checks fail by setting to 0.0
380  mfx_version->Major = 0;
381  mfx_version->Minor = 0;
382  return MFX_ERR_NONE;
383  }
384 
385  device_ctx = (AVHWDeviceContext *)device_ref->data;
386  device_hwctx = device_ctx->hwctx;
387 
388  return MFXQueryVersion(device_hwctx->session, mfx_version);
389 }
390 
392 {
393 #if QSV_ONEVPL
394  VPPContext *vpp = ctx->priv;
395  QSVVPPContext *qsvvpp = &vpp->qsv;
396  mfxExtVideoSignalInfo invsi_conf, outvsi_conf;
397  mfxExtMasteringDisplayColourVolume mdcv_conf;
398  mfxExtContentLightLevelInfo clli_conf;
399  AVFrameSideData *sd;
400  int tm = 0;
401 
402  fp->num_ext_buf = 0;
403 
404  if (!in || !out ||
405  !QSV_RUNTIME_VERSION_ATLEAST(qsvvpp->ver, 2, 0))
406  return 0;
407 
408  memset(&invsi_conf, 0, sizeof(mfxExtVideoSignalInfo));
409  invsi_conf.Header.BufferId = MFX_EXTBUFF_VIDEO_SIGNAL_INFO_IN;
410  invsi_conf.Header.BufferSz = sizeof(mfxExtVideoSignalInfo);
411  invsi_conf.VideoFullRange = (in->color_range == AVCOL_RANGE_JPEG);
412  invsi_conf.ColourPrimaries = (in->color_primaries == AVCOL_PRI_UNSPECIFIED) ? AVCOL_PRI_BT709 : in->color_primaries;
413  invsi_conf.TransferCharacteristics = (in->color_trc == AVCOL_TRC_UNSPECIFIED) ? AVCOL_TRC_BT709 : in->color_trc;
414  invsi_conf.MatrixCoefficients = (in->colorspace == AVCOL_SPC_UNSPECIFIED) ? AVCOL_SPC_BT709 : in->colorspace;
415  invsi_conf.ColourDescriptionPresent = 1;
416 
417  memset(&mdcv_conf, 0, sizeof(mfxExtMasteringDisplayColourVolume));
419  if (vpp->tonemap && sd) {
421 
422  if (mdm->has_primaries && mdm->has_luminance) {
423  const int mapping[3] = {1, 2, 0};
424  const int chroma_den = 50000;
425  const int luma_den = 10000;
426  int i;
427 
428  mdcv_conf.Header.BufferId = MFX_EXTBUFF_MASTERING_DISPLAY_COLOUR_VOLUME_IN;
429  mdcv_conf.Header.BufferSz = sizeof(mfxExtMasteringDisplayColourVolume);
430 
431  for (i = 0; i < 3; i++) {
432  const int j = mapping[i];
433 
434  mdcv_conf.DisplayPrimariesX[i] =
435  FFMIN(lrint(chroma_den *
436  av_q2d(mdm->display_primaries[j][0])),
437  chroma_den);
438  mdcv_conf.DisplayPrimariesY[i] =
439  FFMIN(lrint(chroma_den *
440  av_q2d(mdm->display_primaries[j][1])),
441  chroma_den);
442  }
443 
444  mdcv_conf.WhitePointX =
445  FFMIN(lrint(chroma_den * av_q2d(mdm->white_point[0])),
446  chroma_den);
447  mdcv_conf.WhitePointY =
448  FFMIN(lrint(chroma_den * av_q2d(mdm->white_point[1])),
449  chroma_den);
450 
451  /* MaxDisplayMasteringLuminance is in the unit of 1 nits however
452  * MinDisplayMasteringLuminance is in the unit of 0.0001 nits
453  */
454  mdcv_conf.MaxDisplayMasteringLuminance =
455  lrint(av_q2d(mdm->max_luminance));
456  mdcv_conf.MinDisplayMasteringLuminance =
457  lrint(luma_den * av_q2d(mdm->min_luminance));
458  tm = 1;
459  }
460  }
461 
462  memset(&clli_conf, 0, sizeof(mfxExtContentLightLevelInfo));
464  if (vpp->tonemap && sd) {
466 
467  clli_conf.Header.BufferId = MFX_EXTBUFF_CONTENT_LIGHT_LEVEL_INFO;
468  clli_conf.Header.BufferSz = sizeof(mfxExtContentLightLevelInfo);
469  clli_conf.MaxContentLightLevel = FFMIN(clm->MaxCLL, 65535);
470  clli_conf.MaxPicAverageLightLevel = FFMIN(clm->MaxFALL, 65535);
471  tm = 1;
472  }
473 
474  if (tm) {
477 
478  out->color_primaries = AVCOL_PRI_BT709;
479  out->color_trc = AVCOL_TRC_BT709;
480  out->colorspace = AVCOL_SPC_BT709;
481  out->color_range = AVCOL_RANGE_MPEG;
482  }
483 
485  out->color_range = vpp->color_range;
487  out->color_primaries = vpp->color_primaries;
489  out->color_trc = vpp->color_transfer;
491  out->colorspace = vpp->color_matrix;
492 
493  memset(&outvsi_conf, 0, sizeof(mfxExtVideoSignalInfo));
494  outvsi_conf.Header.BufferId = MFX_EXTBUFF_VIDEO_SIGNAL_INFO_OUT;
495  outvsi_conf.Header.BufferSz = sizeof(mfxExtVideoSignalInfo);
496  outvsi_conf.VideoFullRange = (out->color_range == AVCOL_RANGE_JPEG);
497  outvsi_conf.ColourPrimaries = (out->color_primaries == AVCOL_PRI_UNSPECIFIED) ? AVCOL_PRI_BT709 : out->color_primaries;
498  outvsi_conf.TransferCharacteristics = (out->color_trc == AVCOL_TRC_UNSPECIFIED) ? AVCOL_TRC_BT709 : out->color_trc;
499  outvsi_conf.MatrixCoefficients = (out->colorspace == AVCOL_SPC_UNSPECIFIED) ? AVCOL_SPC_BT709 : out->colorspace;
500  outvsi_conf.ColourDescriptionPresent = 1;
501 
502  if (memcmp(&vpp->invsi_conf, &invsi_conf, sizeof(mfxExtVideoSignalInfo)) ||
503  memcmp(&vpp->mdcv_conf, &mdcv_conf, sizeof(mfxExtMasteringDisplayColourVolume)) ||
504  memcmp(&vpp->clli_conf, &clli_conf, sizeof(mfxExtContentLightLevelInfo)) ||
505  memcmp(&vpp->outvsi_conf, &outvsi_conf, sizeof(mfxExtVideoSignalInfo))) {
506  vpp->invsi_conf = invsi_conf;
507  fp->ext_buf[fp->num_ext_buf++] = (mfxExtBuffer*)&vpp->invsi_conf;
508 
509  vpp->outvsi_conf = outvsi_conf;
510  fp->ext_buf[fp->num_ext_buf++] = (mfxExtBuffer*)&vpp->outvsi_conf;
511 
512  vpp->mdcv_conf = mdcv_conf;
513  if (mdcv_conf.Header.BufferId)
514  fp->ext_buf[fp->num_ext_buf++] = (mfxExtBuffer*)&vpp->mdcv_conf;
515 
516  vpp->clli_conf = clli_conf;
517  if (clli_conf.Header.BufferId)
518  fp->ext_buf[fp->num_ext_buf++] = (mfxExtBuffer*)&vpp->clli_conf;
519  }
520 #endif
521 
522  return 0;
523 }
524 
525 static int config_output(AVFilterLink *outlink)
526 {
527  AVFilterContext *ctx = outlink->src;
528  VPPContext *vpp = ctx->priv;
529  QSVVPPParam param = { NULL };
530  QSVVPPCrop crop = { 0 };
531  mfxExtBuffer *ext_buf[ENH_FILTERS_COUNT];
532  mfxVersion mfx_version;
533  AVFilterLink *inlink = ctx->inputs[0];
534  enum AVPixelFormat in_format;
535 
536  outlink->w = vpp->out_width;
537  outlink->h = vpp->out_height;
538  outlink->frame_rate = vpp->framerate;
539  if (vpp->framerate.num == 0 || vpp->framerate.den == 0)
540  outlink->time_base = inlink->time_base;
541  else
542  outlink->time_base = av_inv_q(vpp->framerate);
543 
544  param.filter_frame = NULL;
546  param.num_ext_buf = 0;
547  param.ext_buf = ext_buf;
548 
549  if (get_mfx_version(ctx, &mfx_version) != MFX_ERR_NONE) {
550  av_log(ctx, AV_LOG_ERROR, "Failed to query mfx version.\n");
551  return AVERROR(EINVAL);
552  }
553 
554  if (inlink->format == AV_PIX_FMT_QSV) {
555  if (!inlink->hw_frames_ctx || !inlink->hw_frames_ctx->data)
556  return AVERROR(EINVAL);
557  else
558  in_format = ((AVHWFramesContext*)inlink->hw_frames_ctx->data)->sw_format;
559  } else
560  in_format = inlink->format;
561 
562  if (vpp->out_format == AV_PIX_FMT_NONE)
563  vpp->out_format = in_format;
564  param.out_sw_format = vpp->out_format;
565 
566  if (vpp->use_crop) {
567  crop.in_idx = 0;
568  crop.x = vpp->crop_x;
569  crop.y = vpp->crop_y;
570  crop.w = vpp->crop_w;
571  crop.h = vpp->crop_h;
572 
573  param.num_crop = 1;
574  param.crop = &crop;
575  }
576 
577 #define INIT_MFX_EXTBUF(extbuf, id) do { \
578  memset(&vpp->extbuf, 0, sizeof(vpp->extbuf)); \
579  vpp->extbuf.Header.BufferId = id; \
580  vpp->extbuf.Header.BufferSz = sizeof(vpp->extbuf); \
581  param.ext_buf[param.num_ext_buf++] = (mfxExtBuffer*)&vpp->extbuf; \
582  } while (0)
583 
584 #define SET_MFX_PARAM_FIELD(extbuf, field, value) do { \
585  vpp->extbuf.field = value; \
586  } while (0)
587 
588  if (vpp->deinterlace) {
589  INIT_MFX_EXTBUF(deinterlace_conf, MFX_EXTBUFF_VPP_DEINTERLACING);
590  SET_MFX_PARAM_FIELD(deinterlace_conf, Mode, (vpp->deinterlace == 1 ?
591  MFX_DEINTERLACING_BOB : MFX_DEINTERLACING_ADVANCED));
592  }
593 
594  if (vpp->use_frc) {
595  INIT_MFX_EXTBUF(frc_conf, MFX_EXTBUFF_VPP_FRAME_RATE_CONVERSION);
596  SET_MFX_PARAM_FIELD(frc_conf, Algorithm, MFX_FRCALGM_DISTRIBUTED_TIMESTAMP);
597  }
598 
599  if (vpp->denoise) {
600  INIT_MFX_EXTBUF(denoise_conf, MFX_EXTBUFF_VPP_DENOISE);
601  SET_MFX_PARAM_FIELD(denoise_conf, DenoiseFactor, vpp->denoise);
602  }
603 
604  if (vpp->detail) {
605  INIT_MFX_EXTBUF(detail_conf, MFX_EXTBUFF_VPP_DETAIL);
606  SET_MFX_PARAM_FIELD(detail_conf, DetailFactor, vpp->detail);
607  }
608 
609  if (vpp->procamp) {
610  INIT_MFX_EXTBUF(procamp_conf, MFX_EXTBUFF_VPP_PROCAMP);
611  SET_MFX_PARAM_FIELD(procamp_conf, Hue, vpp->hue);
612  SET_MFX_PARAM_FIELD(procamp_conf, Saturation, vpp->saturation);
613  SET_MFX_PARAM_FIELD(procamp_conf, Contrast, vpp->contrast);
614  SET_MFX_PARAM_FIELD(procamp_conf, Brightness, vpp->brightness);
615  }
616 
617  if (vpp->transpose >= 0) {
618  if (QSV_RUNTIME_VERSION_ATLEAST(mfx_version, 1, 17)) {
619  switch (vpp->transpose) {
621  vpp->rotate = MFX_ANGLE_270;
622  vpp->hflip = MFX_MIRRORING_HORIZONTAL;
623  break;
624  case TRANSPOSE_CLOCK:
625  vpp->rotate = MFX_ANGLE_90;
626  vpp->hflip = MFX_MIRRORING_DISABLED;
627  break;
628  case TRANSPOSE_CCLOCK:
629  vpp->rotate = MFX_ANGLE_270;
630  vpp->hflip = MFX_MIRRORING_DISABLED;
631  break;
633  vpp->rotate = MFX_ANGLE_90;
634  vpp->hflip = MFX_MIRRORING_HORIZONTAL;
635  break;
636  case TRANSPOSE_REVERSAL:
637  vpp->rotate = MFX_ANGLE_180;
638  vpp->hflip = MFX_MIRRORING_DISABLED;
639  break;
640  case TRANSPOSE_HFLIP:
641  vpp->rotate = MFX_ANGLE_0;
642  vpp->hflip = MFX_MIRRORING_HORIZONTAL;
643  break;
644  case TRANSPOSE_VFLIP:
645  vpp->rotate = MFX_ANGLE_180;
646  vpp->hflip = MFX_MIRRORING_HORIZONTAL;
647  break;
648  default:
649  av_log(ctx, AV_LOG_ERROR, "Failed to set transpose mode to %d.\n", vpp->transpose);
650  return AVERROR(EINVAL);
651  }
652  } else {
653  av_log(ctx, AV_LOG_WARNING, "The QSV VPP transpose option is "
654  "not supported with this MSDK version.\n");
655  vpp->transpose = 0;
656  }
657  }
658 
659  if (vpp->rotate) {
660  if (QSV_RUNTIME_VERSION_ATLEAST(mfx_version, 1, 17)) {
661  INIT_MFX_EXTBUF(rotation_conf, MFX_EXTBUFF_VPP_ROTATION);
662  SET_MFX_PARAM_FIELD(rotation_conf, Angle, vpp->rotate);
663 
664  if (MFX_ANGLE_90 == vpp->rotate || MFX_ANGLE_270 == vpp->rotate) {
665  FFSWAP(int, vpp->out_width, vpp->out_height);
666  FFSWAP(int, outlink->w, outlink->h);
667  av_log(ctx, AV_LOG_DEBUG, "Swap width and height for clock/cclock rotation.\n");
668  }
669  } else {
670  av_log(ctx, AV_LOG_WARNING, "The QSV VPP rotate option is "
671  "not supported with this MSDK version.\n");
672  vpp->rotate = 0;
673  }
674  }
675 
676  if (vpp->hflip) {
677  if (QSV_RUNTIME_VERSION_ATLEAST(mfx_version, 1, 19)) {
678  INIT_MFX_EXTBUF(mirroring_conf, MFX_EXTBUFF_VPP_MIRRORING);
679  SET_MFX_PARAM_FIELD(mirroring_conf, Type, vpp->hflip);
680  } else {
681  av_log(ctx, AV_LOG_WARNING, "The QSV VPP hflip option is "
682  "not supported with this MSDK version.\n");
683  vpp->hflip = 0;
684  }
685  }
686 
687  if (inlink->w != outlink->w || inlink->h != outlink->h || in_format != vpp->out_format) {
688  if (QSV_RUNTIME_VERSION_ATLEAST(mfx_version, 1, 19)) {
689  int mode = vpp->scale_mode;
690 
691 #if QSV_ONEVPL
692  if (mode > 2)
693  mode = MFX_SCALING_MODE_VENDOR + mode - 2;
694 #endif
695 
696  INIT_MFX_EXTBUF(scale_conf, MFX_EXTBUFF_VPP_SCALING);
697  SET_MFX_PARAM_FIELD(scale_conf, ScalingMode, mode);
698  } else
699  av_log(ctx, AV_LOG_WARNING, "The QSV VPP Scale & format conversion "
700  "option is not supported with this MSDK version.\n");
701  }
702 
703 #undef INIT_MFX_EXTBUF
704 #undef SET_MFX_PARAM_FIELD
705 
706  if (vpp->use_frc || vpp->use_crop || vpp->deinterlace || vpp->denoise ||
707  vpp->detail || vpp->procamp || vpp->rotate || vpp->hflip ||
708  inlink->w != outlink->w || inlink->h != outlink->h || in_format != vpp->out_format ||
713  vpp->tonemap ||
714  !vpp->has_passthrough)
715  return ff_qsvvpp_init(ctx, &param);
716  else {
717  /* No MFX session is created in this case */
718  av_log(ctx, AV_LOG_VERBOSE, "qsv vpp pass through mode.\n");
719  if (inlink->hw_frames_ctx)
720  outlink->hw_frames_ctx = av_buffer_ref(inlink->hw_frames_ctx);
721  }
722 
723  return 0;
724 }
725 
727 {
728  AVFilterLink *inlink = ctx->inputs[0];
729  AVFilterLink *outlink = ctx->outputs[0];
730  QSVVPPContext *qsv = ctx->priv;
731  AVFrame *in = NULL;
732  int ret, status = 0;
733  int64_t pts = AV_NOPTS_VALUE;
734 
736 
737  if (!qsv->eof) {
739  if (ret < 0)
740  return ret;
741 
743  if (status == AVERROR_EOF) {
744  qsv->eof = 1;
745  }
746  }
747  }
748 
749  if (qsv->session) {
750  if (in || qsv->eof) {
751  ret = ff_qsvvpp_filter_frame(qsv, inlink, in);
752  av_frame_free(&in);
753  if (ret == AVERROR(EAGAIN))
754  goto not_ready;
755  else if (ret < 0)
756  return ret;
757 
758  if (qsv->eof)
759  goto eof;
760 
761  if (qsv->got_frame) {
762  qsv->got_frame = 0;
763  return 0;
764  }
765  }
766  } else {
767  /* No MFX session is created in pass-through mode */
768  if (in) {
769  if (in->pts != AV_NOPTS_VALUE)
770  in->pts = av_rescale_q(in->pts, inlink->time_base, outlink->time_base);
771 
772  if (outlink->frame_rate.num && outlink->frame_rate.den)
773  in->duration = av_rescale_q(1, av_inv_q(outlink->frame_rate), outlink->time_base);
774  else
775  in->duration = 0;
776 
777  ret = ff_filter_frame(outlink, in);
778  if (ret < 0)
779  return ret;
780 
781  if (qsv->eof)
782  goto eof;
783 
784  return 0;
785  }
786  }
787 
788 not_ready:
789  if (qsv->eof)
790  goto eof;
791 
793 
794  return FFERROR_NOT_READY;
795 
796 eof:
797  pts = av_rescale_q(pts, inlink->time_base, outlink->time_base);
798  ff_outlink_set_status(outlink, status, pts);
799  return 0;
800 }
801 
803 {
805 }
806 
807 static const AVFilterPad vpp_inputs[] = {
808  {
809  .name = "default",
810  .type = AVMEDIA_TYPE_VIDEO,
811  .config_props = config_input,
812  .get_buffer.video = ff_qsvvpp_get_video_buffer,
813  },
814 };
815 
816 static const AVFilterPad vpp_outputs[] = {
817  {
818  .name = "default",
819  .type = AVMEDIA_TYPE_VIDEO,
820  .config_props = config_output,
821  },
822 };
823 
824 #define DEFINE_QSV_FILTER(x, sn, ln, fmts) \
825 static const AVClass x##_class = { \
826  .class_name = #sn "_qsv", \
827  .item_name = av_default_item_name, \
828  .option = x##_options, \
829  .version = LIBAVUTIL_VERSION_INT, \
830 }; \
831 const AVFilter ff_vf_##sn##_qsv = { \
832  .name = #sn "_qsv", \
833  .description = NULL_IF_CONFIG_SMALL("Quick Sync Video " #ln), \
834  .preinit = x##_preinit, \
835  .init = vpp_init, \
836  .uninit = vpp_uninit, \
837  .priv_size = sizeof(VPPContext), \
838  .priv_class = &x##_class, \
839  FILTER_INPUTS(vpp_inputs), \
840  FILTER_OUTPUTS(vpp_outputs), \
841  fmts, \
842  .activate = activate, \
843  .flags_internal = FF_FILTER_FLAG_HWFRAME_AWARE, \
844  .flags = AVFILTER_FLAG_HWDEVICE, \
845 };
846 
847 #if CONFIG_VPP_QSV_FILTER
848 
849 static const AVOption vpp_options[] = {
850  { "deinterlace", "deinterlace mode: 0=off, 1=bob, 2=advanced", OFFSET(deinterlace), AV_OPT_TYPE_INT, { .i64 = 0 }, 0, MFX_DEINTERLACING_ADVANCED, .flags = FLAGS, .unit = "deinterlace" },
851  { "bob", "Bob deinterlace mode.", 0, AV_OPT_TYPE_CONST, { .i64 = MFX_DEINTERLACING_BOB }, .flags = FLAGS, .unit = "deinterlace" },
852  { "advanced", "Advanced deinterlace mode. ", 0, AV_OPT_TYPE_CONST, { .i64 = MFX_DEINTERLACING_ADVANCED }, .flags = FLAGS, .unit = "deinterlace" },
853 
854  { "denoise", "denoise level [0, 100]", OFFSET(denoise), AV_OPT_TYPE_INT, { .i64 = 0 }, 0, 100, .flags = FLAGS },
855  { "detail", "enhancement level [0, 100]", OFFSET(detail), AV_OPT_TYPE_INT, { .i64 = 0 }, 0, 100, .flags = FLAGS },
856  { "framerate", "output framerate", OFFSET(framerate), AV_OPT_TYPE_RATIONAL, { .dbl = 0.0 },0, DBL_MAX, .flags = FLAGS },
857  { "procamp", "Enable ProcAmp", OFFSET(procamp), AV_OPT_TYPE_INT, { .i64 = 0 }, 0, 1, .flags = FLAGS},
858  { "hue", "ProcAmp hue", OFFSET(hue), AV_OPT_TYPE_FLOAT, { .dbl = 0.0 }, -180.0, 180.0, .flags = FLAGS},
859  { "saturation", "ProcAmp saturation", OFFSET(saturation), AV_OPT_TYPE_FLOAT, { .dbl = 1.0 }, 0.0, 10.0, .flags = FLAGS},
860  { "contrast", "ProcAmp contrast", OFFSET(contrast), AV_OPT_TYPE_FLOAT, { .dbl = 1.0 }, 0.0, 10.0, .flags = FLAGS},
861  { "brightness", "ProcAmp brightness", OFFSET(brightness), AV_OPT_TYPE_FLOAT, { .dbl = 0.0 }, -100.0, 100.0, .flags = FLAGS},
862 
863  { "transpose", "set transpose direction", OFFSET(transpose), AV_OPT_TYPE_INT, { .i64 = -1 }, -1, 6, FLAGS, .unit = "transpose"},
864  { "cclock_hflip", "rotate counter-clockwise with horizontal flip", 0, AV_OPT_TYPE_CONST, { .i64 = TRANSPOSE_CCLOCK_FLIP }, .flags=FLAGS, .unit = "transpose" },
865  { "clock", "rotate clockwise", 0, AV_OPT_TYPE_CONST, { .i64 = TRANSPOSE_CLOCK }, .flags=FLAGS, .unit = "transpose" },
866  { "cclock", "rotate counter-clockwise", 0, AV_OPT_TYPE_CONST, { .i64 = TRANSPOSE_CCLOCK }, .flags=FLAGS, .unit = "transpose" },
867  { "clock_hflip", "rotate clockwise with horizontal flip", 0, AV_OPT_TYPE_CONST, { .i64 = TRANSPOSE_CLOCK_FLIP }, .flags=FLAGS, .unit = "transpose" },
868  { "reversal", "rotate by half-turn", 0, AV_OPT_TYPE_CONST, { .i64 = TRANSPOSE_REVERSAL }, .flags=FLAGS, .unit = "transpose" },
869  { "hflip", "flip horizontally", 0, AV_OPT_TYPE_CONST, { .i64 = TRANSPOSE_HFLIP }, .flags=FLAGS, .unit = "transpose" },
870  { "vflip", "flip vertically", 0, AV_OPT_TYPE_CONST, { .i64 = TRANSPOSE_VFLIP }, .flags=FLAGS, .unit = "transpose" },
871 
872  { "cw", "set the width crop area expression", OFFSET(cw), AV_OPT_TYPE_STRING, { .str = "iw" }, 0, 0, FLAGS },
873  { "ch", "set the height crop area expression", OFFSET(ch), AV_OPT_TYPE_STRING, { .str = "ih" }, 0, 0, FLAGS },
874  { "cx", "set the x crop area expression", OFFSET(cx), AV_OPT_TYPE_STRING, { .str = "(in_w-out_w)/2" }, 0, 0, FLAGS },
875  { "cy", "set the y crop area expression", OFFSET(cy), AV_OPT_TYPE_STRING, { .str = "(in_h-out_h)/2" }, 0, 0, FLAGS },
876 
877  { "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 },
878  { "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 },
879  { "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 },
880  { "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 },
881  { "format", "Output pixel format", OFFSET(output_format_str), AV_OPT_TYPE_STRING, { .str = "same" }, .flags = FLAGS },
882  { "async_depth", "Internal parallelization depth, the higher the value the higher the latency.", OFFSET(qsv.async_depth), AV_OPT_TYPE_INT, { .i64 = 4 }, 0, INT_MAX, .flags = FLAGS },
883 #if QSV_ONEVPL
884  { "scale_mode", "scaling & format conversion mode (mode compute(3), vd(4) and ve(5) are only available on some platforms)", OFFSET(scale_mode), AV_OPT_TYPE_INT, { .i64 = 0 }, 0, 5, .flags = FLAGS, .unit = "scale mode" },
885 #else
886  { "scale_mode", "scaling & format conversion mode", OFFSET(scale_mode), AV_OPT_TYPE_INT, { .i64 = MFX_SCALING_MODE_DEFAULT }, MFX_SCALING_MODE_DEFAULT, MFX_SCALING_MODE_QUALITY, .flags = FLAGS, .unit = "scale mode" },
887 #endif
888  { "auto", "auto mode", 0, AV_OPT_TYPE_CONST, { .i64 = MFX_SCALING_MODE_DEFAULT}, INT_MIN, INT_MAX, FLAGS, .unit = "scale mode"},
889  { "low_power", "low power mode", 0, AV_OPT_TYPE_CONST, { .i64 = MFX_SCALING_MODE_LOWPOWER}, INT_MIN, INT_MAX, FLAGS, .unit = "scale mode"},
890  { "hq", "high quality mode", 0, AV_OPT_TYPE_CONST, { .i64 = MFX_SCALING_MODE_QUALITY}, INT_MIN, INT_MAX, FLAGS, .unit = "scale mode"},
891 #if QSV_ONEVPL
892  { "compute", "compute", 0, AV_OPT_TYPE_CONST, { .i64 = 3}, INT_MIN, INT_MAX, FLAGS, .unit = "scale mode"},
893  { "vd", "vd", 0, AV_OPT_TYPE_CONST, { .i64 = 4}, INT_MIN, INT_MAX, FLAGS, .unit = "scale mode"},
894  { "ve", "ve", 0, AV_OPT_TYPE_CONST, { .i64 = 5}, INT_MIN, INT_MAX, FLAGS, .unit = "scale mode"},
895 #endif
896 
897  { "rate", "Generate output at frame rate or field rate, available only for deinterlace mode",
898  OFFSET(field_rate), AV_OPT_TYPE_INT, { .i64 = 0 }, 0, 1, FLAGS, .unit = "rate" },
899  { "frame", "Output at frame rate (one frame of output for each field-pair)",
900  0, AV_OPT_TYPE_CONST, { .i64 = 0 }, 0, 0, FLAGS, .unit = "rate" },
901  { "field", "Output at field rate (one frame of output for each field)",
902  0, AV_OPT_TYPE_CONST, { .i64 = 1 }, 0, 0, FLAGS, .unit = "rate" },
903 
904  { "out_range", "Output color range",
906  AVCOL_RANGE_UNSPECIFIED, AVCOL_RANGE_JPEG, FLAGS, .unit = "range" },
907  { "full", "Full range",
908  0, AV_OPT_TYPE_CONST, { .i64 = AVCOL_RANGE_JPEG }, 0, 0, FLAGS, .unit = "range" },
909  { "limited", "Limited range",
910  0, AV_OPT_TYPE_CONST, { .i64 = AVCOL_RANGE_MPEG }, 0, 0, FLAGS, .unit = "range" },
911  { "jpeg", "Full range",
912  0, AV_OPT_TYPE_CONST, { .i64 = AVCOL_RANGE_JPEG }, 0, 0, FLAGS, .unit = "range" },
913  { "mpeg", "Limited range",
914  0, AV_OPT_TYPE_CONST, { .i64 = AVCOL_RANGE_MPEG }, 0, 0, FLAGS, .unit = "range" },
915  { "tv", "Limited range",
916  0, AV_OPT_TYPE_CONST, { .i64 = AVCOL_RANGE_MPEG }, 0, 0, FLAGS, .unit = "range" },
917  { "pc", "Full range",
918  0, AV_OPT_TYPE_CONST, { .i64 = AVCOL_RANGE_JPEG }, 0, 0, FLAGS, .unit = "range" },
919  { "out_color_matrix", "Output color matrix coefficient set",
920  OFFSET(color_matrix_str), AV_OPT_TYPE_STRING, { .str = NULL }, .flags = FLAGS },
921  { "out_color_primaries", "Output color primaries",
922  OFFSET(color_primaries_str), AV_OPT_TYPE_STRING, { .str = NULL }, .flags = FLAGS },
923  { "out_color_transfer", "Output color transfer characteristics",
924  OFFSET(color_transfer_str), AV_OPT_TYPE_STRING, { .str = NULL }, .flags = FLAGS },
925 
926  {"tonemap", "Perform tonemapping (0=disable tonemapping, 1=perform tonemapping if the input has HDR metadata)", OFFSET(tonemap), AV_OPT_TYPE_INT, {.i64 = 0 }, 0, 1, .flags = FLAGS},
927 
928  { NULL }
929 };
930 
931 static int vpp_query_formats(AVFilterContext *ctx)
932 {
933  VPPContext *vpp = ctx->priv;
934  int ret, i = 0;
935  static const enum AVPixelFormat in_pix_fmts[] = {
941 #if CONFIG_VAAPI
943 #endif
946  };
947  static enum AVPixelFormat out_pix_fmts[4];
948 
950  &ctx->inputs[0]->outcfg.formats);
951  if (ret < 0)
952  return ret;
953 
954  /* User specifies the output format */
955  if (vpp->out_format == AV_PIX_FMT_NV12 ||
956  vpp->out_format == AV_PIX_FMT_P010)
957  out_pix_fmts[i++] = vpp->out_format;
958  else {
961  }
962 
965 
967  &ctx->outputs[0]->incfg.formats);
968 }
969 
970 DEFINE_QSV_FILTER(vpp, vpp, "VPP", FILTER_QUERY_FUNC(vpp_query_formats));
971 
972 #endif
973 
974 #if CONFIG_SCALE_QSV_FILTER
975 
976 static const AVOption qsvscale_options[] = {
977  { "w", "Output video width(0=input video width, -1=keep input video aspect)", OFFSET(ow), AV_OPT_TYPE_STRING, { .str = "iw" }, .flags = FLAGS },
978  { "h", "Output video height(0=input video height, -1=keep input video aspect)", OFFSET(oh), AV_OPT_TYPE_STRING, { .str = "ih" }, .flags = FLAGS },
979  { "format", "Output pixel format", OFFSET(output_format_str), AV_OPT_TYPE_STRING, { .str = "same" }, .flags = FLAGS },
980 
981 #if QSV_ONEVPL
982  { "mode", "scaling & format conversion mode (mode compute(3), vd(4) and ve(5) are only available on some platforms)", OFFSET(scale_mode), AV_OPT_TYPE_INT, { .i64 = 0}, 0, 5, FLAGS, .unit = "mode"},
983 #else
984  { "mode", "scaling & format conversion mode", OFFSET(scale_mode), AV_OPT_TYPE_INT, { .i64 = MFX_SCALING_MODE_DEFAULT}, MFX_SCALING_MODE_DEFAULT, MFX_SCALING_MODE_QUALITY, FLAGS, .unit = "mode"},
985 #endif
986  { "low_power", "low power mode", 0, AV_OPT_TYPE_CONST, { .i64 = MFX_SCALING_MODE_LOWPOWER}, INT_MIN, INT_MAX, FLAGS, .unit = "mode"},
987  { "hq", "high quality mode", 0, AV_OPT_TYPE_CONST, { .i64 = MFX_SCALING_MODE_QUALITY}, INT_MIN, INT_MAX, FLAGS, .unit = "mode"},
988 #if QSV_ONEVPL
989  { "compute", "compute", 0, AV_OPT_TYPE_CONST, { .i64 = 3}, INT_MIN, INT_MAX, FLAGS, .unit = "mode"},
990  { "vd", "vd", 0, AV_OPT_TYPE_CONST, { .i64 = 4}, INT_MIN, INT_MAX, FLAGS, .unit = "mode"},
991  { "ve", "ve", 0, AV_OPT_TYPE_CONST, { .i64 = 5}, INT_MIN, INT_MAX, FLAGS, .unit = "mode"},
992 #endif
993 
994  { NULL },
995 };
996 
997 static av_cold int qsvscale_preinit(AVFilterContext *ctx)
998 {
999  VPPContext *vpp = ctx->priv;
1000 
1001  vpp_preinit(ctx);
1002  vpp->has_passthrough = 0;
1003 
1004  return 0;
1005 }
1006 
1007 DEFINE_QSV_FILTER(qsvscale, scale, "scaling and format conversion", FILTER_SINGLE_PIXFMT(AV_PIX_FMT_QSV));
1008 
1009 #endif
1010 
1011 #if CONFIG_DEINTERLACE_QSV_FILTER
1012 
1013 static const AVOption qsvdeint_options[] = {
1014  { "mode", "set deinterlace mode", OFFSET(deinterlace), AV_OPT_TYPE_INT, {.i64 = MFX_DEINTERLACING_ADVANCED}, MFX_DEINTERLACING_BOB, MFX_DEINTERLACING_ADVANCED, FLAGS, .unit = "mode"},
1015  { "bob", "bob algorithm", 0, AV_OPT_TYPE_CONST, {.i64 = MFX_DEINTERLACING_BOB}, MFX_DEINTERLACING_BOB, MFX_DEINTERLACING_ADVANCED, FLAGS, .unit = "mode"},
1016  { "advanced", "Motion adaptive algorithm", 0, AV_OPT_TYPE_CONST, {.i64 = MFX_DEINTERLACING_ADVANCED}, MFX_DEINTERLACING_BOB, MFX_DEINTERLACING_ADVANCED, FLAGS, .unit = "mode"},
1017 
1018  { NULL },
1019 };
1020 
1021 static av_cold int qsvdeint_preinit(AVFilterContext *ctx)
1022 {
1023  VPPContext *vpp = ctx->priv;
1024 
1025  vpp_preinit(ctx);
1026  vpp->has_passthrough = 0;
1027  vpp->field_rate = 1;
1028 
1029  return 0;
1030 }
1031 
1032 DEFINE_QSV_FILTER(qsvdeint, deinterlace, "deinterlacing", FILTER_SINGLE_PIXFMT(AV_PIX_FMT_QSV))
1033 
1034 #endif
AVFrame::color_trc
enum AVColorTransferCharacteristic color_trc
Definition: frame.h:660
AVMasteringDisplayMetadata::has_primaries
int has_primaries
Flag indicating whether the display primaries (and white point) are set.
Definition: mastering_display_metadata.h:62
AVHWDeviceContext::hwctx
void * hwctx
The format-specific data, allocated and freed by libavutil along with this context.
Definition: hwcontext.h:93
QSVVPPCrop::in_idx
int in_idx
Input index.
Definition: qsvvpp.h:106
AV_LOG_WARNING
#define AV_LOG_WARNING
Something somehow does not look correct.
Definition: log.h:186
AVFrame::color_range
enum AVColorRange color_range
MPEG vs JPEG YUV range.
Definition: frame.h:656
AVMasteringDisplayMetadata::max_luminance
AVRational max_luminance
Max luminance of mastering display (cd/m^2).
Definition: mastering_display_metadata.h:57
AVPixelFormat
AVPixelFormat
Pixel format.
Definition: pixfmt.h:71
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
var_name
var_name
Definition: noise.c:46
ff_make_format_list
AVFilterFormats * ff_make_format_list(const int *fmts)
Create a list of supported formats.
Definition: formats.c:435
AVColorTransferCharacteristic
AVColorTransferCharacteristic
Color Transfer Characteristic.
Definition: pixfmt.h:584
OFFSET
#define OFFSET(x)
Definition: vf_vpp_qsv.c:44
VAR_CW
@ VAR_CW
Definition: vf_vpp_qsv.c:147
VPPContext::color_transfer
enum AVColorTransferCharacteristic color_transfer
Definition: vf_vpp_qsv.c:120
out
FILE * out
Definition: movenc.c:54
av_frame_get_side_data
AVFrameSideData * av_frame_get_side_data(const AVFrame *frame, enum AVFrameSideDataType type)
Definition: frame.c:824
QSVVPPParam::crop
QSVVPPCrop * crop
Definition: qsvvpp.h:124
QSVVPPParam::out_sw_format
enum AVPixelFormat out_sw_format
Definition: qsvvpp.h:120
ff_filter_frame
int ff_filter_frame(AVFilterLink *link, AVFrame *frame)
Send a frame of data to the next filter.
Definition: avfilter.c:1007
AVFrame::duration
int64_t duration
Duration of the frame, in the same units as pts.
Definition: frame.h:807
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:109
AVMasteringDisplayMetadata::display_primaries
AVRational display_primaries[3][2]
CIE 1931 xy chromaticity coords of color primaries (r, g, b order).
Definition: mastering_display_metadata.h:42
ff_qsvvpp_get_video_buffer
AVFrame * ff_qsvvpp_get_video_buffer(AVFilterLink *inlink, int w, int h)
Definition: qsvvpp.c:1146
AVMasteringDisplayMetadata::has_luminance
int has_luminance
Flag indicating whether the luminance (min_ and max_) have been set.
Definition: mastering_display_metadata.h:67
VAR_CY
@ VAR_CY
Definition: vf_vpp_qsv.c:150
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:91
VAR_CH
@ VAR_CH
Definition: vf_vpp_qsv.c:148
QSVVPPContext::session
mfxSession session
Definition: qsvvpp.h:66
AVFrame::color_primaries
enum AVColorPrimaries color_primaries
Definition: frame.h:658
VPPContext::crop_h
int crop_h
Definition: vf_vpp_qsv.c:92
VPPContext::detail
int detail
Definition: vf_vpp_qsv.c:88
av_frame_free
void av_frame_free(AVFrame **frame)
Free the frame and any dynamically allocated objects in it, e.g.
Definition: frame.c:100
QSVVPPContext::ver
mfxVersion ver
Definition: qsvvpp.h:101
AVContentLightMetadata::MaxCLL
unsigned MaxCLL
Max content light level (cd/m^2).
Definition: mastering_display_metadata.h:102
AVFrame::colorspace
enum AVColorSpace colorspace
YUV colorspace type.
Definition: frame.h:667
AVFrame
This structure describes decoded (raw) audio or video data.
Definition: frame.h:340
pixdesc.h
AVFrame::pts
int64_t pts
Presentation timestamp in time_base units (time when frame should be shown to user).
Definition: frame.h:452
AVQSVDeviceContext
This struct is allocated as AVHWDeviceContext.hwctx.
Definition: hwcontext_qsv.h:35
VAR_CX
@ VAR_CX
Definition: vf_vpp_qsv.c:149
AVCOL_RANGE_JPEG
@ AVCOL_RANGE_JPEG
Full range content.
Definition: pixfmt.h:687
AVOption
AVOption.
Definition: opt.h:251
AVCOL_TRC_UNSPECIFIED
@ AVCOL_TRC_UNSPECIFIED
Definition: pixfmt.h:587
VPPContext::scale_mode
int scale_mode
Definition: vf_vpp_qsv.c:100
FILTER_QUERY_FUNC
#define FILTER_QUERY_FUNC(func)
Definition: internal.h:159
VPPContext::contrast
float contrast
Definition: vf_vpp_qsv.c:106
vpp_uninit
static av_cold void vpp_uninit(AVFilterContext *ctx)
Definition: vf_vpp_qsv.c:802
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:146
VPPContext::hue
float hue
Definition: vf_vpp_qsv.c:104
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
AVColorPrimaries
AVColorPrimaries
Chromaticity coordinates of the source primaries.
Definition: pixfmt.h:559
VAR_IN_H
@ VAR_IN_H
Definition: vf_vpp_qsv.c:144
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
AVContentLightMetadata
Content light level needed by to transmit HDR over HDMI (CTA-861.3).
Definition: mastering_display_metadata.h:98
TRANSPOSE_CCLOCK
@ TRANSPOSE_CCLOCK
Definition: transpose.h:33
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:1438
VPPContext::saturation
float saturation
Definition: vf_vpp_qsv.c:105
qsvvpp.h
VAR_IN_W
@ VAR_IN_W
Definition: vf_vpp_qsv.c:143
tonemap
static void tonemap(TonemapContext *s, AVFrame *out, const AVFrame *in, const AVPixFmtDescriptor *desc, int x, int y, double peak)
Definition: vf_tonemap.c:108
VPPContext::transpose
int transpose
Definition: vf_vpp_qsv.c:96
pts
static int64_t pts
Definition: transcode_aac.c:643
PASS_EXPR
#define PASS_EXPR(e, s)
VPPContext::out_format
enum AVPixelFormat out_format
Output sw format.
Definition: vf_vpp_qsv.c:82
av_expr_free
void av_expr_free(AVExpr *e)
Free a parsed expression previously created with av_expr_parse().
Definition: eval.c:359
AVRational::num
int num
Numerator.
Definition: rational.h:59
AVFilterPad
A filter pad used for either input or output.
Definition: internal.h:33
AVHWDeviceContext
This struct aggregates all the (hardware/vendor-specific) "high-level" state, i.e.
Definition: hwcontext.h:62
VPPContext::out_width
int out_width
New dimensions.
Definition: vf_vpp_qsv.c:77
FLAGS
#define FLAGS
Definition: vf_vpp_qsv.c:45
TRANSPOSE_HFLIP
@ TRANSPOSE_HFLIP
Definition: transpose.h:36
in_pix_fmts
static enum AVPixelFormat in_pix_fmts[]
Definition: vf_ciescope.c:128
lrint
#define lrint
Definition: tablegen.h:53
VPPContext::crop_x
int crop_x
Definition: vf_vpp_qsv.c:93
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:85
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
AVMasteringDisplayMetadata::white_point
AVRational white_point[2]
CIE 1931 xy chromaticity coords of white point.
Definition: mastering_display_metadata.h:47
QSVVPPCrop::w
int w
Definition: qsvvpp.h:107
VPPContext::denoise_conf
mfxExtVPPDenoise denoise_conf
Definition: vf_vpp_qsv.c:56
QSV_RUNTIME_VERSION_ATLEAST
#define QSV_RUNTIME_VERSION_ATLEAST(MFX_VERSION, MAJOR, MINOR)
Definition: qsv_internal.h:63
ff_formats_ref
int ff_formats_ref(AVFilterFormats *f, AVFilterFormats **ref)
Add *ref as a new reference to formats.
Definition: formats.c:678
av_q2d
static double av_q2d(AVRational a)
Convert an AVRational to a double.
Definition: rational.h:104
VPPContext::field_rate
int field_rate
Definition: vf_vpp_qsv.c:124
VPPContext::color_primaries_str
char * color_primaries_str
The color properties for output.
Definition: vf_vpp_qsv.c:114
filters.h
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:726
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:159
VPPContext::detail_conf
mfxExtVPPDetail detail_conf
Definition: vf_vpp_qsv.c:57
AV_PIX_FMT_YUV420P
@ AV_PIX_FMT_YUV420P
planar YUV 4:2:0, 12bpp, (1 Cr & Cb sample per 2x2 Y samples)
Definition: pixfmt.h:73
color_range
color_range
Definition: vf_selectivecolor.c:43
AVCOL_PRI_UNSPECIFIED
@ AVCOL_PRI_UNSPECIFIED
Definition: pixfmt.h:562
NAN
#define NAN
Definition: mathematics.h:115
VPPContext::has_passthrough
int has_passthrough
Definition: vf_vpp_qsv.c:123
if
if(ret)
Definition: filter_design.txt:179
INIT_MFX_EXTBUF
#define INIT_MFX_EXTBUF(extbuf, id)
QSVVPPContext
Definition: qsvvpp.h:63
framerate
float framerate
Definition: av1_levels.c:29
ff_qsvvpp_close
int ff_qsvvpp_close(AVFilterContext *avctx)
Definition: qsvvpp.c:936
NULL
#define NULL
Definition: coverity.c:32
ENH_FILTERS_COUNT
#define ENH_FILTERS_COUNT
Definition: vf_vpp_qsv.c:48
vpp_set_frame_ext_params
static int vpp_set_frame_ext_params(AVFilterContext *ctx, const AVFrame *in, AVFrame *out, QSVVPPFrameParam *fp)
Definition: vf_vpp_qsv.c:391
QSVVPPParam::num_crop
int num_crop
Definition: qsvvpp.h:123
QSVVPPParam
Definition: qsvvpp.h:110
QSVVPPCrop::x
int x
Definition: qsvvpp.h:107
VPPContext::cw
char * cw
Definition: vf_vpp_qsv.c:109
AV_PIX_FMT_YUYV422
@ AV_PIX_FMT_YUYV422
packed YUV 4:2:2, 16bpp, Y0 Cb Y1 Cr
Definition: pixfmt.h:74
VAR_IW
@ VAR_IW
Definition: vf_vpp_qsv.c:143
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:142
VPPContext::color_primaries
enum AVColorPrimaries color_primaries
Definition: vf_vpp_qsv.c:119
AVCOL_PRI_BT709
@ AVCOL_PRI_BT709
also ITU-R BT1361 / IEC 61966-2-4 / SMPTE RP 177 Annex B
Definition: pixfmt.h:561
VPPContext::qsv
QSVVPPContext qsv
Definition: vf_vpp_qsv.c:51
VPPContext::deinterlace
int deinterlace
Definition: vf_vpp_qsv.c:86
VAR_H
@ VAR_H
Definition: vf_vpp_qsv.c:146
VPPContext::deinterlace_conf
mfxExtVPPDeinterlacing deinterlace_conf
Definition: vf_vpp_qsv.c:54
VPPContext::frc_conf
mfxExtVPPFrameRateConversion frc_conf
Definition: vf_vpp_qsv.c:55
AV_FRAME_DATA_MASTERING_DISPLAY_METADATA
@ AV_FRAME_DATA_MASTERING_DISPLAY_METADATA
Mastering display metadata associated with a video frame.
Definition: frame.h:120
double
double
Definition: af_crystalizer.c:131
vpp_inputs
static const AVFilterPad vpp_inputs[]
Definition: vf_vpp_qsv.c:807
VPPContext::denoise
int denoise
Definition: vf_vpp_qsv.c:87
DEFINE_QSV_FILTER
#define DEFINE_QSV_FILTER(x, sn, ln, fmts)
Definition: vf_vpp_qsv.c:824
AV_PIX_FMT_QSV
@ AV_PIX_FMT_QSV
HW acceleration through QSV, data[3] contains a pointer to the mfxFrameSurface1 structure.
Definition: pixfmt.h:247
fp
#define fp
Definition: regdef.h:44
VPPContext
Definition: vf_vpp_qsv.c:50
QSVVPPContext::got_frame
int got_frame
Definition: qsvvpp.h:95
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:1386
AVCOL_RANGE_UNSPECIFIED
@ AVCOL_RANGE_UNSPECIFIED
Definition: pixfmt.h:653
VPPContext::ow
char * ow
Definition: vf_vpp_qsv.c:110
VPPContext::hflip
int hflip
Definition: vf_vpp_qsv.c:98
VPPContext::scale_conf
mfxExtVPPScaling scale_conf
Definition: vf_vpp_qsv.c:61
color_primaries
static const AVColorPrimariesDesc color_primaries[AVCOL_PRI_NB]
Definition: csp.c:76
eval.h
scale
static void scale(int *out, const int *in, const int w, const int h, const int shift)
Definition: vvc_intra.c:292
VAR_OH
@ VAR_OH
Definition: vf_vpp_qsv.c:146
VAR_W
@ VAR_W
Definition: vf_vpp_qsv.c:145
config_input
static int config_input(AVFilterLink *inlink)
Definition: vf_vpp_qsv.c:296
VPPContext::rotate
int rotate
Definition: vf_vpp_qsv.c:97
VPPContext::tonemap
int tonemap
Definition: vf_vpp_qsv.c:125
STRING_OPTION
#define STRING_OPTION(var_name, func_name, default_value)
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:145
AVFrameSideData::data
uint8_t * data
Definition: frame.h:248
VPPContext::output_format_str
char * output_format_str
Definition: vf_vpp_qsv.c:111
VAR_VARS_NB
@ VAR_VARS_NB
Definition: vf_vpp_qsv.c:153
VPPContext::ch
char * ch
Definition: vf_vpp_qsv.c:109
VPPContext::procamp_conf
mfxExtVPPProcAmp procamp_conf
Definition: vf_vpp_qsv.c:58
av_frame_remove_side_data
void av_frame_remove_side_data(AVFrame *frame, enum AVFrameSideDataType type)
Remove and free all side data instances of the given type.
Definition: frame.c:919
AV_PIX_FMT_RGB32
#define AV_PIX_FMT_RGB32
Definition: pixfmt.h:455
FF_FILTER_FORWARD_WANTED
FF_FILTER_FORWARD_WANTED(outlink, inlink)
AVCOL_TRC_BT709
@ AVCOL_TRC_BT709
also ITU-R BT1361
Definition: pixfmt.h:586
QSVVPPContext::eof
int eof
Definition: qsvvpp.h:97
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:172
hwcontext_qsv.h
Type
Type
Definition: vf_idet.h:29
AV_FRAME_DATA_CONTENT_LIGHT_LEVEL
@ AV_FRAME_DATA_CONTENT_LIGHT_LEVEL
Content light level (based on CTA-861.3).
Definition: frame.h:137
config_output
static int config_output(AVFilterLink *outlink)
Definition: vf_vpp_qsv.c:525
i
#define i(width, name, range_min, range_max)
Definition: cbs_h2645.c:255
VAR_A
@ VAR_A
Definition: vf_vpp_qsv.c:151
AVColorSpace
AVColorSpace
YUV colorspace type.
Definition: pixfmt.h:613
VPPContext::rotation_conf
mfxExtVPPRotation rotation_conf
Definition: vf_vpp_qsv.c:59
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:116
FFMIN
#define FFMIN(a, b)
Definition: macros.h:49
VPPContext::color_matrix_str
char * color_matrix_str
Definition: vf_vpp_qsv.c:116
get_mfx_version
static mfxStatus get_mfx_version(const AVFilterContext *ctx, mfxVersion *mfx_version)
Definition: vf_vpp_qsv.c:365
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:112
ff_qsvvpp_init
int ff_qsvvpp_init(AVFilterContext *avctx, QSVVPPParam *param)
Definition: qsvvpp.c:744
VPPContext::crop_y
int crop_y
Definition: vf_vpp_qsv.c:94
VPPContext::framerate
AVRational framerate
Definition: vf_vpp_qsv.c:84
AVMasteringDisplayMetadata
Mastering display metadata capable of representing the color volume of the display used to master the...
Definition: mastering_display_metadata.h:38
AVFilterPad::name
const char * name
Pad name.
Definition: internal.h:39
VPPContext::out_height
int out_height
Definition: vf_vpp_qsv.c:78
AVCOL_SPC_UNSPECIFIED
@ AVCOL_SPC_UNSPECIFIED
Definition: pixfmt.h:616
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:261
AVCOL_RANGE_MPEG
@ AVCOL_RANGE_MPEG
Narrow or limited range content.
Definition: pixfmt.h:670
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:125
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:96
FFSWAP
#define FFSWAP(type, a, b)
Definition: macros.h:52
VAR_SAR
@ VAR_SAR
Definition: vf_vpp_qsv.c:152
AV_PIX_FMT_UYVY422
@ AV_PIX_FMT_UYVY422
packed YUV 4:2:2, 16bpp, Cb Y0 Cr Y1
Definition: pixfmt.h:88
av_get_pix_fmt
enum AVPixelFormat av_get_pix_fmt(const char *name)
Return the pixel format corresponding to name.
Definition: pixdesc.c:2900
QSVVPPCrop::h
int h
Crop rectangle.
Definition: qsvvpp.h:107
QSVVPPCrop::y
int y
Definition: qsvvpp.h:107
VPPContext::oh
char * oh
Definition: vf_vpp_qsv.c:110
TRANSPOSE_CCLOCK_FLIP
@ TRANSPOSE_CCLOCK_FLIP
Definition: transpose.h:31
status
ov_status_e status
Definition: dnn_backend_openvino.c:120
ff_qsvvpp_filter_frame
int ff_qsvvpp_filter_frame(QSVVPPContext *s, AVFilterLink *inlink, AVFrame *picref)
Definition: qsvvpp.c:960
eval_expr
static int eval_expr(AVFilterContext *ctx)
Definition: vf_vpp_qsv.c:156
AVQSVDeviceContext::session
mfxSession session
Definition: hwcontext_qsv.h:36
AVRational::den
int den
Denominator.
Definition: rational.h:60
mode
mode
Definition: ebur128.h:83
AV_PIX_FMT_NONE
@ AV_PIX_FMT_NONE
Definition: pixfmt.h:72
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:241
VPPContext::use_crop
int use_crop
Definition: vf_vpp_qsv.c:90
transpose.h
VPPContext::color_transfer_str
char * color_transfer_str
Definition: vf_vpp_qsv.c:115
VAR_DAR
@ VAR_DAR
Definition: vf_vpp_qsv.c:151
TRANSPOSE_REVERSAL
@ TRANSPOSE_REVERSAL
Definition: transpose.h:35
VPPContext::cy
char * cy
Definition: vf_vpp_qsv.c:109
AVMasteringDisplayMetadata::min_luminance
AVRational min_luminance
Min luminance of mastering display (cd/m^2).
Definition: mastering_display_metadata.h:52
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:409
TRANSPOSE_VFLIP
@ TRANSPOSE_VFLIP
Definition: transpose.h:37
AV_PIX_FMT_P010
#define AV_PIX_FMT_P010
Definition: pixfmt.h:532
VPPContext::color_range
int color_range
Definition: vf_vpp_qsv.c:118
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
mastering_display_metadata.h
var_names
static const char *const var_names[]
Definition: vf_vpp_qsv.c:128
AVFrameSideData
Structure to hold side data for an AVFrame.
Definition: frame.h:246
VPPContext::mirroring_conf
mfxExtVPPMirroring mirroring_conf
Definition: vf_vpp_qsv.c:60
AVContentLightMetadata::MaxFALL
unsigned MaxFALL
Max average light level per frame (cd/m^2).
Definition: mastering_display_metadata.h:107
hwcontext.h
av_log
#define av_log(a,...)
Definition: tableprint_vlc.h:27
QSVVPPCrop
Definition: qsvvpp.h:105
VPPContext::color_matrix
enum AVColorSpace color_matrix
Definition: vf_vpp_qsv.c:121
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:144
AVCOL_SPC_BT709
@ AVCOL_SPC_BT709
also ITU-R BT1361 / IEC 61966-2-4 xvYCC709 / derived in SMPTE RP 177 Annex B
Definition: pixfmt.h:615
VAR_OW
@ VAR_OW
Definition: vf_vpp_qsv.c:145
AV_OPT_TYPE_CONST
@ AV_OPT_TYPE_CONST
Definition: opt.h:234
VPPContext::brightness
float brightness
Definition: vf_vpp_qsv.c:107
QSVVPPParam::set_frame_ext_params
int(* set_frame_ext_params)(AVFilterContext *ctx, const AVFrame *in, AVFrame *out, QSVVPPFrameParam *fp)
callbak
Definition: qsvvpp.h:113
QSVVPPFrameParam
Definition: qsvvpp.h:57
VPPContext::procamp
int procamp
Definition: vf_vpp_qsv.c:103
QSVVPPParam::ext_buf
mfxExtBuffer ** ext_buf
Definition: qsvvpp.h:117
vpp_outputs
static const AVFilterPad vpp_outputs[]
Definition: vf_vpp_qsv.c:816