100 double var_values[
VARS_NB], res;
110 var_values[
VAR_A] = (double) inlink->
w / inlink->
h;
120 NULL, NULL, NULL, NULL, NULL, 0, ctx);
124 NULL, NULL, NULL, NULL, NULL, 0, ctx)) < 0)
130 NULL, NULL, NULL, NULL, NULL, 0, ctx)) < 0)
137 NULL, NULL, NULL, NULL, NULL, 0, ctx);
138 s->
x = var_values[
VAR_X] = res;
141 NULL, NULL, NULL, NULL, NULL, 0, ctx)) < 0)
143 s->
y = var_values[
VAR_Y] = res;
147 NULL, NULL, NULL, NULL, NULL, 0, ctx)) < 0)
149 s->
x = var_values[
VAR_X] = res;
152 if (s->
w < 0 || s->
h < 0 || s->
x < 0 || s->
y < 0) {
170 inlink->
w, inlink->
h, s->
w, s->
h, s->
x, s->
y,
173 if (s->
x < 0 || s->
y < 0 ||
174 s->
w <= 0 || s->
h <= 0 ||
175 (
unsigned)s->
x + (
unsigned)inlink->
w > s->
w ||
176 (
unsigned)s->
y + (
unsigned)inlink->
h > s->
h) {
178 "Input area %d:%d:%d:%d not within the padded area 0:0:%d:%d or zero-sized\n",
179 s->
x, s->
y, s->
x + inlink->
w, s->
y + inlink->
h, s->
w, s->
h);
187 "Error when evaluating the expression '%s'\n", expr);
206 w + (s->
w - s->
in_w),
207 h + (s->
h - s->
in_h));
216 for (plane = 0; plane < 4 && frame->
data[plane] && frame->
linesize[plane]; plane++) {
229 int planes[4] = { -1, -1, -1, -1}, *p = planes;
240 for (i = 0; i < FF_ARRAY_ELEMS(planes) && planes[i] >= 0; i++) {
250 ptrdiff_t req_start = (s->
x >> hsub) * s->
draw.
pixelstep[planes[i]] +
251 (s->
y >> vsub) * frame->
linesize[planes[i]];
252 ptrdiff_t req_end = ((s->
w - s->
x - frame->
width) >> hsub) *
258 if (start - buf->
data < req_start ||
259 (buf->
data + buf->
size) - end < req_end)
262 for (j = 0; j < FF_ARRAY_ELEMS(planes) && planes[j] >= 0; j++) {
263 int vsub1 = s->
draw.
vsub[planes[j]];
270 if (
FFSIGN(start - end1) !=
FFSIGN(start - end1 - req_start) ||
286 for (i = 0; i < 4 && frame->
buf[i]; i++)
313 for (i = 0; i < 4 && out->
data[i] && out->
linesize[i]; i++) {
329 if (s->
h > s->
y + s->
in_h) {
358 #define OFFSET(x) offsetof(PadContext, x)
359 #define FLAGS AV_OPT_FLAG_FILTERING_PARAM|AV_OPT_FLAG_VIDEO_PARAM
366 {
"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 },
367 {
"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 },
398 .priv_class = &pad_class,
400 .
inputs = avfilter_vf_pad_inputs,
401 .
outputs = avfilter_vf_pad_outputs,