FFmpeg
Data Structures | Macros | Functions | Variables
vf_find_rect.c File Reference
#include "libavutil/imgutils.h"
#include "libavutil/opt.h"
#include "internal.h"
#include "lavfutils.h"

Go to the source code of this file.

Data Structures

struct  FOCContext
 

Macros

#define MAX_MIPMAPS   5
 
#define OFFSET(x)   offsetof(FOCContext, x)
 
#define FLAGS   AV_OPT_FLAG_FILTERING_PARAM|AV_OPT_FLAG_VIDEO_PARAM
 

Functions

 AVFILTER_DEFINE_CLASS (find_rect)
 
static int query_formats (AVFilterContext *ctx)
 
static AVFramedownscale (AVFrame *in)
 
static float compare (const AVFrame *haystack, const AVFrame *obj, int offx, int offy)
 
static int config_input (AVFilterLink *inlink)
 
static float search (FOCContext *foc, int pass, int maxpass, int xmin, int xmax, int ymin, int ymax, int *best_x, int *best_y, float best_score)
 
static int filter_frame (AVFilterLink *inlink, AVFrame *in)
 
static av_cold void uninit (AVFilterContext *ctx)
 
static av_cold int init (AVFilterContext *ctx)
 

Variables

static const AVOption find_rect_options []
 
static const AVFilterPad foc_inputs []
 
static const AVFilterPad foc_outputs []
 
const AVFilter ff_vf_find_rect
 

Macro Definition Documentation

◆ MAX_MIPMAPS

#define MAX_MIPMAPS   5
Todo:
switch to dualinput

Definition at line 31 of file vf_find_rect.c.

◆ OFFSET

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

Definition at line 46 of file vf_find_rect.c.

◆ FLAGS

Definition at line 47 of file vf_find_rect.c.

Function Documentation

◆ AVFILTER_DEFINE_CLASS()

AVFILTER_DEFINE_CLASS ( find_rect  )

◆ query_formats()

static int query_formats ( AVFilterContext ctx)
static

Definition at line 62 of file vf_find_rect.c.

◆ downscale()

static AVFrame* downscale ( AVFrame in)
static

Definition at line 73 of file vf_find_rect.c.

Referenced by filter_frame(), and init().

◆ compare()

static float compare ( const AVFrame haystack,
const AVFrame obj,
int  offx,
int  offy 
)
static

Definition at line 106 of file vf_find_rect.c.

Referenced by ff_interleave_add_packet(), search(), and smc_encode_stream().

◆ config_input()

static int config_input ( AVFilterLink inlink)
static

Definition at line 144 of file vf_find_rect.c.

◆ search()

static float search ( FOCContext foc,
int  pass,
int  maxpass,
int  xmin,
int  xmax,
int  ymin,
int  ymax,
int best_x,
int best_y,
float  best_score 
)
static

Definition at line 157 of file vf_find_rect.c.

Referenced by encode_blocks(), and filter_frame().

◆ filter_frame()

static int filter_frame ( AVFilterLink inlink,
AVFrame in 
)
static

Definition at line 183 of file vf_find_rect.c.

◆ uninit()

static av_cold void uninit ( AVFilterContext ctx)
static

Definition at line 237 of file vf_find_rect.c.

◆ init()

static av_cold int init ( AVFilterContext ctx)
static

Definition at line 252 of file vf_find_rect.c.

Variable Documentation

◆ find_rect_options

const AVOption find_rect_options[]
static
Initial value:
= {
{ "object", "object bitmap filename", OFFSET(obj_filename), AV_OPT_TYPE_STRING, {.str = NULL}, .flags = FLAGS },
{ "threshold", "set threshold", OFFSET(threshold), AV_OPT_TYPE_FLOAT, {.dbl = 0.5}, 0, 1.0, FLAGS },
{ "mipmaps", "set mipmaps", OFFSET(mipmaps), AV_OPT_TYPE_INT, {.i64 = 3}, 1, MAX_MIPMAPS, FLAGS },
{ "xmin", "", OFFSET(xmin), AV_OPT_TYPE_INT, {.i64 = 0}, 0, INT_MAX, FLAGS },
{ "ymin", "", OFFSET(ymin), AV_OPT_TYPE_INT, {.i64 = 0}, 0, INT_MAX, FLAGS },
{ "xmax", "", OFFSET(xmax), AV_OPT_TYPE_INT, {.i64 = 0}, 0, INT_MAX, FLAGS },
{ "ymax", "", OFFSET(ymax), AV_OPT_TYPE_INT, {.i64 = 0}, 0, INT_MAX, FLAGS },
{ "discard", "", OFFSET(discard), AV_OPT_TYPE_BOOL, {.i64 = 0}, 0, 1, FLAGS },
{ NULL }
}

Definition at line 48 of file vf_find_rect.c.

◆ foc_inputs

const AVFilterPad foc_inputs[]
static
Initial value:
= {
{
.name = "default",
.config_props = config_input,
.filter_frame = filter_frame,
},
}

Definition at line 286 of file vf_find_rect.c.

◆ foc_outputs

const AVFilterPad foc_outputs[]
static
Initial value:
= {
{
.name = "default",
},
}

Definition at line 295 of file vf_find_rect.c.

◆ ff_vf_find_rect

const AVFilter ff_vf_find_rect
Initial value:
= {
.name = "find_rect",
.description = NULL_IF_CONFIG_SMALL("Find a user specified object."),
.priv_size = sizeof(FOCContext),
.init = init,
.priv_class = &find_rect_class,
}

Definition at line 302 of file vf_find_rect.c.

FLAGS
#define FLAGS
Definition: vf_find_rect.c:47
filter_frame
static int filter_frame(AVFilterLink *inlink, AVFrame *in)
Definition: vf_find_rect.c:183
query_formats
static int query_formats(AVFilterContext *ctx)
Definition: vf_find_rect.c:62
FILTER_INPUTS
#define FILTER_INPUTS(array)
Definition: internal.h:152
NULL
#define NULL
Definition: coverity.c:32
init
static av_cold int init(AVFilterContext *ctx)
Definition: vf_find_rect.c:252
NULL_IF_CONFIG_SMALL
#define NULL_IF_CONFIG_SMALL(x)
Return NULL if CONFIG_SMALL is true, otherwise the argument without modification.
Definition: internal.h:117
foc_inputs
static const AVFilterPad foc_inputs[]
Definition: vf_find_rect.c:286
FOCContext
Definition: vf_find_rect.c:33
OFFSET
#define OFFSET(x)
Definition: vf_find_rect.c:46
AV_OPT_TYPE_FLOAT
@ AV_OPT_TYPE_FLOAT
Definition: opt.h:227
config_input
static int config_input(AVFilterLink *inlink)
Definition: vf_find_rect.c:144
AV_OPT_TYPE_INT
@ AV_OPT_TYPE_INT
Definition: opt.h:224
uninit
static av_cold void uninit(AVFilterContext *ctx)
Definition: vf_find_rect.c:237
foc_outputs
static const AVFilterPad foc_outputs[]
Definition: vf_find_rect.c:295
MAX_MIPMAPS
#define MAX_MIPMAPS
Definition: vf_find_rect.c:31
AVMEDIA_TYPE_VIDEO
@ AVMEDIA_TYPE_VIDEO
Definition: avutil.h:201
AV_OPT_TYPE_BOOL
@ AV_OPT_TYPE_BOOL
Definition: opt.h:241
FILTER_OUTPUTS
#define FILTER_OUTPUTS(array)
Definition: internal.h:153
AV_OPT_TYPE_STRING
@ AV_OPT_TYPE_STRING
Definition: opt.h:228