History

avfilter/vf_delogo: add auto set the area inside of the frame

when the area outside of the frame, then use expr should give user warning message and auto set to the area inside of the frame.

Steven Liu committed 7 years ago

Commit aea82df1 parent 9f0b9ae1 file · +15 −0Browse files

Showing the changes to libavfilter (1 of 1 file). Show all

Unified · Split

libavfilter/vf_delogo.c+15−0
@@ -327,6 +327,21 @@ static int filter_frame(AVFilterLink *inlink, AVFrame *in) · 326 unmodified lines
327327 s->w = av_expr_eval(s->w_pexpr, s->var_values, s);
328328 s->h = av_expr_eval(s->h_pexpr, s->var_values, s);
329329
330+ if (s->x + (s->band - 1) <= 0 || s->x + s->w - (s->band*2 - 2) > inlink->w ||
331+ s->y + (s->band - 1) <= 0 || s->y + s->h - (s->band*2 - 2) > inlink->h) {
332+ av_log(s, AV_LOG_WARNING, "Logo area is outside of the frame,"
333+ " auto set the area inside of the frame\n");
334+ }
335+
336+ if (s->x + (s->band - 1) <= 0)
337+ s->x = 1 + s->band;
338+ if (s->y + (s->band - 1) <= 0)
339+ s->y = 1 + s->band;
340+ if (s->x + s->w - (s->band*2 - 2) > inlink->w)
341+ s->w = inlink->w - s->x - (s->band*2 - 2);
342+ if (s->y + s->h - (s->band*2 - 2) > inlink->h)
343+ s->h = inlink->h - s->y - (s->band*2 - 2);
344+
330345 ret = config_input(inlink);
331346 if (ret < 0) {
332347 av_frame_free(&in);

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t