42 int x,
y, w_opt, h_opt, w, h;
45 unsigned char yuv_color[4];
96 s->
x, s->
y, s->
w, s->
h,
105 int plane, x,
y, xb = s->
x, yb = s->
y;
106 unsigned char *row[4];
108 for (y =
FFMAX(yb, 0); y < frame->
height && y < (yb + s->
h); y++) {
111 for (plane = 1; plane < 3; plane++)
112 row[plane] = frame->
data[plane] +
116 for (x =
FFMAX(xb, 0); x < xb + s->
w && x < frame->
width; x++)
117 if ((y - yb < s->thickness) || (yb + s->
h - 1 - y < s->
thickness) ||
118 (x - xb < s->thickness) || (xb + s->
w - 1 - x < s->
thickness))
119 row[0][x] = 0xff - row[0][x];
121 for (x =
FFMAX(xb, 0); x < xb + s->
w && x < frame->
width; x++) {
124 if ((y - yb < s->thickness) || (yb + s->
h - 1 - y < s->
thickness) ||
125 (x - xb < s->thickness) || (xb + s->
w - 1 - x < s->
thickness)) {
137 #define OFFSET(x) offsetof(DrawBoxContext, x)
138 #define FLAGS AV_OPT_FLAG_VIDEO_PARAM|AV_OPT_FLAG_FILTERING_PARAM
140 #if CONFIG_DRAWBOX_FILTER
142 static const AVOption drawbox_options[] = {
182 .priv_class = &drawbox_class,
192 #if CONFIG_DRAWGRID_FILTER
204 x_modulo = x % drawgrid->
w;
205 y_modulo = y % drawgrid->
h;
209 x_modulo += drawgrid->
w;
211 y_modulo += drawgrid->
h;
223 for (y = 0; y < frame->
height; y++) {
226 for (plane = 1; plane < 3; plane++)
227 row[plane] = frame->
data[plane] +
231 for (x = 0; x < frame->
width; x++)
232 if (pixel_belongs_to_grid(drawgrid, x, y))
233 row[0][x] = 0xff - row[0][x];
235 for (x = 0; x < frame->
width; x++) {
238 if (pixel_belongs_to_grid(drawgrid, x, y)) {
239 row[0][x ] = (1 -
alpha) * row[0][x ] + alpha * drawgrid->
yuv_color[
Y];
240 row[1][x >> drawgrid->
hsub] = (1 - alpha) * row[1][x >> drawgrid->
hsub] + alpha * drawgrid->
yuv_color[
U];
250 static const AVOption drawgrid_options[] = {
271 .filter_frame = drawgrid_filter_frame,
289 .priv_class = &drawgrid_class,
292 .
inputs = drawgrid_inputs,