85 double var_values[
VARS_NB], res;
132 ctx->thickness = var_values[
VAR_T] = res;
138 if (
ctx->x +
ctx->w > inlink->
w)
140 if (
ctx->y +
ctx->h > inlink->
h)
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;
148 if (
ctx->outer_rect.width <=
ctx->thickness * 2 ||
149 ctx->outer_rect.height <=
ctx->thickness * 2) {
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;
167 if (!
ctx->outer_frames_ref) {
175 ctx->outer_frames->width =
ctx->outer_rect.width;
176 ctx->outer_frames->height =
ctx->outer_rect.height;
182 "Error when evaluating the expression '%s'.\n",
194 VAProcPipelineParameterBuffer box_params;
195 VAProcPipelineParameterBuffer
params[3];
196 VABlendState blend_state = {
197 .flags = VA_BLEND_GLOBAL_ALPHA,
200 int err, nb_params = 0;
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 |
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;
272 params[nb_params].blend_state = &blend_state;
274 params[nb_params].output_region = &
box[1];
275 params[nb_params].output_background_color = 0;
278 if (!drawbox_ctx->
fill) {
281 params[nb_params].surface_region = &
box[2];
282 params[nb_params].output_region = &
box[3];
283 params[nb_params].output_background_color = 0;
321#define OFFSET(x) offsetof(DrawboxVAAPIContext, x)
322#define FLAGS AV_OPT_FLAG_FILTERING_PARAM|AV_OPT_FLAG_VIDEO_PARAM
359 .p.name =
"drawbox_vaapi",
361 .p.priv_class = &drawbox_vaapi_class,
SwsAArch64OpImplParams params
const FFFilter ff_vf_drawbox_vaapi
static AVFormatContext * ctx
int ff_filter_frame(AVFilterLink *link, AVFrame *frame)
Send a frame of data to the next filter.
Main libavfilter public API header.
#define i(width, name, range_min, range_max)
int(* init)(AVBSFContext *ctx)
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.
simple arithmetic expression evaluator
static av_unused double box(double x, const double *params)
@ AV_OPT_TYPE_BOOL
Underlying C type is int.
@ AV_OPT_TYPE_STRING
Underlying C type is a uint8_t* that is either NULL or points to a C string allocated with the av_mal...
@ AV_OPT_TYPE_COLOR
Underlying C type is uint8_t[4].
void av_buffer_unref(AVBufferRef **buf)
Free a given reference and automatically free the buffer if there are no more references to it.
void av_frame_free(AVFrame **frame)
Free the frame and any dynamically allocated objects in it, e.g.
int av_frame_copy_props(AVFrame *dst, const AVFrame *src)
Copy only "metadata" fields from src to dst.
AVFrame * av_frame_alloc(void)
Allocate an AVFrame and set its fields to default values.
#define AV_LOG_ERROR
Something went wrong and cannot losslessly be recovered.
int av_hwframe_ctx_init(AVBufferRef *ref)
Finalize the context before use.
AVBufferRef * av_hwframe_ctx_alloc(AVBufferRef *device_ref_in)
Allocate an AVHWFramesContext tied to a given device context.
int av_hwframe_get_buffer(AVBufferRef *hwframe_ref, AVFrame *frame, int flags)
Allocate a new frame attached to the given AVHWFramesContext.
static av_cold void uninit(AVBitStreamFilterContext *ctx)
static int output_frame(H264Context *h, AVFrame *dst, H264Picture *srcp)
#define FILTER_INPUTS(array)
#define FILTER_OUTPUTS(array)
#define FF_FILTER_FLAG_HWFRAME_AWARE
The filter is aware of hardware frames, and any hardware frame context should not be automatically pr...
#define AVFILTER_DEFINE_CLASS(fname)
#define FILTER_QUERY_FUNC2(func)
Various defines for YUV<->RGB conversion.
#define NULL_IF_CONFIG_SMALL(x)
Return NULL if CONFIG_SMALL is true, otherwise the argument without modification.
static const char *const var_names[]
@ AV_PIX_FMT_VAAPI
Hardware acceleration through VA-API, data[3] contains a VASurfaceID.
A reference to a data buffer.
AVFilterLink ** inputs
array of pointers to input links
void * priv
private data for use by the filter
AVFilterLink ** outputs
array of pointers to output links
A link between two filters.
int w
agreed upon image width
int h
agreed upon image height
AVFilterContext * src
source filter
AVFilterContext * dst
dest filter
A filter pad used for either input or output.
This structure describes decoded (raw) audio or video data.
AVBufferRef * hw_frames_ctx
For hwaccel-format frames, this should be a reference to the AVHWFramesContext describing the frame.
This struct describes a set or pool of "hardware" frames (i.e.
enum AVPixelFormat sw_format
The pixel format identifying the actual data layout of the hardware frames.
AVHWFramesContext * outer_frames
AVBufferRef * outer_frames_ref
void(* pipeline_uninit)(AVFilterContext *avctx)
enum AVPixelFormat output_format
AVHWFramesContext * input_frames
int ff_vaapi_vpp_render_pictures(AVFilterContext *avctx, VAProcPipelineParameterBuffer *params_list, int cout, AVFrame *output_frame)
int ff_vaapi_vpp_config_output(AVFilterLink *outlink)
int ff_vaapi_vpp_config_input(AVFilterLink *inlink)
int ff_vaapi_vpp_query_formats(const AVFilterContext *avctx, AVFilterFormatsConfig **cfg_in, AVFilterFormatsConfig **cfg_out)
void ff_vaapi_vpp_pipeline_uninit(AVFilterContext *avctx)
void ff_vaapi_vpp_ctx_init(AVFilterContext *avctx)
int ff_vaapi_vpp_init_params(AVFilterContext *avctx, VAProcPipelineParameterBuffer *params, const AVFrame *input_frame, AVFrame *output_frame)
int ff_vaapi_vpp_render_picture(AVFilterContext *avctx, VAProcPipelineParameterBuffer *params, AVFrame *output_frame)
void ff_vaapi_vpp_ctx_uninit(AVFilterContext *avctx)
static const int NUM_EXPR_EVALS
static const AVFilterPad drawbox_vaapi_outputs[]
static const AVFilterPad drawbox_vaapi_inputs[]
static const AVOption drawbox_vaapi_options[]
static av_cold int drawbox_vaapi_init(AVFilterContext *avctx)
static int drawbox_vaapi_config_output(AVFilterLink *outlink)
static int drawbox_vaapi_filter_frame(AVFilterLink *link, AVFrame *input_frame)
static av_cold void drawbox_vaapi_uninit(AVFilterContext *avctx)
AVFrame * ff_get_video_buffer(AVFilterLink *link, int w, int h)
Request a picture buffer with a specific set of permissions.