vf_cropdetect.c File Reference

border detection filter Ported from MPlayer libmpcodecs/vf_cropdetect.c. More...

#include "libavutil/imgutils.h"
#include "libavutil/internal.h"
#include "libavutil/opt.h"
#include "avfilter.h"
#include "formats.h"
#include "internal.h"
#include "video.h"
Include dependency graph for vf_cropdetect.c:

Go to the source code of this file.

Data Structures

struct  CropDetectContext
 

Macros

#define OFFSET(x)   offsetof(CropDetectContext, x)
 
#define FLAGS   AV_OPT_FLAG_VIDEO_PARAM|AV_OPT_FLAG_FILTERING_PARAM
 

Functions

static int query_formats (AVFilterContext *ctx)
 
static int checkline (void *ctx, const unsigned char *src, int stride, int len, int bpp)
 
static av_cold int init (AVFilterContext *ctx)
 
static int config_input (AVFilterLink *inlink)
 
static int filter_frame (AVFilterLink *inlink, AVFrame *frame)
 
 AVFILTER_DEFINE_CLASS (cropdetect)
 

Variables

static const AVOption cropdetect_options []
 
static const AVFilterPad avfilter_vf_cropdetect_inputs []
 
static const AVFilterPad avfilter_vf_cropdetect_outputs []
 
AVFilter avfilter_vf_cropdetect
 

Detailed Description

border detection filter Ported from MPlayer libmpcodecs/vf_cropdetect.c.

Definition in file vf_cropdetect.c.

Macro Definition Documentation

Definition at line 195 of file vf_cropdetect.c.

#define OFFSET (   x)    offsetof(CropDetectContext, x)

Definition at line 194 of file vf_cropdetect.c.

Function Documentation

AVFILTER_DEFINE_CLASS ( cropdetect  )
static int checkline ( void ctx,
const unsigned char *  src,
int  stride,
int  len,
int  bpp 
)
static

Definition at line 60 of file vf_cropdetect.c.

Referenced by filter_frame().

static int config_input ( AVFilterLink inlink)
static

Definition at line 99 of file vf_cropdetect.c.

static int filter_frame ( AVFilterLink inlink,
AVFrame frame 
)
static

Definition at line 115 of file vf_cropdetect.c.

static av_cold int init ( AVFilterContext ctx)
static

Definition at line 87 of file vf_cropdetect.c.

static int query_formats ( AVFilterContext ctx)
static

Definition at line 45 of file vf_cropdetect.c.

Variable Documentation

AVFilter avfilter_vf_cropdetect
Initial value:
= {
.name = "cropdetect",
.description = NULL_IF_CONFIG_SMALL("Auto-detect crop size."),
.priv_size = sizeof(CropDetectContext),
.priv_class = &cropdetect_class,
.init = init,
}
static const AVFilterPad outputs[]
Definition: af_ashowinfo.c:117
static av_cold int init(AVFilterContext *ctx)
Definition: vf_cropdetect.c:87
#define NULL_IF_CONFIG_SMALL(x)
Return NULL if CONFIG_SMALL is true, otherwise the argument without modification. ...
static int query_formats(AVFilterContext *ctx)
Definition: vf_cropdetect.c:45
static const AVFilterPad avfilter_vf_cropdetect_inputs[]
static const AVFilterPad avfilter_vf_cropdetect_outputs[]
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

Definition at line 226 of file vf_cropdetect.c.

const AVFilterPad avfilter_vf_cropdetect_inputs[]
static
Initial value:
= {
{
.name = "default",
.config_props = config_input,
.get_video_buffer = ff_null_get_video_buffer,
.filter_frame = filter_frame,
},
{ NULL }
}
AVFrame * ff_null_get_video_buffer(AVFilterLink *link, int w, int h)
Definition: video.c:35
static int filter_frame(AVFilterLink *inlink, AVFrame *frame)
NULL
Definition: eval.c:55
static int config_input(AVFilterLink *inlink)
Definition: vf_cropdetect.c:99

Definition at line 207 of file vf_cropdetect.c.

const AVFilterPad avfilter_vf_cropdetect_outputs[]
static
Initial value:
= {
{
.name = "default",
},
{ NULL }
}
NULL
Definition: eval.c:55

Definition at line 218 of file vf_cropdetect.c.

const AVOption cropdetect_options[]
static
Initial value:
= {
{ "limit", "Threshold below which the pixel is considered black", OFFSET(limit), AV_OPT_TYPE_INT, { .i64 = 24 }, 0, 255, FLAGS },
{ "round", "Value by which the width/height should be divisible", OFFSET(round), AV_OPT_TYPE_INT, { .i64 = 16 }, 0, INT_MAX, FLAGS },
{ "reset", "Recalculate the crop area after this many frames", OFFSET(reset_count), AV_OPT_TYPE_INT, { .i64 = 0 }, 0, INT_MAX, FLAGS },
{ "reset_count", "Recalculate the crop area after this many frames",OFFSET(reset_count),AV_OPT_TYPE_INT,{ .i64 = 0 }, 0, INT_MAX, FLAGS },
{ NULL },
}
static av_always_inline av_const double round(double x)
Definition: libm.h:162
NULL
Definition: eval.c:55
#define FLAGS
#define OFFSET(x)

Definition at line 197 of file vf_cropdetect.c.