88 char *x_expr, *
y_expr, *w_expr, *h_expr;
125 }
else if (d > INT_MAX || d < INT_MIN) {
126 *n = d > INT_MAX ? INT_MAX : INT_MIN;
164 NULL, NULL, NULL, NULL, NULL, 0, ctx)) < 0)
169 NULL, NULL, NULL, NULL, NULL, 0, ctx)) < 0)
175 NULL, NULL, NULL, NULL, NULL, 0, ctx)) < 0)
182 "Too big value or invalid expression for out_w/ow or out_h/oh. "
183 "Maybe the expression for out_w:'%s' or for out_h:'%s' is self-referencing.\n",
187 s->
w &= ~((1 << s->
hsub) - 1);
188 s->
h &= ~((1 << s->
vsub) - 1);
194 NULL, NULL, NULL, NULL, 0, ctx)) < 0 ||
196 NULL, NULL, NULL, NULL, 0, ctx)) < 0)
203 dar.num * s->
h, dar.den * s->
w, INT_MAX);
205 s->out_sar = link->sample_aspect_ratio;
208 link->w, link->h, link->sample_aspect_ratio.num, link->sample_aspect_ratio.den,
209 s->w,
s->h,
s->out_sar.num,
s->out_sar.den);
211 if (
s->w <= 0 ||
s->h <= 0 ||
212 s->w > link->w ||
s->h > link->h) {
214 "Invalid too big or non positive size for width '%d' or height '%d'\n",
220 s->x = (link->w -
s->w) / 2;
221 s->y = (link->h -
s->h) / 2;
222 s->x &= ~((1 <<
s->hsub) - 1);
223 s->y &= ~((1 <<
s->vsub) - 1);
268 if ((
unsigned)s->
x + (
unsigned)s->
w > link->
w)
269 s->
x = link->
w - s->
w;
270 if ((
unsigned)s->
y + (
unsigned)s->
h > link->
h)
271 s->
y = link->
h - s->
h;
272 s->
x &= ~((1 << s->
hsub) - 1);
273 s->
y &= ~((1 << s->
vsub) - 1);
275 av_dlog(ctx,
"n:%d t:%f pos:%f x:%d y:%d x+w:%d y+h:%d\n",
277 s->
x, s->
y, s->
x+s->
w, s->
y+s->
h);
283 for (i = 1; i < 3; i ++) {
284 if (frame->
data[i]) {
292 if (frame->
data[3]) {
300 #define OFFSET(x) offsetof(CropContext, x)
301 #define FLAGS AV_OPT_FLAG_FILTERING_PARAM|AV_OPT_FLAG_VIDEO_PARAM
339 .priv_class = &crop_class,
342 .
inputs = avfilter_vf_crop_inputs,
343 .
outputs = avfilter_vf_crop_outputs,