Signed-off-by: Paul B Mahol <onemda@gmail.com>
Paul B Mahol authored on 2016/02/17 17:42:46... | ... |
@@ -240,32 +240,32 @@ static int filter_frame(AVFilterLink *inlink, AVFrame *frame) |
240 | 240 |
} |
241 | 241 |
} |
242 | 242 |
} else { |
243 |
- for (y = FFMAX(yb, 0); y < frame->height && y < (yb + s->h); y++) { |
|
244 |
- row[0] = frame->data[0] + y * frame->linesize[0]; |
|
245 |
- |
|
246 |
- for (plane = 1; plane < 3; plane++) |
|
247 |
- row[plane] = frame->data[plane] + |
|
248 |
- frame->linesize[plane] * (y >> s->vsub); |
|
249 |
- |
|
250 |
- if (s->invert_color) { |
|
251 |
- for (x = FFMAX(xb, 0); x < xb + s->w && x < frame->width; x++) |
|
252 |
- if ((y - yb < s->thickness) || (yb + s->h - 1 - y < s->thickness) || |
|
253 |
- (x - xb < s->thickness) || (xb + s->w - 1 - x < s->thickness)) |
|
254 |
- row[0][x] = 0xff - row[0][x]; |
|
255 |
- } else { |
|
256 |
- for (x = FFMAX(xb, 0); x < xb + s->w && x < frame->width; x++) { |
|
257 |
- double alpha = (double)s->yuv_color[A] / 255; |
|
258 |
- |
|
259 |
- if ((y - yb < s->thickness) || (yb + s->h - 1 - y < s->thickness) || |
|
260 |
- (x - xb < s->thickness) || (xb + s->w - 1 - x < s->thickness)) { |
|
261 |
- row[0][x ] = (1 - alpha) * row[0][x ] + alpha * s->yuv_color[Y]; |
|
262 |
- row[1][x >> s->hsub] = (1 - alpha) * row[1][x >> s->hsub] + alpha * s->yuv_color[U]; |
|
263 |
- row[2][x >> s->hsub] = (1 - alpha) * row[2][x >> s->hsub] + alpha * s->yuv_color[V]; |
|
243 |
+ for (y = FFMAX(yb, 0); y < frame->height && y < (yb + s->h); y++) { |
|
244 |
+ row[0] = frame->data[0] + y * frame->linesize[0]; |
|
245 |
+ |
|
246 |
+ for (plane = 1; plane < 3; plane++) |
|
247 |
+ row[plane] = frame->data[plane] + |
|
248 |
+ frame->linesize[plane] * (y >> s->vsub); |
|
249 |
+ |
|
250 |
+ if (s->invert_color) { |
|
251 |
+ for (x = FFMAX(xb, 0); x < xb + s->w && x < frame->width; x++) |
|
252 |
+ if ((y - yb < s->thickness) || (yb + s->h - 1 - y < s->thickness) || |
|
253 |
+ (x - xb < s->thickness) || (xb + s->w - 1 - x < s->thickness)) |
|
254 |
+ row[0][x] = 0xff - row[0][x]; |
|
255 |
+ } else { |
|
256 |
+ for (x = FFMAX(xb, 0); x < xb + s->w && x < frame->width; x++) { |
|
257 |
+ double alpha = (double)s->yuv_color[A] / 255; |
|
258 |
+ |
|
259 |
+ if ((y - yb < s->thickness) || (yb + s->h - 1 - y < s->thickness) || |
|
260 |
+ (x - xb < s->thickness) || (xb + s->w - 1 - x < s->thickness)) { |
|
261 |
+ row[0][x ] = (1 - alpha) * row[0][x ] + alpha * s->yuv_color[Y]; |
|
262 |
+ row[1][x >> s->hsub] = (1 - alpha) * row[1][x >> s->hsub] + alpha * s->yuv_color[U]; |
|
263 |
+ row[2][x >> s->hsub] = (1 - alpha) * row[2][x >> s->hsub] + alpha * s->yuv_color[V]; |
|
264 |
+ } |
|
264 | 265 |
} |
265 | 266 |
} |
266 | 267 |
} |
267 | 268 |
} |
268 |
- } |
|
269 | 269 |
|
270 | 270 |
return ff_filter_frame(inlink->dst->outputs[0], frame); |
271 | 271 |
} |
... | ... |
@@ -379,30 +379,30 @@ static int drawgrid_filter_frame(AVFilterLink *inlink, AVFrame *frame) |
379 | 379 |
} |
380 | 380 |
} |
381 | 381 |
} else { |
382 |
- for (y = 0; y < frame->height; y++) { |
|
383 |
- row[0] = frame->data[0] + y * frame->linesize[0]; |
|
384 |
- |
|
385 |
- for (plane = 1; plane < 3; plane++) |
|
386 |
- row[plane] = frame->data[plane] + |
|
387 |
- frame->linesize[plane] * (y >> drawgrid->vsub); |
|
388 |
- |
|
389 |
- if (drawgrid->invert_color) { |
|
390 |
- for (x = 0; x < frame->width; x++) |
|
391 |
- if (pixel_belongs_to_grid(drawgrid, x, y)) |
|
392 |
- row[0][x] = 0xff - row[0][x]; |
|
393 |
- } else { |
|
394 |
- for (x = 0; x < frame->width; x++) { |
|
395 |
- double alpha = (double)drawgrid->yuv_color[A] / 255; |
|
396 |
- |
|
397 |
- if (pixel_belongs_to_grid(drawgrid, x, y)) { |
|
398 |
- row[0][x ] = (1 - alpha) * row[0][x ] + alpha * drawgrid->yuv_color[Y]; |
|
399 |
- row[1][x >> drawgrid->hsub] = (1 - alpha) * row[1][x >> drawgrid->hsub] + alpha * drawgrid->yuv_color[U]; |
|
400 |
- row[2][x >> drawgrid->hsub] = (1 - alpha) * row[2][x >> drawgrid->hsub] + alpha * drawgrid->yuv_color[V]; |
|
382 |
+ for (y = 0; y < frame->height; y++) { |
|
383 |
+ row[0] = frame->data[0] + y * frame->linesize[0]; |
|
384 |
+ |
|
385 |
+ for (plane = 1; plane < 3; plane++) |
|
386 |
+ row[plane] = frame->data[plane] + |
|
387 |
+ frame->linesize[plane] * (y >> drawgrid->vsub); |
|
388 |
+ |
|
389 |
+ if (drawgrid->invert_color) { |
|
390 |
+ for (x = 0; x < frame->width; x++) |
|
391 |
+ if (pixel_belongs_to_grid(drawgrid, x, y)) |
|
392 |
+ row[0][x] = 0xff - row[0][x]; |
|
393 |
+ } else { |
|
394 |
+ for (x = 0; x < frame->width; x++) { |
|
395 |
+ double alpha = (double)drawgrid->yuv_color[A] / 255; |
|
396 |
+ |
|
397 |
+ if (pixel_belongs_to_grid(drawgrid, x, y)) { |
|
398 |
+ row[0][x ] = (1 - alpha) * row[0][x ] + alpha * drawgrid->yuv_color[Y]; |
|
399 |
+ row[1][x >> drawgrid->hsub] = (1 - alpha) * row[1][x >> drawgrid->hsub] + alpha * drawgrid->yuv_color[U]; |
|
400 |
+ row[2][x >> drawgrid->hsub] = (1 - alpha) * row[2][x >> drawgrid->hsub] + alpha * drawgrid->yuv_color[V]; |
|
401 |
+ } |
|
401 | 402 |
} |
402 | 403 |
} |
403 | 404 |
} |
404 | 405 |
} |
405 |
- } |
|
406 | 406 |
|
407 | 407 |
return ff_filter_frame(inlink->dst->outputs[0], frame); |
408 | 408 |
} |