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);
200 unsigned x,
y, direct = 0;
224 const float *fmap = s->
fmap;
225 const int dst_linesize = out->
linesize[0];
226 const int src_linesize = in ->
linesize[0];
229 for (y = 0; y < inlink->
h; y++) {
233 for (x = 0; x < inlink->
w; x++, dstp += 3, srcp += 3) {
234 const float f = fmap[x];
242 fmap += fmap_linesize;
247 for (plane = 0; plane < 4 && in->
data[plane] && in->
linesize[plane]; plane++) {
250 const float *fmap = s->
fmap;
251 const int dst_linesize = out->
linesize[plane];
252 const int src_linesize = in ->
linesize[plane];
254 const int chroma = plane == 1 || plane == 2;
260 for (y = 0; y < h; y++) {
264 for (x = 0; x < w; x++) {
266 if (chroma) *dstp++ = av_clip_uint8(fmap[x << hsub] * (*srcp++ - 127) + 127 + dv);
267 else *dstp++ = av_clip_uint8(fmap[x ] * *srcp++ + dv);
271 fmap += fmap_linesize << vsub;
302 s->
dmax = hypot(inlink->
w / 2., inlink->
h / 2.);
342 .
inputs = vignette_inputs,
344 .priv_class = &vignette_class,