58 int logo_x,
int logo_y,
int logo_w,
int logo_h,
59 int band,
int show,
int direct)
65 uint8_t *topleft, *botleft, *topright;
66 int xclipl, xclipr, yclipt, yclipb;
67 int logo_x1, logo_x2, logo_y1, logo_y2;
69 xclipl =
FFMAX(-logo_x, 0);
70 xclipr =
FFMAX(logo_x+logo_w-w, 0);
71 yclipt =
FFMAX(-logo_y, 0);
72 yclipb =
FFMAX(logo_y+logo_h-h, 0);
74 logo_x1 = logo_x + xclipl;
75 logo_x2 = logo_x + logo_w - xclipr;
76 logo_y1 = logo_y + yclipt;
77 logo_y2 = logo_y + logo_h - yclipb;
79 topleft = src+logo_y1 * src_linesize+logo_x1;
80 topright = src+logo_y1 * src_linesize+logo_x2-1;
81 botleft = src+(logo_y2-1) * src_linesize+logo_x1;
86 dst += (logo_y1 + 1) * dst_linesize;
87 src += (logo_y1 + 1) * src_linesize;
89 for (y = logo_y1+1; y < logo_y2-1; y++) {
92 xsrc = src+logo_x1+1; x < logo_x2-1; x++, xdst++, xsrc++) {
94 (topleft[src_linesize*(y-logo_y -yclipt)] +
95 topleft[src_linesize*(y-logo_y-1-yclipt)] +
96 topleft[src_linesize*(y-logo_y+1-yclipt)]) * (logo_w-(x-logo_x))/logo_w
98 (topright[src_linesize*(y-logo_y-yclipt)] +
99 topright[src_linesize*(y-logo_y-1-yclipt)] +
100 topright[src_linesize*(y-logo_y+1-yclipt)]) * (x-logo_x)/logo_w
102 (topleft[x-logo_x-xclipl] +
103 topleft[x-logo_x-1-xclipl] +
104 topleft[x-logo_x+1-xclipl]) * (logo_h-(y-logo_y))/logo_h
106 (botleft[x-logo_x-xclipl] +
107 botleft[x-logo_x-1-xclipl] +
108 botleft[x-logo_x+1-xclipl]) * (y-logo_y)/logo_h;
111 if (y >= logo_y+band && y < logo_y+logo_h-band &&
112 x >= logo_x+band && x < logo_x+logo_w-band) {
117 dist =
FFMAX(dist, logo_x-x+band);
118 else if (x >= logo_x+logo_w-band)
119 dist =
FFMAX(dist, x-(logo_x+logo_w-1-band));
122 dist =
FFMAX(dist, logo_y-y+band);
123 else if (y >= logo_y+logo_h-band)
124 dist =
FFMAX(dist, y-(logo_y+logo_h-1-band));
126 *xdst = (*xsrc*dist + interp*(band-dist))/
band;
127 if (show && (dist == band-1))
142 #define OFFSET(x) offsetof(DelogoContext, x)
143 #define FLAGS AV_OPT_FLAG_FILTERING_PARAM|AV_OPT_FLAG_VIDEO_PARAM
176 delogo->
class = &delogo_class;
180 ret = sscanf(args,
"%d:%d:%d:%d:%d",
181 &delogo->
x, &delogo->
y, &delogo->
w, &delogo->
h, &delogo->
band);
183 if (delogo->
band < 0)
188 #define CHECK_UNSET_OPT(opt) \
189 if (delogo->opt == -1) { \
190 av_log(delogo, AV_LOG_ERROR, "Option %s was not set.\n", #opt); \
191 return AVERROR(EINVAL); \
202 delogo->
x, delogo->
y, delogo->
w, delogo->
h, delogo->
band, delogo->
show);
204 delogo->
w += delogo->
band*2;
205 delogo->
h += delogo->
band*2;
206 delogo->
x -= delogo->
band;
207 delogo->
y -= delogo->
band;
235 for (plane = 0; plane < 4 && in->
data[plane]; plane++) {
236 int hsub = plane == 1 || plane == 2 ? hsub0 : 0;
237 int vsub = plane == 1 || plane == 2 ? vsub0 : 0;
241 inlink->
w>>hsub, inlink->
h>>vsub,
242 delogo->
x>>hsub, delogo->
y>>vsub,
243 delogo->
w>>hsub, delogo->
h>>vsub,
245 delogo->
show, direct);
280 .
inputs = avfilter_vf_delogo_inputs,
281 .
outputs = avfilter_vf_delogo_outputs,
282 .priv_class = &delogo_class,