FFmpeg
Loading...
Searching...
No Matches
vf_hsvkey.c File Reference
#include <float.h>
#include "libavutil/opt.h"
#include "libavutil/intreadwrite.h"
#include "libavutil/pixdesc.h"
#include "avfilter.h"
#include "filters.h"

Go to the source code of this file.

Data Structures

struct  HSVKeyContext
 

Macros

#define SQR(x)
 
#define OFFSET(x)
 
#define FLAGS   AV_OPT_FLAG_FILTERING_PARAM|AV_OPT_FLAG_VIDEO_PARAM|AV_OPT_FLAG_RUNTIME_PARAM
 

Functions

static int do_hsvkey_pixel (HSVKeyContext *s, int y, int u, int v, float hue_key, float sat_key, float val_key)
 
static int do_hsvkey_slice (AVFilterContext *avctx, void *arg, int jobnr, int nb_jobs)
 
static int do_hsvkey16_slice (AVFilterContext *avctx, void *arg, int jobnr, int nb_jobs)
 
static int do_hsvhold_slice (AVFilterContext *avctx, void *arg, int jobnr, int nb_jobs)
 
static int do_hsvhold16_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 int config_input (AVFilterLink *inlink)
 
 AVFILTER_DEFINE_CLASS (hsvkey)
 
 AVFILTER_DEFINE_CLASS (hsvhold)
 

Variables

static enum AVPixelFormat key_pixel_fmts []
 
static const AVFilterPad inputs []
 
static const AVFilterPad outputs []
 
static const AVOption hsvkey_options []
 
const FFFilter ff_vf_hsvkey
 
static enum AVPixelFormat hold_pixel_fmts []
 
static const AVOption hsvhold_options []
 
const FFFilter ff_vf_hsvhold
 

Macro Definition Documentation

◆ SQR

#define SQR ( x)
Value:
((x)*(x))

Definition at line 50 of file vf_hsvkey.c.

Referenced by do_hsvkey_pixel().

◆ OFFSET

#define OFFSET ( x)
Value:

Definition at line 286 of file vf_hsvkey.c.

◆ FLAGS

Function Documentation

◆ do_hsvkey_pixel()

static int do_hsvkey_pixel ( HSVKeyContext * s,
int y,
int u,
int v,
float hue_key,
float sat_key,
float val_key )
static

◆ do_hsvkey_slice()

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

Definition at line 87 of file vf_hsvkey.c.

Referenced by config_output().

◆ do_hsvkey16_slice()

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

Definition at line 112 of file vf_hsvkey.c.

Referenced by config_output().

◆ do_hsvhold_slice()

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

Definition at line 138 of file vf_hsvkey.c.

Referenced by config_output().

◆ do_hsvhold16_slice()

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

Definition at line 174 of file vf_hsvkey.c.

Referenced by config_output().

◆ filter_frame()

static int filter_frame ( AVFilterLink * link,
AVFrame * frame )
static

Definition at line 211 of file vf_hsvkey.c.

◆ config_output()

static av_cold int config_output ( AVFilterLink * outlink)
static

Definition at line 225 of file vf_hsvkey.c.

◆ config_input()

static av_cold int config_input ( AVFilterLink * inlink)
static

Definition at line 245 of file vf_hsvkey.c.

◆ AVFILTER_DEFINE_CLASS() [1/2]

AVFILTER_DEFINE_CLASS ( hsvkey )

◆ AVFILTER_DEFINE_CLASS() [2/2]

AVFILTER_DEFINE_CLASS ( hsvhold )

Variable Documentation

◆ key_pixel_fmts

