FFmpeg
Data Structures | Macros | Functions | Variables
vf_backgroundkey.c File Reference
#include "libavutil/opt.h"
#include "libavutil/imgutils.h"
#include "avfilter.h"
#include "formats.h"
#include "internal.h"
#include "video.h"

Go to the source code of this file.

Data Structures

struct  BackgroundkeyContext
 

Macros

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

Functions

static int do_backgroundkey_slice (AVFilterContext *avctx, void *arg, int jobnr, int nb_jobs)
 
static int do_backgroundkey16_slice (AVFilterContext *avctx, void *arg, int jobnr, int nb_jobs)
 
static int filter_frame (AVFilterLink *link, AVFrame *frame)
 
static av_cold int config_output (AVFilterLink *outlink)
 
static av_cold void uninit (AVFilterContext *ctx)
 
 AVFILTER_DEFINE_CLASS (backgroundkey)
 

Variables

static const AVFilterPad backgroundkey_inputs []
 
static const AVFilterPad backgroundkey_outputs []
 
static const AVOption backgroundkey_options []
 
static enum AVPixelFormat backgroundkey_fmts []
 
const AVFilter ff_vf_backgroundkey
 

Macro Definition Documentation

◆ OFFSET

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

Definition at line 219 of file vf_backgroundkey.c.

◆ FLAGS

Definition at line 220 of file vf_backgroundkey.c.

Function Documentation

◆ do_backgroundkey_slice()

static int do_backgroundkey_slice ( AVFilterContext avctx,
void *  arg,
int  jobnr,
int  nb_jobs 
)
static

Definition at line 47 of file vf_backgroundkey.c.

Referenced by config_output().

◆ do_backgroundkey16_slice()

static int do_backgroundkey16_slice ( AVFilterContext avctx,
void *  arg,
int  jobnr,
int  nb_jobs 
)
static

Definition at line 90 of file vf_backgroundkey.c.

Referenced by config_output().

◆ filter_frame()

static int filter_frame ( AVFilterLink link,
AVFrame frame 
)
static

Definition at line 134 of file vf_backgroundkey.c.

◆ config_output()

static av_cold int config_output ( AVFilterLink outlink)
static

Definition at line 170 of file vf_backgroundkey.c.

◆ uninit()

static av_cold void uninit ( AVFilterContext ctx)
static

Definition at line 194 of file vf_backgroundkey.c.

◆ AVFILTER_DEFINE_CLASS()

AVFILTER_DEFINE_CLASS ( backgroundkey  )

Variable Documentation

◆ backgroundkey_inputs

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

Definition at line 202 of file vf_backgroundkey.c.

◆ backgroundkey_outputs

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

Definition at line 211 of file vf_backgroundkey.c.

◆ backgroundkey_options

const AVOption backgroundkey_options[]
static
Initial value:
= {
{ "threshold", "set the scene change threshold", OFFSET(threshold), AV_OPT_TYPE_FLOAT, { .dbl = 0.08}, 0.0, 1.0, FLAGS },
{ "similarity", "set the similarity", OFFSET(similarity), AV_OPT_TYPE_FLOAT, { .dbl = 0.1 }, 0.0, 1.0, FLAGS },
{ "blend", "set the blend value", OFFSET(blend), AV_OPT_TYPE_FLOAT, { .dbl = 0.0 }, 0.0, 1.0, FLAGS },
{ NULL }
}

Definition at line 222 of file vf_backgroundkey.c.

◆ backgroundkey_fmts

enum AVPixelFormat backgroundkey_fmts[]
static

◆ ff_vf_backgroundkey

const AVFilter ff_vf_backgroundkey
Initial value:
= {
.name = "backgroundkey",
.description = NULL_IF_CONFIG_SMALL("Turns a static background into transparency."),
.priv_size = sizeof(BackgroundkeyContext),
.priv_class = &backgroundkey_class,
.process_command = ff_filter_process_command,
}

Definition at line 244 of file vf_backgroundkey.c.

