FFmpeg
Data Structures | Macros | Functions | Variables
vf_dnn_detect.c File Reference
#include "libavformat/avio.h"
#include "libavutil/opt.h"
#include "libavutil/pixdesc.h"
#include "libavutil/avassert.h"
#include "libavutil/imgutils.h"
#include "filters.h"
#include "dnn_filter_common.h"
#include "formats.h"
#include "internal.h"
#include "libavutil/time.h"
#include "libavutil/avstring.h"
#include "libavutil/detection_bbox.h"

Go to the source code of this file.

Data Structures

struct  DnnDetectContext
 

Macros

#define OFFSET(x)   offsetof(DnnDetectContext, dnnctx.x)
 
#define OFFSET2(x)   offsetof(DnnDetectContext, x)
 
#define FLAGS   AV_OPT_FLAG_FILTERING_PARAM | AV_OPT_FLAG_VIDEO_PARAM
 

Functions

 AVFILTER_DEFINE_CLASS (dnn_detect)
 
static int dnn_detect_post_proc_ov (AVFrame *frame, DNNData *output, AVFilterContext *filter_ctx)
 
static int dnn_detect_post_proc_tf (AVFrame *frame, DNNData *output, AVFilterContext *filter_ctx)
 
static int dnn_detect_post_proc (AVFrame *frame, DNNData *output, uint32_t nb, AVFilterContext *filter_ctx)
 
static void free_detect_labels (DnnDetectContext *ctx)
 
static int read_detect_label_file (AVFilterContext *context)
 
static int check_output_nb (DnnDetectContext *ctx, DNNBackendType backend_type, int output_nb)
 
static av_cold int dnn_detect_init (AVFilterContext *context)
 
static int dnn_detect_query_formats (AVFilterContext *context)
 
static int dnn_detect_filter_frame (AVFilterLink *inlink, AVFrame *in)
 
static int dnn_detect_activate_sync (AVFilterContext *filter_ctx)
 
static int dnn_detect_flush_frame (AVFilterLink *outlink, int64_t pts, int64_t *out_pts)
 
static int dnn_detect_activate_async (AVFilterContext *filter_ctx)
 
static int dnn_detect_activate (AVFilterContext *filter_ctx)
 
static av_cold void dnn_detect_uninit (AVFilterContext *context)
 

Variables

static const AVOption dnn_detect_options []
 
static const AVFilterPad dnn_detect_inputs []
 
static const AVFilterPad dnn_detect_outputs []
 
const AVFilter ff_vf_dnn_detect
 

Detailed Description

implementing an object detecting filter using deep learning networks.

Definition in file vf_dnn_detect.c.

Macro Definition Documentation

◆ OFFSET

#define OFFSET (   x)    offsetof(DnnDetectContext, dnnctx.x)

Definition at line 46 of file vf_dnn_detect.c.

◆ OFFSET2

#define OFFSET2 (   x)    offsetof(DnnDetectContext, x)

Definition at line 47 of file vf_dnn_detect.c.

◆ FLAGS

Definition at line 48 of file vf_dnn_detect.c.

Function Documentation

◆ AVFILTER_DEFINE_CLASS()

AVFILTER_DEFINE_CLASS ( dnn_detect  )

◆ dnn_detect_post_proc_ov()

static int dnn_detect_post_proc_ov ( AVFrame frame,
DNNData output,
AVFilterContext filter_ctx 
)
static

Definition at line 65 of file vf_dnn_detect.c.

Referenced by dnn_detect_post_proc().

◆ dnn_detect_post_proc_tf()

static int dnn_detect_post_proc_tf ( AVFrame frame,
DNNData output,
AVFilterContext filter_ctx 
)
static

Definition at line 142 of file vf_dnn_detect.c.

Referenced by dnn_detect_post_proc().

◆ dnn_detect_post_proc()

static int dnn_detect_post_proc ( AVFrame frame,
DNNData output,
uint32_t  nb,
AVFilterContext filter_ctx 
)
static

Definition at line 217 of file vf_dnn_detect.c.

Referenced by dnn_detect_init().

◆ free_detect_labels()

static void free_detect_labels ( DnnDetectContext ctx)
static

Definition at line 232 of file vf_dnn_detect.c.

Referenced by dnn_detect_uninit().

◆ read_detect_label_file()

static int read_detect_label_file ( AVFilterContext context)
static

Definition at line 241 of file vf_dnn_detect.c.

Referenced by dnn_detect_init().

◆ check_output_nb()

static int check_output_nb ( DnnDetectContext ctx,
DNNBackendType  backend_type,
int  output_nb 
)
static

Definition at line 299 of file vf_dnn_detect.c.

Referenced by dnn_detect_init().

◆ dnn_detect_init()

static av_cold int dnn_detect_init ( AVFilterContext context)
static

Definition at line 323 of file vf_dnn_detect.c.

◆ dnn_detect_query_formats()

static int dnn_detect_query_formats ( AVFilterContext context)
static

