70 "repeat",
"endall",
"pass"
80 int max_plane_step[4];
138 var_values[
VAR_PI ] = M_PI;
160 "main w:%d h:%d fmt:%s overlay x:%d y:%d w:%d h:%d fmt:%s eof_action:%s\n",
168 if (s->
x < 0 || s->
y < 0 ||
172 "Overlay area (%d,%d)<->(%d,%d) not within the main area (0,0)<->(%d,%d) or zero-sized\n",
176 (
int)var_values[
VAR_MAIN_W], (
int)var_values[VAR_MAIN_H]);
183 "Error when evaluating the expression '%s'\n", expr);
205 int overlay_end_y = y + src->
height;
210 start_y =
FFMAX(y, 0);
211 height = end_y - start_y;
220 for (i = 0; i <
height; i++) {
222 for (j = 0; j <
width; j++) {
223 d[
r] = (d[
r] * (0xff - s[3]) + s[0] * s[3] + 128) >> 8;
224 d[1] = (d[1] * (0xff - s[3]) + s[1] * s[3] + 128) >> 8;
225 d[
b] = (d[
b] * (0xff - s[3]) + s[2] * s[3] + 128) >> 8;
233 for (i = 0; i < 3; i++) {
234 int hsub = i ? s->
hsub : 0;
235 int vsub = i ? s->
vsub : 0;
237 (start_y >> vsub) * dst->
linesize[i];
240 int wp =
FFALIGN(width, 1<<hsub) >> hsub;
241 int hp =
FFALIGN(height, 1<<vsub) >> vsub;
243 sp += ((-y) >> vsub) * src->
linesize[i];
246 for (j = 0; j < hp; j++) {
247 uint8_t *d = dp, *s = sp, *a = ap;
248 for (k = 0; k < wp; k++) {
250 int alpha_v, alpha_h, alpha;
251 if (hsub && vsub && j+1 < hp && k+1 < wp) {
252 alpha = (a[0] + a[src->
linesize[3]] +
254 }
else if (hsub || vsub) {
255 alpha_h = hsub && k+1 < wp ?
256 (a[0] + a[1]) >> 1 : a[0];
257 alpha_v = vsub && j+1 < hp ?
258 (a[0] + a[src->
linesize[3]]) >> 1 : a[0];
259 alpha = (alpha_v + alpha_h) >> 1;
262 *d = (*d * (0xff - alpha) + *s++ * alpha + 128) >> 8;
268 ap += (1 << vsub) * src->
linesize[3];
366 #define OFFSET(x) offsetof(OverlayContext, x)
367 #define FLAGS AV_OPT_FLAG_VIDEO_PARAM
369 {
"x",
"Horizontal position of the left edge of the overlaid video on the "
371 {
"y",
"Vertical position of the top edge of the overlaid video on the "
373 {
"eof_action",
"Action to take when encountering EOF from secondary input ",
425 .priv_class = &overlay_class,
429 .
inputs = avfilter_vf_overlay_inputs,
430 .
outputs = avfilter_vf_overlay_outputs,