FFmpeg
vf_libplacebo.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 #include "libavutil/file.h"
20 #include "libavutil/opt.h"
21 #include "internal.h"
22 #include "vulkan_filter.h"
23 #include "scale_eval.h"
24 
25 #include <libplacebo/renderer.h>
26 #include <libplacebo/utils/libav.h>
27 #include <libplacebo/vulkan.h>
28 
29 enum {
41 };
42 
43 static const struct pl_tone_map_function * const tonemapping_funcs[TONE_MAP_COUNT] = {
44  [TONE_MAP_AUTO] = &pl_tone_map_auto,
45  [TONE_MAP_CLIP] = &pl_tone_map_clip,
46  [TONE_MAP_BT2390] = &pl_tone_map_bt2390,
47  [TONE_MAP_BT2446A] = &pl_tone_map_bt2446a,
48  [TONE_MAP_SPLINE] = &pl_tone_map_spline,
49  [TONE_MAP_REINHARD] = &pl_tone_map_reinhard,
50  [TONE_MAP_MOBIUS] = &pl_tone_map_mobius,
51  [TONE_MAP_HABLE] = &pl_tone_map_hable,
52  [TONE_MAP_GAMMA] = &pl_tone_map_gamma,
53  [TONE_MAP_LINEAR] = &pl_tone_map_linear,
54 };
55 
56 typedef struct LibplaceboContext {
57  /* lavfi vulkan*/
60 
61  /* libplacebo */
62  pl_log log;
63  pl_vulkan vulkan;
64  pl_gpu gpu;
65  pl_renderer renderer;
66 
67  /* settings */
69  char *w_expr;
70  char *h_expr;
81  int color_trc;
82 
83  /* pl_render_params */
84  char *upscaler;
85  char *downscaler;
87  float antiringing;
88  int sigmoid;
89  int skip_aa;
90  float polar_cutoff;
96 
97  /* pl_deband_params */
98  int deband;
103 
104  /* pl_color_adjustment */
105  float brightness;
106  float contrast;
107  float saturation;
108  float hue;
109  float gamma;
110 
111  /* pl_peak_detect_params */
113  float smoothing;
114  float min_peak;
115  float scene_low;
116  float scene_high;
117  float overshoot;
118 
119  /* pl_color_map_params */
120  int intent;
126  float crosstalk;
128  /* for backwards compatibility */
129  float desat_str;
130  float desat_exp;
133 
134  /* pl_dither_params */
138 
139  /* pl_cone_params */
140  int cones;
141  float cone_str;
142 
143  /* custom shaders */
144  char *shader_path;
145  void *shader_bin;
147  const struct pl_hook *hooks[2];
150 
151 static inline enum pl_log_level get_log_level(void)
152 {
153  int av_lev = av_log_get_level();
154  return av_lev >= AV_LOG_TRACE ? PL_LOG_TRACE :
155  av_lev >= AV_LOG_DEBUG ? PL_LOG_DEBUG :
156  av_lev >= AV_LOG_VERBOSE ? PL_LOG_INFO :
157  av_lev >= AV_LOG_WARNING ? PL_LOG_WARN :
158  av_lev >= AV_LOG_ERROR ? PL_LOG_ERR :
159  av_lev >= AV_LOG_FATAL ? PL_LOG_FATAL :
160  PL_LOG_NONE;
161 }
162 
163 static void pl_av_log(void *log_ctx, enum pl_log_level level, const char *msg)
164 {
165  int av_lev;
166 
167  switch (level) {
168  case PL_LOG_FATAL: av_lev = AV_LOG_FATAL; break;
169  case PL_LOG_ERR: av_lev = AV_LOG_ERROR; break;
170  case PL_LOG_WARN: av_lev = AV_LOG_WARNING; break;
171  case PL_LOG_INFO: av_lev = AV_LOG_VERBOSE; break;
172  case PL_LOG_DEBUG: av_lev = AV_LOG_DEBUG; break;
173  case PL_LOG_TRACE: av_lev = AV_LOG_TRACE; break;
174  default: return;
175  }
176 
177  av_log(log_ctx, av_lev, "%s\n", msg);
178 }
179 
180 static int parse_shader(AVFilterContext *avctx, const void *shader, size_t len)
181 {
182  LibplaceboContext *s = avctx->priv;
183  const struct pl_hook *hook;
184 
185  hook = pl_mpv_user_shader_parse(s->gpu, shader, len);
186  if (!hook) {
187  av_log(s, AV_LOG_ERROR, "Failed parsing custom shader!\n");
188  return AVERROR(EINVAL);
189  }
190 
191  s->hooks[s->num_hooks++] = hook;
192  return 0;
193 }
194 
195 static int find_scaler(AVFilterContext *avctx,
196  const struct pl_filter_config **opt,
197  const char *name)
198 {
199  const struct pl_filter_preset *preset;
200  if (!strcmp(name, "help")) {
201  av_log(avctx, AV_LOG_INFO, "Available scaler presets:\n");
202  for (preset = pl_scale_filters; preset->name; preset++)
203  av_log(avctx, AV_LOG_INFO, " %s\n", preset->name);
204  return AVERROR_EXIT;
205  }
206 
207  for (preset = pl_scale_filters; preset->name; preset++) {
208  if (!strcmp(name, preset->name)) {
209  *opt = preset->filter;
210  return 0;
211  }
212  }
213 
214  av_log(avctx, AV_LOG_ERROR, "No such scaler preset '%s'.\n", name);
215  return AVERROR(EINVAL);
216 }
217 
219 {
220  LibplaceboContext *s = avctx->priv;
221 
222  /* Create libplacebo log context */
223  s->log = pl_log_create(PL_API_VER, pl_log_params(
224  .log_level = get_log_level(),
225  .log_cb = pl_av_log,
226  .log_priv = s,
227  ));
228 
229  if (!s->log)
230  return AVERROR(ENOMEM);
231 
232  /* Note: s->vulkan etc. are initialized later, when hwctx is available */
233  return 0;
234 }
235 
236 static int init_vulkan(AVFilterContext *avctx)
237 {
238  int err = 0;
239  LibplaceboContext *s = avctx->priv;
240  const AVVulkanDeviceContext *hwctx = s->vkctx.hwctx;
241  uint8_t *buf = NULL;
242  size_t buf_len;
243 
244  /* Import libavfilter vulkan context into libplacebo */
245  s->vulkan = pl_vulkan_import(s->log, pl_vulkan_import_params(
246  .instance = hwctx->inst,
247  .get_proc_addr = hwctx->get_proc_addr,
248  .phys_device = hwctx->phys_dev,
249  .device = hwctx->act_dev,
250  .extensions = hwctx->enabled_dev_extensions,
251  .num_extensions = hwctx->nb_enabled_dev_extensions,
252  .features = &hwctx->device_features,
253  .queue_graphics = {
254  .index = hwctx->queue_family_index,
255  .count = hwctx->nb_graphics_queues,
256  },
257  .queue_compute = {
258  .index = hwctx->queue_family_comp_index,
259  .count = hwctx->nb_comp_queues,
260  },
261  .queue_transfer = {
262  .index = hwctx->queue_family_tx_index,
263  .count = hwctx->nb_tx_queues,
264  },
265  /* This is the highest version created by hwcontext_vulkan.c */
266  .max_api_version = VK_API_VERSION_1_2,
267  ));
268 
269  if (!s->vulkan) {
270  av_log(s, AV_LOG_ERROR, "Failed importing vulkan device to libplacebo!\n");
271  err = AVERROR_EXTERNAL;
272  goto fail;
273  }
274 
275  /* Create the renderer */
276  s->gpu = s->vulkan->gpu;
277  s->renderer = pl_renderer_create(s->log, s->gpu);
278 
279  /* Parse the user shaders, if requested */
280  if (s->shader_bin_len)
281  RET(parse_shader(avctx, s->shader_bin, s->shader_bin_len));
282 
283  if (s->shader_path && s->shader_path[0]) {
284  RET(av_file_map(s->shader_path, &buf, &buf_len, 0, s));
285  RET(parse_shader(avctx, buf, buf_len));
286  }
287 
288  /* fall through */
289 fail:
290  if (buf)
291  av_file_unmap(buf, buf_len);
292  s->initialized = 1;
293  return err;
294 }
295 
297 {
298  LibplaceboContext *s = avctx->priv;
299 
300  for (int i = 0; i < s->num_hooks; i++)
301  pl_mpv_user_shader_destroy(&s->hooks[i]);
302  pl_renderer_destroy(&s->renderer);
303  pl_vulkan_destroy(&s->vulkan);
304  pl_log_destroy(&s->log);
305  ff_vk_uninit(&s->vkctx);
306  s->initialized = 0;
307  s->gpu = NULL;
308 }
309 
311 {
312  int err = 0, ok;
313  LibplaceboContext *s = avctx->priv;
314  struct pl_render_params params;
315  enum pl_tone_map_mode tonemapping_mode = s->tonemapping_mode;
316  enum pl_gamut_mode gamut_mode = s->gamut_mode;
317  struct pl_frame image, target;
318  ok = pl_map_avframe_ex(s->gpu, &image, pl_avframe_params(
319  .frame = in,
320  .map_dovi = s->apply_dovi,
321  ));
322 
323  ok &= pl_map_avframe_ex(s->gpu, &target, pl_avframe_params(
324  .frame = out,
325  .map_dovi = false,
326  ));
327 
328  if (!ok) {
329  err = AVERROR_EXTERNAL;
330  goto fail;
331  }
332 
333  if (!s->apply_filmgrain)
334  image.film_grain.type = PL_FILM_GRAIN_NONE;
335 
336  if (s->target_sar.num) {
337  float aspect = pl_rect2df_aspect(&target.crop) * av_q2d(s->target_sar);
338  pl_rect2df_aspect_set(&target.crop, aspect, s->pad_crop_ratio);
339  }
340 
341  /* backwards compatibility with older API */
342  if (!tonemapping_mode && (s->desat_str >= 0.0f || s->desat_exp >= 0.0f)) {
343  float str = s->desat_str < 0.0f ? 0.9f : s->desat_str;
344  float exp = s->desat_exp < 0.0f ? 0.2f : s->desat_exp;
345  if (str >= 0.9f && exp <= 0.1f) {
346  tonemapping_mode = PL_TONE_MAP_RGB;
347  } else if (str > 0.1f) {
348  tonemapping_mode = PL_TONE_MAP_HYBRID;
349  } else {
350  tonemapping_mode = PL_TONE_MAP_LUMA;
351  }
352  }
353 
354  if (s->gamut_warning)
355  gamut_mode = PL_GAMUT_WARN;
356  if (s->gamut_clipping)
357  gamut_mode = PL_GAMUT_DESATURATE;
358 
359  /* Update render params */
360  params = (struct pl_render_params) {
361  PL_RENDER_DEFAULTS
362  .lut_entries = s->lut_entries,
363  .antiringing_strength = s->antiringing,
364 
365  .deband_params = !s->deband ? NULL : pl_deband_params(
366  .iterations = s->deband_iterations,
367  .threshold = s->deband_threshold,
368  .radius = s->deband_radius,
369  .grain = s->deband_grain,
370  ),
371 
372  .sigmoid_params = s->sigmoid ? &pl_sigmoid_default_params : NULL,
373 
374  .color_adjustment = &(struct pl_color_adjustment) {
375  .brightness = s->brightness,
376  .contrast = s->contrast,
377  .saturation = s->saturation,
378  .hue = s->hue,
379  .gamma = s->gamma,
380  },
381 
382  .peak_detect_params = !s->peakdetect ? NULL : pl_peak_detect_params(
383  .smoothing_period = s->smoothing,
384  .minimum_peak = s->min_peak,
385  .scene_threshold_low = s->scene_low,
386  .scene_threshold_high = s->scene_high,
387  .overshoot_margin = s->overshoot,
388  ),
389 
390  .color_map_params = pl_color_map_params(
391  .intent = s->intent,
392  .gamut_mode = gamut_mode,
393  .tone_mapping_function = tonemapping_funcs[s->tonemapping],
394  .tone_mapping_param = s->tonemapping_param,
395  .tone_mapping_mode = tonemapping_mode,
396  .inverse_tone_mapping = s->inverse_tonemapping,
397  .tone_mapping_crosstalk = s->crosstalk,
398  .lut_size = s->tonemapping_lut_size,
399  ),
400 
401  .dither_params = s->dithering < 0 ? NULL : pl_dither_params(
402  .method = s->dithering,
403  .lut_size = s->dither_lut_size,
404  .temporal = s->dither_temporal,
405  ),
406 
407  .cone_params = !s->cones ? NULL : pl_cone_params(
408  .cones = s->cones,
409  .strength = s->cone_str,
410  ),
411 
412  .hooks = s->hooks,
413  .num_hooks = s->num_hooks,
414 
415  .skip_anti_aliasing = s->skip_aa,
416  .polar_cutoff = s->polar_cutoff,
417  .disable_linear_scaling = s->disable_linear,
418  .disable_builtin_scalers = s->disable_builtin,
419  .force_icc_lut = s->force_icc_lut,
420  .force_dither = s->force_dither,
421  .disable_fbos = s->disable_fbos,
422  };
423 
424  RET(find_scaler(avctx, &params.upscaler, s->upscaler));
425  RET(find_scaler(avctx, &params.downscaler, s->downscaler));
426 
427  pl_render_image(s->renderer, &image, &target, &params);
428  pl_unmap_avframe(s->gpu, &image);
429  pl_unmap_avframe(s->gpu, &target);
430 
431  /* Flush the command queues for performance */
432  pl_gpu_flush(s->gpu);
433  return 0;
434 
435 fail:
436  pl_unmap_avframe(s->gpu, &image);
437  pl_unmap_avframe(s->gpu, &target);
438  return err;
439 }
440 
442 {
443  int err, changed_csp;
444  AVFilterContext *ctx = link->dst;
445  LibplaceboContext *s = ctx->priv;
446  AVFilterLink *outlink = ctx->outputs[0];
447 
448  AVFrame *out = ff_get_video_buffer(outlink, outlink->w, outlink->h);
449  if (!out) {
450  err = AVERROR(ENOMEM);
451  goto fail;
452  }
453 
454  pl_log_level_update(s->log, get_log_level());
455  if (!s->initialized)
456  RET(init_vulkan(ctx));
457 
459  out->width = outlink->w;
460  out->height = outlink->h;
461 
462  if (s->apply_dovi && av_frame_get_side_data(in, AV_FRAME_DATA_DOVI_METADATA)) {
463  /* Output of dovi reshaping is always BT.2020+PQ, so infer the correct
464  * output colorspace defaults */
465  out->colorspace = AVCOL_SPC_BT2020_NCL;
466  out->color_primaries = AVCOL_PRI_BT2020;
467  out->color_trc = AVCOL_TRC_SMPTE2084;
468  }
469 
470  if (s->colorspace >= 0)
471  out->colorspace = s->colorspace;
472  if (s->color_range >= 0)
473  out->color_range = s->color_range;
474  if (s->color_trc >= 0)
475  out->color_trc = s->color_trc;
476  if (s->color_primaries >= 0)
477  out->color_primaries = s->color_primaries;
478 
479  changed_csp = in->colorspace != out->colorspace ||
480  in->color_range != out->color_range ||
481  in->color_trc != out->color_trc ||
482  in->color_primaries != out->color_primaries;
483 
484  /* Strip side data if no longer relevant */
485  if (changed_csp) {
488  }
489  if (s->apply_dovi || changed_csp) {
492  }
493  if (s->apply_filmgrain)
495 
496  RET(process_frames(ctx, out, in));
497 
498  av_frame_free(&in);
499 
500  return ff_filter_frame(outlink, out);
501 
502 fail:
503  av_frame_free(&in);
504  av_frame_free(&out);
505  return err;
506 }
507 
509 {
510  int err;
511  AVFilterContext *avctx = outlink->src;
512  LibplaceboContext *s = avctx->priv;
513  AVFilterLink *inlink = outlink->src->inputs[0];
514  AVHWFramesContext *hwfc;
515  AVVulkanFramesContext *vkfc;
516  AVRational scale_sar;
517  int *out_w = &s->vkctx.output_width;
518  int *out_h = &s->vkctx.output_height;
519 
520  RET(ff_scale_eval_dimensions(s, s->w_expr, s->h_expr, inlink, outlink,
521  out_w, out_h));
522 
523  ff_scale_adjust_dimensions(inlink, out_w, out_h,
524  s->force_original_aspect_ratio,
525  s->force_divisible_by);
526 
527  scale_sar = (AVRational){outlink->h * inlink->w, *out_w * *out_h};
528  if (inlink->sample_aspect_ratio.num)
529  scale_sar = av_mul_q(scale_sar, inlink->sample_aspect_ratio);
530 
531  if (s->normalize_sar) {
532  /* Apply all SAR during scaling, so we don't need to set the out SAR */
533  s->target_sar = scale_sar;
534  } else {
535  /* This is consistent with other scale_* filters, which only
536  * set the outlink SAR to be equal to the scale SAR iff the input SAR
537  * was set to something nonzero */
538  if (inlink->sample_aspect_ratio.num)
539  outlink->sample_aspect_ratio = scale_sar;
540  }
541 
542  if (s->out_format_string) {
543  s->vkctx.output_format = av_get_pix_fmt(s->out_format_string);
544  if (s->vkctx.output_format == AV_PIX_FMT_NONE) {
545  av_log(avctx, AV_LOG_ERROR, "Invalid output format.\n");
546  return AVERROR(EINVAL);
547  }
548  } else {
549  /* Default to re-using the input format */
550  s->vkctx.output_format = s->vkctx.input_format;
551  }
552 
554  hwfc = (AVHWFramesContext *) outlink->hw_frames_ctx->data;
555  vkfc = hwfc->hwctx;
556  vkfc->usage |= VK_IMAGE_USAGE_COLOR_ATTACHMENT_BIT;
557 
558  return 0;
559 
560 fail:
561  return err;
562 }
563 
564 #define OFFSET(x) offsetof(LibplaceboContext, x)
565 #define STATIC (AV_OPT_FLAG_FILTERING_PARAM | AV_OPT_FLAG_VIDEO_PARAM)
566 #define DYNAMIC (STATIC | AV_OPT_FLAG_RUNTIME_PARAM)
567 
568 static const AVOption libplacebo_options[] = {
569  { "w", "Output video width", OFFSET(w_expr), AV_OPT_TYPE_STRING, {.str = "iw"}, .flags = STATIC },
570  { "h", "Output video height", OFFSET(h_expr), AV_OPT_TYPE_STRING, {.str = "ih"}, .flags = STATIC },
571  { "format", "Output video format", OFFSET(out_format_string), AV_OPT_TYPE_STRING, .flags = STATIC },
572  { "force_original_aspect_ratio", "decrease or increase w/h if necessary to keep the original AR", OFFSET(force_original_aspect_ratio), AV_OPT_TYPE_INT, { .i64 = 0 }, 0, 2, STATIC, "force_oar" },
573  { "disable", NULL, 0, AV_OPT_TYPE_CONST, {.i64 = 0 }, 0, 0, STATIC, "force_oar" },
574  { "decrease", NULL, 0, AV_OPT_TYPE_CONST, {.i64 = 1 }, 0, 0, STATIC, "force_oar" },
575  { "increase", NULL, 0, AV_OPT_TYPE_CONST, {.i64 = 2 }, 0, 0, STATIC, "force_oar" },
576  { "force_divisible_by", "enforce that the output resolution is divisible by a defined integer when force_original_aspect_ratio is used", OFFSET(force_divisible_by), AV_OPT_TYPE_INT, { .i64 = 1 }, 1, 256, STATIC },
577  { "normalize_sar", "force SAR normalization to 1:1", OFFSET(normalize_sar), AV_OPT_TYPE_BOOL, {.i64 = 1}, 0, 1, STATIC },
578  { "pad_crop_ratio", "ratio between padding and cropping when normalizing SAR (0=pad, 1=crop)", OFFSET(pad_crop_ratio), AV_OPT_TYPE_FLOAT, {.dbl=0.0}, 0.0, 1.0, DYNAMIC },
579 
580  {"colorspace", "select colorspace", OFFSET(colorspace), AV_OPT_TYPE_INT, {.i64=-1}, -1, AVCOL_SPC_NB-1, DYNAMIC, "colorspace"},
581  {"auto", "keep the same colorspace", 0, AV_OPT_TYPE_CONST, {.i64=-1}, INT_MIN, INT_MAX, STATIC, "colorspace"},
582  {"gbr", NULL, 0, AV_OPT_TYPE_CONST, {.i64=AVCOL_SPC_RGB}, INT_MIN, INT_MAX, STATIC, "colorspace"},
583  {"bt709", NULL, 0, AV_OPT_TYPE_CONST, {.i64=AVCOL_SPC_BT709}, INT_MIN, INT_MAX, STATIC, "colorspace"},
584  {"unknown", NULL, 0, AV_OPT_TYPE_CONST, {.i64=AVCOL_SPC_UNSPECIFIED}, INT_MIN, INT_MAX, STATIC, "colorspace"},
585  {"bt470bg", NULL, 0, AV_OPT_TYPE_CONST, {.i64=AVCOL_SPC_BT470BG}, INT_MIN, INT_MAX, STATIC, "colorspace"},
586  {"smpte170m", NULL, 0, AV_OPT_TYPE_CONST, {.i64=AVCOL_SPC_SMPTE170M}, INT_MIN, INT_MAX, STATIC, "colorspace"},
587  {"smpte240m", NULL, 0, AV_OPT_TYPE_CONST, {.i64=AVCOL_SPC_SMPTE240M}, INT_MIN, INT_MAX, STATIC, "colorspace"},
588  {"ycgco", NULL, 0, AV_OPT_TYPE_CONST, {.i64=AVCOL_SPC_YCGCO}, INT_MIN, INT_MAX, STATIC, "colorspace"},
589  {"bt2020nc", NULL, 0, AV_OPT_TYPE_CONST, {.i64=AVCOL_SPC_BT2020_NCL}, INT_MIN, INT_MAX, STATIC, "colorspace"},
590  {"bt2020c", NULL, 0, AV_OPT_TYPE_CONST, {.i64=AVCOL_SPC_BT2020_CL}, INT_MIN, INT_MAX, STATIC, "colorspace"},
591  {"ictcp", NULL, 0, AV_OPT_TYPE_CONST, {.i64=AVCOL_SPC_ICTCP}, INT_MIN, INT_MAX, STATIC, "colorspace"},
592 
593  {"range", "select color range", OFFSET(color_range), AV_OPT_TYPE_INT, {.i64=-1}, -1, AVCOL_RANGE_NB-1, DYNAMIC, "range"},
594  {"auto", "keep the same color range", 0, AV_OPT_TYPE_CONST, {.i64=-1}, 0, 0, STATIC, "range"},
595  {"unspecified", NULL, 0, AV_OPT_TYPE_CONST, {.i64=AVCOL_RANGE_UNSPECIFIED}, 0, 0, STATIC, "range"},
596  {"unknown", NULL, 0, AV_OPT_TYPE_CONST, {.i64=AVCOL_RANGE_UNSPECIFIED}, 0, 0, STATIC, "range"},
597  {"limited", NULL, 0, AV_OPT_TYPE_CONST, {.i64=AVCOL_RANGE_MPEG}, 0, 0, STATIC, "range"},
598  {"tv", NULL, 0, AV_OPT_TYPE_CONST, {.i64=AVCOL_RANGE_MPEG}, 0, 0, STATIC, "range"},
599  {"mpeg", NULL, 0, AV_OPT_TYPE_CONST, {.i64=AVCOL_RANGE_MPEG}, 0, 0, STATIC, "range"},
600  {"full", NULL, 0, AV_OPT_TYPE_CONST, {.i64=AVCOL_RANGE_JPEG}, 0, 0, STATIC, "range"},
601  {"pc", NULL, 0, AV_OPT_TYPE_CONST, {.i64=AVCOL_RANGE_JPEG}, 0, 0, STATIC, "range"},
602  {"jpeg", NULL, 0, AV_OPT_TYPE_CONST, {.i64=AVCOL_RANGE_JPEG}, 0, 0, STATIC, "range"},
603 
604  {"color_primaries", "select color primaries", OFFSET(color_primaries), AV_OPT_TYPE_INT, {.i64=-1}, -1, AVCOL_PRI_NB-1, DYNAMIC, "color_primaries"},
605  {"auto", "keep the same color primaries", 0, AV_OPT_TYPE_CONST, {.i64=-1}, INT_MIN, INT_MAX, STATIC, "color_primaries"},
606  {"bt709", NULL, 0, AV_OPT_TYPE_CONST, {.i64=AVCOL_PRI_BT709}, INT_MIN, INT_MAX, STATIC, "color_primaries"},
607  {"unknown", NULL, 0, AV_OPT_TYPE_CONST, {.i64=AVCOL_PRI_UNSPECIFIED}, INT_MIN, INT_MAX, STATIC, "color_primaries"},
608  {"bt470m", NULL, 0, AV_OPT_TYPE_CONST, {.i64=AVCOL_PRI_BT470M}, INT_MIN, INT_MAX, STATIC, "color_primaries"},
609  {"bt470bg", NULL, 0, AV_OPT_TYPE_CONST, {.i64=AVCOL_PRI_BT470BG}, INT_MIN, INT_MAX, STATIC, "color_primaries"},
610  {"smpte170m", NULL, 0, AV_OPT_TYPE_CONST, {.i64=AVCOL_PRI_SMPTE170M}, INT_MIN, INT_MAX, STATIC, "color_primaries"},
611  {"smpte240m", NULL, 0, AV_OPT_TYPE_CONST, {.i64=AVCOL_PRI_SMPTE240M}, INT_MIN, INT_MAX, STATIC, "color_primaries"},
612  {"film", NULL, 0, AV_OPT_TYPE_CONST, {.i64=AVCOL_PRI_FILM}, INT_MIN, INT_MAX, STATIC, "color_primaries"},
613  {"bt2020", NULL, 0, AV_OPT_TYPE_CONST, {.i64=AVCOL_PRI_BT2020}, INT_MIN, INT_MAX, STATIC, "color_primaries"},
614  {"smpte428", NULL, 0, AV_OPT_TYPE_CONST, {.i64=AVCOL_PRI_SMPTE428}, INT_MIN, INT_MAX, STATIC, "color_primaries"},
615  {"smpte431", NULL, 0, AV_OPT_TYPE_CONST, {.i64=AVCOL_PRI_SMPTE431}, INT_MIN, INT_MAX, STATIC, "color_primaries"},
616  {"smpte432", NULL, 0, AV_OPT_TYPE_CONST, {.i64=AVCOL_PRI_SMPTE432}, INT_MIN, INT_MAX, STATIC, "color_primaries"},
617  {"jedec-p22", NULL, 0, AV_OPT_TYPE_CONST, {.i64=AVCOL_PRI_JEDEC_P22}, INT_MIN, INT_MAX, STATIC, "color_primaries"},
618  {"ebu3213", NULL, 0, AV_OPT_TYPE_CONST, {.i64=AVCOL_PRI_EBU3213}, INT_MIN, INT_MAX, STATIC, "color_primaries"},
619 
620  {"color_trc", "select color transfer", OFFSET(color_trc), AV_OPT_TYPE_INT, {.i64=-1}, -1, AVCOL_TRC_NB-1, DYNAMIC, "color_trc"},
621  {"auto", "keep the same color transfer", 0, AV_OPT_TYPE_CONST, {.i64=-1}, INT_MIN, INT_MAX, STATIC, "color_trc"},
622  {"bt709", NULL, 0, AV_OPT_TYPE_CONST, {.i64=AVCOL_TRC_BT709}, INT_MIN, INT_MAX, STATIC, "color_trc"},
623  {"unknown", NULL, 0, AV_OPT_TYPE_CONST, {.i64=AVCOL_TRC_UNSPECIFIED}, INT_MIN, INT_MAX, STATIC, "color_trc"},
624  {"bt470m", NULL, 0, AV_OPT_TYPE_CONST, {.i64=AVCOL_TRC_GAMMA22}, INT_MIN, INT_MAX, STATIC, "color_trc"},
625  {"bt470bg", NULL, 0, AV_OPT_TYPE_CONST, {.i64=AVCOL_TRC_GAMMA28}, INT_MIN, INT_MAX, STATIC, "color_trc"},
626  {"smpte170m", NULL, 0, AV_OPT_TYPE_CONST, {.i64=AVCOL_TRC_SMPTE170M}, INT_MIN, INT_MAX, STATIC, "color_trc"},
627  {"smpte240m", NULL, 0, AV_OPT_TYPE_CONST, {.i64=AVCOL_TRC_SMPTE240M}, INT_MIN, INT_MAX, STATIC, "color_trc"},
628  {"linear", NULL, 0, AV_OPT_TYPE_CONST, {.i64=AVCOL_TRC_LINEAR}, INT_MIN, INT_MAX, STATIC, "color_trc"},
629  {"iec61966-2-4", NULL, 0, AV_OPT_TYPE_CONST, {.i64=AVCOL_TRC_IEC61966_2_4}, INT_MIN, INT_MAX, STATIC, "color_trc"},
630  {"bt1361e", NULL, 0, AV_OPT_TYPE_CONST, {.i64=AVCOL_TRC_BT1361_ECG}, INT_MIN, INT_MAX, STATIC, "color_trc"},
631  {"iec61966-2-1", NULL, 0, AV_OPT_TYPE_CONST, {.i64=AVCOL_TRC_IEC61966_2_1}, INT_MIN, INT_MAX, STATIC, "color_trc"},
632  {"bt2020-10", NULL, 0, AV_OPT_TYPE_CONST, {.i64=AVCOL_TRC_BT2020_10}, INT_MIN, INT_MAX, STATIC, "color_trc"},
633  {"bt2020-12", NULL, 0, AV_OPT_TYPE_CONST, {.i64=AVCOL_TRC_BT2020_12}, INT_MIN, INT_MAX, STATIC, "color_trc"},
634  {"smpte2084", NULL, 0, AV_OPT_TYPE_CONST, {.i64=AVCOL_TRC_SMPTE2084}, INT_MIN, INT_MAX, STATIC, "color_trc"},
635  {"arib-std-b67", NULL, 0, AV_OPT_TYPE_CONST, {.i64=AVCOL_TRC_ARIB_STD_B67}, INT_MIN, INT_MAX, STATIC, "color_trc"},
636 
637  { "upscaler", "Upscaler function", OFFSET(upscaler), AV_OPT_TYPE_STRING, {.str = "spline36"}, .flags = DYNAMIC },
638  { "downscaler", "Downscaler function", OFFSET(downscaler), AV_OPT_TYPE_STRING, {.str = "mitchell"}, .flags = DYNAMIC },
639  { "lut_entries", "Number of scaler LUT entries", OFFSET(lut_entries), AV_OPT_TYPE_INT, {.i64 = 0}, 0, 256, DYNAMIC },
640  { "antiringing", "Antiringing strength (for non-EWA filters)", OFFSET(antiringing), AV_OPT_TYPE_FLOAT, {.dbl = 0.0}, 0.0, 1.0, DYNAMIC },
641  { "sigmoid", "Enable sigmoid upscaling", OFFSET(sigmoid), AV_OPT_TYPE_BOOL, {.i64 = 1}, 0, 1, DYNAMIC },
642  { "apply_filmgrain", "Apply film grain metadata", OFFSET(apply_filmgrain), AV_OPT_TYPE_BOOL, {.i64 = 1}, 0, 1, DYNAMIC },
643  { "apply_dolbyvision", "Apply Dolby Vision metadata", OFFSET(apply_dovi), AV_OPT_TYPE_BOOL, {.i64 = 1}, 0, 1, DYNAMIC },
644 
645  { "deband", "Enable debanding", OFFSET(deband), AV_OPT_TYPE_BOOL, {.i64 = 0}, 0, 1, DYNAMIC },
646  { "deband_iterations", "Deband iterations", OFFSET(deband_iterations), AV_OPT_TYPE_INT, {.i64 = 1}, 0, 16, DYNAMIC },
647  { "deband_threshold", "Deband threshold", OFFSET(deband_threshold), AV_OPT_TYPE_FLOAT, {.dbl = 4.0}, 0.0, 1024.0, DYNAMIC },
648  { "deband_radius", "Deband radius", OFFSET(deband_radius), AV_OPT_TYPE_FLOAT, {.dbl = 16.0}, 0.0, 1024.0, DYNAMIC },
649  { "deband_grain", "Deband grain", OFFSET(deband_grain), AV_OPT_TYPE_FLOAT, {.dbl = 6.0}, 0.0, 1024.0, DYNAMIC },
650 
651  { "brightness", "Brightness boost", OFFSET(brightness), AV_OPT_TYPE_FLOAT, {.dbl = 0.0}, -1.0, 1.0, DYNAMIC },
652  { "contrast", "Contrast gain", OFFSET(contrast), AV_OPT_TYPE_FLOAT, {.dbl = 1.0}, 0.0, 16.0, DYNAMIC },
653  { "saturation", "Saturation gain", OFFSET(saturation), AV_OPT_TYPE_FLOAT, {.dbl = 1.0}, 0.0, 16.0, DYNAMIC },
654  { "hue", "Hue shift", OFFSET(hue), AV_OPT_TYPE_FLOAT, {.dbl = 0.0}, -M_PI, M_PI, DYNAMIC },
655  { "gamma", "Gamma adjustment", OFFSET(gamma), AV_OPT_TYPE_FLOAT, {.dbl = 1.0}, 0.0, 16.0, DYNAMIC },
656 
657  { "peak_detect", "Enable dynamic peak detection for HDR tone-mapping", OFFSET(peakdetect), AV_OPT_TYPE_BOOL, {.i64 = 1}, 0, 1, DYNAMIC },
658  { "smoothing_period", "Peak detection smoothing period", OFFSET(smoothing), AV_OPT_TYPE_FLOAT, {.dbl = 100.0}, 0.0, 1000.0, DYNAMIC },
659  { "minimum_peak", "Peak detection minimum peak", OFFSET(min_peak), AV_OPT_TYPE_FLOAT, {.dbl = 1.0}, 0.0, 100.0, DYNAMIC },
660  { "scene_threshold_low", "Scene change low threshold", OFFSET(scene_low), AV_OPT_TYPE_FLOAT, {.dbl = 5.5}, -1.0, 100.0, DYNAMIC },
661  { "scene_threshold_high", "Scene change high threshold", OFFSET(scene_high), AV_OPT_TYPE_FLOAT, {.dbl = 10.0}, -1.0, 100.0, DYNAMIC },
662  { "overshoot", "Tone-mapping overshoot margin", OFFSET(overshoot), AV_OPT_TYPE_FLOAT, {.dbl = 0.05}, 0.0, 1.0, DYNAMIC },
663 
664  { "intent", "Rendering intent", OFFSET(intent), AV_OPT_TYPE_INT, {.i64 = PL_INTENT_RELATIVE_COLORIMETRIC}, 0, 3, DYNAMIC, "intent" },
665  { "perceptual", "Perceptual", 0, AV_OPT_TYPE_CONST, {.i64 = PL_INTENT_PERCEPTUAL}, 0, 0, STATIC, "intent" },
666  { "relative", "Relative colorimetric", 0, AV_OPT_TYPE_CONST, {.i64 = PL_INTENT_RELATIVE_COLORIMETRIC}, 0, 0, STATIC, "intent" },
667  { "absolute", "Absolute colorimetric", 0, AV_OPT_TYPE_CONST, {.i64 = PL_INTENT_ABSOLUTE_COLORIMETRIC}, 0, 0, STATIC, "intent" },
668  { "saturation", "Saturation mapping", 0, AV_OPT_TYPE_CONST, {.i64 = PL_INTENT_SATURATION}, 0, 0, STATIC, "intent" },
669  { "gamut_mode", "Gamut-mapping mode", OFFSET(gamut_mode), AV_OPT_TYPE_INT, {.i64 = PL_GAMUT_CLIP}, 0, PL_GAMUT_MODE_COUNT - 1, DYNAMIC, "gamut_mode" },
670  { "clip", "Hard-clip gamut boundary", 0, AV_OPT_TYPE_CONST, {.i64 = PL_GAMUT_CLIP}, 0, 0, STATIC, "gamut_mode" },
671  { "warn", "Highlight out-of-gamut colors", 0, AV_OPT_TYPE_CONST, {.i64 = PL_GAMUT_WARN}, 0, 0, STATIC, "gamut_mode" },
672  { "darken", "Darken image to fit gamut", 0, AV_OPT_TYPE_CONST, {.i64 = PL_GAMUT_DARKEN}, 0, 0, STATIC, "gamut_mode" },
673  { "desaturate", "Colorimetrically desaturate colors", 0, AV_OPT_TYPE_CONST, {.i64 = PL_GAMUT_DESATURATE}, 0, 0, STATIC, "gamut_mode" },
674  { "tonemapping", "Tone-mapping algorithm", OFFSET(tonemapping), AV_OPT_TYPE_INT, {.i64 = TONE_MAP_AUTO}, 0, TONE_MAP_COUNT - 1, DYNAMIC, "tonemap" },
675  { "auto", "Automatic selection", 0, AV_OPT_TYPE_CONST, {.i64 = TONE_MAP_AUTO}, 0, 0, STATIC, "tonemap" },
676  { "clip", "No tone mapping (clip", 0, AV_OPT_TYPE_CONST, {.i64 = TONE_MAP_CLIP}, 0, 0, STATIC, "tonemap" },
677  { "bt.2390", "ITU-R BT.2390 EETF", 0, AV_OPT_TYPE_CONST, {.i64 = TONE_MAP_BT2390}, 0, 0, STATIC, "tonemap" },
678  { "bt.2446a", "ITU-R BT.2446 Method A", 0, AV_OPT_TYPE_CONST, {.i64 = TONE_MAP_BT2446A}, 0, 0, STATIC, "tonemap" },
679  { "spline", "Single-pivot polynomial spline", 0, AV_OPT_TYPE_CONST, {.i64 = TONE_MAP_SPLINE}, 0, 0, STATIC, "tonemap" },
680  { "reinhard", "Reinhard", 0, AV_OPT_TYPE_CONST, {.i64 = TONE_MAP_REINHARD}, 0, 0, STATIC, "tonemap" },
681  { "mobius", "Mobius", 0, AV_OPT_TYPE_CONST, {.i64 = TONE_MAP_MOBIUS}, 0, 0, STATIC, "tonemap" },
682  { "hable", "Filmic tone-mapping (Hable)", 0, AV_OPT_TYPE_CONST, {.i64 = TONE_MAP_HABLE}, 0, 0, STATIC, "tonemap" },
683  { "gamma", "Gamma function with knee", 0, AV_OPT_TYPE_CONST, {.i64 = TONE_MAP_GAMMA}, 0, 0, STATIC, "tonemap" },
684  { "linear", "Perceptually linear stretch", 0, AV_OPT_TYPE_CONST, {.i64 = TONE_MAP_LINEAR}, 0, 0, STATIC, "tonemap" },
685  { "tonemapping_param", "Tunable parameter for some tone-mapping functions", OFFSET(tonemapping_param), AV_OPT_TYPE_FLOAT, {.dbl = 0.0}, 0.0, 100.0, .flags = DYNAMIC },
686  { "tonemapping_mode", "Tone-mapping mode", OFFSET(tonemapping_mode), AV_OPT_TYPE_INT, {.i64 = PL_TONE_MAP_AUTO}, 0, PL_TONE_MAP_MODE_COUNT - 1, DYNAMIC, "tonemap_mode" },
687  { "auto", "Automatic selection", 0, AV_OPT_TYPE_CONST, {.i64 = PL_TONE_MAP_AUTO}, 0, 0, STATIC, "tonemap_mode" },
688  { "rgb", "Per-channel (RGB)", 0, AV_OPT_TYPE_CONST, {.i64 = PL_TONE_MAP_RGB}, 0, 0, STATIC, "tonemap_mode" },
689  { "max", "Maximum component", 0, AV_OPT_TYPE_CONST, {.i64 = PL_TONE_MAP_MAX}, 0, 0, STATIC, "tonemap_mode" },
690  { "hybrid", "Hybrid of Luma/RGB", 0, AV_OPT_TYPE_CONST, {.i64 = PL_TONE_MAP_HYBRID}, 0, 0, STATIC, "tonemap_mode" },
691  { "luma", "Luminance", 0, AV_OPT_TYPE_CONST, {.i64 = PL_TONE_MAP_LUMA}, 0, 0, STATIC, "tonemap_mode" },
692  { "inverse_tonemapping", "Inverse tone mapping (range expansion)", OFFSET(inverse_tonemapping), AV_OPT_TYPE_BOOL, {.i64 = 0}, 0, 1, DYNAMIC },
693  { "tonemapping_crosstalk", "Crosstalk factor for tone-mapping", OFFSET(crosstalk), AV_OPT_TYPE_FLOAT, {.dbl = 0.04}, 0.0, 0.30, DYNAMIC },
694  { "tonemapping_lut_size", "Tone-mapping LUT size", OFFSET(tonemapping_lut_size), AV_OPT_TYPE_INT, {.i64 = 256}, 2, 1024, DYNAMIC },
695  /* deprecated options for backwards compatibility, defaulting to -1 to not override the new defaults */
696  { "desaturation_strength", "Desaturation strength", OFFSET(desat_str), AV_OPT_TYPE_FLOAT, {.dbl = -1.0}, -1.0, 1.0, DYNAMIC | AV_OPT_FLAG_DEPRECATED },
697  { "desaturation_exponent", "Desaturation exponent", OFFSET(desat_exp), AV_OPT_TYPE_FLOAT, {.dbl = -1.0}, -1.0, 10.0, DYNAMIC | AV_OPT_FLAG_DEPRECATED },
698  { "gamut_warning", "Highlight out-of-gamut colors", OFFSET(gamut_warning), AV_OPT_TYPE_BOOL, {.i64 = 0}, 0, 1, DYNAMIC | AV_OPT_FLAG_DEPRECATED },
699  { "gamut_clipping", "Enable colorimetric gamut clipping", OFFSET(gamut_clipping), AV_OPT_TYPE_BOOL, {.i64 = 0}, 0, 1, DYNAMIC | AV_OPT_FLAG_DEPRECATED },
700 
701  { "dithering", "Dither method to use", OFFSET(dithering), AV_OPT_TYPE_INT, {.i64 = PL_DITHER_BLUE_NOISE}, -1, PL_DITHER_METHOD_COUNT - 1, DYNAMIC, "dither" },
702  { "none", "Disable dithering", 0, AV_OPT_TYPE_CONST, {.i64 = -1}, 0, 0, STATIC, "dither" },
703  { "blue", "Blue noise", 0, AV_OPT_TYPE_CONST, {.i64 = PL_DITHER_BLUE_NOISE}, 0, 0, STATIC, "dither" },
704  { "ordered", "Ordered LUT", 0, AV_OPT_TYPE_CONST, {.i64 = PL_DITHER_ORDERED_LUT}, 0, 0, STATIC, "dither" },
705  { "ordered_fixed", "Fixed function ordered", 0, AV_OPT_TYPE_CONST, {.i64 = PL_DITHER_ORDERED_FIXED}, 0, 0, STATIC, "dither" },
706  { "white", "White noise", 0, AV_OPT_TYPE_CONST, {.i64 = PL_DITHER_WHITE_NOISE}, 0, 0, STATIC, "dither" },
707  { "dither_lut_size", "Dithering LUT size", OFFSET(dither_lut_size), AV_OPT_TYPE_INT, {.i64 = 6}, 1, 8, STATIC },
708  { "dither_temporal", "Enable temporal dithering", OFFSET(dither_temporal), AV_OPT_TYPE_BOOL, {.i64 = 0}, 0, 1, DYNAMIC },
709 
710  { "cones", "Colorblindness adaptation model", OFFSET(cones), AV_OPT_TYPE_FLAGS, {.i64 = 0}, 0, PL_CONE_LMS, DYNAMIC, "cone" },
711  { "l", "L cone", 0, AV_OPT_TYPE_CONST, {.i64 = PL_CONE_L}, 0, 0, STATIC, "cone" },
712  { "m", "M cone", 0, AV_OPT_TYPE_CONST, {.i64 = PL_CONE_M}, 0, 0, STATIC, "cone" },
713  { "s", "S cone", 0, AV_OPT_TYPE_CONST, {.i64 = PL_CONE_S}, 0, 0, STATIC, "cone" },
714  { "cone-strength", "Colorblindness adaptation strength", OFFSET(cone_str), AV_OPT_TYPE_FLOAT, {.dbl = 0.0}, 0.0, 10.0, DYNAMIC },
715 
716  { "custom_shader_path", "Path to custom user shader (mpv .hook format)", OFFSET(shader_path), AV_OPT_TYPE_STRING, .flags = STATIC },
717  { "custom_shader_bin", "Custom user shader as binary (mpv .hook format)", OFFSET(shader_bin), AV_OPT_TYPE_BINARY, .flags = STATIC },
718 
719  /* Performance/quality tradeoff options */
720  { "skip_aa", "Skip anti-aliasing", OFFSET(skip_aa), AV_OPT_TYPE_BOOL, {.i64 = 0}, 0, 0, DYNAMIC },
721  { "polar_cutoff", "Polar LUT cutoff", OFFSET(polar_cutoff), AV_OPT_TYPE_FLOAT, {.dbl = 0}, 0.0, 1.0, DYNAMIC },
722  { "disable_linear", "Disable linear scaling", OFFSET(disable_linear), AV_OPT_TYPE_BOOL, {.i64 = 0}, 0, 1, DYNAMIC },
723  { "disable_builtin", "Disable built-in scalers", OFFSET(disable_builtin), AV_OPT_TYPE_BOOL, {.i64 = 0}, 0, 1, DYNAMIC },
724  { "force_icc_lut", "Force the use of a full ICC 3DLUT for color mapping", OFFSET(force_icc_lut), AV_OPT_TYPE_BOOL, {.i64 = 0}, 0, 1, DYNAMIC },
725  { "force_dither", "Force dithering", OFFSET(force_dither), AV_OPT_TYPE_BOOL, {.i64 = 0}, 0, 1, DYNAMIC },
726  { "disable_fbos", "Force-disable FBOs", OFFSET(disable_fbos), AV_OPT_TYPE_BOOL, {.i64 = 0}, 0, 1, DYNAMIC },
727  { NULL },
728 };
729 
730 AVFILTER_DEFINE_CLASS(libplacebo);
731 
732 static const AVFilterPad libplacebo_inputs[] = {
733  {
734  .name = "default",
735  .type = AVMEDIA_TYPE_VIDEO,
736  .filter_frame = &filter_frame,
737  .config_props = &ff_vk_filter_config_input,
738  },
739 };
740 
741 static const AVFilterPad libplacebo_outputs[] = {
742  {
743  .name = "default",
744  .type = AVMEDIA_TYPE_VIDEO,
745  .config_props = &libplacebo_config_output,
746  },
747 };
748 
750  .name = "libplacebo",
751  .description = NULL_IF_CONFIG_SMALL("Apply various GPU filters from libplacebo"),
752  .priv_size = sizeof(LibplaceboContext),
753  .init = &libplacebo_init,
759  .priv_class = &libplacebo_class,
760  .flags_internal = FF_FILTER_FLAG_HWFRAME_AWARE,
761 };
ff_get_video_buffer
AVFrame * ff_get_video_buffer(AVFilterLink *link, int w, int h)
Request a picture buffer with a specific set of permissions.
Definition: video.c:101
AVFrame::color_trc
enum AVColorTransferCharacteristic color_trc
Definition: frame.h:582
LibplaceboContext::colorspace
int colorspace
Definition: vf_libplacebo.c:78
AVVulkanDeviceContext::phys_dev
VkPhysicalDevice phys_dev
Physical device.
Definition: hwcontext_vulkan.h:63
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:578
name
it s the only field you need to keep assuming you have a context There is some magic you don t need to care about around this just let it vf default minimum maximum flags name is the option name
Definition: writing_filters.txt:88
level
uint8_t level
Definition: svq3.c:206
AVCOL_PRI_EBU3213
@ AVCOL_PRI_EBU3213
EBU Tech. 3213-E (nothing there) / one of JEDEC P22 group phosphors.
Definition: pixfmt.h:487
LibplaceboContext::gamut_clipping
int gamut_clipping
Definition: vf_libplacebo.c:132
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
LibplaceboContext::deband
int deband
Definition: vf_libplacebo.c:98
LibplaceboContext::deband_iterations
int deband_iterations
Definition: vf_libplacebo.c:99
LibplaceboContext::deband_threshold
float deband_threshold
Definition: vf_libplacebo.c:100
LibplaceboContext::gamut_mode
int gamut_mode
Definition: vf_libplacebo.c:121
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:684
FF_FILTER_FLAG_HWFRAME_AWARE
#define FF_FILTER_FLAG_HWFRAME_AWARE
The filter is aware of hardware frames, and any hardware frame context should not be automatically pr...
Definition: internal.h:370
LibplaceboContext::contrast
float contrast
Definition: vf_libplacebo.c:106
ff_filter_frame
int ff_filter_frame(AVFilterLink *link, AVFrame *frame)
Send a frame of data to the next filter.
Definition: avfilter.c:999
AVBufferRef::data
uint8_t * data
The data buffer.
Definition: buffer.h:90
AVCOL_TRC_LINEAR
@ AVCOL_TRC_LINEAR
"Linear transfer characteristics"
Definition: pixfmt.h:505
AV_FRAME_DATA_DOVI_METADATA
@ AV_FRAME_DATA_DOVI_METADATA
Parsed Dolby Vision metadata, suitable for passing to a software implementation.
Definition: frame.h:204
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
AV_FRAME_DATA_FILM_GRAIN_PARAMS
@ AV_FRAME_DATA_FILM_GRAIN_PARAMS
Film grain parameters for a frame, described by AVFilmGrainParams.
Definition: frame.h:184
AVFrame::color_primaries
enum AVColorPrimaries color_primaries
Definition: frame.h:580
LibplaceboContext::apply_filmgrain
int apply_filmgrain
Definition: vf_libplacebo.c:76
LibplaceboContext::intent
int intent
Definition: vf_libplacebo.c:120
av_frame_free
void av_frame_free(AVFrame **frame)
Free the frame and any dynamically allocated objects in it, e.g.
Definition: frame.c:111
AVFrame::colorspace
enum AVColorSpace colorspace
YUV colorspace type.
Definition: frame.h:589
AVFrame
This structure describes decoded (raw) audio or video data.
Definition: frame.h:325
AVCOL_TRC_NB
@ AVCOL_TRC_NB
Not part of ABI.
Definition: pixfmt.h:518
AVVulkanDeviceContext::get_proc_addr
PFN_vkGetInstanceProcAddr get_proc_addr
Pointer to the instance-provided vkGetInstanceProcAddr loading function.
Definition: hwcontext_vulkan.h:53
AVCOL_RANGE_JPEG
@ AVCOL_RANGE_JPEG
Full range content.
Definition: pixfmt.h:599
pl_av_log
static void pl_av_log(void *log_ctx, enum pl_log_level level, const char *msg)
Definition: vf_libplacebo.c:163
AVOption
AVOption.
Definition: opt.h:251
AVCOL_SPC_NB
@ AVCOL_SPC_NB
Not part of ABI.
Definition: pixfmt.h:542
AVCOL_TRC_UNSPECIFIED
@ AVCOL_TRC_UNSPECIFIED
Definition: pixfmt.h:499
LibplaceboContext
Definition: vf_libplacebo.c:56
AV_FRAME_DATA_DOVI_RPU_BUFFER
@ AV_FRAME_DATA_DOVI_RPU_BUFFER
Dolby Vision RPU raw data, suitable for passing to x265 or other libraries.
Definition: frame.h:197
AVVulkanDeviceContext::inst
VkInstance inst
Vulkan instance.
Definition: hwcontext_vulkan.h:58
AVCOL_PRI_JEDEC_P22
@ AVCOL_PRI_JEDEC_P22
Definition: pixfmt.h:488
AV_LOG_VERBOSE
#define AV_LOG_VERBOSE
Detailed information.
Definition: log.h:196
AVCOL_SPC_RGB
@ AVCOL_SPC_RGB
order of coefficients is actually GBR, also IEC 61966-2-1 (sRGB), YZX and ST 428-1
Definition: pixfmt.h:526
ff_scale_eval_dimensions
int ff_scale_eval_dimensions(void *log_ctx, const char *w_expr, const char *h_expr, AVFilterLink *inlink, AVFilterLink *outlink, int *ret_w, int *ret_h)
Parse and evaluate string expressions for width and height.
Definition: scale_eval.c:57
AVCOL_TRC_BT2020_12
@ AVCOL_TRC_BT2020_12
ITU-R BT2020 for 12-bit system.
Definition: pixfmt.h:512
process_frames
static int process_frames(AVFilterContext *avctx, AVFrame *out, AVFrame *in)
Definition: vf_libplacebo.c:310
ff_vk_uninit
void ff_vk_uninit(FFVulkanContext *s)
Frees the main Vulkan context.
Definition: vulkan.c:1379
LibplaceboContext::sigmoid
int sigmoid
Definition: vf_libplacebo.c:88
AVFilter::name
const char * name
Filter name.
Definition: avfilter.h:175
LibplaceboContext::vkctx
FFVulkanContext vkctx
Definition: vf_libplacebo.c:58
AVCOL_SPC_BT2020_CL
@ AVCOL_SPC_BT2020_CL
ITU-R BT2020 constant luminance system.
Definition: pixfmt.h:537
AV_PIX_FMT_VULKAN
@ AV_PIX_FMT_VULKAN
Vulkan hardware images.
Definition: pixfmt.h:348
init
static int init
Definition: av_tx.c:47
TONE_MAP_SPLINE
@ TONE_MAP_SPLINE
Definition: vf_libplacebo.c:34
libplacebo_config_output
static int libplacebo_config_output(AVFilterLink *outlink)
Definition: vf_libplacebo.c:508
AVCOL_SPC_BT470BG
@ AVCOL_SPC_BT470BG
also ITU-R BT601-6 625 / ITU-R BT1358 625 / ITU-R BT1700 625 PAL & SECAM / IEC 61966-2-4 xvYCC601
Definition: pixfmt.h:531
AV_OPT_TYPE_BINARY
@ AV_OPT_TYPE_BINARY
offset must point to a pointer immediately followed by an int for the length
Definition: opt.h:231
AVCOL_TRC_IEC61966_2_1
@ AVCOL_TRC_IEC61966_2_1
IEC 61966-2-1 (sRGB or sYCC)
Definition: pixfmt.h:510
av_file_map
int av_file_map(const char *filename, uint8_t **bufptr, size_t *size, int log_offset, void *log_ctx)
Read the file with name filename, and put its content in a newly allocated buffer or map it with mmap...
Definition: file.c:53
AVFilterContext::priv
void * priv
private data for use by the filter
Definition: avfilter.h:423
LibplaceboContext::shader_bin_len
int shader_bin_len
Definition: vf_libplacebo.c:146
fail
#define fail()
Definition: checkasm.h:131
vulkan_filter.h
AVCOL_RANGE_NB
@ AVCOL_RANGE_NB
Not part of ABI.
Definition: pixfmt.h:600
AVCOL_TRC_GAMMA28
@ AVCOL_TRC_GAMMA28
also ITU-R BT470BG
Definition: pixfmt.h:502
AVVulkanFramesContext
Allocated as AVHWFramesContext.hwctx, used to set pool-specific options.
Definition: hwcontext_vulkan.h:157
find_scaler
static int find_scaler(AVFilterContext *avctx, const struct pl_filter_config **opt, const char *name)
Definition: vf_libplacebo.c:195
LibplaceboContext::lut_entries
int lut_entries
Definition: vf_libplacebo.c:86
filter_frame
static int filter_frame(AVFilterLink *link, AVFrame *in)
Definition: vf_libplacebo.c:441
LibplaceboContext::gamut_warning
int gamut_warning
Definition: vf_libplacebo.c:131
AVCOL_TRC_GAMMA22
@ AVCOL_TRC_GAMMA22
also ITU-R BT470M / ITU-R BT1700 625 PAL & SECAM
Definition: pixfmt.h:501
AVFilterPad
A filter pad used for either input or output.
Definition: internal.h:49
LibplaceboContext::antiringing
float antiringing
Definition: vf_libplacebo.c:87
preset
preset
Definition: vf_curves.c:46
LibplaceboContext::disable_linear
int disable_linear
Definition: vf_libplacebo.c:91
AV_LOG_TRACE
#define AV_LOG_TRACE
Extremely verbose debugging, useful for libav* development.
Definition: log.h:206
AV_LOG_ERROR
#define AV_LOG_ERROR
Something went wrong and cannot losslessly be recovered.
Definition: log.h:180
ff_vf_libplacebo
const AVFilter ff_vf_libplacebo
Definition: vf_libplacebo.c:749
s
#define s(width, name)
Definition: cbs_vp9.c:256
AVCOL_PRI_NB
@ AVCOL_PRI_NB
Not part of ABI.
Definition: pixfmt.h:489
LibplaceboContext::force_original_aspect_ratio
int force_original_aspect_ratio
Definition: vf_libplacebo.c:73
AVCOL_TRC_BT1361_ECG
@ AVCOL_TRC_BT1361_ECG
ITU-R BT1361 Extended Colour Gamut.
Definition: pixfmt.h:509
LibplaceboContext::force_dither
int force_dither
Definition: vf_libplacebo.c:94
AVCOL_SPC_SMPTE170M
@ AVCOL_SPC_SMPTE170M
also ITU-R BT601-6 525 / ITU-R BT1358 525 / ITU-R BT1700 NTSC / functionally identical to above
Definition: pixfmt.h:532
init_vulkan
static int init_vulkan(AVFilterContext *avctx)
Definition: vf_libplacebo.c:236
av_q2d
static double av_q2d(AVRational a)
Convert an AVRational to a double.
Definition: rational.h:104
libplacebo_inputs
static const AVFilterPad libplacebo_inputs[]
Definition: vf_libplacebo.c:732
libplacebo_uninit
static void libplacebo_uninit(AVFilterContext *avctx)
Definition: vf_libplacebo.c:296
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
LibplaceboContext::tonemapping
int tonemapping
Definition: vf_libplacebo.c:122
AVCOL_PRI_SMPTE428
@ AVCOL_PRI_SMPTE428
SMPTE ST 428-1 (CIE 1931 XYZ)
Definition: pixfmt.h:483
LibplaceboContext::disable_builtin
int disable_builtin
Definition: vf_libplacebo.c:92
tonemapping_funcs
static const struct pl_tone_map_function *const tonemapping_funcs[TONE_MAP_COUNT]
Definition: vf_libplacebo.c:43
LibplaceboContext::color_trc
int color_trc
Definition: vf_libplacebo.c:81
LibplaceboContext::w_expr
char * w_expr
Definition: vf_libplacebo.c:69
AVCOL_PRI_SMPTE240M
@ AVCOL_PRI_SMPTE240M
identical to above, also called "SMPTE C" even though it uses D65
Definition: pixfmt.h:480
color_range
color_range
Definition: vf_selectivecolor.c:44
LibplaceboContext::force_divisible_by
int force_divisible_by
Definition: vf_libplacebo.c:74
AVCOL_PRI_UNSPECIFIED
@ AVCOL_PRI_UNSPECIFIED
Definition: pixfmt.h:474
FILTER_INPUTS
#define FILTER_INPUTS(array)
Definition: internal.h:190
av_file_unmap
void av_file_unmap(uint8_t *bufptr, size_t size)
Unmap or free the buffer bufptr created by av_file_map().
Definition: file.c:144
link
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 link
Definition: filter_design.txt:23
AVCOL_PRI_BT470BG
@ AVCOL_PRI_BT470BG
also ITU-R BT601-6 625 / ITU-R BT1358 625 / ITU-R BT1700 625 PAL & SECAM
Definition: pixfmt.h:478
AVCOL_PRI_SMPTE170M
@ AVCOL_PRI_SMPTE170M
also ITU-R BT601-6 525 / ITU-R BT1358 525 / ITU-R BT1700 NTSC
Definition: pixfmt.h:479
TONE_MAP_LINEAR
@ TONE_MAP_LINEAR
Definition: vf_libplacebo.c:39
av_log_get_level
int av_log_get_level(void)
Get the current log level.
Definition: log.c:437
AVVulkanDeviceContext
Main Vulkan context, allocated as AVHWDeviceContext.hwctx.
Definition: hwcontext_vulkan.h:42
NULL
#define NULL
Definition: coverity.c:32
LibplaceboContext::dither_temporal
int dither_temporal
Definition: vf_libplacebo.c:137
av_frame_copy_props
int av_frame_copy_props(AVFrame *dst, const AVFrame *src)
Copy only "metadata" fields from src to dst.
Definition: frame.c:596
AVVulkanDeviceContext::nb_enabled_dev_extensions
int nb_enabled_dev_extensions
Definition: hwcontext_vulkan.h:97
LibplaceboContext::skip_aa
int skip_aa
Definition: vf_libplacebo.c:89
LibplaceboContext::shader_bin
void * shader_bin
Definition: vf_libplacebo.c:145
AVRational
Rational number (pair of numerator and denominator).
Definition: rational.h:58
LibplaceboContext::cones
int cones
Definition: vf_libplacebo.c:140
AVCOL_TRC_IEC61966_2_4
@ AVCOL_TRC_IEC61966_2_4
IEC 61966-2-4.
Definition: pixfmt.h:508
log_cb
static void log_cb(cmsContext ctx, cmsUInt32Number error, const char *str)
Definition: fflcms2.c:25
LibplaceboContext::brightness
float brightness
Definition: vf_libplacebo.c:105
AVFilterContext::inputs
AVFilterLink ** inputs
array of pointers to input links
Definition: avfilter.h:416
TONE_MAP_HABLE
@ TONE_MAP_HABLE
Definition: vf_libplacebo.c:37
LibplaceboContext::gpu
pl_gpu gpu
Definition: vf_libplacebo.c:64
AVCOL_PRI_BT709
@ AVCOL_PRI_BT709
also ITU-R BT1361 / IEC 61966-2-4 / SMPTE RP 177 Annex B
Definition: pixfmt.h:473
LibplaceboContext::initialized
int initialized
Definition: vf_libplacebo.c:59
ff_vk_filter_config_output
int ff_vk_filter_config_output(AVFilterLink *outlink)
Definition: vulkan_filter.c:133
AV_FRAME_DATA_MASTERING_DISPLAY_METADATA
@ AV_FRAME_DATA_MASTERING_DISPLAY_METADATA
Mastering display metadata associated with a video frame.
Definition: frame.h:120
LibplaceboContext::desat_str
float desat_str
Definition: vf_libplacebo.c:129
AVVulkanFramesContext::usage
VkImageUsageFlagBits usage
Defines extra usage of output frames.
Definition: hwcontext_vulkan.h:170
AVCOL_TRC_BT2020_10
@ AVCOL_TRC_BT2020_10
ITU-R BT2020 for 10-bit system.
Definition: pixfmt.h:511
AVCOL_SPC_YCGCO
@ AVCOL_SPC_YCGCO
used by Dirac / VC-2 and H.264 FRext, see ITU-T SG16
Definition: pixfmt.h:534
FFVulkanContext
Definition: vulkan.h:188
exp
int8_t exp
Definition: eval.c:72
LibplaceboContext::desat_exp
float desat_exp
Definition: vf_libplacebo.c:130
AVCOL_RANGE_UNSPECIFIED
@ AVCOL_RANGE_UNSPECIFIED
Definition: pixfmt.h:565
parse_shader
static int parse_shader(AVFilterContext *avctx, const void *shader, size_t len)
Definition: vf_libplacebo.c:180
AVCOL_PRI_BT2020
@ AVCOL_PRI_BT2020
ITU-R BT2020.
Definition: pixfmt.h:482
LibplaceboContext::cone_str
float cone_str
Definition: vf_libplacebo.c:141
color_primaries
static const AVColorPrimariesDesc color_primaries[AVCOL_PRI_NB]
Definition: csp.c:71
TONE_MAP_COUNT
@ TONE_MAP_COUNT
Definition: vf_libplacebo.c:40
LibplaceboContext::hue
float hue
Definition: vf_libplacebo.c:108
AVCOL_TRC_SMPTE2084
@ AVCOL_TRC_SMPTE2084
SMPTE ST 2084 for 10-, 12-, 14- and 16-bit systems.
Definition: pixfmt.h:513
AVCOL_PRI_SMPTE431
@ AVCOL_PRI_SMPTE431
SMPTE ST 431-2 (2011) / DCI P3.
Definition: pixfmt.h:485
f
f
Definition: af_crystalizer.c:122
NULL_IF_CONFIG_SMALL
#define NULL_IF_CONFIG_SMALL(x)
Return NULL if CONFIG_SMALL is true, otherwise the argument without modification.
Definition: internal.h:117
AVCOL_TRC_SMPTE240M
@ AVCOL_TRC_SMPTE240M
Definition: pixfmt.h:504
AVCOL_PRI_FILM
@ AVCOL_PRI_FILM
colour filters using Illuminant C
Definition: pixfmt.h:481
TONE_MAP_BT2446A
@ TONE_MAP_BT2446A
Definition: vf_libplacebo.c:33
process_command
static int process_command(AVFilterContext *ctx, const char *cmd, const char *args, char *res, int res_len, int flags)
Definition: af_acrusher.c:306
AVFILTER_DEFINE_CLASS
AVFILTER_DEFINE_CLASS(libplacebo)
LibplaceboContext::deband_grain
float deband_grain
Definition: vf_libplacebo.c:102
LibplaceboContext::out_format_string
char * out_format_string
Definition: vf_libplacebo.c:68
LibplaceboContext::disable_fbos
int disable_fbos
Definition: vf_libplacebo.c:95
LibplaceboContext::tonemapping_mode
int tonemapping_mode
Definition: vf_libplacebo.c:124
LibplaceboContext::saturation
float saturation
Definition: vf_libplacebo.c:107
TONE_MAP_REINHARD
@ TONE_MAP_REINHARD
Definition: vf_libplacebo.c:35
LibplaceboContext::num_hooks
int num_hooks
Definition: vf_libplacebo.c:148
libplacebo_options
static const AVOption libplacebo_options[]
Definition: vf_libplacebo.c:568
scale_eval.h
ff_filter_process_command
int ff_filter_process_command(AVFilterContext *ctx, const char *cmd, const char *arg, char *res, int res_len, int flags)
Generic processing of user supplied commands that are set in the same way as the filter options.
Definition: avfilter.c:863
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:784
TONE_MAP_CLIP
@ TONE_MAP_CLIP
Definition: vf_libplacebo.c:31
AVERROR_EXTERNAL
#define AVERROR_EXTERNAL
Generic error in an external library.
Definition: error.h:59
LibplaceboContext::overshoot
float overshoot
Definition: vf_libplacebo.c:117
LibplaceboContext::normalize_sar
int normalize_sar
Definition: vf_libplacebo.c:75
LibplaceboContext::polar_cutoff
float polar_cutoff
Definition: vf_libplacebo.c:90
LibplaceboContext::apply_dovi
int apply_dovi
Definition: vf_libplacebo.c:77
LibplaceboContext::downscaler
char * downscaler
Definition: vf_libplacebo.c:85
LibplaceboContext::log
pl_log log
Definition: vf_libplacebo.c:62
LibplaceboContext::vulkan
pl_vulkan vulkan
Definition: vf_libplacebo.c:63
M_PI
#define M_PI
Definition: mathematics.h:52
AV_LOG_INFO
#define AV_LOG_INFO
Standard information.
Definition: log.h:191
AVCOL_TRC_BT709
@ AVCOL_TRC_BT709
also ITU-R BT1361
Definition: pixfmt.h:498
internal.h
AV_OPT_TYPE_FLOAT
@ AV_OPT_TYPE_FLOAT
Definition: opt.h:228
FILTER_SINGLE_PIXFMT
#define FILTER_SINGLE_PIXFMT(pix_fmt_)
Definition: internal.h:180
AVCOL_SPC_SMPTE240M
@ AVCOL_SPC_SMPTE240M
derived from 170M primaries and D65 white point, 170M is derived from BT470 System M's primaries
Definition: pixfmt.h:533
get_log_level
static enum pl_log_level get_log_level(void)
Definition: vf_libplacebo.c:151
AV_FRAME_DATA_CONTENT_LIGHT_LEVEL
@ AV_FRAME_DATA_CONTENT_LIGHT_LEVEL
Content light level (based on CTA-861.3).
Definition: frame.h:137
i
#define i(width, name, range_min, range_max)
Definition: cbs_h2645.c:269
LibplaceboContext::upscaler
char * upscaler
Definition: vf_libplacebo.c:84
AVCOL_SPC_BT2020_NCL
@ AVCOL_SPC_BT2020_NCL
ITU-R BT2020 non-constant luminance system.
Definition: pixfmt.h:536
LibplaceboContext::gamma
float gamma
Definition: vf_libplacebo.c:109
LibplaceboContext::target_sar
AVRational target_sar
Definition: vf_libplacebo.c:71
LibplaceboContext::force_icc_lut
int force_icc_lut
Definition: vf_libplacebo.c:93
LibplaceboContext::min_peak
float min_peak
Definition: vf_libplacebo.c:114
LibplaceboContext::tonemapping_lut_size
int tonemapping_lut_size
Definition: vf_libplacebo.c:127
LibplaceboContext::tonemapping_param
float tonemapping_param
Definition: vf_libplacebo.c:123
LibplaceboContext::color_primaries
int color_primaries
Definition: vf_libplacebo.c:80
len
int len
Definition: vorbis_enc_data.h:426
AVFilterPad::name
const char * name
Pad name.
Definition: internal.h:55
AVCOL_SPC_UNSPECIFIED
@ AVCOL_SPC_UNSPECIFIED
Definition: pixfmt.h:528
LibplaceboContext::dithering
int dithering
Definition: vf_libplacebo.c:135
LibplaceboContext::scene_high
float scene_high
Definition: vf_libplacebo.c:116
STATIC
#define STATIC
Definition: vf_libplacebo.c:565
AVCOL_RANGE_MPEG
@ AVCOL_RANGE_MPEG
Narrow or limited range content.
Definition: pixfmt.h:582
AVFilter
Filter definition.
Definition: avfilter.h:171
AVHWFramesContext
This struct describes a set or pool of "hardware" frames (i.e.
Definition: hwcontext.h:124
AVCOL_PRI_BT470M
@ AVCOL_PRI_BT470M
also FCC Title 47 Code of Federal Regulations 73.682 (a)(20)
Definition: pixfmt.h:476
AV_LOG_FATAL
#define AV_LOG_FATAL
Something went wrong and recovery is not possible.
Definition: log.h:174
frame
these buffered frames must be flushed immediately if a new input produces new the filter must not call request_frame to get more It must just process the frame or queue it The task of requesting more frames is left to the filter s request_frame method or the application If a filter has several the filter must be ready for frames arriving randomly on any input any filter with several inputs will most likely require some kind of queuing mechanism It is perfectly acceptable to have a limited queue and to drop frames when the inputs are too unbalanced request_frame For filters that do not use the this method is called when a frame is wanted on an output For a it should directly call filter_frame on the corresponding output For a if there are queued frames already one of these frames should be pushed If the filter should request a frame on one of its repeatedly until at least one frame has been pushed Return or at least make progress towards producing a frame
Definition: filter_design.txt:264
LibplaceboContext::scene_low
float scene_low
Definition: vf_libplacebo.c:115
AVHWFramesContext::hwctx
void * hwctx
The format-specific data, allocated and freed automatically along with this context.
Definition: hwcontext.h:162
ff_scale_adjust_dimensions
int ff_scale_adjust_dimensions(AVFilterLink *inlink, int *ret_w, int *ret_h, int force_original_aspect_ratio, int force_divisible_by)
Transform evaluated width and height obtained from ff_scale_eval_dimensions into actual target width ...
Definition: scale_eval.c:113
LibplaceboContext::peakdetect
int peakdetect
Definition: vf_libplacebo.c:112
av_get_pix_fmt
enum AVPixelFormat av_get_pix_fmt(const char *name)
Return the pixel format corresponding to name.
Definition: pixdesc.c:2594
LibplaceboContext::deband_radius
float deband_radius
Definition: vf_libplacebo.c:101
AVCOL_TRC_ARIB_STD_B67
@ AVCOL_TRC_ARIB_STD_B67
ARIB STD-B67, known as "Hybrid log-gamma".
Definition: pixfmt.h:517
libplacebo_outputs
static const AVFilterPad libplacebo_outputs[]
Definition: vf_libplacebo.c:741
TONE_MAP_AUTO
@ TONE_MAP_AUTO
Definition: vf_libplacebo.c:30
AV_PIX_FMT_NONE
@ AV_PIX_FMT_NONE
Definition: pixfmt.h:65
AV_OPT_TYPE_INT
@ AV_OPT_TYPE_INT
Definition: opt.h:225
LibplaceboContext::inverse_tonemapping
int inverse_tonemapping
Definition: vf_libplacebo.c:125
AVCOL_TRC_SMPTE170M
@ AVCOL_TRC_SMPTE170M
also ITU-R BT601-6 525 or 625 / ITU-R BT1358 525 or 625 / ITU-R BT1700 NTSC
Definition: pixfmt.h:503
file.h
av_mul_q
AVRational av_mul_q(AVRational b, AVRational c)
Multiply two rationals.
Definition: rational.c:80
OFFSET
#define OFFSET(x)
Definition: vf_libplacebo.c:564
AVFilterContext
An instance of a filter.
Definition: avfilter.h:408
LibplaceboContext::crosstalk
float crosstalk
Definition: vf_libplacebo.c:126
TONE_MAP_MOBIUS
@ TONE_MAP_MOBIUS
Definition: vf_libplacebo.c:36
AVVulkanDeviceContext::enabled_dev_extensions
const char *const * enabled_dev_extensions
Enabled device extensions.
Definition: hwcontext_vulkan.h:96
ff_vk_filter_config_input
int ff_vk_filter_config_input(AVFilterLink *inlink)
Definition: vulkan_filter.c:52
AVMEDIA_TYPE_VIDEO
@ AVMEDIA_TYPE_VIDEO
Definition: avutil.h:201
LibplaceboContext::renderer
pl_renderer renderer
Definition: vf_libplacebo.c:65
LibplaceboContext::pad_crop_ratio
float pad_crop_ratio
Definition: vf_libplacebo.c:72
AVVulkanDeviceContext::act_dev
VkDevice act_dev
Active device.
Definition: hwcontext_vulkan.h:68
AVCOL_PRI_SMPTE432
@ AVCOL_PRI_SMPTE432
SMPTE ST 432-1 (2010) / P3 D65 / Display P3.
Definition: pixfmt.h:486
AV_OPT_TYPE_BOOL
@ AV_OPT_TYPE_BOOL
Definition: opt.h:244
FILTER_OUTPUTS
#define FILTER_OUTPUTS(array)
Definition: internal.h:191
LibplaceboContext::smoothing
float smoothing
Definition: vf_libplacebo.c:113
AV_OPT_TYPE_FLAGS
@ AV_OPT_TYPE_FLAGS
Definition: opt.h:224
convert_header.str
string str
Definition: convert_header.py:20
DYNAMIC
#define DYNAMIC
Definition: vf_libplacebo.c:566
av_log
#define av_log(a,...)
Definition: tableprint_vlc.h:27
TONE_MAP_GAMMA
@ TONE_MAP_GAMMA
Definition: vf_libplacebo.c:38
LibplaceboContext::shader_path
char * shader_path
Definition: vf_libplacebo.c:144
uninit
static av_cold int uninit(AVCodecContext *avctx)
Definition: crystalhd.c:285
AVERROR_EXIT
#define AVERROR_EXIT
Immediate exit was requested; the called function should not be restarted.
Definition: error.h:58
AVVulkanDeviceContext::device_features
VkPhysicalDeviceFeatures2 device_features
This structure should be set to the set of features that present and enabled during device creation.
Definition: hwcontext_vulkan.h:76
LibplaceboContext::color_range
int color_range
Definition: vf_libplacebo.c:79
AV_OPT_TYPE_STRING
@ AV_OPT_TYPE_STRING
Definition: opt.h:229
LibplaceboContext::dither_lut_size
int dither_lut_size
Definition: vf_libplacebo.c:136
libplacebo_init
static int libplacebo_init(AVFilterContext *avctx)
Definition: vf_libplacebo.c:218
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:527
LibplaceboContext::h_expr
char * h_expr
Definition: vf_libplacebo.c:70
AVCOL_SPC_ICTCP
@ AVCOL_SPC_ICTCP
ITU-R BT.2100-0, ICtCp.
Definition: pixfmt.h:541
LibplaceboContext::hooks
const struct pl_hook * hooks[2]
Definition: vf_libplacebo.c:147
AV_OPT_TYPE_CONST
@ AV_OPT_TYPE_CONST
Definition: opt.h:234
RET
#define RET(x)
Definition: vulkan.h:52
TONE_MAP_BT2390
@ TONE_MAP_BT2390
Definition: vf_libplacebo.c:32
AV_OPT_FLAG_DEPRECATED
#define AV_OPT_FLAG_DEPRECATED
set if option is deprecated, users should refer to AVOption.help text for more information
Definition: opt.h:298