111 var_values[
VAR_A] = (double) inlink->
w / inlink->
h;
121 NULL, NULL, NULL, NULL, NULL, 0, ctx);
125 NULL, NULL, NULL, NULL, NULL, 0, ctx)) < 0)
131 NULL, NULL, NULL, NULL, NULL, 0, ctx)) < 0)
138 NULL, NULL, NULL, NULL, NULL, 0, ctx);
142 NULL, NULL, NULL, NULL, NULL, 0, ctx)) < 0)
148 NULL, NULL, NULL, NULL, NULL, 0, ctx)) < 0)
153 if (s->
w < 0 || s->
h < 0 || s->
x < 0 || s->
y < 0) {
171 inlink->
w, inlink->
h, s->
w, s->
h, s->
x, s->
y,
174 if (s->
x < 0 || s->
y < 0 ||
175 s->
w <= 0 || s->
h <= 0 ||
176 (
unsigned)s->
x + (
unsigned)inlink->
w > s->
w ||
177 (
unsigned)s->
y + (
unsigned)inlink->
h > s->
h) {
179 "Input area %d:%d:%d:%d not within the padded area 0:0:%d:%d or zero-sized\n",
180 s->
x, s->
y, s->
x + inlink->
w, s->
y + inlink->
h, s->
w, s->
h);
188 "Error when evaluating the expression '%s'\n", expr);
207 w + (s->
w - s->
in_w),
208 h + (s->
h - s->
in_h));
217 for (plane = 0; plane < 4 && frame->
data[plane]; plane++) {
230 int planes[4] = { -1, -1, -1, -1}, *p = planes;
241 for (i = 0; i < FF_ARRAY_ELEMS(planes) && planes[i] >= 0; i++) {
251 ptrdiff_t req_start = (s->
x >> hsub) * s->
draw.
pixelstep[planes[i]] +
252 (s->
y >> vsub) * frame->
linesize[planes[i]];
253 ptrdiff_t req_end = ((s->
w - s->
x - frame->
width) >> hsub) *
255 (s->
y >> vsub) * frame->
linesize[planes[i]];
259 if (start - buf->
data < req_start ||
260 (buf->
data + buf->
size) - end < req_end)
263 for (j = 0; j < FF_ARRAY_ELEMS(planes) && planes[j] >= 0; j++) {
264 int vsub1 = s->
draw.
vsub[planes[j]];
271 if (
FFSIGN(start - end1) !=
FFSIGN(start - end1 - req_start) ||
287 for (i = 0; i < 4 && frame->
buf[i]; i++)
314 for (i = 0; i < 4 && out->
data[i]; i++) {
330 if (s->
h > s->
y + s->
in_h) {
359 #define OFFSET(x) offsetof(PadContext, x)
360 #define FLAGS AV_OPT_FLAG_FILTERING_PARAM|AV_OPT_FLAG_VIDEO_PARAM
367 {
"x",
"set the x offset expression for the input image position",
OFFSET(x_expr),
AV_OPT_TYPE_STRING, {.str =
"0"}, CHAR_MIN, CHAR_MAX,
FLAGS },
368 {
"y",
"set the y offset expression for the input image position",
OFFSET(y_expr),
AV_OPT_TYPE_STRING, {.str =
"0"}, CHAR_MIN, CHAR_MAX,
FLAGS },
397 .description =
NULL_IF_CONFIG_SMALL(
"Pad input image to width:height[:x:y[:color]] (default x and y: 0, default color: black)."),
400 .priv_class = &pad_class,
403 .
inputs = avfilter_vf_pad_inputs,
405 .
outputs = avfilter_vf_pad_outputs,