FFmpeg
Data Structures | Macros | Functions | Variables
vf_backgroundkey.c File Reference
#include "libavutil/opt.h"
#include "libavutil/pixdesc.h"
#include "avfilter.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 218 of file vf_backgroundkey.c.

◆ FLAGS

Definition at line 219 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 46 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 89 of file vf_backgroundkey.c.

Referenced by config_output().

◆ filter_frame()

static int filter_frame ( AVFilterLink link,
AVFrame frame 
)
static

Definition at line 133 of file vf_backgroundkey.c.

◆ config_output()

static av_cold int config_output ( AVFilterLink outlink)
static

Definition at line 169 of file vf_backgroundkey.c.

◆ uninit()

static av_cold void uninit ( AVFilterContext ctx)
static

Definition at line 193 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 201 of file vf_backgroundkey.c.

◆ backgroundkey_outputs

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

Definition at line 210 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 221 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 243 of file vf_backgroundkey.c.

AV_PIX_FMT_YUVA422P16
#define AV_PIX_FMT_YUVA422P16
Definition: pixfmt.h:522
AV_PIX_FMT_GBRAP16
#define AV_PIX_FMT_GBRAP16
Definition: pixfmt.h:501
backgroundkey_fmts
static enum AVPixelFormat backgroundkey_fmts[]
Definition: vf_backgroundkey.c:228
FILTER_PIXFMTS_ARRAY
#define FILTER_PIXFMTS_ARRAY(array)
Definition: internal.h:162
AV_PIX_FMT_YUVA422P9
#define AV_PIX_FMT_YUVA422P9
Definition: pixfmt.h:514
AV_PIX_FMT_YUVA420P16
#define AV_PIX_FMT_YUVA420P16
Definition: pixfmt.h:521
AV_PIX_FMT_YUVA420P10
#define AV_PIX_FMT_YUVA420P10
Definition: pixfmt.h:516
AV_PIX_FMT_YUVA422P10
#define AV_PIX_FMT_YUVA422P10
Definition: pixfmt.h:517
uninit
static av_cold void uninit(AVFilterContext *ctx)
Definition: vf_backgroundkey.c:193
AV_PIX_FMT_YUVA420P9
#define AV_PIX_FMT_YUVA420P9
Definition: pixfmt.h:513
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:523
filter_frame
static int filter_frame(AVFilterLink *link, AVFrame *frame)
Definition: vf_backgroundkey.c:133
AV_PIX_FMT_GBRAP10
#define AV_PIX_FMT_GBRAP10
Definition: pixfmt.h:498
backgroundkey_outputs
static const AVFilterPad backgroundkey_outputs[]
Definition: vf_backgroundkey.c:210
backgroundkey_inputs
static const AVFilterPad backgroundkey_inputs[]
Definition: vf_backgroundkey.c:201
AV_PIX_FMT_GBRAP12
#define AV_PIX_FMT_GBRAP12
Definition: pixfmt.h:499
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:218
AV_PIX_FMT_YUVA444P12
#define AV_PIX_FMT_YUVA444P12
Definition: pixfmt.h:520
FILTER_INPUTS
#define FILTER_INPUTS(array)
Definition: internal.h:182
NULL
#define NULL
Definition: coverity.c:32
FLAGS
#define FLAGS
Definition: vf_backgroundkey.c:219
BackgroundkeyContext
Definition: vf_backgroundkey.c:25
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:106
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:890
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:518
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:147
AV_OPT_TYPE_FLOAT
@ AV_OPT_TYPE_FLOAT
Definition: opt.h:238
config_output
static av_cold int config_output(AVFilterLink *outlink)
Definition: vf_backgroundkey.c:169
AV_PIX_FMT_YUVA444P9
#define AV_PIX_FMT_YUVA444P9
Definition: pixfmt.h:515
AV_PIX_FMT_NONE
@ AV_PIX_FMT_NONE
Definition: pixfmt.h:72
AV_PIX_FMT_YUVA422P12
#define AV_PIX_FMT_YUVA422P12
Definition: pixfmt.h:519
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:117
AVMEDIA_TYPE_VIDEO
@ AVMEDIA_TYPE_VIDEO
Definition: avutil.h:201
FILTER_OUTPUTS
#define FILTER_OUTPUTS(array)
Definition: internal.h:183
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
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:52