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 snprintf(buf, sizeof(buf), "%d", value); \
117 av_dict_set(metadata, key, buf, 0)
124 int w, h, x,
y, shrink_by;
141 for (y = 0; y < s->
y1; y++) {
148 for (y = frame->
height - 1; y > s->
y2; y--) {
155 for (y = 0; y < s->
x1; y++) {
162 for (y = frame->
width - 1; y > s->
x2; y--) {
184 shrink_by = w % s->
round;
186 x += (shrink_by/2 + 1) & ~1;
188 shrink_by = h % s->
round;
190 y += (shrink_by/2 + 1) & ~1;
202 "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",
203 s->
x1, s->
x2, s->
y1, s->
y2, w, h, x, y, frame->
pts,
211 #define OFFSET(x) offsetof(CropDetectContext, x)
212 #define FLAGS AV_OPT_FLAG_VIDEO_PARAM|AV_OPT_FLAG_FILTERING_PARAM
215 {
"limit",
"Threshold below which the pixel is considered black",
OFFSET(limit),
AV_OPT_TYPE_INT, { .i64 = 24 }, 0, 255,
FLAGS },
217 {
"reset",
"Recalculate the crop area after this many frames",
OFFSET(reset_count),
AV_OPT_TYPE_INT, { .i64 = 0 }, 0, INT_MAX,
FLAGS },
218 {
"reset_count",
"Recalculate the crop area after this many frames",
OFFSET(reset_count),
AV_OPT_TYPE_INT,{ .i64 = 0 }, 0, INT_MAX,
FLAGS },
243 .
name =
"cropdetect",
246 .priv_class = &cropdetect_class,
249 .
inputs = avfilter_vf_cropdetect_inputs,
250 .
outputs = avfilter_vf_cropdetect_outputs,