75 total += src[0] + src[1] + src[2];
107 s->
x1 = inlink->
w - 1;
108 s->
y1 = inlink->
h - 1;
115 #define SET_META(key, value) \
116 av_dict_set_int(metadata, key, value, 0)
123 int w, h, x,
y, shrink_by;
139 for (y = 0; y < s->
y1; y++) {
153 for (y = 0; y < s->
x1; y++) {
182 shrink_by = w % s->
round;
184 x += (shrink_by/2 + 1) & ~1;
186 shrink_by = h % s->
round;
188 y += (shrink_by/2 + 1) & ~1;
200 "x1:%d x2:%d y1:%d y2:%d w:%d h:%d x:%d y:%d pts:%"PRId64
" t:%f crop=%d:%d:%d:%d\n",
201 s->
x1, s->
x2, s->
y1, s->
y2, w, h, x, y, frame->
pts,
209 #define OFFSET(x) offsetof(CropDetectContext, x)
210 #define FLAGS AV_OPT_FLAG_VIDEO_PARAM|AV_OPT_FLAG_FILTERING_PARAM
213 {
"limit",
"Threshold below which the pixel is considered black",
OFFSET(limit),
AV_OPT_TYPE_INT, { .i64 = 24 }, 0, 255,
FLAGS },
215 {
"reset",
"Recalculate the crop area after this many frames",
OFFSET(reset_count),
AV_OPT_TYPE_INT, { .i64 = 0 }, 0, INT_MAX,
FLAGS },
216 {
"reset_count",
"Recalculate the crop area after this many frames",
OFFSET(reset_count),
AV_OPT_TYPE_INT,{ .i64 = 0 }, 0, INT_MAX,
FLAGS },
241 .
name =
"cropdetect",
244 .priv_class = &cropdetect_class,
247 .
inputs = avfilter_vf_cropdetect_inputs,
248 .
outputs = avfilter_vf_cropdetect_outputs,