FFmpeg
Data Structures | Macros | Functions | Variables
vf_backgroundkey.c File Reference
#include "libavutil/mem.h"
#include "libavutil/opt.h"
#include "libavutil/pixdesc.h"
#include "avfilter.h"
#include "filters.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:546
AV_PIX_FMT_GBRAP16
#define AV_PIX_FMT_GBRAP16
Definition: pixfmt.h:525
FILTER_PIXFMTS_ARRAY
#define FILTER_PIXFMTS_ARRAY(array)
Definition: filters.h:242
backgroundkey_fmts
static enum AVPixelFormat backgroundkey_fmts[]
Definition: vf_backgroundkey.c:229
AV_PIX_FMT_YUVA422P9
#define AV_PIX_FMT_YUVA422P9
Definition: pixfmt.h:538
FILTER_INPUTS
#define FILTER_INPUTS(array)
Definition: filters.h:262
AV_PIX_FMT_YUVA420P16
#define AV_PIX_FMT_YUVA420P16
Definition: pixfmt.h:545
AV_PIX_FMT_YUVA420P10
#define AV_PIX_FMT_YUVA420P10
Definition: pixfmt.h:540
AV_PIX_FMT_YUVA422P10
#define AV_PIX_FMT_YUVA422P10
Definition: pixfmt.h:541
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:537
AV_PIX_FMT_GBRAP
@ AV_PIX_FMT_GBRAP
planar GBRA 4:4:4:4 32bpp
Definition: pixfmt.h:212
AV_PIX_FMT_YUVA444P16
#define AV_PIX_FMT_YUVA444P16
Definition: pixfmt.h:547
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:522
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:523
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:108
OFFSET
#define OFFSET(x)
Definition: vf_backgroundkey.c:219
AV_PIX_FMT_YUVA444P12
#define AV_PIX_FMT_YUVA444P12
Definition: pixfmt.h:544
FILTER_OUTPUTS
#define FILTER_OUTPUTS(array)
Definition: filters.h:263
NULL
#define NULL
Definition: coverity.c:32
FLAGS
#define FLAGS
Definition: vf_backgroundkey.c:220
BackgroundkeyContext
Definition: vf_backgroundkey.c:26
AVFILTERPAD_FLAG_NEEDS_WRITABLE
#define AVFILTERPAD_FLAG_NEEDS_WRITABLE
The filter expects writable frames from its input link, duplicating data buffers if needed.
Definition: filters.h:57
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:94
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:901
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:174
AV_PIX_FMT_YUVA444P10
#define AV_PIX_FMT_YUVA444P10
Definition: pixfmt.h:542
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:182
AV_OPT_TYPE_FLOAT
@ AV_OPT_TYPE_FLOAT
Underlying C type is float.
Definition: opt.h:271
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:539
AV_PIX_FMT_NONE
@ AV_PIX_FMT_NONE
Definition: pixfmt.h:72
AV_PIX_FMT_YUVA422P12
#define AV_PIX_FMT_YUVA422P12
Definition: pixfmt.h:543
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:152
AVMEDIA_TYPE_VIDEO
@ AVMEDIA_TYPE_VIDEO
Definition: avutil.h:201
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:173