FFmpeg: libavfilter/vf_pad_vaapi.c Source File
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
22
27
29 "in_w", "iw",
30 "in_h", "ih",
31 "out_w", "ow",
32 "out_h", "oh",
33 "x",
34 "y",
35 "a",
36 "sar",
37 "dar",
39 };
40
52 };
53
57
63
68
70 {
76 double var_values[
VARS_NB], res;
78 char *expr;
79
86 (
double)
inlink->sample_aspect_ratio.num /
inlink->sample_aspect_ratio.den : 1;
88
100
101 /* evaluate the width again, as it may depend on the evaluated output height */
109
110 if (adjusted_aspect.
num && adjusted_aspect.
den) {
111 adjusted_aspect =
av_div_q(adjusted_aspect,
inlink->sample_aspect_ratio);
114 } else {
116 }
117 }
118
119 /* evaluate x and y */
129 /* evaluate x again, as it may depend on the evaluated y value */
135
140
141 /* sanity check params */
145 }
146
149 } else {
151 }
152
155 } else {
157 }
158
162 }
163
165 if (err < 0)
166 return err;
167
168 return 0;
169 }
170
172 {
178 VAProcPipelineParameterBuffer params;
179 int err;
180
185 }
186
191 }
192
194 if (err < 0)
196
199 if (err < 0)
201
202 pad_ctx->
rect.x = pad_ctx->
x;
203 pad_ctx->
rect.y = pad_ctx->
y;
206 params.output_region = &pad_ctx->
rect;
207
208 params.output_background_color = (pad_ctx->
pad_rgba[3] << 24 |
212
214 if (err < 0)
216
218
220
224 return err;
225 }
226
228 {
230
234
235 return 0;
236 }
237
238 #define OFFSET(x) offsetof(PadVAAPIContext, x)
239 #define FLAGS AV_OPT_FLAG_FILTERING_PARAM|AV_OPT_FLAG_VIDEO_PARAM
240
251 };
252
254
256 {
261 },
262 };
263
265 {
269 },
270 };
271
276 .priv_class = &pad_vaapi_class,
283 };
AVFrame * ff_get_video_buffer(AVFilterLink *link, int w, int h)
Request a picture buffer with a specific set of permissions.
void ff_vaapi_vpp_pipeline_uninit(AVFilterContext *avctx)
void ff_vaapi_vpp_ctx_init(AVFilterContext *avctx)
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
int ff_vaapi_vpp_render_picture(AVFilterContext *avctx, VAProcPipelineParameterBuffer *params, AVFrame *output_frame)
int ff_filter_frame(AVFilterLink *link, AVFrame *frame)
Send a frame of data to the next filter.
AVRational av_div_q(AVRational b, AVRational c)
Divide one rational by another.
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
void av_frame_free(AVFrame **frame)
Free the frame and any dynamically allocated objects in it, e.g.
#define FILTER_INPUTS(array)
This structure describes decoded (raw) audio or video data.
const char * name
Filter name.
@ AV_OPT_TYPE_RATIONAL
Underlying C type is AVRational.
A link between two filters.
void * priv
private data for use by the filter
A filter pad used for either input or output.
#define AV_LOG_ERROR
Something went wrong and cannot losslessly be recovered.
enum AVPixelFormat output_format
static const char *const var_names[]
#define FILTER_OUTPUTS(array)
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
int av_frame_copy_props(AVFrame *dst, const AVFrame *src)
Copy only "metadata" fields from src to dst.
Rational number (pair of numerator and denominator).
@ AV_OPT_TYPE_COLOR
Underlying C type is uint8_t[4].
AVFilterLink ** inputs
array of pointers to input links
int ff_vaapi_vpp_config_input(AVFilterLink *inlink)
void ff_vaapi_vpp_ctx_uninit(AVFilterContext *avctx)
static const AVOption pad_vaapi_options[]
int ff_vaapi_vpp_query_formats(AVFilterContext *avctx)
static const AVFilterPad pad_vaapi_outputs[]
#define FF_FILTER_FLAG_HWFRAME_AWARE
The filter is aware of hardware frames, and any hardware frame context should not be automatically pr...
static av_cold int pad_vaapi_init(AVFilterContext *avctx)
AVFILTER_DEFINE_CLASS(pad_vaapi)
int(* init)(AVBSFContext *ctx)
const AVFilter ff_vf_pad_vaapi
#define NULL_IF_CONFIG_SMALL(x)
Return NULL if CONFIG_SMALL is true, otherwise the argument without modification.
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.
AVFilterContext * src
source filter
static int output_frame(H264Context *h, AVFrame *dst, H264Picture *srcp)
static int pad_vaapi_config_output(AVFilterLink *outlink)
static void uninit(AVBSFContext *ctx)
int w
agreed upon image width
const char * name
Pad name.
int64_t av_rescale(int64_t a, int64_t b, int64_t c)
Rescale a 64-bit integer with rounding to nearest.
AVBufferRef * hw_frames_ctx
For hwaccel-format frames, this should be a reference to the AVHWFramesContext describing the frame.
int ff_vaapi_vpp_config_output(AVFilterLink *outlink)
int h
agreed upon image height
void(* pipeline_uninit)(AVFilterContext *avctx)
static const AVFilterPad pad_vaapi_inputs[]
@ 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...
static int pad_vaapi_filter_frame(AVFilterLink *link, AVFrame *input_frame)
#define FILTER_QUERY_FUNC(func)
int ff_vaapi_vpp_init_params(AVFilterContext *avctx, VAProcPipelineParameterBuffer *params, const AVFrame *input_frame, AVFrame *output_frame)
AVFilterLink ** outputs
array of pointers to output links
Generated on Fri Aug 22 2025 13:59:18 for FFmpeg by
doxygen
1.8.17