From patchwork Mon Jul 17 15:45:09 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Nicolas George X-Patchwork-Id: 4345 Delivered-To: ffmpegpatchwork@gmail.com Received: by 10.103.1.76 with SMTP id 73csp307385vsb; Mon, 17 Jul 2017 08:46:57 -0700 (PDT) X-Received: by 10.28.136.147 with SMTP id k141mr4028022wmd.14.1500306417294; Mon, 17 Jul 2017 08:46:57 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1500306417; cv=none; d=google.com; s=arc-20160816; b=hGOn3mGvDs4DzmhdU9s2b0wN2tOt9jlxh+2VwSrsrGSdXgTOnrFy/muxDHFWDWrIMX YPo8VNWCyVl1FvlCkb/BMcP36S3uwFqgKqvsyq3ZYazTOBK79wLiZPmmX1hTHlYUZae5 +oUaEnjGZe1UlM5PawvNg3rACWRAlvUqLU9N2N75okigB8MXIXnHRqtUHj0wOaJM80Mw WCuKhRmRW0bFiuYfSNN6XrP1wpUbcMnt2c8AhO2hxJYShIDiD3wPL3f7DoohE/ADaHWb 4x9atNScwhs/3MkeZeXEyeZalhKRWWqMuabd/UY7oSZS8Ylw8rq1/1yrfqTBihQLtDSo CQKw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:content-transfer-encoding:mime-version:reply-to :list-subscribe:list-help:list-post:list-archive:list-unsubscribe :list-id:precedence:subject:references:in-reply-to:message-id:date :to:from:delivered-to:arc-authentication-results; bh=VEu9IgC04HbAm/7t6cqIeg0E5hkyZG6zWwmmKiWvJ04=; b=RXlSZozwVNOfpvJ74imIy73afdmtH0zjcIsiO5PKwhpyfeyE5nn+gn0suosKMUl7f2 Ps53PwWnvFllwfyGrxIWCnolh8sPbfyYFn6tPYiLHxUCfYXfhBsvf4MLQFBtJDEElTac 0+KnIdsKxDzeOzU7WzcC118lRuFNA/YETjAk9ru+19acWJqY0YcUPhd2/DSafmxL4lKo c+0uS6QlvsTWozryj1GbSYVZ+8eKSGBrDutZS3HHz8fO9LUH7qeEFSy0kKH1r2avPtDV NDlKQHVrO5o4zLRWLJz+akLCcc/fmCZZ9CQYOEhyfMeEsJU7KuuaRCW2HRDrr3acbr0t u+NQ== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of ffmpeg-devel-bounces@ffmpeg.org designates 79.124.17.100 as permitted sender) smtp.mailfrom=ffmpeg-devel-bounces@ffmpeg.org Return-Path: Received: from ffbox0-bg.mplayerhq.hu (ffbox0-bg.ffmpeg.org. [79.124.17.100]) by mx.google.com with ESMTP id c139si10304649wmh.53.2017.07.17.08.46.56; Mon, 17 Jul 2017 08:46:57 -0700 (PDT) Received-SPF: pass (google.com: domain of ffmpeg-devel-bounces@ffmpeg.org designates 79.124.17.100 as permitted sender) client-ip=79.124.17.100; Authentication-Results: mx.google.com; spf=pass (google.com: domain of ffmpeg-devel-bounces@ffmpeg.org designates 79.124.17.100 as permitted sender) smtp.mailfrom=ffmpeg-devel-bounces@ffmpeg.org Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id EAE62689DE3; Mon, 17 Jul 2017 18:45:24 +0300 (EEST) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org Received: from nef2.ens.fr (nef2.ens.fr [129.199.96.40]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id 1DCF9689D4B for ; Mon, 17 Jul 2017 18:45:18 +0300 (EEST) Received: from phare.normalesup.org (phare.normalesup.org [129.199.129.80]) by nef2.ens.fr (8.13.6/1.01.28121999) with ESMTP id v6HFjOXe070497 for ; Mon, 17 Jul 2017 17:45:24 +0200 (CEST) Received: by phare.normalesup.org (Postfix, from userid 1001) id 87344E00D0; Mon, 17 Jul 2017 17:45:24 +0200 (CEST) From: Nicolas George To: ffmpeg-devel@ffmpeg.org Date: Mon, 17 Jul 2017 17:45:09 +0200 Message-Id: <20170717154509.28255-10-george@nsup.org> X-Mailer: git-send-email 2.13.2 In-Reply-To: <20170717154509.28255-1-george@nsup.org> References: <20170717154509.28255-1-george@nsup.org> X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.4.3 (nef2.ens.fr [129.199.96.32]); Mon, 17 Jul 2017 17:45:24 +0200 (CEST) Subject: [FFmpeg-devel] [PATCH 10/10] lavfi/vf_displace: move to activate design. X-BeenThere: ffmpeg-devel@ffmpeg.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: FFmpeg development discussions and patches List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Reply-To: FFmpeg development discussions and patches MIME-Version: 1.0 Errors-To: ffmpeg-devel-bounces@ffmpeg.org Sender: "ffmpeg-devel" Signed-off-by: Nicolas George --- libavfilter/Makefile | 2 +- libavfilter/vf_displace.c | 31 +++++++++++-------------------- 2 files changed, 12 insertions(+), 21 deletions(-) diff --git a/libavfilter/Makefile b/libavfilter/Makefile index 441e07843f..4d61d7835e 100644 --- a/libavfilter/Makefile +++ b/libavfilter/Makefile @@ -168,7 +168,7 @@ OBJS-$(CONFIG_DELOGO_FILTER) += vf_delogo.o OBJS-$(CONFIG_DESHAKE_FILTER) += vf_deshake.o OBJS-$(CONFIG_DETELECINE_FILTER) += vf_detelecine.o OBJS-$(CONFIG_DILATION_FILTER) += vf_neighbor.o -OBJS-$(CONFIG_DISPLACE_FILTER) += vf_displace.o framesync.o +OBJS-$(CONFIG_DISPLACE_FILTER) += vf_displace.o framesync2.o OBJS-$(CONFIG_DOUBLEWEAVE_FILTER) += vf_weave.o OBJS-$(CONFIG_DRAWBOX_FILTER) += vf_drawbox.o OBJS-$(CONFIG_DRAWGRAPH_FILTER) += f_drawgraph.o diff --git a/libavfilter/vf_displace.c b/libavfilter/vf_displace.c index 9daa0c9ddb..6100a249c6 100644 --- a/libavfilter/vf_displace.c +++ b/libavfilter/vf_displace.c @@ -23,7 +23,7 @@ #include "libavutil/opt.h" #include "avfilter.h" #include "formats.h" -#include "framesync.h" +#include "framesync2.h" #include "internal.h" #include "video.h" @@ -212,9 +212,9 @@ static int process_frame(FFFrameSync *fs) AVFrame *out, *in, *xpic, *ypic; int ret; - if ((ret = ff_framesync_get_frame(&s->fs, 0, &in, 0)) < 0 || - (ret = ff_framesync_get_frame(&s->fs, 1, &xpic, 0)) < 0 || - (ret = ff_framesync_get_frame(&s->fs, 2, &ypic, 0)) < 0) + if ((ret = ff_framesync2_get_frame(&s->fs, 0, &in, 0)) < 0 || + (ret = ff_framesync2_get_frame(&s->fs, 1, &xpic, 0)) < 0 || + (ret = ff_framesync2_get_frame(&s->fs, 2, &ypic, 0)) < 0) return ret; if (ctx->is_disabled) { @@ -310,7 +310,7 @@ static int config_output(AVFilterLink *outlink) outlink->sample_aspect_ratio = srclink->sample_aspect_ratio; outlink->frame_rate = srclink->frame_rate; - ret = ff_framesync_init(&s->fs, ctx, 3); + ret = ff_framesync2_init(&s->fs, ctx, 3); if (ret < 0) return ret; @@ -330,44 +330,35 @@ static int config_output(AVFilterLink *outlink) s->fs.opaque = s; s->fs.on_event = process_frame; - return ff_framesync_configure(&s->fs); + return ff_framesync2_configure(&s->fs); } -static int filter_frame(AVFilterLink *inlink, AVFrame *buf) +static int activate(AVFilterContext *ctx) { - DisplaceContext *s = inlink->dst->priv; - return ff_framesync_filter_frame(&s->fs, inlink, buf); -} - -static int request_frame(AVFilterLink *outlink) -{ - DisplaceContext *s = outlink->src->priv; - return ff_framesync_request_frame(&s->fs, outlink); + DisplaceContext *s = ctx->priv; + return ff_framesync2_activate(&s->fs); } static av_cold void uninit(AVFilterContext *ctx) { DisplaceContext *s = ctx->priv; - ff_framesync_uninit(&s->fs); + ff_framesync2_uninit(&s->fs); } static const AVFilterPad displace_inputs[] = { { .name = "source", .type = AVMEDIA_TYPE_VIDEO, - .filter_frame = filter_frame, .config_props = config_input, }, { .name = "xmap", .type = AVMEDIA_TYPE_VIDEO, - .filter_frame = filter_frame, }, { .name = "ymap", .type = AVMEDIA_TYPE_VIDEO, - .filter_frame = filter_frame, }, { NULL } }; @@ -377,7 +368,6 @@ static const AVFilterPad displace_outputs[] = { .name = "default", .type = AVMEDIA_TYPE_VIDEO, .config_props = config_output, - .request_frame = request_frame, }, { NULL } }; @@ -388,6 +378,7 @@ AVFilter ff_vf_displace = { .priv_size = sizeof(DisplaceContext), .uninit = uninit, .query_formats = query_formats, + .activate = activate, .inputs = displace_inputs, .outputs = displace_outputs, .priv_class = &displace_class,