125 double var_values[
VARS_NB], res;
152 s->
x = var_values[
VAR_X] = res;
159 s->
y = var_values[
VAR_Y] = res;
166 s->
w = var_values[
VAR_W] = res;
173 s->
h = var_values[
VAR_H] = res;
184 s->
w = (s->
w > 0) ? s->
w : inlink->
w;
185 s->
h = (s->
h > 0) ? s->
h : inlink->
h;
188 if (s->
w < 0 || s->
h < 0) {
194 s->
x, s->
y, s->
w, s->
h,
201 "Error when evaluating the expression '%s'.\n",
209 int plane, x,
y, xb = s->
x, yb = s->
y;
210 unsigned char *row[4];
212 for (y =
FFMAX(yb, 0); y < frame->
height && y < (yb + s->
h); y++) {
215 for (plane = 1; plane < 3; plane++)
216 row[plane] = frame->
data[plane] +
220 for (x =
FFMAX(xb, 0); x < xb + s->
w && x < frame->
width; x++)
221 if ((y - yb < s->thickness) || (yb + s->
h - 1 - y < s->
thickness) ||
222 (x - xb < s->thickness) || (xb + s->
w - 1 - x < s->
thickness))
223 row[0][x] = 0xff - row[0][x];
225 for (x =
FFMAX(xb, 0); x < xb + s->
w && x < frame->
width; x++) {
228 if ((y - yb < s->thickness) || (yb + s->
h - 1 - y < s->
thickness) ||
229 (x - xb < s->thickness) || (xb + s->
w - 1 - x < s->
thickness)) {
241 #define OFFSET(x) offsetof(DrawBoxContext, x)
242 #define FLAGS AV_OPT_FLAG_VIDEO_PARAM|AV_OPT_FLAG_FILTERING_PARAM
244 #if CONFIG_DRAWBOX_FILTER
246 static const AVOption drawbox_options[] = {
285 .priv_class = &drawbox_class,
294 #if CONFIG_DRAWGRID_FILTER
306 x_modulo = x % drawgrid->
w;
307 y_modulo = y % drawgrid->
h;
311 x_modulo += drawgrid->
w;
313 y_modulo += drawgrid->
h;
325 for (y = 0; y < frame->
height; y++) {
328 for (plane = 1; plane < 3; plane++)
329 row[plane] = frame->
data[plane] +
333 for (x = 0; x < frame->
width; x++)
334 if (pixel_belongs_to_grid(drawgrid, x, y))
335 row[0][x] = 0xff - row[0][x];
337 for (x = 0; x < frame->
width; x++) {
340 if (pixel_belongs_to_grid(drawgrid, x, y)) {
341 row[0][x ] = (1 -
alpha) * row[0][x ] + alpha * drawgrid->
yuv_color[
Y];
342 row[1][x >> drawgrid->
hsub] = (1 - alpha) * row[1][x >> drawgrid->
hsub] + alpha * drawgrid->
yuv_color[
U];
352 static const AVOption drawgrid_options[] = {
373 .filter_frame = drawgrid_filter_frame,
391 .priv_class = &drawgrid_class,
394 .
inputs = drawgrid_inputs,