[FFmpeg-devel] [PATCH] avfilter/vf_delogo: add auto set the area inside of the frame
Paul B Mahol
onemda at gmail.com
Tue Sep 3 10:24:46 EEST 2019
On 9/2/19, Steven Liu <lq at chinaffmpeg.org> wrote:
> 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.
>
> Signed-off-by: Steven Liu <lq at chinaffmpeg.org>
> ---
> libavfilter/vf_delogo.c | 14 ++++++++++++++
> 1 file changed, 14 insertions(+)
>
> diff --git a/libavfilter/vf_delogo.c b/libavfilter/vf_delogo.c
> index 814575a36c..5521a29214 100644
> --- a/libavfilter/vf_delogo.c
> +++ b/libavfilter/vf_delogo.c
> @@ -327,6 +327,20 @@ static int filter_frame(AVFilterLink *inlink, AVFrame
> *in)
> s->w = av_expr_eval(s->w_pexpr, s->var_values, s);
> s->h = av_expr_eval(s->h_pexpr, s->var_values, s);
>
> + if (s->x + (s->band - 1) < 0 || s->x + s->w - (s->band*2 - 2) >
> inlink->w ||
> + s->y + (s->band - 1) < 0 || s->y + s->h - (s->band*2 - 2) >
> inlink->h) {
> + av_log(s, AV_LOG_WARNING, "Logo area is outside of the frame,"
> + "auto set the area inside of the frame\n");
> + }
> + if (s->x + (s->band - 1) < 0)
> + s->x = s->band;
> + if (s->y + (s->band - 1) < 0)
> + s->y = s->band;
> + if (s->x + s->w - (s->band*2 - 2) > inlink->w)
> + s->x = inlink->w - s->w + (s->band*2 - 2);
> + if (s->y + s->h - (s->band*2 - 2) > inlink->h)
> + s->y = inlink->h - s->h + (s->band*2 - 2);
> +
What about s->h and s->w being too big?
> ret = config_input(inlink);
> if (ret < 0) {
> av_frame_free(&in);
> --
> 2.15.1
>
>
>
> _______________________________________________
> ffmpeg-devel mailing list
> ffmpeg-devel at ffmpeg.org
> https://ffmpeg.org/mailman/listinfo/ffmpeg-devel
>
> To unsubscribe, visit link above, or email
> ffmpeg-devel-request at ffmpeg.org with subject "unsubscribe".
More information about the ffmpeg-devel
mailing list