FFmpeg
vf_tonemap_vaapi.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 #include <string.h>
19 
20 #include "libavutil/opt.h"
21 #include "libavutil/pixdesc.h"
23 
24 #include "avfilter.h"
25 #include "internal.h"
26 #include "vaapi_vpp.h"
27 #include "video.h"
28 
29 typedef struct HDRVAAPIContext {
30  VAAPIVPPContext vpp_ctx; // must be the first field
31 
33 
37 
41 
42  VAHdrMetaDataHDR10 in_metadata;
43 
47 
48 static int tonemap_vaapi_save_metadata(AVFilterContext *avctx, AVFrame *input_frame)
49 {
50  HDRVAAPIContext *ctx = avctx->priv;
52  AVContentLightMetadata *light_meta;
53 
54  if (input_frame->color_trc != AVCOL_TRC_SMPTE2084) {
55  av_log(avctx, AV_LOG_WARNING, "Only support HDR10 as input for vaapi tone-mapping\n");
56  }
57 
58  ctx->src_display = av_frame_get_side_data(input_frame,
60  if (ctx->src_display) {
61  hdr_meta = (AVMasteringDisplayMetadata *)ctx->src_display->data;
62  if (!hdr_meta) {
63  av_log(avctx, AV_LOG_ERROR, "No mastering display data\n");
64  return AVERROR(EINVAL);
65  }
66 
67  if (hdr_meta->has_luminance) {
68  const int luma_den = 10000;
69  ctx->in_metadata.max_display_mastering_luminance =
70  lrint(luma_den * av_q2d(hdr_meta->max_luminance));
71  ctx->in_metadata.min_display_mastering_luminance =
72  FFMIN(lrint(luma_den * av_q2d(hdr_meta->min_luminance)),
73  ctx->in_metadata.max_display_mastering_luminance);
74 
75  av_log(avctx, AV_LOG_DEBUG,
76  "Mastering Display Metadata(in luminance):\n");
77  av_log(avctx, AV_LOG_DEBUG,
78  "min_luminance=%u, max_luminance=%u\n",
79  ctx->in_metadata.min_display_mastering_luminance,
80  ctx->in_metadata.max_display_mastering_luminance);
81  }
82 
83  if (hdr_meta->has_primaries) {
84  int i;
85  const int mapping[3] = {1, 2, 0}; //green, blue, red
86  const int chroma_den = 50000;
87 
88  for (i = 0; i < 3; i++) {
89  const int j = mapping[i];
90  ctx->in_metadata.display_primaries_x[i] =
91  FFMIN(lrint(chroma_den *
92  av_q2d(hdr_meta->display_primaries[j][0])),
93  chroma_den);
94  ctx->in_metadata.display_primaries_y[i] =
95  FFMIN(lrint(chroma_den *
96  av_q2d(hdr_meta->display_primaries[j][1])),
97  chroma_den);
98  }
99 
100  ctx->in_metadata.white_point_x =
101  FFMIN(lrint(chroma_den * av_q2d(hdr_meta->white_point[0])),
102  chroma_den);
103  ctx->in_metadata.white_point_y =
104  FFMIN(lrint(chroma_den * av_q2d(hdr_meta->white_point[1])),
105  chroma_den);
106 
107  av_log(avctx, AV_LOG_DEBUG,
108  "Mastering Display Metadata(in primaries):\n");
109  av_log(avctx, AV_LOG_DEBUG,
110  "G(%u,%u) B(%u,%u) R(%u,%u) WP(%u,%u)\n",
111  ctx->in_metadata.display_primaries_x[0],
112  ctx->in_metadata.display_primaries_y[0],
113  ctx->in_metadata.display_primaries_x[1],
114  ctx->in_metadata.display_primaries_y[1],
115  ctx->in_metadata.display_primaries_x[2],
116  ctx->in_metadata.display_primaries_y[2],
117  ctx->in_metadata.white_point_x,
118  ctx->in_metadata.white_point_y);
119  }
120  } else {
121  av_log(avctx, AV_LOG_ERROR, "No mastering display data from input\n");
122  return AVERROR(EINVAL);
123  }
124 
125  ctx->src_light = av_frame_get_side_data(input_frame,
127  if (ctx->src_light) {
128  light_meta = (AVContentLightMetadata *)ctx->src_light->data;
129  if (!light_meta) {
130  av_log(avctx, AV_LOG_ERROR, "No light metadata\n");
131  return AVERROR(EINVAL);
132  }
133 
134  ctx->in_metadata.max_content_light_level = light_meta->MaxCLL;
135  ctx->in_metadata.max_pic_average_light_level = light_meta->MaxFALL;
136 
137  av_log(avctx, AV_LOG_DEBUG,
138  "Mastering Content Light Level (in):\n");
139  av_log(avctx, AV_LOG_DEBUG,
140  "MaxCLL(%u) MaxFALL(%u)\n",
141  ctx->in_metadata.max_content_light_level,
142  ctx->in_metadata.max_pic_average_light_level);
143  } else {
144  av_log(avctx, AV_LOG_DEBUG, "No content light level from input\n");
145  }
146  return 0;
147 }
148 
150 {
151  VAAPIVPPContext *vpp_ctx = avctx->priv;
152  HDRVAAPIContext *ctx = avctx->priv;
153  VAStatus vas;
154  VAProcFilterParameterBufferHDRToneMapping *hdrtm_param;
155 
156  vas = vaMapBuffer(vpp_ctx->hwctx->display, vpp_ctx->filter_buffers[0],
157  (void**)&hdrtm_param);
158  if (vas != VA_STATUS_SUCCESS) {
159  av_log(avctx, AV_LOG_ERROR, "Failed to map "
160  "buffer (%d): %d (%s).\n",
161  vpp_ctx->filter_buffers[0], vas, vaErrorStr(vas));
162  return AVERROR(EIO);
163  }
164 
165  memcpy(hdrtm_param->data.metadata, &ctx->in_metadata, sizeof(VAHdrMetaDataHDR10));
166 
167  vas = vaUnmapBuffer(vpp_ctx->hwctx->display, vpp_ctx->filter_buffers[0]);
168  if (vas != VA_STATUS_SUCCESS) {
169  av_log(avctx, AV_LOG_ERROR, "Failed to unmap output buffers: "
170  "%d (%s).\n", vas, vaErrorStr(vas));
171  return AVERROR(EIO);
172  }
173 
174  return 0;
175 }
176 
178 {
179  VAAPIVPPContext *vpp_ctx = avctx->priv;
180  HDRVAAPIContext *ctx = avctx->priv;
181  VAStatus vas;
182  VAProcFilterParameterBufferHDRToneMapping hdrtm_param;
183  VAProcFilterCapHighDynamicRange hdr_cap[VAProcHighDynamicRangeMetadataTypeCount];
184  int num_query_caps;
185  int i;
186 
187  memset(&hdrtm_param, 0, sizeof(hdrtm_param));
188  memset(&ctx->in_metadata, 0, sizeof(ctx->in_metadata));
189 
190  num_query_caps = VAProcHighDynamicRangeMetadataTypeCount;
191  vas = vaQueryVideoProcFilterCaps(vpp_ctx->hwctx->display,
192  vpp_ctx->va_context,
193  VAProcFilterHighDynamicRangeToneMapping,
194  &hdr_cap, &num_query_caps);
195  if (vas != VA_STATUS_SUCCESS) {
196  av_log(avctx, AV_LOG_ERROR, "Failed to query HDR caps "
197  "context: %d (%s).\n", vas, vaErrorStr(vas));
198  return AVERROR(EIO);
199  }
200 
201  for (i = 0; i < num_query_caps; i++) {
202  if (hdr_cap[i].metadata_type != VAProcHighDynamicRangeMetadataNone)
203  break;
204  }
205 
206  if (i >= num_query_caps) {
207  av_log(avctx, AV_LOG_ERROR, "VAAPI driver doesn't support HDR\n");
208  return AVERROR(EINVAL);
209  }
210 
211  for (i = 0; i < num_query_caps; i++) {
212  if (VA_TONE_MAPPING_HDR_TO_SDR & hdr_cap[i].caps_flag)
213  break;
214  }
215 
216  if (i >= num_query_caps) {
217  av_log(avctx, AV_LOG_ERROR,
218  "VAAPI driver doesn't support HDR to SDR\n");
219  return AVERROR(EINVAL);
220  }
221 
222  hdrtm_param.type = VAProcFilterHighDynamicRangeToneMapping;
223  hdrtm_param.data.metadata_type = VAProcHighDynamicRangeMetadataHDR10;
224  hdrtm_param.data.metadata = &ctx->in_metadata;
225  hdrtm_param.data.metadata_size = sizeof(VAHdrMetaDataHDR10);
226 
227  return ff_vaapi_vpp_make_param_buffers(avctx,
228  VAProcFilterParameterBufferType,
229  &hdrtm_param, sizeof(hdrtm_param), 1);
230 }
231 
233 {
234  AVFilterContext *avctx = inlink->dst;
235  AVFilterLink *outlink = avctx->outputs[0];
236  VAAPIVPPContext *vpp_ctx = avctx->priv;
237  HDRVAAPIContext *ctx = avctx->priv;
239  VASurfaceID input_surface, output_surface;
240 
241  VAProcPipelineParameterBuffer params;
242  int err;
243 
244  av_log(avctx, AV_LOG_DEBUG, "Filter input: %s, %ux%u (%"PRId64").\n",
245  av_get_pix_fmt_name(input_frame->format),
246  input_frame->width, input_frame->height, input_frame->pts);
247 
248  if (vpp_ctx->va_context == VA_INVALID_ID){
249  av_frame_free(&input_frame);
250  return AVERROR(EINVAL);
251  }
252 
253  err = tonemap_vaapi_save_metadata(avctx, input_frame);
254  if (err < 0)
255  goto fail;
256 
257  err = tonemap_vaapi_set_filter_params(avctx, input_frame);
258  if (err < 0)
259  goto fail;
260 
261  input_surface = (VASurfaceID)(uintptr_t)input_frame->data[3];
262  av_log(avctx, AV_LOG_DEBUG, "Using surface %#x for tonemap vpp input.\n",
263  input_surface);
264 
265  output_frame = ff_get_video_buffer(outlink, vpp_ctx->output_width,
266  vpp_ctx->output_height);
267  if (!output_frame) {
268  err = AVERROR(ENOMEM);
269  goto fail;
270  }
271 
272  output_surface = (VASurfaceID)(uintptr_t)output_frame->data[3];
273  av_log(avctx, AV_LOG_DEBUG, "Using surface %#x for tonemap vpp output.\n",
274  output_surface);
275  memset(&params, 0, sizeof(params));
276 
277  err = av_frame_copy_props(output_frame, input_frame);
278  if (err < 0)
279  goto fail;
280 
281  if (ctx->color_primaries != AVCOL_PRI_UNSPECIFIED)
282  output_frame->color_primaries = ctx->color_primaries;
283 
284  if (ctx->color_transfer != AVCOL_TRC_UNSPECIFIED)
285  output_frame->color_trc = ctx->color_transfer;
286  else
287  output_frame->color_trc = AVCOL_TRC_BT709;
288 
289  if (ctx->color_matrix != AVCOL_SPC_UNSPECIFIED)
290  output_frame->colorspace = ctx->color_matrix;
291 
292  err = ff_vaapi_vpp_init_params(avctx, &params,
293  input_frame, output_frame);
294  if (err < 0)
295  goto fail;
296 
297  if (vpp_ctx->nb_filter_buffers) {
298  params.filters = &vpp_ctx->filter_buffers[0];
299  params.num_filters = vpp_ctx->nb_filter_buffers;
300  }
301 
302  err = ff_vaapi_vpp_render_picture(avctx, &params, output_frame);
303  if (err < 0)
304  goto fail;
305 
306  av_frame_free(&input_frame);
307 
308  av_log(avctx, AV_LOG_DEBUG, "Filter output: %s, %ux%u (%"PRId64").\n",
310  output_frame->width, output_frame->height, output_frame->pts);
311 
314 
315  return ff_filter_frame(outlink, output_frame);
316 
317 fail:
318  av_frame_free(&input_frame);
320  return err;
321 }
322 
324 {
325  VAAPIVPPContext *vpp_ctx = avctx->priv;
326  HDRVAAPIContext *ctx = avctx->priv;
327 
328  ff_vaapi_vpp_ctx_init(avctx);
331 
332  if (ctx->output_format_string) {
333  vpp_ctx->output_format = av_get_pix_fmt(ctx->output_format_string);
334  } else {
335  vpp_ctx->output_format = AV_PIX_FMT_NV12;
336  av_log(avctx, AV_LOG_WARNING, "Output format not set, use default format NV12\n");
337  }
338 
339 #define STRING_OPTION(var_name, func_name, default_value) do { \
340  if (ctx->var_name ## _string) { \
341  int var = av_ ## func_name ## _from_name(ctx->var_name ## _string); \
342  if (var < 0) { \
343  av_log(avctx, AV_LOG_ERROR, "Invalid %s.\n", #var_name); \
344  return AVERROR(EINVAL); \
345  } \
346  ctx->var_name = var; \
347  } else { \
348  ctx->var_name = default_value; \
349  } \
350  } while (0)
351 
353  STRING_OPTION(color_transfer, color_transfer, AVCOL_TRC_UNSPECIFIED);
354  STRING_OPTION(color_matrix, color_space, AVCOL_SPC_UNSPECIFIED);
355 
356  return 0;
357 }
358 
359 #define OFFSET(x) offsetof(HDRVAAPIContext, x)
360 #define FLAGS (AV_OPT_FLAG_VIDEO_PARAM | AV_OPT_FLAG_FILTERING_PARAM)
361 static const AVOption tonemap_vaapi_options[] = {
362  { "format", "Output pixel format set", OFFSET(output_format_string), AV_OPT_TYPE_STRING, .flags = FLAGS, .unit = "format" },
363  { "matrix", "Output color matrix coefficient set",
364  OFFSET(color_matrix_string), AV_OPT_TYPE_STRING,
365  { .str = NULL }, .flags = FLAGS, .unit = "matrix" },
366  { "m", "Output color matrix coefficient set",
367  OFFSET(color_matrix_string), AV_OPT_TYPE_STRING,
368  { .str = NULL }, .flags = FLAGS, .unit = "matrix" },
369  { "primaries", "Output color primaries set",
370  OFFSET(color_primaries_string), AV_OPT_TYPE_STRING,
371  { .str = NULL }, .flags = FLAGS, .unit = "primaries" },
372  { "p", "Output color primaries set",
373  OFFSET(color_primaries_string), AV_OPT_TYPE_STRING,
374  { .str = NULL }, .flags = FLAGS, .unit = "primaries" },
375  { "transfer", "Output color transfer characteristics set",
376  OFFSET(color_transfer_string), AV_OPT_TYPE_STRING,
377  { .str = NULL }, .flags = FLAGS, .unit = "transfer" },
378  { "t", "Output color transfer characteristics set",
379  OFFSET(color_transfer_string), AV_OPT_TYPE_STRING,
380  { .str = NULL }, .flags = FLAGS, .unit = "transfer" },
381  { NULL }
382 };
383 
384 
385 AVFILTER_DEFINE_CLASS(tonemap_vaapi);
386 
388  {
389  .name = "default",
390  .type = AVMEDIA_TYPE_VIDEO,
391  .filter_frame = &tonemap_vaapi_filter_frame,
392  .config_props = &ff_vaapi_vpp_config_input,
393  },
394 };
395 
397  {
398  .name = "default",
399  .type = AVMEDIA_TYPE_VIDEO,
400  .config_props = &ff_vaapi_vpp_config_output,
401  },
402 };
403 
405  .name = "tonemap_vaapi",
406  .description = NULL_IF_CONFIG_SMALL("VAAPI VPP for tone-mapping"),
407  .priv_size = sizeof(HDRVAAPIContext),
413  .priv_class = &tonemap_vaapi_class,
414  .flags_internal = FF_FILTER_FLAG_HWFRAME_AWARE,
415 };
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:112
AVFrame::color_trc
enum AVColorTransferCharacteristic color_trc
Definition: frame.h:623
AVMasteringDisplayMetadata::has_primaries
int has_primaries
Flag indicating whether the display primaries (and white point) are set.
Definition: mastering_display_metadata.h:62
ff_vaapi_vpp_pipeline_uninit
void ff_vaapi_vpp_pipeline_uninit(AVFilterContext *avctx)
Definition: vaapi_vpp.c:48
ff_vaapi_vpp_ctx_init
void ff_vaapi_vpp_ctx_init(AVFilterContext *avctx)
Definition: vaapi_vpp.c:709
AV_LOG_WARNING
#define AV_LOG_WARNING
Something somehow does not look correct.
Definition: log.h:186
HDRVAAPIContext::vpp_ctx
VAAPIVPPContext vpp_ctx
Definition: vf_tonemap_vaapi.c:30
AVMasteringDisplayMetadata::max_luminance
AVRational max_luminance
Max luminance of mastering display (cd/m^2).
Definition: mastering_display_metadata.h:57
HDRVAAPIContext::color_matrix
enum AVColorSpace color_matrix
Definition: vf_tonemap_vaapi.c:40
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
AVColorTransferCharacteristic
AVColorTransferCharacteristic
Color Transfer Characteristic.
Definition: pixfmt.h:580
ff_vaapi_vpp_render_picture
int ff_vaapi_vpp_render_picture(AVFilterContext *avctx, VAProcPipelineParameterBuffer *params, AVFrame *output_frame)
Definition: vaapi_vpp.c:702
av_frame_get_side_data
AVFrameSideData * av_frame_get_side_data(const AVFrame *frame, enum AVFrameSideDataType type)
Definition: frame.c:716
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:351
ff_filter_frame
int ff_filter_frame(AVFilterLink *link, AVFrame *frame)
Send a frame of data to the next filter.
Definition: avfilter.c:1018
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
AVMasteringDisplayMetadata::has_luminance
int has_luminance
Flag indicating whether the luminance (min_ and max_) have been set.
Definition: mastering_display_metadata.h:67
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_free
void av_frame_free(AVFrame **frame)
Free the frame and any dynamically allocated objects in it, e.g.
Definition: frame.c:88
AVContentLightMetadata::MaxCLL
unsigned MaxCLL
Max content light level (cd/m^2).
Definition: mastering_display_metadata.h:102
AVFrame
This structure describes decoded (raw) audio or video data.
Definition: frame.h:340
pixdesc.h
AVFrame::pts
int64_t pts
Presentation timestamp in time_base units (time when frame should be shown to user).
Definition: frame.h:452
AVFrame::width
int width
Definition: frame.h:412
tonemap_vaapi_save_metadata
static int tonemap_vaapi_save_metadata(AVFilterContext *avctx, AVFrame *input_frame)
Definition: vf_tonemap_vaapi.c:48
HDRVAAPIContext::color_primaries_string
char * color_primaries_string
Definition: vf_tonemap_vaapi.c:34
AVOption
AVOption.
Definition: opt.h:346
AVCOL_TRC_UNSPECIFIED
@ AVCOL_TRC_UNSPECIFIED
Definition: pixfmt.h:583
FILTER_QUERY_FUNC
#define FILTER_QUERY_FUNC(func)
Definition: internal.h:159
AVVAAPIDeviceContext::display
VADisplay display
The VADisplay handle, to be filled by the user.
Definition: hwcontext_vaapi.h:72
AVColorPrimaries
AVColorPrimaries
Chromaticity coordinates of the source primaries.
Definition: pixfmt.h:555
AVFilter::name
const char * name
Filter name.
Definition: avfilter.h:170
video.h
AVFrame::data
uint8_t * data[AV_NUM_DATA_POINTERS]
pointer to the picture/channel planes.
Definition: frame.h:361
HDRVAAPIContext::src_light
AVFrameSideData * src_light
Definition: vf_tonemap_vaapi.c:45
VAAPIVPPContext::build_filter_params
int(* build_filter_params)(AVFilterContext *avctx)
Definition: vaapi_vpp.h:61
AVContentLightMetadata
Content light level needed by to transmit HDR over HDMI (CTA-861.3).
Definition: mastering_display_metadata.h:98
AVFilterContext::priv
void * priv
private data for use by the filter
Definition: avfilter.h:422
fail
#define fail()
Definition: checkasm.h:179
OFFSET
#define OFFSET(x)
Definition: vf_tonemap_vaapi.c:359
HDRVAAPIContext::color_primaries
enum AVColorPrimaries color_primaries
Definition: vf_tonemap_vaapi.c:38
HDRVAAPIContext::color_transfer
enum AVColorTransferCharacteristic color_transfer
Definition: vf_tonemap_vaapi.c:39
AVFilterPad
A filter pad used for either input or output.
Definition: internal.h:33
lrint
#define lrint
Definition: tablegen.h:53
AV_LOG_ERROR
#define AV_LOG_ERROR
Something went wrong and cannot losslessly be recovered.
Definition: log.h:180
av_cold
#define av_cold
Definition: attributes.h:90
AVMasteringDisplayMetadata::white_point
AVRational white_point[2]
CIE 1931 xy chromaticity coords of white point.
Definition: mastering_display_metadata.h:47
av_q2d
static double av_q2d(AVRational a)
Convert an AVRational to a double.
Definition: rational.h:104
VAAPIVPPContext::output_width
int output_width
Definition: vaapi_vpp.h:53
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
VAAPIVPPContext::output_format
enum AVPixelFormat output_format
Definition: vaapi_vpp.h:52
ff_vaapi_vpp_make_param_buffers
int ff_vaapi_vpp_make_param_buffers(AVFilterContext *avctx, int type, const void *data, size_t size, int count)
Definition: vaapi_vpp.c:577
VAAPIVPPContext::hwctx
AVVAAPIDeviceContext * hwctx
Definition: vaapi_vpp.h:41
HDRVAAPIContext::color_transfer_string
char * color_transfer_string
Definition: vf_tonemap_vaapi.c:35
AVCOL_PRI_UNSPECIFIED
@ AVCOL_PRI_UNSPECIFIED
Definition: pixfmt.h:558
FILTER_INPUTS
#define FILTER_INPUTS(array)
Definition: internal.h:182
if
if(ret)
Definition: filter_design.txt:179
FLAGS
#define FLAGS
Definition: vf_tonemap_vaapi.c:360
NULL
#define NULL
Definition: coverity.c:32
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:637
AV_FRAME_DATA_MASTERING_DISPLAY_METADATA
@ AV_FRAME_DATA_MASTERING_DISPLAY_METADATA
Mastering display metadata associated with a video frame.
Definition: frame.h:120
ff_vaapi_vpp_config_input
int ff_vaapi_vpp_config_input(AVFilterLink *inlink)
Definition: vaapi_vpp.c:74
ff_vaapi_vpp_ctx_uninit
void ff_vaapi_vpp_ctx_uninit(AVFilterContext *avctx)
Definition: vaapi_vpp.c:723
ff_vaapi_vpp_query_formats
int ff_vaapi_vpp_query_formats(AVFilterContext *avctx)
Definition: vaapi_vpp.c:27
color_primaries
static const AVColorPrimariesDesc color_primaries[AVCOL_PRI_NB]
Definition: csp.c:76
AVCOL_TRC_SMPTE2084
@ AVCOL_TRC_SMPTE2084
SMPTE ST 2084 for 10-, 12-, 14- and 16-bit systems.
Definition: pixfmt.h:597
vaapi_vpp.h
init
int(* init)(AVBSFContext *ctx)
Definition: dts2pts.c:365
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:106
AVFILTER_DEFINE_CLASS
AVFILTER_DEFINE_CLASS(tonemap_vaapi)
AVFrame::format
int format
format of the frame, -1 if unknown or unset Values correspond to enum AVPixelFormat for video frames,...
Definition: frame.h:427
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:783
output_frame
static int output_frame(H264Context *h, AVFrame *dst, H264Picture *srcp)
Definition: h264dec.c:874
tonemap_vaapi_build_filter_params
static int tonemap_vaapi_build_filter_params(AVFilterContext *avctx)
Definition: vf_tonemap_vaapi.c:177
tonemap_vaapi_options
static const AVOption tonemap_vaapi_options[]
Definition: vf_tonemap_vaapi.c:361
ff_vf_tonemap_vaapi
const AVFilter ff_vf_tonemap_vaapi
Definition: vf_tonemap_vaapi.c:404
AVCOL_TRC_BT709
@ AVCOL_TRC_BT709
also ITU-R BT1361
Definition: pixfmt.h:582
internal.h
VAAPIVPPContext::output_height
int output_height
Definition: vaapi_vpp.h:54
uninit
static void uninit(AVBSFContext *ctx)
Definition: pcm_rechunk.c:68
AV_FRAME_DATA_CONTENT_LIGHT_LEVEL
@ AV_FRAME_DATA_CONTENT_LIGHT_LEVEL
Content light level (based on CTA-861.3).
Definition: frame.h:137
STRING_OPTION
#define STRING_OPTION(var_name, func_name, default_value)
i
#define i(width, name, range_min, range_max)
Definition: cbs_h2645.c:255
AVColorSpace
AVColorSpace
YUV colorspace type.
Definition: pixfmt.h:609
VAAPIVPPContext::filter_buffers
VABufferID filter_buffers[VAProcFilterCount]
Definition: vaapi_vpp.h:56
tonemap_vaapi_outputs
static const AVFilterPad tonemap_vaapi_outputs[]
Definition: vf_tonemap_vaapi.c:396
FFMIN
#define FFMIN(a, b)
Definition: macros.h:49
AVMasteringDisplayMetadata
Mastering display metadata capable of representing the color volume of the display used to master the...
Definition: mastering_display_metadata.h:38
AVFilterPad::name
const char * name
Pad name.
Definition: internal.h:39
AVCOL_SPC_UNSPECIFIED
@ AVCOL_SPC_UNSPECIFIED
Definition: pixfmt.h:612
AVFilter
Filter definition.
Definition: avfilter.h:166
tonemap_vaapi_filter_frame
static int tonemap_vaapi_filter_frame(AVFilterLink *inlink, AVFrame *input_frame)
Definition: vf_tonemap_vaapi.c:232
VAAPIVPPContext
Definition: vaapi_vpp.h:38
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
VAAPIVPPContext::va_context
VAContextID va_context
Definition: vaapi_vpp.h:46
av_get_pix_fmt
enum AVPixelFormat av_get_pix_fmt(const char *name)
Return the pixel format corresponding to name.
Definition: pixdesc.c:2894
HDRVAAPIContext::output_format_string
char * output_format_string
Definition: vf_tonemap_vaapi.c:32
AVFrame::height
int height
Definition: frame.h:412
ff_vaapi_vpp_config_output
int ff_vaapi_vpp_config_output(AVFilterLink *outlink)
Definition: vaapi_vpp.c:99
avfilter.h
HDRVAAPIContext::src_display
AVFrameSideData * src_display
Definition: vf_tonemap_vaapi.c:44
VAAPIVPPContext::pipeline_uninit
void(* pipeline_uninit)(AVFilterContext *avctx)
Definition: vaapi_vpp.h:63
AVMasteringDisplayMetadata::min_luminance
AVRational min_luminance
Min luminance of mastering display (cd/m^2).
Definition: mastering_display_metadata.h:52
tonemap_vaapi_init
static av_cold int tonemap_vaapi_init(AVFilterContext *avctx)
Definition: vf_tonemap_vaapi.c:323
AVFilterContext
An instance of a filter.
Definition: avfilter.h:407
HDRVAAPIContext::in_metadata
VAHdrMetaDataHDR10 in_metadata
Definition: vf_tonemap_vaapi.c:42
VAAPIVPPContext::nb_filter_buffers
int nb_filter_buffers
Definition: vaapi_vpp.h:57
AVMEDIA_TYPE_VIDEO
@ AVMEDIA_TYPE_VIDEO
Definition: avutil.h:201
mastering_display_metadata.h
AVFrameSideData
Structure to hold side data for an AVFrame.
Definition: frame.h:246
AVContentLightMetadata::MaxFALL
unsigned MaxFALL
Max average light level per frame (cd/m^2).
Definition: mastering_display_metadata.h:107
FILTER_OUTPUTS
#define FILTER_OUTPUTS(array)
Definition: internal.h:183
av_log
#define av_log(a,...)
Definition: tableprint_vlc.h:27
AV_OPT_TYPE_STRING
@ AV_OPT_TYPE_STRING
Definition: opt.h:239
tonemap_vaapi_set_filter_params
static int tonemap_vaapi_set_filter_params(AVFilterContext *avctx, AVFrame *input_frame)
Definition: vf_tonemap_vaapi.c:149
HDRVAAPIContext::color_matrix_string
char * color_matrix_string
Definition: vf_tonemap_vaapi.c:36
tonemap_vaapi_inputs
static const AVFilterPad tonemap_vaapi_inputs[]
Definition: vf_tonemap_vaapi.c:387
av_get_pix_fmt_name
const char * av_get_pix_fmt_name(enum AVPixelFormat pix_fmt)
Return the short name for a pixel format, NULL in case pix_fmt is unknown.
Definition: pixdesc.c:2882
ff_vaapi_vpp_init_params
int ff_vaapi_vpp_init_params(AVFilterContext *avctx, VAProcPipelineParameterBuffer *params, const AVFrame *input_frame, AVFrame *output_frame)
Definition: vaapi_vpp.c:528
AVFilterContext::outputs
AVFilterLink ** outputs
array of pointers to output links
Definition: avfilter.h:419
HDRVAAPIContext
Definition: vf_tonemap_vaapi.c:29