77 total += src[0] + src[1] + src[2];
109 s->
x1 = inlink->
w - 1;
110 s->
y1 = inlink->
h - 1;
122 int w, h, x, y, shrink_by;
135 for (y = 0; y < s->
y1; y++) {
142 for (y = frame->
height - 1; y > s->
y2; y--) {
149 for (y = 0; y < s->
x1; y++) {
156 for (y = frame->
width - 1; y > s->
x2; y--) {
178 shrink_by = w % s->
round;
180 x += (shrink_by/2 + 1) & ~1;
182 shrink_by = h % s->
round;
184 y += (shrink_by/2 + 1) & ~1;
187 "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",
188 s->
x1, s->
x2, s->
y1, s->
y2, w, h, x, y, frame->
pts,
196 #define OFFSET(x) offsetof(CropDetectContext, x)
197 #define FLAGS AV_OPT_FLAG_VIDEO_PARAM
199 {
"limit",
"Threshold below which the pixel is considered black",
OFFSET(limit),
AV_OPT_TYPE_INT, { .i64 = 24 }, 0, INT_MAX,
FLAGS },
201 {
"reset",
"Recalculate the crop area after this many frames",
OFFSET(reset_count),
AV_OPT_TYPE_INT, { .i64 = 0 }, 0, INT_MAX,
FLAGS },
232 .
name =
"cropdetect",
236 .priv_class = &cropdetect_class,
static const AVClass cropdetect_class
const AVPixFmtDescriptor * av_pix_fmt_desc_get(enum AVPixelFormat pix_fmt)
This structure describes decoded (raw) audio or video data.
planar YUV 4:4:4, 24bpp, (1 Cr & Cb sample per 1x1 Y samples)
static const AVFilterPad outputs[]
Main libavfilter public API header.
int h
agreed upon image height
AVFrame * ff_null_get_video_buffer(AVFilterLink *link, int w, int h)
AVFilter ff_vf_cropdetect
void av_image_fill_max_pixsteps(int max_pixsteps[4], int max_pixstep_comps[4], const AVPixFmtDescriptor *pixdesc)
Compute the max pixel step for each plane of an image with a format described by pixdesc.
const char * class_name
The name of the class; usually it is the same name as the context structure type to which the AVClass...
int ff_filter_frame(AVFilterLink *link, AVFrame *frame)
Send a frame of data to the next filter.
int64_t pts
Presentation timestamp in time_base units (time when frame should be shown to user).
static av_cold int init(AVFilterContext *ctx)
static double av_q2d(AVRational a)
Convert rational to double.
planar YUV 4:2:2, 16bpp, full scale (JPEG), deprecated in favor of PIX_FMT_YUV422P and setting color_...
#define AV_LOG_VERBOSE
Detailed information.
A link between two filters.
static int filter_frame(AVFilterLink *inlink, AVFrame *frame)
static const AVOption options[]
int width
width and height of the video frame
#define NULL_IF_CONFIG_SMALL(x)
Return NULL if CONFIG_SMALL is true, otherwise the argument without modification. ...
void * priv
private data for use by the filter
#define AV_LOG_DEBUG
Stuff which is only useful for libav* developers.
planar YUV 4:2:0, 12bpp, 1 plane for Y and 1 plane for the UV components, which are interleaved (firs...
AVRational time_base
Define the time base used by the PTS of the frames/samples which will pass through this link...
void av_log(void *avcl, int level, const char *fmt,...)
static av_always_inline av_const double round(double x)
planar YUV 4:2:2, 16bpp, (1 Cr & Cb sample per 2x1 Y samples)
int w
agreed upon image width
common internal API header
as above, but U and V bytes are swapped
planar YUV 4:2:0, 12bpp, full scale (JPEG), deprecated in favor of PIX_FMT_YUV420P and setting color_...
int format
agreed upon media format
static int query_formats(AVFilterContext *ctx)
static const AVFilterPad avfilter_vf_cropdetect_inputs[]
#define AV_LOG_INFO
Standard information.
int linesize[AV_NUM_DATA_POINTERS]
For video, size in bytes of each picture line.
Describe the class of an AVClass context structure.
static const AVFilterPad inputs[]
const char * name
Filter name.
AVFilterLink ** outputs
array of pointers to output links
uint8_t * data[AV_NUM_DATA_POINTERS]
pointer to the picture/channel planes.
planar YUV 4:2:0, 12bpp, (1 Cr & Cb sample per 2x2 Y samples)
planar YUV 4:4:4, 24bpp, full scale (JPEG), deprecated in favor of PIX_FMT_YUV444P and setting color_...
planar YUV 4:1:1, 12bpp, (1 Cr & Cb sample per 4x1 Y samples)
struct AVFilterPad AVFilterPad
static const AVFilterPad avfilter_vf_cropdetect_outputs[]
AVFilterContext * dst
dest filter
static int config_input(AVFilterLink *inlink)
AVPixelFormat
Pixel format.
#define AV_NOPTS_VALUE
Undefined timestamp value.
static int checkline(void *ctx, const unsigned char *src, int stride, int len, int bpp)