AV_PIX_FMT_YUVA422P16
#define AV_PIX_FMT_YUVA422P16
Definition: pixfmt.h:502
AV_PIX_FMT_GBRAP16
#define AV_PIX_FMT_GBRAP16
Definition: pixfmt.h:481
backgroundkey_fmts
static enum AVPixelFormat backgroundkey_fmts[]
Definition: vf_backgroundkey.c:229
FILTER_PIXFMTS_ARRAY
#define FILTER_PIXFMTS_ARRAY(array)
Definition: internal.h:170
AV_PIX_FMT_YUVA422P9
#define AV_PIX_FMT_YUVA422P9
Definition: pixfmt.h:494
AV_PIX_FMT_YUVA420P16
#define AV_PIX_FMT_YUVA420P16
Definition: pixfmt.h:501
AV_PIX_FMT_YUVA420P10
#define AV_PIX_FMT_YUVA420P10
Definition: pixfmt.h:496
AV_PIX_FMT_YUVA422P10
#define AV_PIX_FMT_YUVA422P10
Definition: pixfmt.h:497
uninit
static av_cold void uninit(AVFilterContext *ctx)
Definition: vf_backgroundkey.c:194
AV_PIX_FMT_YUVA420P9
#define AV_PIX_FMT_YUVA420P9
Definition: pixfmt.h:493
AV_PIX_FMT_GBRAP
@ AV_PIX_FMT_GBRAP
planar GBRA 4:4:4:4 32bpp
Definition: pixfmt.h:205
AV_PIX_FMT_YUVA444P16
#define AV_PIX_FMT_YUVA444P16
Definition: pixfmt.h:503
filter_frame
static int filter_frame(AVFilterLink *link, AVFrame *frame)
Definition: vf_backgroundkey.c:134
AV_PIX_FMT_GBRAP10
#define AV_PIX_FMT_GBRAP10
Definition: pixfmt.h:479
backgroundkey_outputs
static const AVFilterPad backgroundkey_outputs[]
Definition: vf_backgroundkey.c:211
backgroundkey_inputs
static const AVFilterPad backgroundkey_inputs[]
Definition: vf_backgroundkey.c:202
AV_PIX_FMT_GBRAP12
#define AV_PIX_FMT_GBRAP12
Definition: pixfmt.h:480
AV_PIX_FMT_YUVA420P
@ AV_PIX_FMT_YUVA420P
planar YUV 4:2:0, 20bpp, (1 Cr & Cb sample per 2x2 Y & A samples)
Definition: pixfmt.h:101
OFFSET
#define OFFSET(x)
Definition: vf_backgroundkey.c:219
AV_PIX_FMT_YUVA444P12
#define AV_PIX_FMT_YUVA444P12
Definition: pixfmt.h:500
FILTER_INPUTS
#define FILTER_INPUTS(array)
Definition: internal.h:190
NULL
#define NULL
Definition: coverity.c:32
FLAGS
#define FLAGS
Definition: vf_backgroundkey.c:220
BackgroundkeyContext
Definition: vf_backgroundkey.c:26
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:115
ff_filter_process_command
int ff_filter_process_command(AVFilterContext *ctx, const char *cmd, const char *arg, char *res, int res_len, int flags)
Generic processing of user supplied commands that are set in the same way as the filter options.
Definition: avfilter.c:858
AV_PIX_FMT_YUVA444P
@ AV_PIX_FMT_YUVA444P
planar YUV 4:4:4 32bpp, (1 Cr & Cb sample per 1x1 Y & A samples)
Definition: pixfmt.h:167
AV_PIX_FMT_YUVA444P10
#define AV_PIX_FMT_YUVA444P10
Definition: pixfmt.h:498
AVFILTER_FLAG_SUPPORT_TIMELINE_GENERIC
#define AVFILTER_FLAG_SUPPORT_TIMELINE_GENERIC
Some filters support a generic "enable" expression option that can be used to enable or disable a fil...
Definition: avfilter.h:152
AV_OPT_TYPE_FLOAT
@ AV_OPT_TYPE_FLOAT
Definition: opt.h:228
config_output
static av_cold int config_output(AVFilterLink *outlink)
Definition: vf_backgroundkey.c:170
AV_PIX_FMT_YUVA444P9
#define AV_PIX_FMT_YUVA444P9
Definition: pixfmt.h:495
AV_PIX_FMT_NONE
@ AV_PIX_FMT_NONE
Definition: pixfmt.h:65
AV_PIX_FMT_YUVA422P12
#define AV_PIX_FMT_YUVA422P12
Definition: pixfmt.h:499
AVFILTER_FLAG_SLICE_THREADS
#define AVFILTER_FLAG_SLICE_THREADS
The filter supports multithreading by splitting frames into multiple parts and processing them concur...
Definition: avfilter.h:127
AVMEDIA_TYPE_VIDEO
@ AVMEDIA_TYPE_VIDEO
Definition: avutil.h:201
FILTER_OUTPUTS
#define FILTER_OUTPUTS(array)
Definition: internal.h:191
AV_PIX_FMT_YUVA422P
@ AV_PIX_FMT_YUVA422P
planar YUV 4:2:2 24bpp, (1 Cr & Cb sample per 2x1 Y & A samples)
Definition: pixfmt.h:166
AVFILTERPAD_FLAG_NEEDS_WRITABLE
#define AVFILTERPAD_FLAG_NEEDS_WRITABLE
The filter expects writable frames from its input link, duplicating data buffers if needed.
Definition: internal.h:68