76 const uint16_t *src16 = (
const uint16_t *)src;
107 total += src[0] + src[1 ] + src[2 ]
115 total += src[0] + src[1] + src[2];
150 s->
x1 = inlink->
w - 1;
151 s->
y1 = inlink->
h - 1;
158 #define SET_META(key, value) \ 159 av_dict_set_int(metadata, key, value, 0) 166 int w,
h, x, y, shrink_by;
168 int outliers, last_y;
184 #define FIND(DST, FROM, NOEND, INC, STEP0, STEP1, LEN) \ 186 for (last_y = y = FROM; NOEND; y = y INC) {\ 187 if (checkline(ctx, frame->data[0] + STEP0 * y, STEP1, LEN, bpp) > limit) {\ 188 if (++outliers > s->max_outliers) { \ 217 shrink_by = w % s->
round;
219 x += (shrink_by/2 + 1) & ~1;
221 shrink_by = h % s->
round;
223 y += (shrink_by/2 + 1) & ~1;
235 "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",
236 s->
x1, s->
x2, s->
y1, s->
y2, w, h, x, y, frame->
pts,
244 #define OFFSET(x) offsetof(CropDetectContext, x) 245 #define FLAGS AV_OPT_FLAG_VIDEO_PARAM|AV_OPT_FLAG_FILTERING_PARAM 278 .
name =
"cropdetect",
281 .priv_class = &cropdetect_class,
284 .
inputs = avfilter_vf_cropdetect_inputs,
285 .
outputs = avfilter_vf_cropdetect_outputs,
const AVPixFmtDescriptor * av_pix_fmt_desc_get(enum AVPixelFormat pix_fmt)
This structure describes decoded (raw) audio or video data.
#define AV_PIX_FMT_YUV444P14
planar YUV 4:4:4, 24bpp, (1 Cr & Cb sample per 1x1 Y samples)
Main libavfilter public API header.
packed RGB 8:8:8, 24bpp, RGBRGB...
int h
agreed upon image height
#define SET_META(key, value)
#define AV_PIX_FMT_YUV420P12
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.
#define AVFILTER_FLAG_SUPPORT_TIMELINE_GENERIC
Some filters support a generic "enable" expression option that can be used to enable or disable a fil...
const char * name
Pad name.
int ff_filter_frame(AVFilterLink *link, AVFrame *frame)
Send a frame of data to the next filter.
AVComponentDescriptor comp[4]
Parameters that describe how pixels are packed.
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 an AVRational to a double.
planar YUV 4:2:2, 16bpp, full scale (JPEG), deprecated in favor of AV_PIX_FMT_YUV422P and setting col...
#define AV_LOG_VERBOSE
Detailed information.
AVDictionary * metadata
metadata.
#define AV_PIX_FMT_YUV444P16
#define AV_PIX_FMT_YUV422P12
A filter pad used for either input or output.
A link between two filters.
static int filter_frame(AVFilterLink *inlink, AVFrame *frame)
#define FIND(DST, FROM, NOEND, INC, STEP0, STEP1, LEN)
#define NULL_IF_CONFIG_SMALL(x)
Return NULL if CONFIG_SMALL is true, otherwise the argument without modification. ...
packed BGRA 8:8:8:8, 32bpp, BGRABGRA...
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...
#define AV_PIX_FMT_YUV444P10
packed RGBA 8:8:8:8, 32bpp, RGBARGBA...
planar YUV 4:2:2, 16bpp, (1 Cr & Cb sample per 2x1 Y samples)
int w
agreed upon image width
common internal API header
#define AV_PIX_FMT_YUV422P9
as above, but U and V bytes are swapped
planar YUV 4:2:0, 12bpp, full scale (JPEG), deprecated in favor of AV_PIX_FMT_YUV420P and setting col...
static const AVOption cropdetect_options[]
these buffered frames must be flushed immediately if a new input produces new the filter must not call request_frame to get more It must just process the frame or queue it The task of requesting more frames is left to the filter s request_frame method or the application If a filter has several the filter must be ready for frames arriving randomly on any input any filter with several inputs will most likely require some kind of queuing mechanism It is perfectly acceptable to have a limited queue and to drop frames when the inputs are too unbalanced request_frame For filters that do not use the this method is called when a frame is wanted on an output For a it should directly call filter_frame on the corresponding output For a if there are queued frames already one of these frames should be pushed If the filter should request a frame on one of its repeatedly until at least one frame has been pushed Return or at least make progress towards producing a frame
packed RGB 8:8:8, 24bpp, BGRBGR...
#define AV_PIX_FMT_YUV444P9
AVFILTER_DEFINE_CLASS(cropdetect)
static const AVFilterPad outputs[]
int format
agreed upon media format
static int query_formats(AVFilterContext *ctx)
#define AV_PIX_FMT_YUV420P16
static const AVFilterPad avfilter_vf_cropdetect_inputs[]
#define AV_LOG_INFO
Standard information.
#define AV_PIX_FMT_YUV420P14
int linesize[AV_NUM_DATA_POINTERS]
For video, size in bytes of each picture line.
Descriptor that unambiguously describes how the bits of a pixel are stored in the up to 4 data planes...
these buffered frames must be flushed immediately if a new input produces new the filter must not call request_frame to get more It must just process the frame or queue it The task of requesting more frames is left to the filter s request_frame method or the application If a filter has several inputs
#define AV_PIX_FMT_YUV420P10
planar YUV 4:1:0, 9bpp, (1 Cr & Cb sample per 4x4 Y samples)
Describe the class of an AVClass context structure.
const char * name
Filter name.
#define AV_PIX_FMT_YUV420P9
AVFilterLink ** outputs
array of pointers to output links
static enum AVPixelFormat pix_fmts[]
#define AV_PIX_FMT_YUV422P14
#define flags(name, subs,...)
#define AV_PIX_FMT_YUV422P10
#define AV_PIX_FMT_YUV444P12
The exact code depends on how similar the blocks are and how related they are to the and needs to apply these operations to the correct inlink or outlink if there are several Macros are available to factor that when no extra processing is inlink
GLint GLenum GLboolean GLsizei stride
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 AV_PIX_FMT_YUV444P and setting col...
planar YUV 4:1:1, 12bpp, (1 Cr & Cb sample per 4x1 Y samples)
static const AVFilterPad avfilter_vf_cropdetect_outputs[]
AVFilterContext * dst
dest filter
static int config_input(AVFilterLink *inlink)
planar YUV 4:4:0 (1 Cr & Cb sample per 1x2 Y samples)
Filter the word “frame” indicates either a video frame or a group of audio as stored in an AVFrame structure Format for each input and each output the list of supported formats For video that means pixel format For audio that means channel sample they are references to shared objects When the negotiation mechanism computes the intersection of the formats supported at each end of a all references to both lists are replaced with a reference to the intersection And when a single format is eventually chosen for a link amongst the remaining all references to the list are updated That means that if a filter requires that its input and output have the same format amongst a supported all it has to do is use a reference to the same list of formats query_formats can leave some formats unset and return AVERROR(EAGAIN) to cause the negotiation mechanism toagain later.That can be used by filters with complex requirements to use the format negotiated on one link to set the formats supported on another.Frame references ownership and permissions
int depth
Number of bits in the component.
AVPixelFormat
Pixel format.
#define AV_PIX_FMT_YUV422P16
#define AV_NOPTS_VALUE
Undefined timestamp value.
static int checkline(void *ctx, const unsigned char *src, int stride, int len, int bpp)