enum AVPixelFormat key_pixel_fmts[]
static
Initial value:
= {
}
#define AV_PIX_FMT_YUVA444P10
Definition pixfmt.h:598
#define AV_PIX_FMT_YUVA420P16
Definition pixfmt.h:601
#define AV_PIX_FMT_YUVA420P10
Definition pixfmt.h:596
#define AV_PIX_FMT_YUVA422P9
Definition pixfmt.h:594
#define AV_PIX_FMT_YUVA420P9
Definition pixfmt.h:593
#define AV_PIX_FMT_YUVA422P10
Definition pixfmt.h:597
@ AV_PIX_FMT_NONE
Definition pixfmt.h:72
@ AV_PIX_FMT_YUVA420P
planar YUV 4:2:0, 20bpp, (1 Cr & Cb sample per 2x2 Y & A samples)
Definition pixfmt.h:108
@ 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_YUVA422P
planar YUV 4:2:2 24bpp, (1 Cr & Cb sample per 2x1 Y & A samples)
Definition pixfmt.h:173
#define AV_PIX_FMT_YUVA422P12
Definition pixfmt.h:599
#define AV_PIX_FMT_YUVA444P16
Definition pixfmt.h:603
#define AV_PIX_FMT_YUVA422P16
Definition pixfmt.h:602
#define AV_PIX_FMT_YUVA444P9
Definition pixfmt.h:595
#define AV_PIX_FMT_YUVA444P12
Definition pixfmt.h:600

Definition at line 257 of file vf_hsvkey.c.

◆ inputs

const AVFilterPad inputs[]
static
Initial value:
= {
{
.name = "default",
.filter_frame = filter_frame,
.config_props = config_input,
},
}
static int config_input(AVFilterLink *inlink)
static int filter_frame(DBEDecodeContext *s, AVFrame *frame)
Definition dolby_e.c:1067
@ AVMEDIA_TYPE_VIDEO
Definition avutil.h:200
#define AVFILTERPAD_FLAG_NEEDS_WRITABLE
The filter expects writable frames from its input link, duplicating data buffers if needed.
Definition filters.h:59

Definition at line 268 of file vf_hsvkey.c.

◆ outputs

const AVFilterPad outputs[]
static
Initial value:
= {
{
.name = "default",
.config_props = config_output,
},
}
static int config_output(AVBitStreamFilterLink *outlink)

Definition at line 278 of file vf_hsvkey.c.

◆ hsvkey_options

const AVOption hsvkey_options[]
static
Initial value:
= {
{ "hue", "set the hue value", OFFSET(hue_opt), AV_OPT_TYPE_FLOAT, { .dbl = 0 }, -360, 360, FLAGS },
{ "sat", "set the saturation value", OFFSET(sat), AV_OPT_TYPE_FLOAT, { .dbl = 0 }, -1, 1, FLAGS },
{ "val", "set the value value", OFFSET(val), AV_OPT_TYPE_FLOAT, { .dbl = 0 }, -1, 1, FLAGS },
{ "similarity", "set the hsvkey similarity value", OFFSET(similarity), AV_OPT_TYPE_FLOAT, { .dbl = 0.01}, 0.00001, 1.0, FLAGS },
{ "blend", "set the hsvkey blend value", OFFSET(blend), AV_OPT_TYPE_FLOAT, { .dbl = 0.0 }, 0.0, 1.0, FLAGS },
{ NULL }
}
static double val(void *priv, double ch)
Definition aeval.c:77
#define FLAGS
Definition cmdutils.c:598
#define NULL
Definition coverity.c:32
#define OFFSET(x)
@ AV_OPT_TYPE_FLOAT
Underlying C type is float.
Definition opt.h:270

Definition at line 289 of file vf_hsvkey.c.

◆ ff_vf_hsvkey

