41 int x,
y, w, h, thickness;
43 unsigned char yuv_color[4];
48 #define OFFSET(x) offsetof(DrawBoxContext, x)
49 #define FLAGS AV_OPT_FLAG_VIDEO_PARAM|AV_OPT_FLAG_FILTERING_PARAM
71 static const char *shorthand[] = {
"x",
"y",
"w",
"h",
"color",
"thickness",
NULL };
74 drawbox->
class = &drawbox_class;
80 if (!strcmp(drawbox->
color_str,
"invert"))
123 if (drawbox->
w == 0) drawbox->
w = inlink->
w;
124 if (drawbox->
h == 0) drawbox->
h = inlink->
h;
127 drawbox->
x, drawbox->
y, drawbox->
w, drawbox->
h,
136 int plane, x,
y, xb = drawbox->
x, yb = drawbox->
y;
137 unsigned char *row[4];
139 for (y =
FFMAX(yb, 0); y < frame->
video->
h && y < (yb + drawbox->
h); y++) {
142 for (plane = 1; plane < 3; plane++)
143 row[plane] = frame->
data[plane] +
147 for (x =
FFMAX(xb, 0); x < xb + drawbox->
w && x < frame->
video->
w; x++)
148 if ((y - yb < drawbox->thickness-1) || (yb + drawbox->
h - y < drawbox->
thickness) ||
149 (x - xb < drawbox->thickness-1) || (xb + drawbox->
w - x < drawbox->
thickness))
150 row[0][x] = 0xff - row[0][x];
152 for (x =
FFMAX(xb, 0); x < xb + drawbox->
w && x < frame->
video->
w; x++) {
155 if ((y - yb < drawbox->thickness-1) || (yb + drawbox->
h - y < drawbox->
thickness) ||
156 (x - xb < drawbox->thickness-1) || (xb + drawbox->
w - x < drawbox->
thickness)) {
158 row[1][x >> drawbox->
hsub] = (1 - alpha) * row[1][x >> drawbox->
hsub] + alpha * drawbox->
yuv_color[
U];
196 .
inputs = avfilter_vf_drawbox_inputs,
197 .
outputs = avfilter_vf_drawbox_outputs,
198 .priv_class = &drawbox_class,