64#define DEF_EXPR_FIELDS(name) AVExpr *name##_pexpr; char *name##_expr; double name
79#define OFFSET(x) offsetof(VignetteContext, x)
80#define FLAGS AV_OPT_FLAG_FILTERING_PARAM|AV_OPT_FLAG_VIDEO_PARAM
103#define PARSE_EXPR(name) do { \
104 int ret = av_expr_parse(&s->name##_pexpr, s->name##_expr, var_names, \
105 NULL, NULL, NULL, NULL, 0, ctx); \
107 av_log(ctx, AV_LOG_ERROR, "Unable to parse expression for '" \
108 AV_STRINGIFY(name) "'\n"); \
139 const int xx = (x -
s->x0) *
s->xscale;
140 const int yy = (y -
s->y0) *
s->yscale;
141 const double dnorm =
hypot(xx, yy) /
s->dmax;
145 const double c = cos(
s->angle * dnorm);
154 float *
dst =
s->fmap;
155 int dst_linesize =
s->fmap_linesize;
177 for (y = 0; y < inlink->
h; y++) {
178 for (x = 0; x < inlink->
w; x++)
183 for (y = 0; y < inlink->
h; y++) {
184 for (x = 0; x < inlink->
w; x++)
195 dv =
s->dither / (
double)(1LL<<32);
196 s->dither =
s->dither * 1664525 + 1013904223;
203 unsigned x, y, direct = 0;
225 uint8_t *
dst =
out->data[0];
226 const uint8_t *
src = in ->
data[0];
227 const float *fmap =
s->fmap;
228 const int dst_linesize =
out->linesize[0];
229 const int src_linesize = in ->
linesize[0];
230 const int fmap_linesize =
s->fmap_linesize;
232 for (y = 0; y < inlink->
h; y++) {
234 const uint8_t *srcp =
src;
236 for (x = 0; x < inlink->
w; x++, dstp += 3, srcp += 3) {
237 const float f = fmap[x];
245 fmap += fmap_linesize;
250 for (plane = 0; plane < 4 && in->
data[plane] && in->
linesize[plane]; plane++) {
251 uint8_t *
dst =
out->data[plane];
252 const uint8_t *
src = in ->
data[plane];
253 const float *fmap =
s->fmap;
254 const int dst_linesize =
out->linesize[plane];
255 const int src_linesize = in ->
linesize[plane];
256 const int fmap_linesize =
s->fmap_linesize;
257 const int chroma = plane == 1 || plane == 2;
258 const int hsub =
chroma ?
s->desc->log2_chroma_w : 0;
259 const int vsub =
chroma ?
s->desc->log2_chroma_h : 0;
263 for (y = 0; y <
h; y++) {
265 const uint8_t *srcp =
src;
267 for (x = 0; x <
w; x++) {
274 fmap += fmap_linesize << vsub;
292 s->var_values[
VAR_W] = inlink->
w;
293 s->var_values[
VAR_H] = inlink->
h;
307 s->dmax =
hypot(inlink->
w / 2., inlink->
h / 2.);
309 s->xscale,
s->yscale,
s->dmax);
311 s->fmap_linesize =
FFALIGN(inlink->
w, 32);
332 .p.name =
"vignette",
334 .p.priv_class = &vignette_class,
uint8_t ptrdiff_t const uint8_t ptrdiff_t int intptr_t intptr_t int int16_t * dst
const FFFilter ff_vf_vignette
int ff_filter_frame(AVFilterLink *link, AVFrame *frame)
Send a frame of data to the next filter.
Main libavfilter public API header.
#define AV_CEIL_RSHIFT(a, b)
static int filter_frame(DBEDecodeContext *s, AVFrame *frame)
int(* init)(AVBSFContext *ctx)
void av_expr_free(AVExpr *e)
Free a parsed expression previously created with av_expr_parse().
double av_expr_eval(AVExpr *e, const double *const_values, void *opaque)
Evaluate a previously parsed expression.
simple arithmetic expression evaluator
@ AV_OPT_TYPE_CONST
Special option type for declaring named constants.
@ AV_OPT_TYPE_RATIONAL
Underlying C type is AVRational.
@ AV_OPT_TYPE_INT
Underlying C type is int.
@ AV_OPT_TYPE_BOOL
Underlying C type is int.
@ 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...
#define AVFILTER_FLAG_SUPPORT_TIMELINE_GENERIC
Some filters support a generic "enable" expression option that can be used to enable or disable a fil...
int av_frame_is_writable(AVFrame *frame)
Check if the frame data is writable.
void av_frame_free(AVFrame **frame)
Free the frame and any dynamically allocated objects in it, e.g.
int av_frame_copy_props(AVFrame *dst, const AVFrame *src)
Copy only "metadata" fields from src to dst.
#define AV_LOG_DEBUG
Stuff which is only useful for libav* developers.
static double av_q2d(AVRational a)
Convert an AVRational to a double.
AVRational av_div_q(AVRational b, AVRational c)
Divide one rational by another.
static av_cold void uninit(AVBitStreamFilterContext *ctx)
#define FILTER_INPUTS(array)
#define FILTER_OUTPUTS(array)
#define FILTER_PIXFMTS_ARRAY(array)
static FilterLink * ff_filter_link(AVFilterLink *link)
#define AVFILTER_DEFINE_CLASS(fname)
#define NULL_IF_CONFIG_SMALL(x)
Return NULL if CONFIG_SMALL is true, otherwise the argument without modification.
static enum AVPixelFormat pix_fmts[]
static av_const double hypot(double x, double y)
Memory handling functions.
static const char *const var_names[]
const AVPixFmtDescriptor * av_pix_fmt_desc_get(enum AVPixelFormat pix_fmt)
#define AV_PIX_FMT_FLAG_RGB
The pixel format contains RGB-like data (as opposed to YUV/grayscale).
AVPixelFormat
Pixel format.
@ AV_PIX_FMT_RGB24
packed RGB 8:8:8, 24bpp, RGBRGB...
@ AV_PIX_FMT_YUV420P
planar YUV 4:2:0, 12bpp, (1 Cr & Cb sample per 2x2 Y samples)
@ AV_PIX_FMT_YUV440P
planar YUV 4:4:0 (1 Cr & Cb sample per 1x2 Y samples)
@ AV_PIX_FMT_YUV422P
planar YUV 4:2:2, 16bpp, (1 Cr & Cb sample per 2x1 Y samples)
@ AV_PIX_FMT_GRAY8
Y , 8bpp.
@ AV_PIX_FMT_YUV410P
planar YUV 4:1:0, 9bpp, (1 Cr & Cb sample per 4x4 Y samples)
@ AV_PIX_FMT_YUV411P
planar YUV 4:1:1, 12bpp, (1 Cr & Cb sample per 4x1 Y samples)
@ AV_PIX_FMT_YUV444P
planar YUV 4:4:4, 24bpp, (1 Cr & Cb sample per 1x1 Y samples)
@ AV_PIX_FMT_BGR24
packed RGB 8:8:8, 24bpp, BGRBGR...
static int config_props(AVBitStreamFilterLink *link)
Describe the class of an AVClass context structure.
A link between two filters.
int w
agreed upon image width
int h
agreed upon image height
AVRational time_base
Define the time base used by the PTS of the frames/samples which will pass through this link.
AVRational sample_aspect_ratio
agreed upon sample aspect ratio
AVFilterContext * dst
dest filter
int format
agreed upon media format
A filter pad used for either input or output.
This structure describes decoded (raw) audio or video data.
uint8_t * data[AV_NUM_DATA_POINTERS]
pointer to the picture/channel planes.
int linesize[AV_NUM_DATA_POINTERS]
For video, a positive or negative value, which is typically indicating the size in bytes of each pict...
Descriptor that unambiguously describes how the bits of a pixel are stored in the up to 4 data planes...
Rational number (pair of numerator and denominator).
Link properties exposed to filter code, but not external callers.
AVRational frame_rate
Frame rate of the stream on the link, or 1/0 if unknown or variable.
const AVPixFmtDescriptor * desc
double var_values[VAR_NB]
#define av_malloc_array(a, b)
static AVFormatContext * ctx
static double get_dither_value(VignetteContext *s)
static const AVFilterPad vignette_inputs[]
static double get_natural_factor(const VignetteContext *s, int x, int y)
static void update_context(VignetteContext *s, AVFilterLink *inlink, AVFrame *frame)
static const AVOption vignette_options[]
static int filter_frame(AVFilterLink *inlink, AVFrame *in)
static int config_props(AVFilterLink *inlink)
static av_cold void uninit(AVFilterContext *ctx)
const AVFilterPad ff_video_default_filterpad[1]
An AVFilterPad array whose only entry has name "default" and is of type AVMEDIA_TYPE_VIDEO.
AVFrame * ff_get_video_buffer(AVFilterLink *link, int w, int h)
Request a picture buffer with a specific set of permissions.