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[] = {
278 .priv_class = &drawbox_class,
287 #if CONFIG_DRAWGRID_FILTER
299 x_modulo = x % drawgrid->
w;
300 y_modulo = y % drawgrid->
h;
304 x_modulo += drawgrid->
w;
306 y_modulo += drawgrid->
h;
318 for (y = 0; y < frame->
height; y++) {
321 for (plane = 1; plane < 3; plane++)
322 row[plane] = frame->
data[plane] +
326 for (x = 0; x < frame->
width; x++)
327 if (pixel_belongs_to_grid(drawgrid, x, y))
328 row[0][x] = 0xff - row[0][x];
330 for (x = 0; x < frame->
width; x++) {
333 if (pixel_belongs_to_grid(drawgrid, x, y)) {
334 row[0][x ] = (1 -
alpha) * row[0][x ] + alpha * drawgrid->
yuv_color[
Y];
335 row[1][x >> drawgrid->
hsub] = (1 - alpha) * row[1][x >> drawgrid->
hsub] + alpha * drawgrid->
yuv_color[
U];
345 static const AVOption drawgrid_options[] = {
366 .filter_frame = drawgrid_filter_frame,
384 .priv_class = &drawgrid_class,
387 .
inputs = drawgrid_inputs,