From patchwork Mon Jul 17 15:45:04 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Nicolas George X-Patchwork-Id: 4343 Delivered-To: ffmpegpatchwork@gmail.com Received: by 10.103.1.76 with SMTP id 73csp306604vsb; Mon, 17 Jul 2017 08:46:08 -0700 (PDT) X-Received: by 10.28.10.208 with SMTP id 199mr4628353wmk.127.1500306368574; Mon, 17 Jul 2017 08:46:08 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1500306368; cv=none; d=google.com; s=arc-20160816; b=QgKpQUT+je5T9o97Jx6zQhD90KuesQXBEEQdPFKEihXT+UhUUChQhBiXixjHolAP2u AwNbmWSdZkzch5qSJ4920I6+chMkJoNdSyEC+XGsviow3orbgjZrJYPwlr+u6zOVvkWK pVsDWc+gc27+JyWXCBVhQ49vJZRFx9qWivoHoqg+p4iiLPAPwwLWoFhK9io1EhoVo6et bX3TX6OQ9KQzfbfaIF1Kj2QWE1AeVCBa6nOffG5R8pkrzd+XA+G06zTBzBrafvVQCzp8 nVdakQnXrH8QTq+l7xPYfZKdlREalopub5OJrtJ3h1gTjZvLJq3D0fh6T+1jYk1M7fif P1vA== 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=eXOFnVT8kHRxgAlPNuJSM3wpxd1Cj/gTyJ+MoAo33Ns=; b=szHU4PSBso+zxNw1jNZ1KFSosnMM5K3aDp3Vyd5i5QZlkC0M0c7FFOEu4QT0664kCg TY1iqOFDqX1ApUo+wCAF8l/lVc/uzg9Hw5Bl41R2GyAtpU+3k8qhk1dSTGF6tqteq5p1 BlEGLSWLoz30O9ZFg2RjEm+rKeBnjSsLgp1MU9EgXnjkUC72wKzoPbebNjC5ObDZvYqv MBqZ/ye/k5NFtOnqHj5AP1cG5voTI+UaMxfhFy51cTKmNEQ7k+Dq2CvnEy7dTEpQy3eQ dA0atSC4kuewEj2Bu9jYAvWbB1h957LAllJzPkUSbkiWQqTWa/iIrJR6QftI7Ui4Shbn WlUQ== 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 131si10300980wmo.123.2017.07.17.08.46.08; Mon, 17 Jul 2017 08:46:08 -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 248EA689D57; Mon, 17 Jul 2017 18:45:22 +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 2C1C0689CFB for ; Mon, 17 Jul 2017 18:45:15 +0300 (EEST) Received: from phare.normalesup.org (archicubes.ens.fr [129.199.129.80]) by nef2.ens.fr (8.13.6/1.01.28121999) with ESMTP id v6HFjLCk070468 for ; Mon, 17 Jul 2017 17:45:21 +0200 (CEST) Received: by phare.normalesup.org (Postfix, from userid 1001) id 97C53E00D0; Mon, 17 Jul 2017 17:45:21 +0200 (CEST) From: Nicolas George To: ffmpeg-devel@ffmpeg.org Date: Mon, 17 Jul 2017 17:45:04 +0200 Message-Id: <20170717154509.28255-5-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:21 +0200 (CEST) Subject: [FFmpeg-devel] [PATCH 05/10] lavfi/vf_maskedmerge: 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/maskedmerge.h | 2 +- libavfilter/vf_maskedmerge.c | 29 ++++++++++------------------- 3 files changed, 12 insertions(+), 21 deletions(-) diff --git a/libavfilter/Makefile b/libavfilter/Makefile index 0edd33576f..5128f0f937 100644 --- a/libavfilter/Makefile +++ b/libavfilter/Makefile @@ -226,7 +226,7 @@ OBJS-$(CONFIG_LUT3D_FILTER) += vf_lut3d.o OBJS-$(CONFIG_LUTRGB_FILTER) += vf_lut.o OBJS-$(CONFIG_LUTYUV_FILTER) += vf_lut.o OBJS-$(CONFIG_MASKEDCLAMP_FILTER) += vf_maskedclamp.o framesync.o -OBJS-$(CONFIG_MASKEDMERGE_FILTER) += vf_maskedmerge.o framesync.o +OBJS-$(CONFIG_MASKEDMERGE_FILTER) += vf_maskedmerge.o framesync2.o OBJS-$(CONFIG_MCDEINT_FILTER) += vf_mcdeint.o OBJS-$(CONFIG_MERGEPLANES_FILTER) += vf_mergeplanes.o framesync.o OBJS-$(CONFIG_MESTIMATE_FILTER) += vf_mestimate.o motion_estimation.o diff --git a/libavfilter/maskedmerge.h b/libavfilter/maskedmerge.h index 8e2b1cf676..3d670f6d5d 100644 --- a/libavfilter/maskedmerge.h +++ b/libavfilter/maskedmerge.h @@ -22,7 +22,7 @@ #define AVFILTER_MASKEDMERGE_H #include "avfilter.h" -#include "framesync.h" +#include "framesync2.h" typedef struct MaskedMergeContext { const AVClass *class; diff --git a/libavfilter/vf_maskedmerge.c b/libavfilter/vf_maskedmerge.c index cf8a56814e..54def62820 100644 --- a/libavfilter/vf_maskedmerge.c +++ b/libavfilter/vf_maskedmerge.c @@ -71,9 +71,9 @@ static int process_frame(FFFrameSync *fs) AVFrame *out, *base, *overlay, *mask; int ret; - if ((ret = ff_framesync_get_frame(&s->fs, 0, &base, 0)) < 0 || - (ret = ff_framesync_get_frame(&s->fs, 1, &overlay, 0)) < 0 || - (ret = ff_framesync_get_frame(&s->fs, 2, &mask, 0)) < 0) + if ((ret = ff_framesync2_get_frame(&s->fs, 0, &base, 0)) < 0 || + (ret = ff_framesync2_get_frame(&s->fs, 1, &overlay, 0)) < 0 || + (ret = ff_framesync2_get_frame(&s->fs, 2, &mask, 0)) < 0) return ret; if (ctx->is_disabled) { @@ -232,7 +232,7 @@ static int config_output(AVFilterLink *outlink) if ((ret = av_image_fill_linesizes(s->linesize, outlink->format, outlink->w)) < 0) return ret; - if ((ret = ff_framesync_init(&s->fs, ctx, 3)) < 0) + if ((ret = ff_framesync2_init(&s->fs, ctx, 3)) < 0) return ret; in = s->fs.in; @@ -251,44 +251,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) { - MaskedMergeContext *s = inlink->dst->priv; - return ff_framesync_filter_frame(&s->fs, inlink, buf); -} - -static int request_frame(AVFilterLink *outlink) -{ - MaskedMergeContext *s = outlink->src->priv; - return ff_framesync_request_frame(&s->fs, outlink); + MaskedMergeContext *s = ctx->priv; + return ff_framesync2_activate(&s->fs); } static av_cold void uninit(AVFilterContext *ctx) { MaskedMergeContext *s = ctx->priv; - ff_framesync_uninit(&s->fs); + ff_framesync2_uninit(&s->fs); } static const AVFilterPad maskedmerge_inputs[] = { { .name = "base", .type = AVMEDIA_TYPE_VIDEO, - .filter_frame = filter_frame, .config_props = config_input, }, { .name = "overlay", .type = AVMEDIA_TYPE_VIDEO, - .filter_frame = filter_frame, }, { .name = "mask", .type = AVMEDIA_TYPE_VIDEO, - .filter_frame = filter_frame, }, { NULL } }; @@ -298,7 +289,6 @@ static const AVFilterPad maskedmerge_outputs[] = { .name = "default", .type = AVMEDIA_TYPE_VIDEO, .config_props = config_output, - .request_frame = request_frame, }, { NULL } }; @@ -309,6 +299,7 @@ AVFilter ff_vf_maskedmerge = { .priv_size = sizeof(MaskedMergeContext), .uninit = uninit, .query_formats = query_formats, + .activate = activate, .inputs = maskedmerge_inputs, .outputs = maskedmerge_outputs, .priv_class = &maskedmerge_class,