FFmpeg
Loading...
Searching...
No Matches
vf_find_rect.c File Reference
#include "libavutil/opt.h"
#include "filters.h"
#include "video.h"
#include "lavfutils.h"

Go to the source code of this file.

Data Structures

struct  FOCContext
 

Macros

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

Functions

 AVFILTER_DEFINE_CLASS (find_rect)
 
static AVFramedownscale (AVFrame *in)
 
static float compare (const AVFrame *haystack, const AVFrame *obj, int offx, int offy)
 
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 []
 
const FFFilter ff_vf_find_rect
 

Macro Definition Documentation

◆ MAX_MIPMAPS

#define MAX_MIPMAPS   5
Todo
switch to dualinput

Definition at line 32 of file vf_find_rect.c.

Referenced by filter_frame(), and uninit().

◆ OFFSET

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

Definition at line 47 of file vf_find_rect.c.

◆ FLAGS

Definition at line 48 of file vf_find_rect.c.

Function Documentation

◆ AVFILTER_DEFINE_CLASS()

AVFILTER_DEFINE_CLASS ( find_rect )

◆ downscale()

static AVFrame * downscale ( AVFrame * in)
static

Definition at line 63 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 114 of file vf_find_rect.c.

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

◆ 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 152 of file vf_find_rect.c.

Referenced by encode_blocks(), filter_frame(), and search().

◆ filter_frame()

static int filter_frame ( AVFilterLink * inlink,
AVFrame * in )
static

Definition at line 178 of file vf_find_rect.c.

◆ uninit()

static av_cold void uninit ( AVFilterContext * ctx)
static

Definition at line 242 of file vf_find_rect.c.

◆ init()

static av_cold int init ( AVFilterContext * ctx)
static

Definition at line 255 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 = INT_MAX}, 0, INT_MAX, FLAGS },
{ "ymax", "", OFFSET(ymax), AV_OPT_TYPE_INT, {.i64 = INT_MAX}, 0, INT_MAX, FLAGS },
{ "discard", "", OFFSET(discard), AV_OPT_TYPE_BOOL, {.i64 = 0}, 0, 1, FLAGS },
{ NULL }
}
#define FLAGS
Definition cmdutils.c:598
#define NULL
Definition coverity.c:32
#define OFFSET(x)
@ AV_OPT_TYPE_INT
Underlying C type is int.
Definition opt.h:258
@ AV_OPT_TYPE_FLOAT
Underlying C type is float.
Definition opt.h:270
@ AV_OPT_TYPE_BOOL
Underlying C type is int.
Definition opt.h:326
@ AV_OPT_TYPE_STRING
Underlying C type is a uint8_t* that is either NULL or points to a C string allocated with the av_mal...
Definition opt.h:275
#define MAX_MIPMAPS

Definition at line 49 of file vf_find_rect.c.

◆ foc_inputs

const AVFilterPad foc_inputs[]
static
Initial value:
= {
{
.name = "default",
.filter_frame = filter_frame,
},
}
static int filter_frame(DBEDecodeContext *s, AVFrame *frame)
Definition dolby_e.c:1067
@ AVMEDIA_TYPE_VIDEO
Definition avutil.h:200

Definition at line 284 of file vf_find_rect.c.

◆ ff_vf_find_rect

const FFFilter ff_vf_find_rect
Initial value:
= {
.p.name = "find_rect",
.p.description = NULL_IF_CONFIG_SMALL("Find a user specified object."),
.p.priv_class = &find_rect_class,
.priv_size = sizeof(FOCContext),
.init = init,
}
int(* init)(AVBSFContext *ctx)
Definition dts2pts.c:608
#define AVFILTER_FLAG_METADATA_ONLY
The filter is a "metadata" filter - it does not modify the frame data in any way.
Definition avfilter.h:182
static av_cold void uninit(AVBitStreamFilterContext *ctx)
#define FILTER_INPUTS(array)
Definition filters.h:264
#define FILTER_OUTPUTS(array)
Definition filters.h:265
#define FILTER_PIXFMTS(...)
Definition filters.h:250
#define NULL_IF_CONFIG_SMALL(x)
Return NULL if CONFIG_SMALL is true, otherwise the argument without modification.
Definition internal.h:88
@ AV_PIX_FMT_YUV420P
planar YUV 4:2:0, 12bpp, (1 Cr & Cb sample per 2x2 Y samples)
Definition pixfmt.h:73
@ AV_PIX_FMT_YUVJ420P
planar YUV 4:2:0, 12bpp, full scale (JPEG), deprecated in favor of AV_PIX_FMT_YUV420P and setting col...
Definition pixfmt.h:85
static const AVFilterPad foc_inputs[]
const AVFilterPad ff_video_default_filterpad[1]
An AVFilterPad array whose only entry has name "default" and is of type AVMEDIA_TYPE_VIDEO.
Definition video.c:37

Definition at line 292 of file vf_find_rect.c.