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 "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 #if QSV_ONEVPL
62  /** Video signal info attached on the input frame */
63  mfxExtVideoSignalInfo invsi_conf;
64  /** Video signal info attached on the output frame */
65  mfxExtVideoSignalInfo outvsi_conf;
66  /** HDR parameters attached on the input frame */
67  mfxExtMasteringDisplayColourVolume mdcv_conf;
68  mfxExtContentLightLevelInfo clli_conf;
69 #endif
70 
71  /**
72  * New dimensions. Special values are:
73  * 0 = original width/height
74  * -1 = keep original aspect
75  */
76  int out_width;
78  /**
79  * Output sw format. AV_PIX_FMT_NONE for no conversion.
80  */
82 
83  AVRational framerate; /* target framerate */
84  int use_frc; /* use framerate conversion */
85  int deinterlace; /* deinterlace mode : 0=off, 1=bob, 2=advanced */
86  int denoise; /* Enable Denoise algorithm. Value [0, 100] */
87  int detail; /* Enable Detail Enhancement algorithm. */
88  /* Level is the optional, value [0, 100] */
89  int use_crop; /* 1 = use crop; 0=none */
90  int crop_w;
91  int crop_h;
92  int crop_x;
93  int crop_y;
94 
95  int transpose;
96  int rotate; /* rotate angle : [0, 90, 180, 270] */
97  int hflip; /* flip mode : 0 = off, 1 = HORIZONTAL flip */
98 
99  int scale_mode; /* scale mode : 0 = auto, 1 = low power, 2 = high quality */
100 
101  /* param for the procamp */
102  int procamp; /* enable procamp */
103  float hue;
104  float saturation;
105  float contrast;
106  float brightness;
107 
108  char *cx, *cy, *cw, *ch;
109  char *ow, *oh;
111 
112  /** The color properties for output */
116 
121 
122  int has_passthrough; /* apply pass through mode if possible */
123  int field_rate; /* Generate output at frame rate or field rate for deinterlace mode, 0: frame, 1: field */
124  int tonemap; /* 1: perform tonemapping if the input has HDR metadata, 0: always disable tonemapping */
125 } VPPContext;
126 
127 static const char *const var_names[] = {
128  "iw", "in_w",
129  "ih", "in_h",
130  "ow", "out_w", "w",
131  "oh", "out_h", "h",
132  "cw",
133  "ch",
134  "cx",
135  "cy",
136  "a", "dar",
137  "sar",
138  NULL
139 };
140 
141 enum var_name {
153 };
154 
156 {
157 #define PASS_EXPR(e, s) {\
158  if (s) {\
159  ret = av_expr_parse(&e, s, var_names, NULL, NULL, NULL, NULL, 0, ctx); \
160  if (ret < 0) { \
161  av_log(ctx, AV_LOG_ERROR, "Error when passing '%s'.\n", s); \
162  goto release; \
163  } \
164  }\
165 }
166 #define CALC_EXPR(e, v, i, d) {\
167  if (e)\
168  i = v = av_expr_eval(e, var_values, NULL); \
169  else\
170  i = v = d;\
171 }
172  VPPContext *vpp = ctx->priv;
173  double var_values[VAR_VARS_NB] = { NAN };
174  AVExpr *w_expr = NULL, *h_expr = NULL;
175  AVExpr *cw_expr = NULL, *ch_expr = NULL;
176  AVExpr *cx_expr = NULL, *cy_expr = NULL;
177  int ret = 0;
178 
179  PASS_EXPR(cw_expr, vpp->cw);
180  PASS_EXPR(ch_expr, vpp->ch);
181 
182  PASS_EXPR(w_expr, vpp->ow);
183  PASS_EXPR(h_expr, vpp->oh);
184 
185  PASS_EXPR(cx_expr, vpp->cx);
186  PASS_EXPR(cy_expr, vpp->cy);
187 
188  var_values[VAR_IW] =
189  var_values[VAR_IN_W] = ctx->inputs[0]->w;
190 
191  var_values[VAR_IH] =
192  var_values[VAR_IN_H] = ctx->inputs[0]->h;
193 
194  var_values[VAR_A] = (double)var_values[VAR_IN_W] / var_values[VAR_IN_H];
195  var_values[VAR_SAR] = ctx->inputs[0]->sample_aspect_ratio.num ?
196  (double)ctx->inputs[0]->sample_aspect_ratio.num / ctx->inputs[0]->sample_aspect_ratio.den : 1;
197  var_values[VAR_DAR] = var_values[VAR_A] * var_values[VAR_SAR];
198 
199  /* crop params */
200  CALC_EXPR(cw_expr, var_values[VAR_CW], vpp->crop_w, var_values[VAR_IW]);
201  CALC_EXPR(ch_expr, var_values[VAR_CH], vpp->crop_h, var_values[VAR_IH]);
202 
203  /* calc again in case cw is relative to ch */
204  CALC_EXPR(cw_expr, var_values[VAR_CW], vpp->crop_w, var_values[VAR_IW]);
205 
206  CALC_EXPR(w_expr,
207  var_values[VAR_OUT_W] = var_values[VAR_OW] = var_values[VAR_W],
208  vpp->out_width, var_values[VAR_CW]);
209  CALC_EXPR(h_expr,
210  var_values[VAR_OUT_H] = var_values[VAR_OH] = var_values[VAR_H],
211  vpp->out_height, var_values[VAR_CH]);
212 
213  /* calc again in case ow is relative to oh */
214  CALC_EXPR(w_expr,
215  var_values[VAR_OUT_W] = var_values[VAR_OW] = var_values[VAR_W],
216  vpp->out_width, var_values[VAR_CW]);
217 
218  CALC_EXPR(cx_expr, var_values[VAR_CX], vpp->crop_x, (var_values[VAR_IW] - var_values[VAR_OW]) / 2);
219  CALC_EXPR(cy_expr, var_values[VAR_CY], vpp->crop_y, (var_values[VAR_IH] - var_values[VAR_OH]) / 2);
220 
221  /* calc again in case cx is relative to cy */
222  CALC_EXPR(cx_expr, var_values[VAR_CX], vpp->crop_x, (var_values[VAR_IW] - var_values[VAR_OW]) / 2);
223 
224  if ((vpp->crop_w != var_values[VAR_IW]) || (vpp->crop_h != var_values[VAR_IH]))
225  vpp->use_crop = 1;
226 
227 release:
228  av_expr_free(w_expr);
229  av_expr_free(h_expr);
230  av_expr_free(cw_expr);
231  av_expr_free(ch_expr);
232  av_expr_free(cx_expr);
233  av_expr_free(cy_expr);
234 #undef PASS_EXPR
235 #undef CALC_EXPR
236 
237  return ret;
238 }
239 
241 {
242  VPPContext *vpp = ctx->priv;
243  /* For AV_OPT_TYPE_STRING options, NULL is handled in other way so
244  * we needn't set default value here
245  */
246  vpp->saturation = 1.0;
247  vpp->contrast = 1.0;
248  vpp->transpose = -1;
249 
254 
255  vpp->has_passthrough = 1;
256 
257  return 0;
258 }
259 
261 {
262  VPPContext *vpp = ctx->priv;
263 
264  if (!vpp->output_format_str || !strcmp(vpp->output_format_str, "same")) {
266  } else {
268  if (vpp->out_format == AV_PIX_FMT_NONE) {
269  av_log(ctx, AV_LOG_ERROR, "Unrecognized output pixel format: %s\n", vpp->output_format_str);
270  return AVERROR(EINVAL);
271  }
272  }
273 
274 #define STRING_OPTION(var_name, func_name, default_value) do { \
275  if (vpp->var_name ## _str) { \
276  int var = av_ ## func_name ## _from_name(vpp->var_name ## _str); \
277  if (var < 0) { \
278  av_log(ctx, AV_LOG_ERROR, "Invalid %s.\n", #var_name); \
279  return AVERROR(EINVAL); \
280  } \
281  vpp->var_name = var; \
282  } else { \
283  vpp->var_name = default_value; \
284  } \
285  } while (0)
286 
288  STRING_OPTION(color_transfer, color_transfer, AVCOL_TRC_UNSPECIFIED);
289  STRING_OPTION(color_matrix, color_space, AVCOL_SPC_UNSPECIFIED);
290 
291 #undef STRING_OPTION
292  return 0;
293 }
294 
296 {
297  AVFilterContext *ctx = inlink->dst;
298  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 = inl->frame_rate;
305 
306  if (vpp->deinterlace && vpp->field_rate)
307  vpp->framerate = av_mul_q(inl->frame_rate,
308  (AVRational){ 2, 1 });
309  }
310 
311  if (av_cmp_q(vpp->framerate, inl->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 FilterLink *l = ff_filter_link(ctx->inputs[0]);
368  AVBufferRef *device_ref;
369  AVHWDeviceContext *device_ctx;
370  AVQSVDeviceContext *device_hwctx;
371 
372  if (l->hw_frames_ctx) {
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  FilterLink *outl = ff_filter_link(outlink);
528  AVFilterContext *ctx = outlink->src;
529  VPPContext *vpp = ctx->priv;
530  QSVVPPParam param = { NULL };
531  QSVVPPCrop crop = { 0 };
532  mfxExtBuffer *ext_buf[ENH_FILTERS_COUNT];
533  mfxVersion mfx_version;
534  AVFilterLink *inlink = ctx->inputs[0];
536  FilterLink *ol = ff_filter_link(outlink);
537  enum AVPixelFormat in_format;
538 
539  outlink->w = vpp->out_width;
540  outlink->h = vpp->out_height;
541  ol->frame_rate = vpp->framerate;
542  if (vpp->framerate.num == 0 || vpp->framerate.den == 0)
543  outlink->time_base = inlink->time_base;
544  else
545  outlink->time_base = av_inv_q(vpp->framerate);
546 
547  param.filter_frame = NULL;
549  param.num_ext_buf = 0;
550  param.ext_buf = ext_buf;
551 
552  if (get_mfx_version(ctx, &mfx_version) != MFX_ERR_NONE) {
553  av_log(ctx, AV_LOG_ERROR, "Failed to query mfx version.\n");
554  return AVERROR(EINVAL);
555  }
556 
557  if (inlink->format == AV_PIX_FMT_QSV) {
558  if (!inl->hw_frames_ctx || !inl->hw_frames_ctx->data)
559  return AVERROR(EINVAL);
560  else
561  in_format = ((AVHWFramesContext*)inl->hw_frames_ctx->data)->sw_format;
562  } else
563  in_format = inlink->format;
564 
565  if (vpp->out_format == AV_PIX_FMT_NONE)
566  vpp->out_format = in_format;
567  param.out_sw_format = vpp->out_format;
568 
569  if (vpp->use_crop) {
570  crop.in_idx = 0;
571  crop.x = vpp->crop_x;
572  crop.y = vpp->crop_y;
573  crop.w = vpp->crop_w;
574  crop.h = vpp->crop_h;
575 
576  param.num_crop = 1;
577  param.crop = &crop;
578  }
579 
580 #define INIT_MFX_EXTBUF(extbuf, id) do { \
581  memset(&vpp->extbuf, 0, sizeof(vpp->extbuf)); \
582  vpp->extbuf.Header.BufferId = id; \
583  vpp->extbuf.Header.BufferSz = sizeof(vpp->extbuf); \
584  param.ext_buf[param.num_ext_buf++] = (mfxExtBuffer*)&vpp->extbuf; \
585  } while (0)
586 
587 #define SET_MFX_PARAM_FIELD(extbuf, field, value) do { \
588  vpp->extbuf.field = value; \
589  } while (0)
590 
591  if (vpp->deinterlace) {
592  INIT_MFX_EXTBUF(deinterlace_conf, MFX_EXTBUFF_VPP_DEINTERLACING);
593  SET_MFX_PARAM_FIELD(deinterlace_conf, Mode, (vpp->deinterlace == 1 ?
594  MFX_DEINTERLACING_BOB : MFX_DEINTERLACING_ADVANCED));
595  }
596 
597  if (vpp->use_frc) {
598  INIT_MFX_EXTBUF(frc_conf, MFX_EXTBUFF_VPP_FRAME_RATE_CONVERSION);
599  SET_MFX_PARAM_FIELD(frc_conf, Algorithm, MFX_FRCALGM_DISTRIBUTED_TIMESTAMP);
600  }
601 
602  if (vpp->denoise) {
603  INIT_MFX_EXTBUF(denoise_conf, MFX_EXTBUFF_VPP_DENOISE);
604  SET_MFX_PARAM_FIELD(denoise_conf, DenoiseFactor, vpp->denoise);
605  }
606 
607  if (vpp->detail) {
608  INIT_MFX_EXTBUF(detail_conf, MFX_EXTBUFF_VPP_DETAIL);
609  SET_MFX_PARAM_FIELD(detail_conf, DetailFactor, vpp->detail);
610  }
611 
612  if (vpp->procamp) {
613  INIT_MFX_EXTBUF(procamp_conf, MFX_EXTBUFF_VPP_PROCAMP);
614  SET_MFX_PARAM_FIELD(procamp_conf, Hue, vpp->hue);
615  SET_MFX_PARAM_FIELD(procamp_conf, Saturation, vpp->saturation);
616  SET_MFX_PARAM_FIELD(procamp_conf, Contrast, vpp->contrast);
617  SET_MFX_PARAM_FIELD(procamp_conf, Brightness, vpp->brightness);
618  }
619 
620  if (vpp->transpose >= 0) {
621  if (QSV_RUNTIME_VERSION_ATLEAST(mfx_version, 1, 17)) {
622  switch (vpp->transpose) {
624  vpp->rotate = MFX_ANGLE_270;
625  vpp->hflip = MFX_MIRRORING_HORIZONTAL;
626  break;
627  case TRANSPOSE_CLOCK:
628  vpp->rotate = MFX_ANGLE_90;
629  vpp->hflip = MFX_MIRRORING_DISABLED;
630  break;
631  case TRANSPOSE_CCLOCK:
632  vpp->rotate = MFX_ANGLE_270;
633  vpp->hflip = MFX_MIRRORING_DISABLED;
634  break;
636  vpp->rotate = MFX_ANGLE_90;
637  vpp->hflip = MFX_MIRRORING_HORIZONTAL;
638  break;
639  case TRANSPOSE_REVERSAL:
640  vpp->rotate = MFX_ANGLE_180;
641  vpp->hflip = MFX_MIRRORING_DISABLED;
642  break;
643  case TRANSPOSE_HFLIP:
644  vpp->rotate = MFX_ANGLE_0;
645  vpp->hflip = MFX_MIRRORING_HORIZONTAL;
646  break;
647  case TRANSPOSE_VFLIP:
648  vpp->rotate = MFX_ANGLE_180;
649  vpp->hflip = MFX_MIRRORING_HORIZONTAL;
650  break;
651  default:
652  av_log(ctx, AV_LOG_ERROR, "Failed to set transpose mode to %d.\n", vpp->transpose);
653  return AVERROR(EINVAL);
654  }
655  } else {
656  av_log(ctx, AV_LOG_WARNING, "The QSV VPP transpose option is "
657  "not supported with this MSDK version.\n");
658  vpp->transpose = 0;
659  }
660  }
661 
662  if (vpp->rotate) {
663  if (QSV_RUNTIME_VERSION_ATLEAST(mfx_version, 1, 17)) {
664  INIT_MFX_EXTBUF(rotation_conf, MFX_EXTBUFF_VPP_ROTATION);
665  SET_MFX_PARAM_FIELD(rotation_conf, Angle, vpp->rotate);
666 
667  if (MFX_ANGLE_90 == vpp->rotate || MFX_ANGLE_270 == vpp->rotate) {
668  FFSWAP(int, vpp->out_width, vpp->out_height);
669  FFSWAP(int, outlink->w, outlink->h);
670  av_log(ctx, AV_LOG_DEBUG, "Swap width and height for clock/cclock rotation.\n");
671  }
672  } else {
673  av_log(ctx, AV_LOG_WARNING, "The QSV VPP rotate option is "
674  "not supported with this MSDK version.\n");
675  vpp->rotate = 0;
676  }
677  }
678 
679  if (vpp->hflip) {
680  if (QSV_RUNTIME_VERSION_ATLEAST(mfx_version, 1, 19)) {
681  INIT_MFX_EXTBUF(mirroring_conf, MFX_EXTBUFF_VPP_MIRRORING);
682  SET_MFX_PARAM_FIELD(mirroring_conf, Type, vpp->hflip);
683  } else {
684  av_log(ctx, AV_LOG_WARNING, "The QSV VPP hflip option is "
685  "not supported with this MSDK version.\n");
686  vpp->hflip = 0;
687  }
688  }
689 
690  if (inlink->w != outlink->w || inlink->h != outlink->h || in_format != vpp->out_format) {
691  if (QSV_RUNTIME_VERSION_ATLEAST(mfx_version, 1, 19)) {
692  int mode = vpp->scale_mode;
693 
694 #if QSV_ONEVPL
695  if (mode > 2)
696  mode = MFX_SCALING_MODE_VENDOR + mode - 2;
697 #endif
698 
699  INIT_MFX_EXTBUF(scale_conf, MFX_EXTBUFF_VPP_SCALING);
700  SET_MFX_PARAM_FIELD(scale_conf, ScalingMode, mode);
701  } else
702  av_log(ctx, AV_LOG_WARNING, "The QSV VPP Scale & format conversion "
703  "option is not supported with this MSDK version.\n");
704  }
705 
706 #undef INIT_MFX_EXTBUF
707 #undef SET_MFX_PARAM_FIELD
708 
709  if (vpp->use_frc || vpp->use_crop || vpp->deinterlace || vpp->denoise ||
710  vpp->detail || vpp->procamp || vpp->rotate || vpp->hflip ||
711  inlink->w != outlink->w || inlink->h != outlink->h || in_format != vpp->out_format ||
716  vpp->tonemap ||
717  !vpp->has_passthrough)
718  return ff_qsvvpp_init(ctx, &param);
719  else {
720  /* No MFX session is created in this case */
721  av_log(ctx, AV_LOG_VERBOSE, "qsv vpp pass through mode.\n");
722  if (inl->hw_frames_ctx)
724  }
725 
726  return 0;
727 }
728 
730 {
731  AVFilterLink *inlink = ctx->inputs[0];
732  AVFilterLink *outlink = ctx->outputs[0];
733  QSVVPPContext *qsv = ctx->priv;
734  AVFrame *in = NULL;
735  int ret, status = 0;
737 
739 
740  if (!qsv->eof) {
742  if (ret < 0)
743  return ret;
744 
746  if (status == AVERROR_EOF) {
747  qsv->eof = 1;
748  }
749  }
750  }
751 
752  if (qsv->session) {
753  if (in || qsv->eof) {
754  ret = ff_qsvvpp_filter_frame(qsv, inlink, in, in);
755  av_frame_free(&in);
756  if (ret == AVERROR(EAGAIN))
757  goto not_ready;
758  else if (ret < 0)
759  return ret;
760 
761  if (qsv->eof)
762  goto eof;
763 
764  if (qsv->got_frame) {
765  qsv->got_frame = 0;
766  return 0;
767  }
768  }
769  } else {
770  /* No MFX session is created in pass-through mode */
771  if (in) {
772  FilterLink *ol = ff_filter_link(outlink);
773  if (in->pts != AV_NOPTS_VALUE)
774  in->pts = av_rescale_q(in->pts, inlink->time_base, outlink->time_base);
775 
776  if (ol->frame_rate.num && ol->frame_rate.den)
777  in->duration = av_rescale_q(1, av_inv_q(ol->frame_rate), outlink->time_base);
778  else
779  in->duration = 0;
780 
781  ret = ff_filter_frame(outlink, in);
782  if (ret < 0)
783  return ret;
784 
785  if (qsv->eof)
786  goto eof;
787 
788  return 0;
789  }
790  }
791 
792 not_ready:
793  if (qsv->eof)
794  goto eof;
795 
797 
798  return FFERROR_NOT_READY;
799 
800 eof:
801  pts = av_rescale_q(pts, inlink->time_base, outlink->time_base);
802  ff_outlink_set_status(outlink, status, pts);
803  return 0;
804 }
805 
807 {
809 }
810 
811 static const AVFilterPad vpp_inputs[] = {
812  {
813  .name = "default",
814  .type = AVMEDIA_TYPE_VIDEO,
815  .config_props = config_input,
816  .get_buffer.video = ff_qsvvpp_get_video_buffer,
817  },
818 };
819 
820 static const AVFilterPad vpp_outputs[] = {
821  {
822  .name = "default",
823  .type = AVMEDIA_TYPE_VIDEO,
824  .config_props = config_output,
825  },
826 };
827 
828 #define DEFINE_QSV_FILTER(x, sn, ln, fmts) \
829 static const AVClass x##_class = { \
830  .class_name = #sn "_qsv", \
831  .item_name = av_default_item_name, \
832  .option = x##_options, \
833  .version = LIBAVUTIL_VERSION_INT, \
834 }; \
835 const AVFilter ff_vf_##sn##_qsv = { \
836  .name = #sn "_qsv", \
837  .description = NULL_IF_CONFIG_SMALL("Quick Sync Video " #ln), \
838  .preinit = x##_preinit, \
839  .init = vpp_init, \
840  .uninit = vpp_uninit, \
841  .priv_size = sizeof(VPPContext), \
842  .priv_class = &x##_class, \
843  FILTER_INPUTS(vpp_inputs), \
844  FILTER_OUTPUTS(vpp_outputs), \
845  fmts, \
846  .activate = activate, \
847  .flags_internal = FF_FILTER_FLAG_HWFRAME_AWARE, \
848  .flags = AVFILTER_FLAG_HWDEVICE, \
849 };
850 
851 #if CONFIG_VPP_QSV_FILTER
852 
853 static const AVOption vpp_options[] = {
854  { "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" },
855  { "bob", "Bob deinterlace mode.", 0, AV_OPT_TYPE_CONST, { .i64 = MFX_DEINTERLACING_BOB }, .flags = FLAGS, .unit = "deinterlace" },
856  { "advanced", "Advanced deinterlace mode. ", 0, AV_OPT_TYPE_CONST, { .i64 = MFX_DEINTERLACING_ADVANCED }, .flags = FLAGS, .unit = "deinterlace" },
857 
858  { "denoise", "denoise level [0, 100]", OFFSET(denoise), AV_OPT_TYPE_INT, { .i64 = 0 }, 0, 100, .flags = FLAGS },
859  { "detail", "enhancement level [0, 100]", OFFSET(detail), AV_OPT_TYPE_INT, { .i64 = 0 }, 0, 100, .flags = FLAGS },
860  { "framerate", "output framerate", OFFSET(framerate), AV_OPT_TYPE_RATIONAL, { .dbl = 0.0 },0, DBL_MAX, .flags = FLAGS },
861  { "procamp", "Enable ProcAmp", OFFSET(procamp), AV_OPT_TYPE_INT, { .i64 = 0 }, 0, 1, .flags = FLAGS},
862  { "hue", "ProcAmp hue", OFFSET(hue), AV_OPT_TYPE_FLOAT, { .dbl = 0.0 }, -180.0, 180.0, .flags = FLAGS},
863  { "saturation", "ProcAmp saturation", OFFSET(saturation), AV_OPT_TYPE_FLOAT, { .dbl = 1.0 }, 0.0, 10.0, .flags = FLAGS},
864  { "contrast", "ProcAmp contrast", OFFSET(contrast), AV_OPT_TYPE_FLOAT, { .dbl = 1.0 }, 0.0, 10.0, .flags = FLAGS},
865  { "brightness", "ProcAmp brightness", OFFSET(brightness), AV_OPT_TYPE_FLOAT, { .dbl = 0.0 }, -100.0, 100.0, .flags = FLAGS},
866 
867  { "transpose", "set transpose direction", OFFSET(transpose), AV_OPT_TYPE_INT, { .i64 = -1 }, -1, 6, FLAGS, .unit = "transpose"},
868  { "cclock_hflip", "rotate counter-clockwise with horizontal flip", 0, AV_OPT_TYPE_CONST, { .i64 = TRANSPOSE_CCLOCK_FLIP }, .flags=FLAGS, .unit = "transpose" },
869  { "clock", "rotate clockwise", 0, AV_OPT_TYPE_CONST, { .i64 = TRANSPOSE_CLOCK }, .flags=FLAGS, .unit = "transpose" },
870  { "cclock", "rotate counter-clockwise", 0, AV_OPT_TYPE_CONST, { .i64 = TRANSPOSE_CCLOCK }, .flags=FLAGS, .unit = "transpose" },
871  { "clock_hflip", "rotate clockwise with horizontal flip", 0, AV_OPT_TYPE_CONST, { .i64 = TRANSPOSE_CLOCK_FLIP }, .flags=FLAGS, .unit = "transpose" },
872  { "reversal", "rotate by half-turn", 0, AV_OPT_TYPE_CONST, { .i64 = TRANSPOSE_REVERSAL }, .flags=FLAGS, .unit = "transpose" },
873  { "hflip", "flip horizontally", 0, AV_OPT_TYPE_CONST, { .i64 = TRANSPOSE_HFLIP }, .flags=FLAGS, .unit = "transpose" },
874  { "vflip", "flip vertically", 0, AV_OPT_TYPE_CONST, { .i64 = TRANSPOSE_VFLIP }, .flags=FLAGS, .unit = "transpose" },
875 
876  { "cw", "set the width crop area expression", OFFSET(cw), AV_OPT_TYPE_STRING, { .str = "iw" }, 0, 0, FLAGS },
877  { "ch", "set the height crop area expression", OFFSET(ch), AV_OPT_TYPE_STRING, { .str = "ih" }, 0, 0, FLAGS },
878  { "cx", "set the x crop area expression", OFFSET(cx), AV_OPT_TYPE_STRING, { .str = "(in_w-out_w)/2" }, 0, 0, FLAGS },
879  { "cy", "set the y crop area expression", OFFSET(cy), AV_OPT_TYPE_STRING, { .str = "(in_h-out_h)/2" }, 0, 0, FLAGS },
880 
881  { "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 },
882  { "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 },
883  { "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 },
884  { "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 },
885  { "format", "Output pixel format", OFFSET(output_format_str), AV_OPT_TYPE_STRING, { .str = "same" }, .flags = FLAGS },
886  { "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 },
887 #if QSV_ONEVPL
888  { "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" },
889 #else
890  { "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" },
891 #endif
892  { "auto", "auto mode", 0, AV_OPT_TYPE_CONST, { .i64 = MFX_SCALING_MODE_DEFAULT}, INT_MIN, INT_MAX, FLAGS, .unit = "scale mode"},
893  { "low_power", "low power mode", 0, AV_OPT_TYPE_CONST, { .i64 = MFX_SCALING_MODE_LOWPOWER}, INT_MIN, INT_MAX, FLAGS, .unit = "scale mode"},
894  { "hq", "high quality mode", 0, AV_OPT_TYPE_CONST, { .i64 = MFX_SCALING_MODE_QUALITY}, INT_MIN, INT_MAX, FLAGS, .unit = "scale mode"},
895 #if QSV_ONEVPL
896  { "compute", "compute", 0, AV_OPT_TYPE_CONST, { .i64 = 3}, INT_MIN, INT_MAX, FLAGS, .unit = "scale mode"},
897  { "vd", "vd", 0, AV_OPT_TYPE_CONST, { .i64 = 4}, INT_MIN, INT_MAX, FLAGS, .unit = "scale mode"},
898  { "ve", "ve", 0, AV_OPT_TYPE_CONST, { .i64 = 5}, INT_MIN, INT_MAX, FLAGS, .unit = "scale mode"},
899 #endif
900 
901  { "rate", "Generate output at frame rate or field rate, available only for deinterlace mode",
902  OFFSET(field_rate), AV_OPT_TYPE_INT, { .i64 = 0 }, 0, 1, FLAGS, .unit = "rate" },
903  { "frame", "Output at frame rate (one frame of output for each field-pair)",
904  0, AV_OPT_TYPE_CONST, { .i64 = 0 }, 0, 0, FLAGS, .unit = "rate" },
905  { "field", "Output at field rate (one frame of output for each field)",
906  0, AV_OPT_TYPE_CONST, { .i64 = 1 }, 0, 0, FLAGS, .unit = "rate" },
907 
908  { "out_range", "Output color range",
910  AVCOL_RANGE_UNSPECIFIED, AVCOL_RANGE_JPEG, FLAGS, .unit = "range" },
911  { "full", "Full range",
912  0, AV_OPT_TYPE_CONST, { .i64 = AVCOL_RANGE_JPEG }, 0, 0, FLAGS, .unit = "range" },
913  { "limited", "Limited range",
914  0, AV_OPT_TYPE_CONST, { .i64 = AVCOL_RANGE_MPEG }, 0, 0, FLAGS, .unit = "range" },
915  { "jpeg", "Full range",
916  0, AV_OPT_TYPE_CONST, { .i64 = AVCOL_RANGE_JPEG }, 0, 0, FLAGS, .unit = "range" },
917  { "mpeg", "Limited range",
918  0, AV_OPT_TYPE_CONST, { .i64 = AVCOL_RANGE_MPEG }, 0, 0, FLAGS, .unit = "range" },
919  { "tv", "Limited range",
920  0, AV_OPT_TYPE_CONST, { .i64 = AVCOL_RANGE_MPEG }, 0, 0, FLAGS, .unit = "range" },
921  { "pc", "Full range",
922  0, AV_OPT_TYPE_CONST, { .i64 = AVCOL_RANGE_JPEG }, 0, 0, FLAGS, .unit = "range" },
923  { "out_color_matrix", "Output color matrix coefficient set",
924  OFFSET(color_matrix_str), AV_OPT_TYPE_STRING, { .str = NULL }, .flags = FLAGS },
925  { "out_color_primaries", "Output color primaries",
926  OFFSET(color_primaries_str), AV_OPT_TYPE_STRING, { .str = NULL }, .flags = FLAGS },
927  { "out_color_transfer", "Output color transfer characteristics",
928  OFFSET(color_transfer_str), AV_OPT_TYPE_STRING, { .str = NULL }, .flags = FLAGS },
929 
930  {"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},
931 
932  { NULL }
933 };
934 
935 static int vpp_query_formats(const AVFilterContext *ctx,
936  AVFilterFormatsConfig **cfg_in,
937  AVFilterFormatsConfig **cfg_out)
938 {
939  const VPPContext *vpp = ctx->priv;
940  int ret, i = 0;
941  static const enum AVPixelFormat in_pix_fmts[] = {
947 #if CONFIG_VAAPI
949 #endif
952  };
953  static enum AVPixelFormat out_pix_fmts[4];
954 
956  &cfg_in[0]->formats);
957  if (ret < 0)
958  return ret;
959 
960  /* User specifies the output format */
961  if (vpp->out_format == AV_PIX_FMT_NV12 ||
962  vpp->out_format == AV_PIX_FMT_P010)
963  out_pix_fmts[i++] = vpp->out_format;
964  else {
967  }
968 
971 
973  &cfg_out[0]->formats);
974 }
975 
976 DEFINE_QSV_FILTER(vpp, vpp, "VPP", FILTER_QUERY_FUNC2(vpp_query_formats));
977 
978 #endif
979 
980 #if CONFIG_SCALE_QSV_FILTER
981 
982 static const AVOption qsvscale_options[] = {
983  { "w", "Output video width(0=input video width, -1=keep input video aspect)", OFFSET(ow), AV_OPT_TYPE_STRING, { .str = "iw" }, .flags = FLAGS },
984  { "h", "Output video height(0=input video height, -1=keep input video aspect)", OFFSET(oh), AV_OPT_TYPE_STRING, { .str = "ih" }, .flags = FLAGS },
985  { "format", "Output pixel format", OFFSET(output_format_str), AV_OPT_TYPE_STRING, { .str = "same" }, .flags = FLAGS },
986 
987 #if QSV_ONEVPL
988  { "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"},
989 #else
990  { "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"},
991 #endif
992  { "low_power", "low power mode", 0, AV_OPT_TYPE_CONST, { .i64 = MFX_SCALING_MODE_LOWPOWER}, INT_MIN, INT_MAX, FLAGS, .unit = "mode"},
993  { "hq", "high quality mode", 0, AV_OPT_TYPE_CONST, { .i64 = MFX_SCALING_MODE_QUALITY}, INT_MIN, INT_MAX, FLAGS, .unit = "mode"},
994 #if QSV_ONEVPL
995  { "compute", "compute", 0, AV_OPT_TYPE_CONST, { .i64 = 3}, INT_MIN, INT_MAX, FLAGS, .unit = "mode"},
996  { "vd", "vd", 0, AV_OPT_TYPE_CONST, { .i64 = 4}, INT_MIN, INT_MAX, FLAGS, .unit = "mode"},
997  { "ve", "ve", 0, AV_OPT_TYPE_CONST, { .i64 = 5}, INT_MIN, INT_MAX, FLAGS, .unit = "mode"},
998 #endif
999 
1000  { NULL },
1001 };
1002 
1003 static av_cold int qsvscale_preinit(AVFilterContext *ctx)
1004 {
1005  VPPContext *vpp = ctx->priv;
1006 
1007  vpp_preinit(ctx);
1008  vpp->has_passthrough = 0;
1009 
1010  return 0;
1011 }
1012 
1013 DEFINE_QSV_FILTER(qsvscale, scale, "scaling and format conversion", FILTER_SINGLE_PIXFMT(AV_PIX_FMT_QSV));
1014 
1015 #endif
1016 
1017 #if CONFIG_DEINTERLACE_QSV_FILTER
1018 
1019 static const AVOption qsvdeint_options[] = {
1020  { "mode", "set deinterlace mode", OFFSET(deinterlace), AV_OPT_TYPE_INT, {.i64 = MFX_DEINTERLACING_ADVANCED}, MFX_DEINTERLACING_BOB, MFX_DEINTERLACING_ADVANCED, FLAGS, .unit = "mode"},
1021  { "bob", "bob algorithm", 0, AV_OPT_TYPE_CONST, {.i64 = MFX_DEINTERLACING_BOB}, MFX_DEINTERLACING_BOB, MFX_DEINTERLACING_ADVANCED, FLAGS, .unit = "mode"},
1022  { "advanced", "Motion adaptive algorithm", 0, AV_OPT_TYPE_CONST, {.i64 = MFX_DEINTERLACING_ADVANCED}, MFX_DEINTERLACING_BOB, MFX_DEINTERLACING_ADVANCED, FLAGS, .unit = "mode"},
1023 
1024  { NULL },
1025 };
1026 
1027 static av_cold int qsvdeint_preinit(AVFilterContext *ctx)
1028 {
1029  VPPContext *vpp = ctx->priv;
1030 
1031  vpp_preinit(ctx);
1032  vpp->has_passthrough = 0;
1033  vpp->field_rate = 1;
1034 
1035  return 0;
1036 }
1037 
1038 DEFINE_QSV_FILTER(qsvdeint, deinterlace, "deinterlacing", FILTER_SINGLE_PIXFMT(AV_PIX_FMT_QSV))
1039 
1040 #endif
formats
formats
Definition: signature.h:47
AVFrame::color_trc
enum AVColorTransferCharacteristic color_trc
Definition: frame.h:686
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:85
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:215
AVFrame::color_range
enum AVColorRange color_range
MPEG vs JPEG YUV range.
Definition: frame.h:682
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:47
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:611
OFFSET
#define OFFSET(x)
Definition: vf_vpp_qsv.c:43
VAR_CW
@ VAR_CW
Definition: vf_vpp_qsv.c:146
VPPContext::color_transfer
enum AVColorTransferCharacteristic color_transfer
Definition: vf_vpp_qsv.c:119
out
FILE * out
Definition: movenc.c:55
av_frame_get_side_data
AVFrameSideData * av_frame_get_side_data(const AVFrame *frame, enum AVFrameSideDataType type)
Definition: frame.c:980
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:1061
AVFrame::duration
int64_t duration
Duration of the frame, in the same units as pts.
Definition: frame.h:809
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:108
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
saturation
static IPT saturation(const CmsCtx *ctx, IPT ipt)
Definition: cms.c:559
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:149
int64_t
long long int64_t
Definition: coverity.c:34
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:90
VAR_CH
@ VAR_CH
Definition: vf_vpp_qsv.c:147
QSVVPPContext::session
mfxSession session
Definition: qsvvpp.h:66
AVFrame::color_primaries
enum AVColorPrimaries color_primaries
Definition: frame.h:684
VPPContext::crop_h
int crop_h
Definition: vf_vpp_qsv.c:91
VPPContext::detail
int detail
Definition: vf_vpp_qsv.c:87
av_frame_free
void av_frame_free(AVFrame **frame)
Free the frame and any dynamically allocated objects in it, e.g.
Definition: frame.c:163
QSVVPPContext::ver
mfxVersion ver
Definition: qsvvpp.h:101
AVContentLightMetadata::MaxCLL
unsigned MaxCLL
Max content light level (cd/m^2).
Definition: mastering_display_metadata.h:111
AVFrame::colorspace
enum AVColorSpace colorspace
YUV colorspace type.
Definition: frame.h:693
mode
Definition: swscale.c:52
AVFrame
This structure describes decoded (raw) audio or video data.
Definition: frame.h:403
pixdesc.h
AVFrame::pts
int64_t pts
Presentation timestamp in time_base units (time when frame should be shown to user).
Definition: frame.h:515
AVQSVDeviceContext
This struct is allocated as AVHWDeviceContext.hwctx.
Definition: hwcontext_qsv.h:35
VAR_CX
@ VAR_CX
Definition: vf_vpp_qsv.c:148
AVCOL_RANGE_JPEG
@ AVCOL_RANGE_JPEG
Full range content.
Definition: pixfmt.h:717
AVOption
AVOption.
Definition: opt.h:429
AVCOL_TRC_UNSPECIFIED
@ AVCOL_TRC_UNSPECIFIED
Definition: pixfmt.h:614
VPPContext::scale_mode
int scale_mode
Definition: vf_vpp_qsv.c:99
VPPContext::contrast
float contrast
Definition: vf_vpp_qsv.c:105
vpp_uninit
static av_cold void vpp_uninit(AVFilterContext *ctx)
Definition: vf_vpp_qsv.c:806
AV_LOG_VERBOSE
#define AV_LOG_VERBOSE
Detailed information.
Definition: log.h:225
float.h
TRANSPOSE_CLOCK_FLIP
@ TRANSPOSE_CLOCK_FLIP
Definition: transpose.h:34
VAR_OUT_H
@ VAR_OUT_H
Definition: vf_vpp_qsv.c:145
VPPContext::hue
float hue
Definition: vf_vpp_qsv.c:103
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:586
VAR_IN_H
@ VAR_IN_H
Definition: vf_vpp_qsv.c:143
AV_OPT_TYPE_RATIONAL
@ AV_OPT_TYPE_RATIONAL
Underlying C type is AVRational.
Definition: opt.h:280
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:434
formats.h
AVContentLightMetadata
Content light level needed by to transmit HDR over HDMI (CTA-861.3).
Definition: mastering_display_metadata.h:107
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:1490
VPPContext::saturation
float saturation
Definition: vf_vpp_qsv.c:104
qsvvpp.h
VAR_IN_W
@ VAR_IN_W
Definition: vf_vpp_qsv.c:142
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:95
pts
static int64_t pts
Definition: transcode_aac.c:644
PASS_EXPR
#define PASS_EXPR(e, s)
VPPContext::out_format
enum AVPixelFormat out_format
Output sw format.
Definition: vf_vpp_qsv.c:81
av_expr_free
void av_expr_free(AVExpr *e)
Free a parsed expression previously created with av_expr_parse().
Definition: eval.c:358
AVRational::num
int num
Numerator.
Definition: rational.h:59
AVFilterPad
A filter pad used for either input or output.
Definition: filters.h:38
AVHWDeviceContext
This struct aggregates all the (hardware/vendor-specific) "high-level" state, i.e.
Definition: hwcontext.h:60
VPPContext::out_width
int out_width
New dimensions.
Definition: vf_vpp_qsv.c:76
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
lrint
#define lrint
Definition: tablegen.h:53
VPPContext::crop_x
int crop_x
Definition: vf_vpp_qsv.c:92
AV_LOG_ERROR
#define AV_LOG_ERROR
Something went wrong and cannot losslessly be recovered.
Definition: log.h:209
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:84
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:424
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:55
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:123
VPPContext::color_primaries_str
char * color_primaries_str
The color properties for output.
Definition: vf_vpp_qsv.c:113
filters.h
AV_LOG_DEBUG
#define AV_LOG_DEBUG
Stuff which is only useful for libav* developers.
Definition: log.h:230
ctx
AVFormatContext * ctx
Definition: movenc.c:49
activate
static int activate(AVFilterContext *ctx)
Definition: vf_vpp_qsv.c:729
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:158
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:73
color_range
color_range
Definition: vf_selectivecolor.c:43
AVCOL_PRI_UNSPECIFIED
@ AVCOL_PRI_UNSPECIFIED
Definition: pixfmt.h:589
NAN
#define NAN
Definition: mathematics.h:115
VPPContext::has_passthrough
int has_passthrough
Definition: vf_vpp_qsv.c:122
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:940
NULL
#define NULL
Definition: coverity.c:32
ENH_FILTERS_COUNT
#define ENH_FILTERS_COUNT
Definition: vf_vpp_qsv.c:47
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:108
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:142
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:126
VPPContext::color_primaries
enum AVColorPrimaries color_primaries
Definition: vf_vpp_qsv.c:118
AVCOL_PRI_BT709
@ AVCOL_PRI_BT709
also ITU-R BT1361 / IEC 61966-2-4 / SMPTE RP 177 Annex B
Definition: pixfmt.h:588
VPPContext::qsv
QSVVPPContext qsv
Definition: vf_vpp_qsv.c:50
VPPContext::deinterlace
int deinterlace
Definition: vf_vpp_qsv.c:85
VAR_H
@ VAR_H
Definition: vf_vpp_qsv.c:145
VPPContext::deinterlace_conf
mfxExtVPPDeinterlacing deinterlace_conf
Definition: vf_vpp_qsv.c:53
VPPContext::frc_conf
mfxExtVPPFrameRateConversion frc_conf
Definition: vf_vpp_qsv.c:54
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:132
vpp_inputs
static const AVFilterPad vpp_inputs[]
Definition: vf_vpp_qsv.c:811
VPPContext::denoise
int denoise
Definition: vf_vpp_qsv.c:86
DEFINE_QSV_FILTER
#define DEFINE_QSV_FILTER(x, sn, ln, fmts)
Definition: vf_vpp_qsv.c:828
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
VPPContext
Definition: vf_vpp_qsv.c:49
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:1437
AVCOL_RANGE_UNSPECIFIED
@ AVCOL_RANGE_UNSPECIFIED
Definition: pixfmt.h:683
AVFilterFormatsConfig
Lists of formats / etc.
Definition: avfilter.h:111
ff_filter_link
static FilterLink * ff_filter_link(AVFilterLink *link)
Definition: filters.h:197
VPPContext::ow
char * ow
Definition: vf_vpp_qsv.c:109
VPPContext::hflip
int hflip
Definition: vf_vpp_qsv.c:97
VPPContext::scale_conf
mfxExtVPPScaling scale_conf
Definition: vf_vpp_qsv.c:60
color_primaries
static const AVColorPrimariesDesc color_primaries[AVCOL_PRI_NB]
Definition: csp.c:76
eval.h
ff_qsvvpp_filter_frame
int ff_qsvvpp_filter_frame(QSVVPPContext *s, AVFilterLink *inlink, AVFrame *picref, AVFrame *propref)
Definition: qsvvpp.c:964
VAR_OH
@ VAR_OH
Definition: vf_vpp_qsv.c:145
VAR_W
@ VAR_W
Definition: vf_vpp_qsv.c:144
config_input
static int config_input(AVFilterLink *inlink)
Definition: vf_vpp_qsv.c:295
VPPContext::rotate
int rotate
Definition: vf_vpp_qsv.c:96
VPPContext::tonemap
int tonemap
Definition: vf_vpp_qsv.c:124
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:144
AVFrameSideData::data
uint8_t * data
Definition: frame.h:267
VPPContext::output_format_str
char * output_format_str
Definition: vf_vpp_qsv.c:110
VAR_VARS_NB
@ VAR_VARS_NB
Definition: vf_vpp_qsv.c:152
VPPContext::ch
char * ch
Definition: vf_vpp_qsv.c:108
VPPContext::procamp_conf
mfxExtVPPProcAmp procamp_conf
Definition: vf_vpp_qsv.c:57
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:1046
AV_PIX_FMT_RGB32
#define AV_PIX_FMT_RGB32
Definition: pixfmt.h:475
FF_FILTER_FORWARD_WANTED
FF_FILTER_FORWARD_WANTED(outlink, inlink)
AVCOL_TRC_BT709
@ AVCOL_TRC_BT709
also ITU-R BT1361
Definition: pixfmt.h:613
QSVVPPContext::eof
int eof
Definition: qsvvpp.h:97
AV_OPT_TYPE_FLOAT
@ AV_OPT_TYPE_FLOAT
Underlying C type is float.
Definition: opt.h:271
denoise
#define denoise(...)
Definition: vf_hqdn3d.c:157
hwcontext_qsv.h
QSVVPPFrameParam::num_ext_buf
int num_ext_buf
Definition: qsvvpp.h:59
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:256
VAR_A
@ VAR_A
Definition: vf_vpp_qsv.c:150
AVColorSpace
AVColorSpace
YUV colorspace type.
Definition: pixfmt.h:640
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:116
FILTER_QUERY_FUNC2
#define FILTER_QUERY_FUNC2(func)
Definition: filters.h:239
FFMIN
#define FFMIN(a, b)
Definition: macros.h:49
VPPContext::color_matrix_str
char * color_matrix_str
Definition: vf_vpp_qsv.c:115
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:748
VPPContext::crop_y
int crop_y
Definition: vf_vpp_qsv.c:93
VPPContext::framerate
AVRational framerate
Definition: vf_vpp_qsv.c:83
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: filters.h:44
VPPContext::out_height
int out_height
Definition: vf_vpp_qsv.c:77
AVCOL_SPC_UNSPECIFIED
@ AVCOL_SPC_UNSPECIFIED
Definition: pixfmt.h:643
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:260
AVCOL_RANGE_MPEG
@ AVCOL_RANGE_MPEG
Narrow or limited range content.
Definition: pixfmt.h:700
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:115
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:151
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:3102
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:109
TRANSPOSE_CCLOCK_FLIP
@ TRANSPOSE_CCLOCK_FLIP
Definition: transpose.h:31
status
ov_status_e status
Definition: dnn_backend_openvino.c:100
eval_expr
static int eval_expr(AVFilterContext *ctx)
Definition: vf_vpp_qsv.c:155
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:72
AV_OPT_TYPE_INT
@ AV_OPT_TYPE_INT
Underlying C type is int.
Definition: opt.h:259
avfilter.h
vpp_preinit
static av_cold int vpp_preinit(AVFilterContext *ctx)
Definition: vf_vpp_qsv.c:240
VPPContext::use_crop
int use_crop
Definition: vf_vpp_qsv.c:89
transpose.h
VPPContext::color_transfer_str
char * color_transfer_str
Definition: vf_vpp_qsv.c:114
VAR_DAR
@ VAR_DAR
Definition: vf_vpp_qsv.c:150
TRANSPOSE_REVERSAL
@ TRANSPOSE_REVERSAL
Definition: transpose.h:35
VPPContext::cy
char * cy
Definition: vf_vpp_qsv.c:108
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:457
TRANSPOSE_VFLIP
@ TRANSPOSE_VFLIP
Definition: transpose.h:37
AV_PIX_FMT_P010
#define AV_PIX_FMT_P010
Definition: pixfmt.h:552
VPPContext::color_range
int color_range
Definition: vf_vpp_qsv.c:117
AVMEDIA_TYPE_VIDEO
@ AVMEDIA_TYPE_VIDEO
Definition: avutil.h:201
QSVVPPFrameParam::ext_buf
mfxExtBuffer ** ext_buf
Definition: qsvvpp.h:60
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:127
AVFrameSideData
Structure to hold side data for an AVFrame.
Definition: frame.h:265
VPPContext::mirroring_conf
mfxExtVPPMirroring mirroring_conf
Definition: vf_vpp_qsv.c:59
scale
static void scale(int *out, const int *in, const int w, const int h, const int shift)
Definition: intra.c:291
AVContentLightMetadata::MaxFALL
unsigned MaxFALL
Max average light level per frame (cd/m^2).
Definition: mastering_display_metadata.h:116
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:120
AV_OPT_TYPE_STRING
@ AV_OPT_TYPE_STRING
Underlying C type is a uint8_t* that is either NULL or points to a C string allocated with the av_mal...
Definition: opt.h:276
transpose
#define transpose(x)
VAR_IH
@ VAR_IH
Definition: vf_vpp_qsv.c:143
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:642
VAR_OW
@ VAR_OW
Definition: vf_vpp_qsv.c:144
AV_OPT_TYPE_CONST
@ AV_OPT_TYPE_CONST
Special option type for declaring named constants.
Definition: opt.h:299
FILTER_SINGLE_PIXFMT
#define FILTER_SINGLE_PIXFMT(pix_fmt_)
Definition: filters.h:252
VPPContext::brightness
float brightness
Definition: vf_vpp_qsv.c:106
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:102
QSVVPPParam::ext_buf
mfxExtBuffer ** ext_buf
Definition: qsvvpp.h:117
vpp_outputs
static const AVFilterPad vpp_outputs[]
Definition: vf_vpp_qsv.c:820