Definition at line 343 of file vf_dnn_detect.c.

◆ dnn_detect_filter_frame()

static int dnn_detect_filter_frame ( AVFilterLink inlink,
AVFrame in 
)
static

Definition at line 357 of file vf_dnn_detect.c.

Referenced by dnn_detect_activate_sync().

◆ dnn_detect_activate_sync()

static int dnn_detect_activate_sync ( AVFilterContext filter_ctx)
static

Definition at line 374 of file vf_dnn_detect.c.

Referenced by dnn_detect_activate().

◆ dnn_detect_flush_frame()

static int dnn_detect_flush_frame ( AVFilterLink outlink,
int64_t  pts,
int64_t *  out_pts 
)
static

Definition at line 414 of file vf_dnn_detect.c.

Referenced by dnn_detect_activate_async().

◆ dnn_detect_activate_async()

static int dnn_detect_activate_async ( AVFilterContext filter_ctx)
static

Definition at line 443 of file vf_dnn_detect.c.

Referenced by dnn_detect_activate().

◆ dnn_detect_activate()

static int dnn_detect_activate ( AVFilterContext filter_ctx)
static

Definition at line 500 of file vf_dnn_detect.c.

◆ dnn_detect_uninit()

static av_cold void dnn_detect_uninit ( AVFilterContext context)
static

Definition at line 510 of file vf_dnn_detect.c.

Variable Documentation

◆ dnn_detect_options

const AVOption dnn_detect_options[]
static
Initial value:
= {
{ "dnn_backend", "DNN backend", OFFSET(backend_type), AV_OPT_TYPE_INT, { .i64 = 2 }, INT_MIN, INT_MAX, FLAGS, "backend" },
{ "confidence", "threshold of confidence", OFFSET2(confidence), AV_OPT_TYPE_FLOAT, { .dbl = 0.5 }, 0, 1, FLAGS},
{ "labels", "path to labels file", OFFSET2(labels_filename), AV_OPT_TYPE_STRING, { .str = NULL }, 0, 0, FLAGS },
{ NULL }
}

Definition at line 49 of file vf_dnn_detect.c.

◆ dnn_detect_inputs

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

Definition at line 517 of file vf_dnn_detect.c.

◆ dnn_detect_outputs

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

Definition at line 525 of file vf_dnn_detect.c.

◆ ff_vf_dnn_detect

const AVFilter ff_vf_dnn_detect
Initial value:
= {
.name = "dnn_detect",
.description = NULL_IF_CONFIG_SMALL("Apply DNN detect filter to the input."),
.priv_size = sizeof(DnnDetectContext),
.priv_class = &dnn_detect_class,
}

Definition at line 533 of file vf_dnn_detect.c.

init
static av_cold int init(AVCodecContext *avctx)
Definition: avrndec.c:31
dnn_detect_init
static av_cold int dnn_detect_init(AVFilterContext *context)
Definition: vf_dnn_detect.c:323
dnn_detect_inputs
static const AVFilterPad dnn_detect_inputs[]
Definition: vf_dnn_detect.c:517
dnn_detect_uninit
static av_cold void dnn_detect_uninit(AVFilterContext *context)
Definition: vf_dnn_detect.c:510
DnnDetectContext
Definition: vf_dnn_detect.c:37
inputs
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: filter_design.txt:243
outputs
static const AVFilterPad outputs[]
Definition: af_acontrast.c:203
NULL
#define NULL
Definition: coverity.c:32
activate
filter_frame For filters that do not use the activate() callback
dnn_detect_activate
static int dnn_detect_activate(AVFilterContext *filter_ctx)
Definition: vf_dnn_detect.c:500
FLAGS
#define FLAGS
Definition: vf_dnn_detect.c:48
DNN_COMMON_OPTIONS
#define DNN_COMMON_OPTIONS
Definition: dnn_filter_common.h:43
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
AV_OPT_TYPE_FLOAT
@ AV_OPT_TYPE_FLOAT
Definition: opt.h:228
dnn_detect_query_formats
static int dnn_detect_query_formats(AVFilterContext *context)
Definition: vf_dnn_detect.c:343
AV_OPT_TYPE_INT
@ AV_OPT_TYPE_INT
Definition: opt.h:225
AVMEDIA_TYPE_VIDEO
@ AVMEDIA_TYPE_VIDEO
Definition: avutil.h:201
OFFSET
#define OFFSET(x)
Definition: vf_dnn_detect.c:46
dnn_detect_outputs
static const AVFilterPad dnn_detect_outputs[]
Definition: vf_dnn_detect.c:525
query_formats
static int query_formats(AVFilterContext *ctx)
Definition: aeval.c:244
uninit
static av_cold int uninit(AVCodecContext *avctx)
Definition: crystalhd.c:279
AV_OPT_TYPE_STRING
@ AV_OPT_TYPE_STRING
Definition: opt.h:229
OFFSET2
#define OFFSET2(x)
Definition: vf_dnn_detect.c:47