FFmpeg
Loading...
Searching...
No Matches
vf_vignette.c File Reference
#include <float.h>
#include "libavutil/mem.h"
#include "libavutil/opt.h"
#include "libavutil/eval.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  VignetteContext
 

Macros

#define DEF_EXPR_FIELDS(name)
 
#define OFFSET(x)
 
#define FLAGS   AV_OPT_FLAG_FILTERING_PARAM|AV_OPT_FLAG_VIDEO_PARAM
 
#define PARSE_EXPR(name)
 

Enumerations

enum  var_name {
  VAR_W , VAR_H , VAR_N , VAR_PTS ,
  VAR_R , VAR_T , VAR_TB , VAR_NB
}
 
enum  EvalMode { EVAL_MODE_INIT , EVAL_MODE_FRAME , EVAL_MODE_NB }
 

Functions

 AVFILTER_DEFINE_CLASS (vignette)
 
static av_cold int init (AVFilterContext *ctx)
 
static av_cold void uninit (AVFilterContext *ctx)
 
static double get_natural_factor (const VignetteContext *s, int x, int y)
 
static void update_context (VignetteContext *s, AVFilterLink *inlink, AVFrame *frame)
 
static double get_dither_value (VignetteContext *s)
 
static int filter_frame (AVFilterLink *inlink, AVFrame *in)
 
static int config_props (AVFilterLink *inlink)
 

Variables

static const char *const var_names []
 
static const AVOption vignette_options []
 
static enum AVPixelFormat pix_fmts []
 
static const AVFilterPad vignette_inputs []
 
const FFFilter ff_vf_vignette
 

Macro Definition Documentation

◆ DEF_EXPR_FIELDS

#define DEF_EXPR_FIELDS ( name)
Value:
AVExpr *name##_pexpr; char *name##_expr; double name
const char * name
Definition qsvenc.c:142
Definition eval.c:171

Definition at line 64 of file vf_vignette.c.

◆ OFFSET

#define OFFSET ( x)
Value:

Definition at line 79 of file vf_vignette.c.

◆ FLAGS

Definition at line 80 of file vf_vignette.c.

◆ PARSE_EXPR

#define PARSE_EXPR ( name)
Value:
do { \
int ret = av_expr_parse(&s->name##_pexpr, s->name##_expr, var_names, \
NULL, NULL, NULL, NULL, 0, ctx); \
if (ret < 0) { \
av_log(ctx, AV_LOG_ERROR, "Unable to parse expression for '" \
AV_STRINGIFY(name) "'\n"); \
return ret; \
} \
} while (0)
static AVFormatContext * ctx
#define s(width, name)
Definition cbs_vp9.c:198
#define NULL
Definition coverity.c:32
int av_expr_parse(AVExpr **expr, const char *s, const char *const *const_names, const char *const *func1_names, double(*const *funcs1)(void *, double), const char *const *func2_names, double(*const *funcs2)(void *, double, double), int log_offset, void *log_ctx)
Parse an expression.
Definition eval.c:735
#define AV_LOG_ERROR
Something went wrong and cannot losslessly be recovered.
Definition log.h:210
#define AV_STRINGIFY(s)
Definition macros.h:66
static const char *const var_names[]
Definition noise.c:30

Referenced by init().

Enumeration Type Documentation

◆ var_name

enum var_name
Enumerator
VAR_W 
VAR_H 
VAR_N 
VAR_PTS 
VAR_R 
VAR_T 
VAR_TB 
VAR_NB 

Definition at line 42 of file vf_vignette.c.

◆ EvalMode

enum EvalMode
Enumerator
EVAL_MODE_INIT 
EVAL_MODE_FRAME 
EVAL_MODE_NB 

Definition at line 53 of file vf_vignette.c.

Function Documentation

◆ AVFILTER_DEFINE_CLASS()

AVFILTER_DEFINE_CLASS ( vignette )

◆ init()

static av_cold int init ( AVFilterContext * ctx)
static

Definition at line 99 of file vf_vignette.c.

◆ uninit()

static av_cold void uninit ( AVFilterContext * ctx)
static

Definition at line 119 of file vf_vignette.c.

◆ get_natural_factor()

static double get_natural_factor ( const VignetteContext * s,
int x,
int y )
static

Definition at line 137 of file vf_vignette.c.

Referenced by update_context().

◆ update_context()

static void update_context ( VignetteContext * s,
AVFilterLink * inlink,
AVFrame * frame )
static

Definition at line 150 of file vf_vignette.c.

Referenced by config_props(), filter_frame(), and update_moov_atom().

◆ get_dither_value()

static double get_dither_value ( VignetteContext * s)
inlinestatic

Definition at line 191 of file vf_vignette.c.

Referenced by filter_frame().

◆ filter_frame()

static int filter_frame ( AVFilterLink * inlink,
AVFrame * in )
static

Definition at line 201 of file vf_vignette.c.

◆ config_props()

static int config_props ( AVFilterLink * inlink)
static

Definition at line 284 of file vf_vignette.c.

Variable Documentation

◆ var_names

const char* const var_names[]
static
Initial value:
= {
"w",
"h",
"n",
"pts",
"r",
"t",
"tb",
}

Definition at line 31 of file vf_vignette.c.

◆ vignette_options

