FFmpeg
vf_drawbox_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 
19 #include "libavutil/colorspace.h"
20 #include "libavutil/eval.h"
21 #include "libavutil/opt.h"
22 
23 #include "avfilter.h"
24 #include "internal.h"
25 #include "vaapi_vpp.h"
26 #include "video.h"
27 
28 static const char *const var_names[] = {
29  "in_h", "ih",
30  "in_w", "iw",
31  "x",
32  "y",
33  "h",
34  "w",
35  "t",
36  "fill",
37  NULL
38 };
39 
40 enum var_name {
50 };
51 
52 static const int NUM_EXPR_EVALS = 5;
53 
54 typedef struct DrawboxVAAPIContext {
55  VAAPIVPPContext vpp_ctx; // must be the first field
56  VARectangle outer_rect, inner_rect;
57 
58  /* The hardware frame context containing the frames for outer_rect. */
62 
63  char *x_expr;
64  char *y_expr;
65  char *w_expr;
66  char *h_expr;
67  char *t_expr;
68 
69  int w, h;
70  int x, y;
71  int replace;
72  uint32_t thickness;
73  uint8_t drawbox_rgba[4];
74 
75  int fill;
76 
78 
80 {
81  AVFilterContext *avctx = outlink->src;
82  AVFilterLink *inlink = avctx->inputs[0];
83  DrawboxVAAPIContext *ctx = avctx->priv;
84  VAAPIVPPContext *vpp_ctx = avctx->priv;
85  double var_values[VARS_NB], res;
86  int ret, i;
87  char *expr;
88 
89  var_values[VAR_IN_W] = var_values[VAR_IW] = inlink->w;
90  var_values[VAR_IN_H] = var_values[VAR_IH] = inlink->h;
91  var_values[VAR_X] = NAN;
92  var_values[VAR_Y] = NAN;
93  var_values[VAR_H] = NAN;
94  var_values[VAR_W] = NAN;
95  var_values[VAR_T] = NAN;
96 
97  for (i = 0; i <= NUM_EXPR_EVALS; i++) {
98  /* evaluate expressions, fail on last iteration */
99  var_values[VAR_MAX] = inlink->w;
100  if ((ret = av_expr_parse_and_eval(&res, (expr = ctx->x_expr),
101  var_names, var_values,
102  NULL, NULL, NULL, NULL, NULL, 0, ctx)) < 0 && i == NUM_EXPR_EVALS)
103  goto fail;
104  ctx->x = var_values[VAR_X] = res;
105 
106  var_values[VAR_MAX] = inlink->h;
107  if ((ret = av_expr_parse_and_eval(&res, (expr = ctx->y_expr),
108  var_names, var_values,
109  NULL, NULL, NULL, NULL, NULL, 0, ctx)) < 0 && i == NUM_EXPR_EVALS)
110  goto fail;
111  ctx->y = var_values[VAR_Y] = res;
112 
113  var_values[VAR_MAX] = inlink->w - ctx->x;
114  if ((ret = av_expr_parse_and_eval(&res, (expr = ctx->w_expr),
115  var_names, var_values,
116  NULL, NULL, NULL, NULL, NULL, 0, ctx)) < 0 && i == NUM_EXPR_EVALS)
117  goto fail;
118  ctx->w = var_values[VAR_W] = res;
119 
120  var_values[VAR_MAX] = inlink->h - ctx->y;
121  if ((ret = av_expr_parse_and_eval(&res, (expr = ctx->h_expr),
122  var_names, var_values,
123  NULL, NULL, NULL, NULL, NULL, 0, ctx)) < 0 && i == NUM_EXPR_EVALS)
124  goto fail;
125  ctx->h = var_values[VAR_H] = res;
126 
127  var_values[VAR_MAX] = INT_MAX;
128  if ((ret = av_expr_parse_and_eval(&res, (expr = ctx->t_expr),
129  var_names, var_values,
130  NULL, NULL, NULL, NULL, NULL, 0, ctx)) < 0 && i == NUM_EXPR_EVALS)
131  goto fail;
132  ctx->thickness = var_values[VAR_T] = res;
133  }
134 
135  /* Sanity check */
136  ctx->w = (ctx->w > 0) ? ctx->w : inlink->w;
137  ctx->h = (ctx->h > 0) ? ctx->h : inlink->h;
138  if (ctx->x + ctx->w > inlink->w)
139  ctx->w = inlink->w - ctx->x;
140  if (ctx->y + ctx->h > inlink->h)
141  ctx->h = inlink->h - ctx->y;
142 
143  ctx->outer_rect.x = ctx->x;
144  ctx->outer_rect.y = ctx->y;
145  ctx->outer_rect.width = ctx->w;
146  ctx->outer_rect.height = ctx->h;
147 
148  if (ctx->outer_rect.width <= ctx->thickness * 2 ||
149  ctx->outer_rect.height <= ctx->thickness * 2) {
150  ctx->fill = 1;
151  } else {
152  ctx->fill = 0;
153  ctx->inner_rect.x = ctx->outer_rect.x + ctx->thickness;
154  ctx->inner_rect.y = ctx->outer_rect.y + ctx->thickness;
155  ctx->inner_rect.width = ctx->outer_rect.width - ctx->thickness * 2;
156  ctx->inner_rect.height = ctx->outer_rect.height - ctx->thickness * 2;
157  }
158 
159  vpp_ctx->output_width = inlink->w;
160  vpp_ctx->output_height = inlink->h;
161 
162  ret = ff_vaapi_vpp_config_output(outlink);
163  if (ret < 0)
164  return ret;
165 
166  ctx->outer_frames_ref = av_hwframe_ctx_alloc(vpp_ctx->device_ref);
167  if (!ctx->outer_frames_ref) {
168  return AVERROR(ENOMEM);
169  }
170 
171  ctx->outer_frames = (AVHWFramesContext*)ctx->outer_frames_ref->data;
172 
173  ctx->outer_frames->format = AV_PIX_FMT_VAAPI;
174  ctx->outer_frames->sw_format = vpp_ctx->input_frames->sw_format;
175  ctx->outer_frames->width = ctx->outer_rect.width;
176  ctx->outer_frames->height = ctx->outer_rect.height;
177 
178  return av_hwframe_ctx_init(ctx->outer_frames_ref);
179 
180 fail:
181  av_log(avctx, AV_LOG_ERROR,
182  "Error when evaluating the expression '%s'.\n",
183  expr);
184  return ret;
185 }
186 
188 {
189  AVFilterContext *avctx = link->dst;
190  AVFilterLink *outlink = avctx->outputs[0];
191  VAAPIVPPContext *vpp_ctx = avctx->priv;
192  DrawboxVAAPIContext *drawbox_ctx = avctx->priv;
194  VAProcPipelineParameterBuffer box_params;
195  VAProcPipelineParameterBuffer params[3];
196  VABlendState blend_state = {
197  .flags = VA_BLEND_GLOBAL_ALPHA,
198  };
199  VARectangle box[4];
200  int err, nb_params = 0;
201 
202  if (!input_frame->hw_frames_ctx ||
203  vpp_ctx->va_context == VA_INVALID_ID) {
204  err = AVERROR(EINVAL);
205  goto fail;
206  }
207 
208  if (!drawbox_ctx->outer_frame) {
209  drawbox_ctx->outer_frame = av_frame_alloc();
210  if (!drawbox_ctx->outer_frame) {
211  err = AVERROR(ENOMEM);
212  goto fail;
213  }
214 
215  err = av_hwframe_get_buffer(drawbox_ctx->outer_frames_ref, drawbox_ctx->outer_frame, 0);
216  if (err < 0) {
217  err = AVERROR(ENOMEM);
218  goto fail;
219  }
220 
221  /* Create image for the outer rect */
222  err = ff_vaapi_vpp_init_params(avctx, &box_params,
223  input_frame, drawbox_ctx->outer_frame);
224  if (err < 0)
225  goto fail;
226 
227  blend_state.global_alpha = 0.0f;
228  box_params.surface_region = &drawbox_ctx->outer_rect;
229  box_params.blend_state = &blend_state;
230  box_params.output_background_color = (drawbox_ctx->drawbox_rgba[3] << 24 |
231  drawbox_ctx->drawbox_rgba[0] << 16 |
232  drawbox_ctx->drawbox_rgba[1] << 8 |
233  drawbox_ctx->drawbox_rgba[2]);
234 
235  err = ff_vaapi_vpp_render_picture(avctx, &box_params, drawbox_ctx->outer_frame);
236  if (err < 0)
237  goto fail;
238  }
239 
240  /* Draw outer & inner rects on the input video, then we can get a box*/
241  output_frame = ff_get_video_buffer(outlink, outlink->w, outlink->h);
242  if (!output_frame) {
243  err = AVERROR(ENOMEM);
244  goto fail;
245  }
246 
247  err = av_frame_copy_props(output_frame, input_frame);
248  if (err < 0)
249  goto fail;
250 
251  err = ff_vaapi_vpp_init_params(avctx, &params[nb_params],
252  input_frame, output_frame);
253  if (err < 0)
254  goto fail;
255 
256  box[0].x = 0;
257  box[0].y = 0;
258  box[0].width = link->w;
259  box[0].height = link->h;
260  params[nb_params].surface_region = &box[0];
261  params[nb_params].output_background_color = 0;
262  nb_params++;
263 
264  err = ff_vaapi_vpp_init_params(avctx, &params[nb_params],
265  drawbox_ctx->outer_frame, output_frame);
266  if (err < 0)
267  goto fail;
268 
269  box[1] = drawbox_ctx->outer_rect;
270  if (drawbox_ctx->drawbox_rgba[3] != 255 && !drawbox_ctx->replace) {
271  blend_state.global_alpha = (float)drawbox_ctx->drawbox_rgba[3] / 255;
272  params[nb_params].blend_state = &blend_state;
273  }
274  params[nb_params].output_region = &box[1];
275  params[nb_params].output_background_color = 0;
276  nb_params++;
277 
278  if (!drawbox_ctx->fill) {
279  box[3] = box[2] = drawbox_ctx->inner_rect;
280  params[nb_params] = params[0];
281  params[nb_params].surface_region = &box[2];
282  params[nb_params].output_region = &box[3];
283  params[nb_params].output_background_color = 0;
284  nb_params++;
285  }
286 
287  err = ff_vaapi_vpp_render_pictures(avctx, params, nb_params, output_frame);
288  if (err < 0)
289  goto fail;
290 
291  av_frame_free(&input_frame);
292 
293  return ff_filter_frame(outlink, output_frame);
294 
295 fail:
296  av_frame_free(&input_frame);
298  return err;
299 }
300 
302 {
303  VAAPIVPPContext *vpp_ctx = avctx->priv;
304 
305  ff_vaapi_vpp_ctx_init(avctx);
307  vpp_ctx->output_format = AV_PIX_FMT_NONE;
308 
309  return 0;
310 }
311 
313 {
314  DrawboxVAAPIContext *ctx = avctx->priv;
315 
316  av_frame_free(&ctx->outer_frame);
317  av_buffer_unref(&ctx->outer_frames_ref);
319 }
320 
321 #define OFFSET(x) offsetof(DrawboxVAAPIContext, x)
322 #define FLAGS AV_OPT_FLAG_FILTERING_PARAM|AV_OPT_FLAG_VIDEO_PARAM
323 
324 static const AVOption drawbox_vaapi_options[] = {
325  { "x", "set horizontal position of the left box edge", OFFSET(x_expr), AV_OPT_TYPE_STRING, { .str="0" }, 0, 0, FLAGS },
326  { "y", "set vertical position of the top box edge", OFFSET(y_expr), AV_OPT_TYPE_STRING, { .str="0" }, 0, 0, FLAGS },
327  { "width", "set width of the box", OFFSET(w_expr), AV_OPT_TYPE_STRING, { .str="0" }, 0, 0, FLAGS },
328  { "w", "set width of the box", OFFSET(w_expr), AV_OPT_TYPE_STRING, { .str="0" }, 0, 0, FLAGS },
329  { "height", "set height of the box", OFFSET(h_expr), AV_OPT_TYPE_STRING, { .str="0" }, 0, 0, FLAGS },
330  { "h", "set height of the box", OFFSET(h_expr), AV_OPT_TYPE_STRING, { .str="0" }, 0, 0, FLAGS },
331  { "color", "set color of the box", OFFSET(drawbox_rgba), AV_OPT_TYPE_COLOR, { .str = "black" }, 0, 0, FLAGS },
332  { "c", "set color of the box", OFFSET(drawbox_rgba), AV_OPT_TYPE_COLOR, { .str = "black" }, 0, 0, FLAGS },
333  { "thickness", "set the box thickness", OFFSET(t_expr), AV_OPT_TYPE_STRING, { .str="3" }, 0, 0, FLAGS },
334  { "t", "set the box thickness", OFFSET(t_expr), AV_OPT_TYPE_STRING, { .str="3" }, 0, 0, FLAGS },
335  { "replace", "replace color", OFFSET(replace), AV_OPT_TYPE_BOOL, { .i64=0 }, 0, 1, FLAGS },
336  { NULL }
337 };
338 
339 AVFILTER_DEFINE_CLASS(drawbox_vaapi);
340 
342  {
343  .name = "default",
344  .type = AVMEDIA_TYPE_VIDEO,
345  .filter_frame = drawbox_vaapi_filter_frame,
346  .config_props = &ff_vaapi_vpp_config_input,
347  },
348 };
349 
351  {
352  .name = "default",
353  .type = AVMEDIA_TYPE_VIDEO,
354  .config_props = &drawbox_vaapi_config_output,
355  },
356 };
357 
359  .name = "drawbox_vaapi",
360  .description = NULL_IF_CONFIG_SMALL("Draw a colored box on the input video."),
361  .priv_size = sizeof(DrawboxVAAPIContext),
362  .priv_class = &drawbox_vaapi_class,
368  .flags_internal = FF_FILTER_FLAG_HWFRAME_AWARE,
369 };
FLAGS
#define FLAGS
Definition: vf_drawbox_vaapi.c:322
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
ff_vaapi_vpp_pipeline_uninit
void ff_vaapi_vpp_pipeline_uninit(AVFilterContext *avctx)
Definition: vaapi_vpp.c:49
ff_vaapi_vpp_ctx_init
void ff_vaapi_vpp_ctx_init(AVFilterContext *avctx)
Definition: vaapi_vpp.c:715
DrawboxVAAPIContext::outer_frames
AVHWFramesContext * outer_frames
Definition: vf_drawbox_vaapi.c:60
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
DrawboxVAAPIContext::w_expr
char * w_expr
Definition: vf_drawbox_vaapi.c:65
var_name
var_name
Definition: noise.c:47
ff_vaapi_vpp_render_picture
int ff_vaapi_vpp_render_picture(AVFilterContext *avctx, VAProcPipelineParameterBuffer *params, AVFrame *output_frame)
Definition: vaapi_vpp.c:708
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:1015
DrawboxVAAPIContext::y_expr
char * y_expr
Definition: vf_drawbox_vaapi.c:64
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:160
av_hwframe_ctx_init
int av_hwframe_ctx_init(AVBufferRef *ref)
Finalize the context before use.
Definition: hwcontext.c:322
AVFrame
This structure describes decoded (raw) audio or video data.
Definition: frame.h:374
av_hwframe_ctx_alloc
AVBufferRef * av_hwframe_ctx_alloc(AVBufferRef *device_ref_in)
Allocate an AVHWFramesContext tied to a given device context.
Definition: hwcontext.c:248
AVOption
AVOption.
Definition: opt.h:357
VAAPIVPPContext::input_frames
AVHWFramesContext * input_frames
Definition: vaapi_vpp.h:49
FILTER_QUERY_FUNC
#define FILTER_QUERY_FUNC(func)
Definition: internal.h:159
ff_vaapi_vpp_render_pictures
int ff_vaapi_vpp_render_pictures(AVFilterContext *avctx, VAProcPipelineParameterBuffer *params_list, int cout, AVFrame *output_frame)
Definition: vaapi_vpp.c:640
AVFilter::name
const char * name
Filter name.
Definition: avfilter.h:170
video.h
DrawboxVAAPIContext::fill
int fill
Definition: vf_drawbox_vaapi.c:75
drawbox_vaapi_outputs
static const AVFilterPad drawbox_vaapi_outputs[]
Definition: vf_drawbox_vaapi.c:350
AVFilterContext::priv
void * priv
private data for use by the filter
Definition: avfilter.h:422
fail
#define fail()
Definition: checkasm.h:184
DrawboxVAAPIContext::outer_rect
VARectangle outer_rect
Definition: vf_drawbox_vaapi.c:56
VAR_T
@ VAR_T
Definition: vf_drawbox_vaapi.c:47
DrawboxVAAPIContext::h_expr
char * h_expr
Definition: vf_drawbox_vaapi.c:66
drawbox_vaapi_config_output
static int drawbox_vaapi_config_output(AVFilterLink *outlink)
Definition: vf_drawbox_vaapi.c:79
VAR_IN_H
@ VAR_IN_H
Definition: vf_drawbox_vaapi.c:41
AVFilterPad
A filter pad used for either input or output.
Definition: internal.h:33
av_frame_alloc
AVFrame * av_frame_alloc(void)
Allocate an AVFrame and set its fields to default values.
Definition: frame.c:148
colorspace.h
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
AVFILTER_DEFINE_CLASS
AVFILTER_DEFINE_CLASS(drawbox_vaapi)
DrawboxVAAPIContext::drawbox_rgba
uint8_t drawbox_rgba[4]
Definition: vf_drawbox_vaapi.c:73
float
float
Definition: af_crystalizer.c:121
VAR_IW
@ VAR_IW
Definition: vf_drawbox_vaapi.c:42
VAAPIVPPContext::output_width
int output_width
Definition: vaapi_vpp.h:53
ctx
AVFormatContext * ctx
Definition: movenc.c:49
VAAPIVPPContext::output_format
enum AVPixelFormat output_format
Definition: vaapi_vpp.h:52
OFFSET
#define OFFSET(x)
Definition: vf_drawbox_vaapi.c:321
NAN
#define NAN
Definition: mathematics.h:115
drawbox_vaapi_inputs
static const AVFilterPad drawbox_vaapi_inputs[]
Definition: vf_drawbox_vaapi.c:341
FILTER_INPUTS
#define FILTER_INPUTS(array)
Definition: internal.h:182
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
drawbox_vaapi_init
static av_cold int drawbox_vaapi_init(AVFilterContext *avctx)
Definition: vf_drawbox_vaapi.c:301
NULL
#define NULL
Definition: coverity.c:32
AVHWFramesContext::sw_format
enum AVPixelFormat sw_format
The pixel format identifying the actual data layout of the hardware frames.
Definition: hwcontext.h:210
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:709
DrawboxVAAPIContext::inner_rect
VARectangle inner_rect
Definition: vf_drawbox_vaapi.c:56
av_buffer_unref
void av_buffer_unref(AVBufferRef **buf)
Free a given reference and automatically free the buffer if there are no more references to it.
Definition: buffer.c:139
VAR_IH
@ VAR_IH
Definition: vf_drawbox_vaapi.c:41
drawbox_vaapi_uninit
static av_cold void drawbox_vaapi_uninit(AVFilterContext *avctx)
Definition: vf_drawbox_vaapi.c:312
AV_OPT_TYPE_COLOR
@ AV_OPT_TYPE_COLOR
Definition: opt.h:260
AVFilterContext::inputs
AVFilterLink ** inputs
array of pointers to input links
Definition: avfilter.h:415
DrawboxVAAPIContext::x
int x
Definition: vf_drawbox_vaapi.c:70
DrawboxVAAPIContext::replace
int replace
Definition: vf_drawbox_vaapi.c:71
DrawboxVAAPIContext::x_expr
char * x_expr
Definition: vf_drawbox_vaapi.c:63
ff_vaapi_vpp_config_input
int ff_vaapi_vpp_config_input(AVFilterLink *inlink)
Definition: vaapi_vpp.c:75
ff_vaapi_vpp_ctx_uninit
void ff_vaapi_vpp_ctx_uninit(AVFilterContext *avctx)
Definition: vaapi_vpp.c:729
DrawboxVAAPIContext::y
int y
Definition: vf_drawbox_vaapi.c:70
ff_vaapi_vpp_query_formats
int ff_vaapi_vpp_query_formats(AVFilterContext *avctx)
Definition: vaapi_vpp.c:28
eval.h
vaapi_vpp.h
init
int(* init)(AVBSFContext *ctx)
Definition: dts2pts.c:366
VAR_X
@ VAR_X
Definition: vf_drawbox_vaapi.c:43
VARS_NB
@ VARS_NB
Definition: vf_drawbox_vaapi.c:49
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:94
av_expr_parse_and_eval
int av_expr_parse_and_eval(double *d, const char *s, const char *const *const_names, const double *const_values, const char *const *func1_names, double(*const *funcs1)(void *, double), const char *const *func2_names, double(*const *funcs2)(void *, double, double), void *opaque, int log_offset, void *log_ctx)
Parse and evaluate an expression.
Definition: eval.c:803
VAR_H
@ VAR_H
Definition: vf_drawbox_vaapi.c:45
output_frame
static int output_frame(H264Context *h, AVFrame *dst, H264Picture *srcp)
Definition: h264dec.c:875
DrawboxVAAPIContext::outer_frames_ref
AVBufferRef * outer_frames_ref
Definition: vf_drawbox_vaapi.c:59
AV_PIX_FMT_VAAPI
@ AV_PIX_FMT_VAAPI
Hardware acceleration through VA-API, data[3] contains a VASurfaceID.
Definition: pixfmt.h:126
internal.h
DrawboxVAAPIContext::t_expr
char * t_expr
Definition: vf_drawbox_vaapi.c:67
VAAPIVPPContext::output_height
int output_height
Definition: vaapi_vpp.h:54
uninit
static void uninit(AVBSFContext *ctx)
Definition: pcm_rechunk.c:68
i
#define i(width, name, range_min, range_max)
Definition: cbs_h2645.c:256
DrawboxVAAPIContext::thickness
uint32_t thickness
Definition: vf_drawbox_vaapi.c:72
DrawboxVAAPIContext::vpp_ctx
VAAPIVPPContext vpp_ctx
Definition: vf_drawbox_vaapi.c:55
AVFilterPad::name
const char * name
Pad name.
Definition: internal.h:39
AVFilter
Filter definition.
Definition: avfilter.h:166
AVHWFramesContext
This struct describes a set or pool of "hardware" frames (i.e.
Definition: hwcontext.h:115
ret
ret
Definition: filter_design.txt:187
VAAPIVPPContext
Definition: vaapi_vpp.h:38
NUM_EXPR_EVALS
static const int NUM_EXPR_EVALS
Definition: vf_drawbox_vaapi.c:52
DrawboxVAAPIContext::h
int h
Definition: vf_drawbox_vaapi.c:69
VAAPIVPPContext::va_context
VAContextID va_context
Definition: vaapi_vpp.h:46
DrawboxVAAPIContext::w
int w
Definition: vf_drawbox_vaapi.c:69
AVFrame::hw_frames_ctx
AVBufferRef * hw_frames_ctx
For hwaccel-format frames, this should be a reference to the AVHWFramesContext describing the frame.
Definition: frame.h:725
AVFrame::height
int height
Definition: frame.h:446
VAR_W
@ VAR_W
Definition: vf_drawbox_vaapi.c:46
ff_vaapi_vpp_config_output
int ff_vaapi_vpp_config_output(AVFilterLink *outlink)
Definition: vaapi_vpp.c:100
AV_PIX_FMT_NONE
@ AV_PIX_FMT_NONE
Definition: pixfmt.h:72
avfilter.h
DrawboxVAAPIContext::outer_frame
AVFrame * outer_frame
Definition: vf_drawbox_vaapi.c:61
VAAPIVPPContext::pipeline_uninit
void(* pipeline_uninit)(AVFilterContext *avctx)
Definition: vaapi_vpp.h:63
AVFilterContext
An instance of a filter.
Definition: avfilter.h:407
AVMEDIA_TYPE_VIDEO
@ AVMEDIA_TYPE_VIDEO
Definition: avutil.h:201
AVBufferRef
A reference to a data buffer.
Definition: buffer.h:82
VAR_IN_W
@ VAR_IN_W
Definition: vf_drawbox_vaapi.c:42
AV_OPT_TYPE_BOOL
@ AV_OPT_TYPE_BOOL
Definition: opt.h:261
FILTER_OUTPUTS
#define FILTER_OUTPUTS(array)
Definition: internal.h:183
ff_vf_drawbox_vaapi
const AVFilter ff_vf_drawbox_vaapi
Definition: vf_drawbox_vaapi.c:358
DrawboxVAAPIContext
Definition: vf_drawbox_vaapi.c:54
av_log
#define av_log(a,...)
Definition: tableprint_vlc.h:27
var_names
static const char *const var_names[]
Definition: vf_drawbox_vaapi.c:28
VAR_MAX
@ VAR_MAX
Definition: vf_drawbox_vaapi.c:48
AV_OPT_TYPE_STRING
@ AV_OPT_TYPE_STRING
Definition: opt.h:249
VAAPIVPPContext::device_ref
AVBufferRef * device_ref
Definition: vaapi_vpp.h:42
av_hwframe_get_buffer
int av_hwframe_get_buffer(AVBufferRef *hwframe_ref, AVFrame *frame, int flags)
Allocate a new frame attached to the given AVHWFramesContext.
Definition: hwcontext.c:491
VAR_Y
@ VAR_Y
Definition: vf_drawbox_vaapi.c:44
drawbox_vaapi_filter_frame
static int drawbox_vaapi_filter_frame(AVFilterLink *link, AVFrame *input_frame)
Definition: vf_drawbox_vaapi.c:187
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:534
AVFilterContext::outputs
AVFilterLink ** outputs
array of pointers to output links
Definition: avfilter.h:419
drawbox_vaapi_options
static const AVOption drawbox_vaapi_options[]
Definition: vf_drawbox_vaapi.c:324