90 char *x_expr, *
y_expr, *w_expr, *h_expr;
95 #define OFFSET(x) offsetof(CropContext, x)
96 #define FLAGS AV_OPT_FLAG_FILTERING_PARAM|AV_OPT_FLAG_VIDEO_PARAM
114 static const char *shorthand[] = {
"w",
"h",
"x",
"y",
"keep_aspect",
NULL };
116 crop->
class = &crop_class;
170 }
else if (d > INT_MAX || d < INT_MIN) {
171 *n = d > INT_MAX ? INT_MAX : INT_MIN;
223 "Too big value or invalid expression for out_w/ow or out_h/oh. "
224 "Maybe the expression for out_w:'%s' or for out_h:'%s' is self-referencing.\n",
228 crop->
w &= ~((1 << crop->
hsub) - 1);
229 crop->
h &= ~((1 << crop->
vsub) - 1);
241 dar.num * crop->
h, dar.den * crop->
w, INT_MAX);
243 crop->out_sar = link->sample_aspect_ratio;
246 link->w, link->h, link->sample_aspect_ratio.num, link->sample_aspect_ratio.den,
247 crop->w, crop->h, crop->out_sar.num, crop->out_sar.den);
249 if (crop->w <= 0 || crop->h <= 0 ||
250 crop->w > link->w || crop->h > link->h) {
252 "Invalid too big or non positive size for width '%d' or height '%d'\n",
258 crop->x = (link->w - crop->w) / 2;
259 crop->y = (link->h - crop->h) / 2;
260 crop->x &= ~((1 << crop->hsub) - 1);
261 crop->y &= ~((1 << crop->vsub) - 1);
300 if (crop->
x < 0) crop->
x = 0;
301 if (crop->
y < 0) crop->
y = 0;
302 if ((
unsigned)crop->
x + (
unsigned)crop->
w > link->
w) crop->
x = link->
w - crop->
w;
303 if ((
unsigned)crop->
y + (
unsigned)crop->
h > link->
h) crop->
y = link->
h - crop->
h;
304 crop->
x &= ~((1 << crop->
hsub) - 1);
305 crop->
y &= ~((1 << crop->
vsub) - 1);
307 av_dlog(ctx,
"n:%d t:%f x:%d y:%d x+w:%d y+h:%d\n",
309 crop->
y, crop->
x+crop->
w, crop->
y+crop->
h);
315 for (i = 1; i < 3; i ++) {
316 if (frame->
data[i]) {
324 if (frame->
data[3]) {
364 .
inputs = avfilter_vf_crop_inputs,
365 .
outputs = avfilter_vf_crop_outputs,
366 .priv_class = &crop_class,