59 #define DEF_EXPR_FIELDS(name) AVExpr *name##_pexpr; char *name##_expr; double name
74 #define OFFSET(x) offsetof(VignetteContext, x)
75 #define FLAGS AV_OPT_FLAG_FILTERING_PARAM|AV_OPT_FLAG_VIDEO_PARAM
85 {
"init",
"eval expressions once during initialization", 0,
AV_OPT_TYPE_CONST, {.i64=EVAL_MODE_INIT}, .flags =
FLAGS, .unit =
"eval" },
98 #define PARSE_EXPR(name) do { \
99 int ret = av_expr_parse(&s->name##_pexpr, s->name##_expr, var_names, \
100 NULL, NULL, NULL, NULL, 0, ctx); \
102 av_log(ctx, AV_LOG_ERROR, "Unable to parse expression for '" \
103 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);
150 #define TS2D(ts) ((ts) == AV_NOPTS_VALUE ? NAN : (double)(ts))
151 #define TS2T(ts, tb) ((ts) == AV_NOPTS_VALUE ? NAN : (double)(ts) * av_q2d(tb))
156 float *dst = s->
fmap;
174 for (y = 0; y < inlink->
h; y++) {
175 for (x = 0; x < inlink->
w; x++)
180 for (y = 0; y < inlink->
h; y++) {
181 for (x = 0; x < inlink->
w; x++)
192 dv = s->
dither / (double)(1LL<<32);
219 const float *fmap = s->
fmap;
220 const int dst_linesize = out->
linesize[0];
221 const int src_linesize = in ->
linesize[0];
224 for (y = 0; y < inlink->
h; y++) {
228 for (x = 0; x < inlink->
w; x++, dstp += 3, srcp += 3) {
229 const float f = fmap[x];
237 fmap += fmap_linesize;
242 for (plane = 0; plane < 4 && in->
data[plane] && in->
linesize[plane]; plane++) {
245 const float *fmap = s->
fmap;
246 const int dst_linesize = out->
linesize[plane];
247 const int src_linesize = in ->
linesize[plane];
249 const int chroma = plane == 1 || plane == 2;
255 for (y = 0; y < h; y++) {
259 for (x = 0; x < w; x++) {
261 if (chroma) *dstp++ = av_clip_uint8(fmap[x << hsub] * (*srcp++ - 127) + 127 + dv);
262 else *dstp++ = av_clip_uint8(fmap[x ] * *srcp++ + dv);
266 fmap += fmap_linesize << vsub;
295 s->
dmax = hypot(inlink->
w / 2., inlink->
h / 2.);
335 .
inputs = vignette_inputs,
337 .priv_class = &vignette_class,