const AVOption vignette_options[]
static
Initial value:
= {
{ "angle", "set lens angle", OFFSET(angle_expr), AV_OPT_TYPE_STRING, {.str="PI/5"}, .flags = FLAGS },
{ "a", "set lens angle", OFFSET(angle_expr), AV_OPT_TYPE_STRING, {.str="PI/5"}, .flags = FLAGS },
{ "x0", "set circle center position on x-axis", OFFSET(x0_expr), AV_OPT_TYPE_STRING, {.str="w/2"}, .flags = FLAGS },
{ "y0", "set circle center position on y-axis", OFFSET(y0_expr), AV_OPT_TYPE_STRING, {.str="h/2"}, .flags = FLAGS },
{ "mode", "set forward/backward mode", OFFSET(backward), AV_OPT_TYPE_INT, {.i64 = 0}, 0, 1, FLAGS, .unit = "mode" },
{ "forward", NULL, 0, AV_OPT_TYPE_CONST, {.i64 = 0}, INT_MIN, INT_MAX, FLAGS, .unit = "mode"},
{ "backward", NULL, 0, AV_OPT_TYPE_CONST, {.i64 = 1}, INT_MIN, INT_MAX, FLAGS, .unit = "mode"},
{ "eval", "specify when to evaluate expressions", OFFSET(eval_mode), AV_OPT_TYPE_INT, {.i64 = EVAL_MODE_INIT}, 0, EVAL_MODE_NB-1, FLAGS, .unit = "eval" },
{ "init", "eval expressions once during initialization", 0, AV_OPT_TYPE_CONST, {.i64=EVAL_MODE_INIT}, .flags = FLAGS, .unit = "eval" },
{ "frame", "eval expressions for each frame", 0, AV_OPT_TYPE_CONST, {.i64=EVAL_MODE_FRAME}, .flags = FLAGS, .unit = "eval" },
{ "dither", "set dithering", OFFSET(do_dither), AV_OPT_TYPE_BOOL, {.i64 = 1}, 0, 1, FLAGS },
{ "aspect", "set aspect ratio", OFFSET(aspect), AV_OPT_TYPE_RATIONAL, {.dbl = 1}, 0, DBL_MAX, .flags = FLAGS },
{ NULL }
}
@ EVAL_MODE_NB
Definition af_volume.h:42
@ EVAL_MODE_FRAME
Definition af_volume.h:41
#define FLAGS
Definition cmdutils.c:598
#define OFFSET(x)
@ AV_OPT_TYPE_CONST
Special option type for declaring named constants.
Definition opt.h:298
@ AV_OPT_TYPE_RATIONAL
Underlying C type is AVRational.
Definition opt.h:279
@ AV_OPT_TYPE_INT
Underlying C type is int.
Definition opt.h:258
@ AV_OPT_TYPE_BOOL
Underlying C type is int.
Definition opt.h:326
@ AV_OPT_TYPE_STRING
Underlying C type is a uint8_t* that is either NULL or points to a C string allocated with the av_mal...
Definition opt.h:275
@ EVAL_MODE_INIT
Definition vf_fftfilt.c:41

Definition at line 81 of file vf_vignette.c.

◆ pix_fmts

enum AVPixelFormat pix_fmts[]
static
Initial value:
= {
}
@ AV_PIX_FMT_NONE
Definition pixfmt.h:72
@ AV_PIX_FMT_RGB24
packed RGB 8:8:8, 24bpp, RGBRGB...
Definition pixfmt.h:75
@ 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_YUV440P
planar YUV 4:4:0 (1 Cr & Cb sample per 1x2 Y samples)
Definition pixfmt.h:106
@ 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_GRAY8
Y , 8bpp.
Definition pixfmt.h:81
@ AV_PIX_FMT_YUV410P
planar YUV 4:1:0, 9bpp, (1 Cr & Cb sample per 4x4 Y samples)
Definition pixfmt.h:79
@ AV_PIX_FMT_YUV411P
planar YUV 4:1:1, 12bpp, (1 Cr & Cb sample per 4x1 Y samples)
Definition pixfmt.h:80
@ AV_PIX_FMT_YUV444P
planar YUV 4:4:4, 24bpp, (1 Cr & Cb sample per 1x1 Y samples)
Definition pixfmt.h:78
@ AV_PIX_FMT_BGR24
packed RGB 8:8:8, 24bpp, BGRBGR...
Definition pixfmt.h:76

Definition at line 128 of file vf_vignette.c.

◆ vignette_inputs

const AVFilterPad vignette_inputs[]
static
Initial value:
= {
{
.name = "default",
.filter_frame = filter_frame,
.config_props = config_props,
},
}
static int filter_frame(DBEDecodeContext *s, AVFrame *frame)
Definition dolby_e.c:1067
@ AVMEDIA_TYPE_VIDEO
Definition avutil.h:200
static int config_props(AVBitStreamFilterLink *link)
Definition source.c:181

Definition at line 322 of file vf_vignette.c.

◆ ff_vf_vignette

const FFFilter ff_vf_vignette
Initial value:
= {
.p.name = "vignette",
.p.description = NULL_IF_CONFIG_SMALL("Make or reverse a vignette effect."),
.p.priv_class = &vignette_class,
.priv_size = sizeof(VignetteContext),
.init = init,
}
int(* init)(AVBSFContext *ctx)
Definition dts2pts.c:608
#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
static av_cold void uninit(AVBitStreamFilterContext *ctx)
#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 pix_fmts[]
Definition libkvazaar.c:296
static const AVFilterPad vignette_inputs[]
const AVFilterPad ff_video_default_filterpad[1]
An AVFilterPad array whose only entry has name "default" and is of type AVMEDIA_TYPE_VIDEO.
Definition video.c:37

Definition at line 331 of file vf_vignette.c.