74 unsigned char yuv_color[4];
147 NULL, NULL, NULL, NULL, NULL, 0, ctx)) < 0 && i ==
NUM_EXPR_EVALS)
153 NULL, NULL, NULL, NULL, NULL, 0, ctx)) < 0 && i ==
NUM_EXPR_EVALS)
159 NULL, NULL, NULL, NULL, NULL, 0, ctx)) < 0 && i ==
NUM_EXPR_EVALS)
165 NULL, NULL, NULL, NULL, NULL, 0, ctx)) < 0 && i ==
NUM_EXPR_EVALS)
171 NULL, NULL, NULL, NULL, NULL, 0, ctx)) < 0 && i ==
NUM_EXPR_EVALS)
177 s->
w = (s->
w > 0) ? s->
w : inlink->
w;
178 s->
h = (s->
h > 0) ? s->
h : inlink->
h;
181 if (s->
w < 0 || s->
h < 0) {
187 s->
x, s->
y, s->
w, s->
h,
194 "Error when evaluating the expression '%s'.\n",
202 int plane, x,
y, xb = s->
x, yb = s->
y;
203 unsigned char *row[4];
205 for (y =
FFMAX(yb, 0); y < frame->
height && y < (yb + s->
h); y++) {
208 for (plane = 1; plane < 3; plane++)
209 row[plane] = frame->
data[plane] +
213 for (x =
FFMAX(xb, 0); x < xb + s->
w && x < frame->
width; x++)
214 if ((y - yb < s->thickness) || (yb + s->
h - 1 - y < s->
thickness) ||
215 (x - xb < s->thickness) || (xb + s->
w - 1 - x < s->
thickness))
216 row[0][x] = 0xff - row[0][x];
218 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)) {
234 #define OFFSET(x) offsetof(DrawBoxContext, x)
235 #define FLAGS AV_OPT_FLAG_VIDEO_PARAM|AV_OPT_FLAG_FILTERING_PARAM
237 #if CONFIG_DRAWBOX_FILTER
239 static const AVOption drawbox_options[] = {
279 .priv_class = &drawbox_class,
289 #if CONFIG_DRAWGRID_FILTER
301 x_modulo = x % drawgrid->
w;
302 y_modulo = y % drawgrid->
h;
306 x_modulo += drawgrid->
w;
308 y_modulo += drawgrid->
h;
320 for (y = 0; y < frame->
height; y++) {
323 for (plane = 1; plane < 3; plane++)
324 row[plane] = frame->
data[plane] +
328 for (x = 0; x < frame->
width; x++)
329 if (pixel_belongs_to_grid(drawgrid, x, y))
330 row[0][x] = 0xff - row[0][x];
332 for (x = 0; x < frame->
width; x++) {
335 if (pixel_belongs_to_grid(drawgrid, x, y)) {
336 row[0][x ] = (1 -
alpha) * row[0][x ] + alpha * drawgrid->
yuv_color[
Y];
337 row[1][x >> drawgrid->
hsub] = (1 - alpha) * row[1][x >> drawgrid->
hsub] + alpha * drawgrid->
yuv_color[
U];
347 static const AVOption drawgrid_options[] = {
368 .filter_frame = drawgrid_filter_frame,
386 .priv_class = &drawgrid_class,
389 .
inputs = drawgrid_inputs,