const FFFilter ff_vf_hsvkey
Initial value:
= {
.p.name = "hsvkey",
.p.description = NULL_IF_CONFIG_SMALL("Turns a certain HSV range into transparency. Operates on YUV colors."),
.p.priv_class = &hsvkey_class,
.priv_size = sizeof(HSVKeyContext),
.process_command = ff_filter_process_command,
}
static const AVFilterPad inputs[]
Definition af_aap.c:299
static const AVFilterPad outputs[]
Definition af_aap.c:310
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:906
#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:196
#define AVFILTER_FLAG_SLICE_THREADS
The filter supports multithreading by splitting frames into multiple parts and processing them concur...
Definition avfilter.h:166
#define FILTER_INPUTS(array)
Definition filters.h:264
#define FILTER_OUTPUTS(array)
Definition filters.h:265
#define FILTER_PIXFMTS_ARRAY(array)
Definition filters.h:244
#define NULL_IF_CONFIG_SMALL(x)
Return NULL if CONFIG_SMALL is true, otherwise the argument without modification.
Definition internal.h:88
static enum AVPixelFormat key_pixel_fmts[]
Definition vf_hsvkey.c:257

Definition at line 300 of file vf_hsvkey.c.

◆ hold_pixel_fmts

enum AVPixelFormat hold_pixel_fmts[]
static
Initial value:
= {
}
#define AV_PIX_FMT_YUV420P16
Definition pixfmt.h:556
#define AV_PIX_FMT_YUV444P12
Definition pixfmt.h:552
#define AV_PIX_FMT_YUV444P9
Definition pixfmt.h:544
#define AV_PIX_FMT_YUV420P10
Definition pixfmt.h:545
#define AV_PIX_FMT_YUV422P9
Definition pixfmt.h:543
#define AV_PIX_FMT_YUV420P12
Definition pixfmt.h:549
#define AV_PIX_FMT_YUV422P12
Definition pixfmt.h:550
#define AV_PIX_FMT_YUV422P10
Definition pixfmt.h:546
#define AV_PIX_FMT_YUV420P9
Definition pixfmt.h:542
#define AV_PIX_FMT_YUV420P14
Definition pixfmt.h:553
@ 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_YUV422P
planar YUV 4:2:2, 16bpp, (1 Cr & Cb sample per 2x1 Y samples)
Definition pixfmt.h:77
@ AV_PIX_FMT_YUV444P
planar YUV 4:4:4, 24bpp, (1 Cr & Cb sample per 1x1 Y samples)
Definition pixfmt.h:78
#define AV_PIX_FMT_YUV422P14
Definition pixfmt.h:554
#define AV_PIX_FMT_YUV422P16
Definition pixfmt.h:557
#define AV_PIX_FMT_YUV444P14
Definition pixfmt.h:555
#define AV_PIX_FMT_YUV444P16
Definition pixfmt.h:558
#define AV_PIX_FMT_YUV444P10
Definition pixfmt.h:548

Definition at line 312 of file vf_hsvkey.c.

◆ hsvhold_options

const AVOption hsvhold_options[]
static
Initial value:
= {
{ "hue", "set the hue value", OFFSET(hue_opt), AV_OPT_TYPE_FLOAT, { .dbl = 0 }, -360, 360, FLAGS },
{ "sat", "set the saturation value", OFFSET(sat), AV_OPT_TYPE_FLOAT, { .dbl = 0 }, -1, 1, FLAGS },
{ "val", "set the value value", OFFSET(val), AV_OPT_TYPE_FLOAT, { .dbl = 0 }, -1, 1, FLAGS },
{ "similarity", "set the hsvhold similarity value", OFFSET(similarity), AV_OPT_TYPE_FLOAT, { .dbl = 0.01 }, 0.00001, 1.0, FLAGS },
{ "blend", "set the hsvhold blend value", OFFSET(blend), AV_OPT_TYPE_FLOAT, { .dbl = 0.0 }, 0.0, 1.0, FLAGS },
{ NULL }
}

Definition at line 331 of file vf_hsvkey.c.

◆ ff_vf_hsvhold

const FFFilter ff_vf_hsvhold
Initial value:
= {
.p.name = "hsvhold",
.p.description = NULL_IF_CONFIG_SMALL("Turns a certain HSV range into gray."),
.p.priv_class = &hsvhold_class,
.priv_size = sizeof(HSVKeyContext),
.process_command = ff_filter_process_command,
}
static enum AVPixelFormat hold_pixel_fmts[]

Definition at line 342 of file vf_hsvkey.c.